[Java] Print error stack trace when tests fail
[ldk-java] / ts / bindings.c
1 #define LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #include "js-wasm.h"
4 #include <stdatomic.h>
5 #include <lightning.h>
6
7 // These should be provided...somehow...
8 void *memset(void *s, int c, size_t n);
9 void *memcpy(void *dest, const void *src, size_t n);
10 int memcmp(const void *s1, const void *s2, size_t n);
11
12 extern void __attribute__((noreturn)) abort(void);
13 static inline void assert(bool expression) {
14         if (!expression) { abort(); }
15 }
16
17 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
18         return val == 0xdeadbeef0badf00dULL;
19 }
20
21
22 void *malloc(size_t size);
23 void free(void *ptr);
24
25 #define MALLOC(a, _) malloc(a)
26 #define do_MALLOC(a, _b, _c) malloc(a)
27 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
28 #define DO_ASSERT(a) (void)(a)
29 #define CHECK(a)
30 #define CHECK_ACCESS(p)
31 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
32
33 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
34 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
35 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
36 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
37
38 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
39
40 #define DECL_ARR_TYPE(ty, name) \
41         struct name##array { \
42                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
43                 ty elems[]; \
44         }; \
45         typedef struct name##array * name##Array; \
46         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
47                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
48                 arr->arr_len = arr_len; \
49                 return arr; \
50         }
51
52 DECL_ARR_TYPE(int64_t, int64_t);
53 DECL_ARR_TYPE(uint64_t, uint64_t);
54 DECL_ARR_TYPE(int8_t, int8_t);
55 DECL_ARR_TYPE(int16_t, int16_t);
56 DECL_ARR_TYPE(uint32_t, uint32_t);
57 DECL_ARR_TYPE(void*, ptr);
58 DECL_ARR_TYPE(char, char);
59 typedef charArray jstring;
60
61 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
62         charArray arr = init_charArray(len, __LINE__);
63         memcpy(arr->elems, chars, len);
64         return arr;
65 }
66 static inline LDKStr str_ref_to_owned_c(const jstring str) {
67         char* newchars = MALLOC(str->arr_len + 1, "String chars");
68         memcpy(newchars, str->elems, str->arr_len);
69         newchars[str->arr_len] = 0;
70         LDKStr res = {
71                 .chars = newchars,
72                 .len = str->arr_len,
73                 .chars_is_owned = true
74         };
75         return res;
76 }
77
78 typedef bool jboolean;
79
80 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
81         return (uint32_t)MALLOC(size, "JS-Called malloc");
82 }
83 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
84         FREE((void*)ptr);
85 }
86
87 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
88         const char *res = check_get_ldk_bindings_version();
89         if (res == NULL) return NULL;
90         return str_ref_to_ts(res, strlen(res));
91 }
92 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
93         const char *res = check_get_ldk_version();
94         if (res == NULL) return NULL;
95         return str_ref_to_ts(res, strlen(res));
96 }
97 #include "version.c"
98 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
99
100 static inline void* untag_ptr(uint64_t ptr) {
101         if (ptr < 4096) return (void*)ptr;
102         if (sizeof(void*) == 4) {
103                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
104                 return (void*)(uintptr_t)ptr;
105         } else {
106                 // For 64-bit systems, assume the top byte is used for tagging, then
107                 // use bit 9 ^ bit 10.
108                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
109                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
110 #ifdef LDK_DEBUG_BUILD
111                 // On debug builds we also use the 11th bit as a debug flag
112                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
113                 CHECK(tenth_bit != eleventh_bit);
114                 p ^= 1ULL << 53;
115 #endif
116                 return (void*)p;
117         }
118 }
119 static inline bool ptr_is_owned(uint64_t ptr) {
120         if(ptr < 4096) return true;
121         if (sizeof(void*) == 4) {
122                 return ptr & (1ULL << 32);
123         } else {
124                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
125                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
126 #ifdef LDK_DEBUG_BUILD
127                 // On debug builds we also use the 11th bit as a debug flag
128                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
129                 CHECK(tenth_bit != eleventh_bit);
130 #endif
131                 return (ninth_bit ^ tenth_bit) ? true : false;
132         }
133 }
134 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
135         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
136         if (sizeof(void*) == 4) {
137                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
138         } else {
139                 CHECK(sizeof(uintptr_t) == 8);
140                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
141                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
142 #ifdef LDK_DEBUG_BUILD
143                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
144                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
145                 CHECK(ninth_bit == tenth_bit);
146                 CHECK(ninth_bit == eleventh_bit);
147                 t ^= 1ULL << 53;
148 #endif
149                 CHECK(ptr_is_owned(t) == is_owned);
150                 CHECK(untag_ptr(t) == ptr);
151                 return t;
152         }
153 }
154
155 static inline LDKBlindedFailure LDKBlindedFailure_from_js(int32_t ord) {
156         switch (ord) {
157                 case 0: return LDKBlindedFailure_FromIntroductionNode;
158                 case 1: return LDKBlindedFailure_FromBlindedNode;
159         }
160         abort();
161 }
162 static inline int32_t LDKBlindedFailure_to_js(LDKBlindedFailure val) {
163         switch (val) {
164                 case LDKBlindedFailure_FromIntroductionNode: return 0;
165                 case LDKBlindedFailure_FromBlindedNode: return 1;
166                 default: abort();
167         }
168 }
169 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_js(int32_t ord) {
170         switch (ord) {
171                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
172                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
173                 case 2: return LDKBolt11SemanticError_NoDescription;
174                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
175                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
176                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
177                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
178                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
179                 case 8: return LDKBolt11SemanticError_InvalidSignature;
180                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
181         }
182         abort();
183 }
184 static inline int32_t LDKBolt11SemanticError_to_js(LDKBolt11SemanticError val) {
185         switch (val) {
186                 case LDKBolt11SemanticError_NoPaymentHash: return 0;
187                 case LDKBolt11SemanticError_MultiplePaymentHashes: return 1;
188                 case LDKBolt11SemanticError_NoDescription: return 2;
189                 case LDKBolt11SemanticError_MultipleDescriptions: return 3;
190                 case LDKBolt11SemanticError_NoPaymentSecret: return 4;
191                 case LDKBolt11SemanticError_MultiplePaymentSecrets: return 5;
192                 case LDKBolt11SemanticError_InvalidFeatures: return 6;
193                 case LDKBolt11SemanticError_InvalidRecoveryId: return 7;
194                 case LDKBolt11SemanticError_InvalidSignature: return 8;
195                 case LDKBolt11SemanticError_ImpreciseAmount: return 9;
196                 default: abort();
197         }
198 }
199 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_js(int32_t ord) {
200         switch (ord) {
201                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
202                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
203                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
204                 case 3: return LDKBolt12SemanticError_MissingAmount;
205                 case 4: return LDKBolt12SemanticError_InvalidAmount;
206                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
207                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
208                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
209                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
210                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
211                 case 10: return LDKBolt12SemanticError_MissingDescription;
212                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
213                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
214                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
215                 case 14: return LDKBolt12SemanticError_MissingQuantity;
216                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
217                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
218                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
219                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
220                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
221                 case 20: return LDKBolt12SemanticError_MissingPayerId;
222                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
223                 case 22: return LDKBolt12SemanticError_MissingPaths;
224                 case 23: return LDKBolt12SemanticError_UnexpectedPaths;
225                 case 24: return LDKBolt12SemanticError_InvalidPayInfo;
226                 case 25: return LDKBolt12SemanticError_MissingCreationTime;
227                 case 26: return LDKBolt12SemanticError_MissingPaymentHash;
228                 case 27: return LDKBolt12SemanticError_MissingSignature;
229         }
230         abort();
231 }
232 static inline int32_t LDKBolt12SemanticError_to_js(LDKBolt12SemanticError val) {
233         switch (val) {
234                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
235                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
236                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
237                 case LDKBolt12SemanticError_MissingAmount: return 3;
238                 case LDKBolt12SemanticError_InvalidAmount: return 4;
239                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
240                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
241                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
242                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
243                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
244                 case LDKBolt12SemanticError_MissingDescription: return 10;
245                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
246                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
247                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
248                 case LDKBolt12SemanticError_MissingQuantity: return 14;
249                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
250                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
251                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
252                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
253                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
254                 case LDKBolt12SemanticError_MissingPayerId: return 20;
255                 case LDKBolt12SemanticError_DuplicatePaymentId: return 21;
256                 case LDKBolt12SemanticError_MissingPaths: return 22;
257                 case LDKBolt12SemanticError_UnexpectedPaths: return 23;
258                 case LDKBolt12SemanticError_InvalidPayInfo: return 24;
259                 case LDKBolt12SemanticError_MissingCreationTime: return 25;
260                 case LDKBolt12SemanticError_MissingPaymentHash: return 26;
261                 case LDKBolt12SemanticError_MissingSignature: return 27;
262                 default: abort();
263         }
264 }
265 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
266         switch (ord) {
267                 case 0: return LDKCOption_NoneZ_Some;
268                 case 1: return LDKCOption_NoneZ_None;
269         }
270         abort();
271 }
272 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
273         switch (val) {
274                 case LDKCOption_NoneZ_Some: return 0;
275                 case LDKCOption_NoneZ_None: return 1;
276                 default: abort();
277         }
278 }
279 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
280         switch (ord) {
281                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
282                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
283                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
284         }
285         abort();
286 }
287 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
288         switch (val) {
289                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
290                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
291                 case LDKChannelMonitorUpdateStatus_UnrecoverableError: return 2;
292                 default: abort();
293         }
294 }
295 static inline LDKChannelShutdownState LDKChannelShutdownState_from_js(int32_t ord) {
296         switch (ord) {
297                 case 0: return LDKChannelShutdownState_NotShuttingDown;
298                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
299                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
300                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
301                 case 4: return LDKChannelShutdownState_ShutdownComplete;
302         }
303         abort();
304 }
305 static inline int32_t LDKChannelShutdownState_to_js(LDKChannelShutdownState val) {
306         switch (val) {
307                 case LDKChannelShutdownState_NotShuttingDown: return 0;
308                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
309                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
310                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
311                 case LDKChannelShutdownState_ShutdownComplete: return 4;
312                 default: abort();
313         }
314 }
315 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
316         switch (ord) {
317                 case 0: return LDKConfirmationTarget_OnChainSweep;
318                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
319                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
320                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
321                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
322                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
323                 case 6: return LDKConfirmationTarget_OutputSpendingFee;
324         }
325         abort();
326 }
327 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
328         switch (val) {
329                 case LDKConfirmationTarget_OnChainSweep: return 0;
330                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee: return 1;
331                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee: return 2;
332                 case LDKConfirmationTarget_AnchorChannelFee: return 3;
333                 case LDKConfirmationTarget_NonAnchorChannelFee: return 4;
334                 case LDKConfirmationTarget_ChannelCloseMinimum: return 5;
335                 case LDKConfirmationTarget_OutputSpendingFee: return 6;
336                 default: abort();
337         }
338 }
339 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
340         switch (ord) {
341                 case 0: return LDKCreationError_DescriptionTooLong;
342                 case 1: return LDKCreationError_RouteTooLong;
343                 case 2: return LDKCreationError_TimestampOutOfBounds;
344                 case 3: return LDKCreationError_InvalidAmount;
345                 case 4: return LDKCreationError_MissingRouteHints;
346                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
347         }
348         abort();
349 }
350 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
351         switch (val) {
352                 case LDKCreationError_DescriptionTooLong: return 0;
353                 case LDKCreationError_RouteTooLong: return 1;
354                 case LDKCreationError_TimestampOutOfBounds: return 2;
355                 case LDKCreationError_InvalidAmount: return 3;
356                 case LDKCreationError_MissingRouteHints: return 4;
357                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
358                 default: abort();
359         }
360 }
361 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
362         switch (ord) {
363                 case 0: return LDKCurrency_Bitcoin;
364                 case 1: return LDKCurrency_BitcoinTestnet;
365                 case 2: return LDKCurrency_Regtest;
366                 case 3: return LDKCurrency_Simnet;
367                 case 4: return LDKCurrency_Signet;
368         }
369         abort();
370 }
371 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
372         switch (val) {
373                 case LDKCurrency_Bitcoin: return 0;
374                 case LDKCurrency_BitcoinTestnet: return 1;
375                 case LDKCurrency_Regtest: return 2;
376                 case LDKCurrency_Simnet: return 3;
377                 case LDKCurrency_Signet: return 4;
378                 default: abort();
379         }
380 }
381 static inline LDKDirection LDKDirection_from_js(int32_t ord) {
382         switch (ord) {
383                 case 0: return LDKDirection_NodeOne;
384                 case 1: return LDKDirection_NodeTwo;
385         }
386         abort();
387 }
388 static inline int32_t LDKDirection_to_js(LDKDirection val) {
389         switch (val) {
390                 case LDKDirection_NodeOne: return 0;
391                 case LDKDirection_NodeTwo: return 1;
392                 default: abort();
393         }
394 }
395 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
396         switch (ord) {
397                 case 0: return LDKHTLCClaim_OfferedTimeout;
398                 case 1: return LDKHTLCClaim_OfferedPreimage;
399                 case 2: return LDKHTLCClaim_AcceptedTimeout;
400                 case 3: return LDKHTLCClaim_AcceptedPreimage;
401                 case 4: return LDKHTLCClaim_Revocation;
402         }
403         abort();
404 }
405 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
406         switch (val) {
407                 case LDKHTLCClaim_OfferedTimeout: return 0;
408                 case LDKHTLCClaim_OfferedPreimage: return 1;
409                 case LDKHTLCClaim_AcceptedTimeout: return 2;
410                 case LDKHTLCClaim_AcceptedPreimage: return 3;
411                 case LDKHTLCClaim_Revocation: return 4;
412                 default: abort();
413         }
414 }
415 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
416         switch (ord) {
417                 case 0: return LDKIOError_NotFound;
418                 case 1: return LDKIOError_PermissionDenied;
419                 case 2: return LDKIOError_ConnectionRefused;
420                 case 3: return LDKIOError_ConnectionReset;
421                 case 4: return LDKIOError_ConnectionAborted;
422                 case 5: return LDKIOError_NotConnected;
423                 case 6: return LDKIOError_AddrInUse;
424                 case 7: return LDKIOError_AddrNotAvailable;
425                 case 8: return LDKIOError_BrokenPipe;
426                 case 9: return LDKIOError_AlreadyExists;
427                 case 10: return LDKIOError_WouldBlock;
428                 case 11: return LDKIOError_InvalidInput;
429                 case 12: return LDKIOError_InvalidData;
430                 case 13: return LDKIOError_TimedOut;
431                 case 14: return LDKIOError_WriteZero;
432                 case 15: return LDKIOError_Interrupted;
433                 case 16: return LDKIOError_Other;
434                 case 17: return LDKIOError_UnexpectedEof;
435         }
436         abort();
437 }
438 static inline int32_t LDKIOError_to_js(LDKIOError val) {
439         switch (val) {
440                 case LDKIOError_NotFound: return 0;
441                 case LDKIOError_PermissionDenied: return 1;
442                 case LDKIOError_ConnectionRefused: return 2;
443                 case LDKIOError_ConnectionReset: return 3;
444                 case LDKIOError_ConnectionAborted: return 4;
445                 case LDKIOError_NotConnected: return 5;
446                 case LDKIOError_AddrInUse: return 6;
447                 case LDKIOError_AddrNotAvailable: return 7;
448                 case LDKIOError_BrokenPipe: return 8;
449                 case LDKIOError_AlreadyExists: return 9;
450                 case LDKIOError_WouldBlock: return 10;
451                 case LDKIOError_InvalidInput: return 11;
452                 case LDKIOError_InvalidData: return 12;
453                 case LDKIOError_TimedOut: return 13;
454                 case LDKIOError_WriteZero: return 14;
455                 case LDKIOError_Interrupted: return 15;
456                 case LDKIOError_Other: return 16;
457                 case LDKIOError_UnexpectedEof: return 17;
458                 default: abort();
459         }
460 }
461 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
462         switch (ord) {
463                 case 0: return LDKLevel_Gossip;
464                 case 1: return LDKLevel_Trace;
465                 case 2: return LDKLevel_Debug;
466                 case 3: return LDKLevel_Info;
467                 case 4: return LDKLevel_Warn;
468                 case 5: return LDKLevel_Error;
469         }
470         abort();
471 }
472 static inline int32_t LDKLevel_to_js(LDKLevel val) {
473         switch (val) {
474                 case LDKLevel_Gossip: return 0;
475                 case LDKLevel_Trace: return 1;
476                 case LDKLevel_Debug: return 2;
477                 case LDKLevel_Info: return 3;
478                 case LDKLevel_Warn: return 4;
479                 case LDKLevel_Error: return 5;
480                 default: abort();
481         }
482 }
483 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
484         switch (ord) {
485                 case 0: return LDKNetwork_Bitcoin;
486                 case 1: return LDKNetwork_Testnet;
487                 case 2: return LDKNetwork_Regtest;
488                 case 3: return LDKNetwork_Signet;
489         }
490         abort();
491 }
492 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
493         switch (val) {
494                 case LDKNetwork_Bitcoin: return 0;
495                 case LDKNetwork_Testnet: return 1;
496                 case LDKNetwork_Regtest: return 2;
497                 case LDKNetwork_Signet: return 3;
498                 default: abort();
499         }
500 }
501 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
502         switch (ord) {
503                 case 0: return LDKPaymentFailureReason_RecipientRejected;
504                 case 1: return LDKPaymentFailureReason_UserAbandoned;
505                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
506                 case 3: return LDKPaymentFailureReason_PaymentExpired;
507                 case 4: return LDKPaymentFailureReason_RouteNotFound;
508                 case 5: return LDKPaymentFailureReason_UnexpectedError;
509         }
510         abort();
511 }
512 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
513         switch (val) {
514                 case LDKPaymentFailureReason_RecipientRejected: return 0;
515                 case LDKPaymentFailureReason_UserAbandoned: return 1;
516                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
517                 case LDKPaymentFailureReason_PaymentExpired: return 3;
518                 case LDKPaymentFailureReason_RouteNotFound: return 4;
519                 case LDKPaymentFailureReason_UnexpectedError: return 5;
520                 default: abort();
521         }
522 }
523 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
524         switch (ord) {
525                 case 0: return LDKRecipient_Node;
526                 case 1: return LDKRecipient_PhantomNode;
527         }
528         abort();
529 }
530 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
531         switch (val) {
532                 case LDKRecipient_Node: return 0;
533                 case LDKRecipient_PhantomNode: return 1;
534                 default: abort();
535         }
536 }
537 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
538         switch (ord) {
539                 case 0: return LDKRetryableSendFailure_PaymentExpired;
540                 case 1: return LDKRetryableSendFailure_RouteNotFound;
541                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
542         }
543         abort();
544 }
545 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
546         switch (val) {
547                 case LDKRetryableSendFailure_PaymentExpired: return 0;
548                 case LDKRetryableSendFailure_RouteNotFound: return 1;
549                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
550                 default: abort();
551         }
552 }
553 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
554         switch (ord) {
555                 case 0: return LDKSecp256k1Error_IncorrectSignature;
556                 case 1: return LDKSecp256k1Error_InvalidMessage;
557                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
558                 case 3: return LDKSecp256k1Error_InvalidSignature;
559                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
560                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
561                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
562                 case 7: return LDKSecp256k1Error_InvalidTweak;
563                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
564                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
565                 case 10: return LDKSecp256k1Error_InvalidParityValue;
566         }
567         abort();
568 }
569 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
570         switch (val) {
571                 case LDKSecp256k1Error_IncorrectSignature: return 0;
572                 case LDKSecp256k1Error_InvalidMessage: return 1;
573                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
574                 case LDKSecp256k1Error_InvalidSignature: return 3;
575                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
576                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
577                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
578                 case LDKSecp256k1Error_InvalidTweak: return 7;
579                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
580                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
581                 case LDKSecp256k1Error_InvalidParityValue: return 10;
582                 default: abort();
583         }
584 }
585 static inline LDKShortChannelIdError LDKShortChannelIdError_from_js(int32_t ord) {
586         switch (ord) {
587                 case 0: return LDKShortChannelIdError_BlockOverflow;
588                 case 1: return LDKShortChannelIdError_TxIndexOverflow;
589                 case 2: return LDKShortChannelIdError_VoutIndexOverflow;
590         }
591         abort();
592 }
593 static inline int32_t LDKShortChannelIdError_to_js(LDKShortChannelIdError val) {
594         switch (val) {
595                 case LDKShortChannelIdError_BlockOverflow: return 0;
596                 case LDKShortChannelIdError_TxIndexOverflow: return 1;
597                 case LDKShortChannelIdError_VoutIndexOverflow: return 2;
598                 default: abort();
599         }
600 }
601 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
602         switch (ord) {
603                 case 0: return LDKSiPrefix_Milli;
604                 case 1: return LDKSiPrefix_Micro;
605                 case 2: return LDKSiPrefix_Nano;
606                 case 3: return LDKSiPrefix_Pico;
607         }
608         abort();
609 }
610 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
611         switch (val) {
612                 case LDKSiPrefix_Milli: return 0;
613                 case LDKSiPrefix_Micro: return 1;
614                 case LDKSiPrefix_Nano: return 2;
615                 case LDKSiPrefix_Pico: return 3;
616                 default: abort();
617         }
618 }
619 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_js(int32_t ord) {
620         switch (ord) {
621                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
622                 case 1: return LDKSocketAddressParseError_InvalidInput;
623                 case 2: return LDKSocketAddressParseError_InvalidPort;
624                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
625         }
626         abort();
627 }
628 static inline int32_t LDKSocketAddressParseError_to_js(LDKSocketAddressParseError val) {
629         switch (val) {
630                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
631                 case LDKSocketAddressParseError_InvalidInput: return 1;
632                 case LDKSocketAddressParseError_InvalidPort: return 2;
633                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
634                 default: abort();
635         }
636 }
637 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
638         switch (ord) {
639                 case 0: return LDKUtxoLookupError_UnknownChain;
640                 case 1: return LDKUtxoLookupError_UnknownTx;
641         }
642         abort();
643 }
644 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
645         switch (val) {
646                 case LDKUtxoLookupError_UnknownChain: return 0;
647                 case LDKUtxoLookupError_UnknownTx: return 1;
648                 default: abort();
649         }
650 }
651 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
652         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
653         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
654         return ret;
655 }
656 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
657         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
658         return ret;
659 }
660 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
661         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
662         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
663         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
664         return ret_arr;
665 }
666
667 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
668 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
669         if (!ptr_is_owned(thing)) return;
670         void* thing_ptr = untag_ptr(thing);
671         CHECK_ACCESS(thing_ptr);
672         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
673         FREE(untag_ptr(thing));
674         BigEndianScalar_free(thing_conv);
675 }
676
677 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
678         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
679         switch(obj->tag) {
680                 case LDKBech32Error_MissingSeparator: return 0;
681                 case LDKBech32Error_InvalidChecksum: return 1;
682                 case LDKBech32Error_InvalidLength: return 2;
683                 case LDKBech32Error_InvalidChar: return 3;
684                 case LDKBech32Error_InvalidData: return 4;
685                 case LDKBech32Error_InvalidPadding: return 5;
686                 case LDKBech32Error_MixedCase: return 6;
687                 default: abort();
688         }
689 }
690 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
691         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
692         assert(obj->tag == LDKBech32Error_InvalidChar);
693         int32_t invalid_char_conv = obj->invalid_char;
694         return invalid_char_conv;
695 }
696 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
697         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
698         assert(obj->tag == LDKBech32Error_InvalidData);
699         int8_t invalid_data_conv = obj->invalid_data;
700         return invalid_data_conv;
701 }
702 static inline struct LDKRefundMaybeWithDerivedMetadataBuilder CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
703         LDKRefundMaybeWithDerivedMetadataBuilder ret = *owner->contents.result;
704         ret.is_owned = false;
705         return ret;
706 }
707 uint64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
708         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
709         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
710         uint64_t ret_ref = 0;
711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
713         return ret_ref;
714 }
715
716 static inline enum LDKBolt12SemanticError CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
717 CHECK(!owner->result_ok);
718         return Bolt12SemanticError_clone(&*owner->contents.err);
719 }
720 uint32_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
721         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
722         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
723         return ret_conv;
724 }
725
726 static inline struct LDKRefund CResult_RefundBolt12SemanticErrorZ_get_ok(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
727         LDKRefund ret = *owner->contents.result;
728         ret.is_owned = false;
729         return ret;
730 }
731 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_get_ok"))) TS_CResult_RefundBolt12SemanticErrorZ_get_ok(uint64_t owner) {
732         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
733         LDKRefund ret_var = CResult_RefundBolt12SemanticErrorZ_get_ok(owner_conv);
734         uint64_t ret_ref = 0;
735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
737         return ret_ref;
738 }
739
740 static inline enum LDKBolt12SemanticError CResult_RefundBolt12SemanticErrorZ_get_err(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
741 CHECK(!owner->result_ok);
742         return Bolt12SemanticError_clone(&*owner->contents.err);
743 }
744 uint32_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_get_err"))) TS_CResult_RefundBolt12SemanticErrorZ_get_err(uint64_t owner) {
745         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
746         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_RefundBolt12SemanticErrorZ_get_err(owner_conv));
747         return ret_conv;
748 }
749
750 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
751         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
752         switch(obj->tag) {
753                 case LDKCOption_u64Z_Some: return 0;
754                 case LDKCOption_u64Z_None: return 1;
755                 default: abort();
756         }
757 }
758 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
759         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
760         assert(obj->tag == LDKCOption_u64Z_Some);
761         int64_t some_conv = obj->some;
762         return some_conv;
763 }
764 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
765         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
766         for (size_t i = 0; i < ret.datalen; i++) {
767                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
768         }
769         return ret;
770 }
771 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
772         LDKRefund ret = *owner->contents.result;
773         ret.is_owned = false;
774         return ret;
775 }
776 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_ok"))) TS_CResult_RefundBolt12ParseErrorZ_get_ok(uint64_t owner) {
777         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
778         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
779         uint64_t ret_ref = 0;
780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
782         return ret_ref;
783 }
784
785 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
786         LDKBolt12ParseError ret = *owner->contents.err;
787         ret.is_owned = false;
788         return ret;
789 }
790 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_err"))) TS_CResult_RefundBolt12ParseErrorZ_get_err(uint64_t owner) {
791         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
792         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
793         uint64_t ret_ref = 0;
794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
796         return ret_ref;
797 }
798
799 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
800         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
801         switch(obj->tag) {
802                 case LDKRetry_Attempts: return 0;
803                 default: abort();
804         }
805 }
806 int32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
807         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
808         assert(obj->tag == LDKRetry_Attempts);
809         int32_t attempts_conv = obj->attempts;
810         return attempts_conv;
811 }
812 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
813         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
814         switch(obj->tag) {
815                 case LDKDecodeError_UnknownVersion: return 0;
816                 case LDKDecodeError_UnknownRequiredFeature: return 1;
817                 case LDKDecodeError_InvalidValue: return 2;
818                 case LDKDecodeError_ShortRead: return 3;
819                 case LDKDecodeError_BadLengthDescriptor: return 4;
820                 case LDKDecodeError_Io: return 5;
821                 case LDKDecodeError_UnsupportedCompression: return 6;
822                 case LDKDecodeError_DangerousValue: return 7;
823                 default: abort();
824         }
825 }
826 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
827         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
828         assert(obj->tag == LDKDecodeError_Io);
829         uint32_t io_conv = LDKIOError_to_js(obj->io);
830         return io_conv;
831 }
832 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
833 CHECK(owner->result_ok);
834         return Retry_clone(&*owner->contents.result);
835 }
836 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_ok"))) TS_CResult_RetryDecodeErrorZ_get_ok(uint64_t owner) {
837         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
838         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
839         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
840         uint64_t ret_ref = tag_ptr(ret_copy, true);
841         return ret_ref;
842 }
843
844 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
845 CHECK(!owner->result_ok);
846         return DecodeError_clone(&*owner->contents.err);
847 }
848 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_err"))) TS_CResult_RetryDecodeErrorZ_get_err(uint64_t owner) {
849         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
850         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
851         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
852         uint64_t ret_ref = tag_ptr(ret_copy, true);
853         return ret_ref;
854 }
855
856 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
857         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
858         switch(obj->tag) {
859                 case LDKAPIError_APIMisuseError: return 0;
860                 case LDKAPIError_FeeRateTooHigh: return 1;
861                 case LDKAPIError_InvalidRoute: return 2;
862                 case LDKAPIError_ChannelUnavailable: return 3;
863                 case LDKAPIError_MonitorUpdateInProgress: return 4;
864                 case LDKAPIError_IncompatibleShutdownScript: return 5;
865                 default: abort();
866         }
867 }
868 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
869         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
870         assert(obj->tag == LDKAPIError_APIMisuseError);
871         LDKStr err_str = obj->api_misuse_error.err;
872                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
873         return err_conv;
874 }
875 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
876         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
877         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
878         LDKStr err_str = obj->fee_rate_too_high.err;
879                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
880         return err_conv;
881 }
882 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
883         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
884         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
885         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
886         return feerate_conv;
887 }
888 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
889         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
890         assert(obj->tag == LDKAPIError_InvalidRoute);
891         LDKStr err_str = obj->invalid_route.err;
892                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
893         return err_conv;
894 }
895 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
896         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
897         assert(obj->tag == LDKAPIError_ChannelUnavailable);
898         LDKStr err_str = obj->channel_unavailable.err;
899                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
900         return err_conv;
901 }
902 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
903         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
904         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
905         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
906                         uint64_t script_ref = 0;
907                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
908                         script_ref = tag_ptr(script_var.inner, false);
909         return script_ref;
910 }
911 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
912 CHECK(owner->result_ok);
913         return *owner->contents.result;
914 }
915 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
916         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
917         CResult_NoneAPIErrorZ_get_ok(owner_conv);
918 }
919
920 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
921 CHECK(!owner->result_ok);
922         return APIError_clone(&*owner->contents.err);
923 }
924 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
925         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
926         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
927         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
928         uint64_t ret_ref = tag_ptr(ret_copy, true);
929         return ret_ref;
930 }
931
932 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
933         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
934         for (size_t i = 0; i < ret.datalen; i++) {
935                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
936         }
937         return ret;
938 }
939 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
940         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
941         for (size_t i = 0; i < ret.datalen; i++) {
942                 ret.data[i] = APIError_clone(&orig->data[i]);
943         }
944         return ret;
945 }
946 uint32_t __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr"))) TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(uint64_t ptr) {
947         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
948         switch(obj->tag) {
949                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
950                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
951                 default: abort();
952         }
953 }
954 int8_tArray __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some"))) TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some(uint64_t ptr) {
955         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
956         assert(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
957         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
958         memcpy(some_arr->elems, obj->some.data, 32);
959         return some_arr;
960 }
961 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
962         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
963         switch(obj->tag) {
964                 case LDKCOption_CVec_u8ZZ_Some: return 0;
965                 case LDKCOption_CVec_u8ZZ_None: return 1;
966                 default: abort();
967         }
968 }
969 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
970         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
971         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
972         LDKCVec_u8Z some_var = obj->some;
973                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
974                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
975         return some_arr;
976 }
977 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
978         LDKRecipientOnionFields ret = *owner->contents.result;
979         ret.is_owned = false;
980         return ret;
981 }
982 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
983         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
984         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
985         uint64_t ret_ref = 0;
986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
988         return ret_ref;
989 }
990
991 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
992 CHECK(!owner->result_ok);
993         return DecodeError_clone(&*owner->contents.err);
994 }
995 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
996         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
997         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
998         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
999         uint64_t ret_ref = tag_ptr(ret_copy, true);
1000         return ret_ref;
1001 }
1002
1003 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1004         return owner->a;
1005 }
1006 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_a"))) TS_C2Tuple_u64CVec_u8ZZ_get_a(uint64_t owner) {
1007         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1008         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
1009         return ret_conv;
1010 }
1011
1012 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1013         return CVec_u8Z_clone(&owner->b);
1014 }
1015 int8_tArray  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_b"))) TS_C2Tuple_u64CVec_u8ZZ_get_b(uint64_t owner) {
1016         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1017         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
1018         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1019         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1020         CVec_u8Z_free(ret_var);
1021         return ret_arr;
1022 }
1023
1024 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
1025         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
1026         for (size_t i = 0; i < ret.datalen; i++) {
1027                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
1028         }
1029         return ret;
1030 }
1031 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1032         LDKRecipientOnionFields ret = *owner->contents.result;
1033         ret.is_owned = false;
1034         return ret;
1035 }
1036 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_get_ok(uint64_t owner) {
1037         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1038         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
1039         uint64_t ret_ref = 0;
1040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1042         return ret_ref;
1043 }
1044
1045 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1046 CHECK(!owner->result_ok);
1047         return *owner->contents.err;
1048 }
1049 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_err"))) TS_CResult_RecipientOnionFieldsNoneZ_get_err(uint64_t owner) {
1050         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1051         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
1052 }
1053
1054 static inline struct LDKUnsignedBolt12Invoice CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1055         LDKUnsignedBolt12Invoice ret = *owner->contents.result;
1056         ret.is_owned = false;
1057         return ret;
1058 }
1059 uint64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(uint64_t owner) {
1060         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1061         LDKUnsignedBolt12Invoice ret_var = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
1062         uint64_t ret_ref = 0;
1063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1065         return ret_ref;
1066 }
1067
1068 static inline enum LDKBolt12SemanticError CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1069 CHECK(!owner->result_ok);
1070         return Bolt12SemanticError_clone(&*owner->contents.err);
1071 }
1072 uint32_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(uint64_t owner) {
1073         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1074         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
1075         return ret_conv;
1076 }
1077
1078 static inline struct LDKBolt12Invoice CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1079         LDKBolt12Invoice ret = *owner->contents.result;
1080         ret.is_owned = false;
1081         return ret;
1082 }
1083 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(uint64_t owner) {
1084         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1085         LDKBolt12Invoice ret_var = CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
1086         uint64_t ret_ref = 0;
1087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1089         return ret_ref;
1090 }
1091
1092 static inline enum LDKBolt12SemanticError CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1093 CHECK(!owner->result_ok);
1094         return Bolt12SemanticError_clone(&*owner->contents.err);
1095 }
1096 uint32_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(uint64_t owner) {
1097         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1098         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
1099         return ret_conv;
1100 }
1101
1102 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1103 CHECK(owner->result_ok);
1104         return *owner->contents.result;
1105 }
1106 int8_tArray  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_ok"))) TS_CResult_SchnorrSignatureNoneZ_get_ok(uint64_t owner) {
1107         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1108         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1109         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1110         return ret_arr;
1111 }
1112
1113 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1114 CHECK(!owner->result_ok);
1115         return *owner->contents.err;
1116 }
1117 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_err"))) TS_CResult_SchnorrSignatureNoneZ_get_err(uint64_t owner) {
1118         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1119         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1120 }
1121
1122 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
1123         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
1124         for (size_t i = 0; i < ret.datalen; i++) {
1125                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1126         }
1127         return ret;
1128 }
1129 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(uint64_t ptr) {
1130         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1131         switch(obj->tag) {
1132                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
1133                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
1134                 default: abort();
1135         }
1136 }
1137 ptrArray __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(uint64_t ptr) {
1138         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1139         assert(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
1140         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
1141                         ptrArray some_arr = NULL;
1142                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
1143                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
1144                         for (size_t m = 0; m < some_var.datalen; m++) {
1145                                 int8_tArray some_conv_12_arr = init_int8_tArray(32, __LINE__);
1146                                 memcpy(some_conv_12_arr->elems, some_var.data[m].data, 32);
1147                                 some_arr_ptr[m] = some_conv_12_arr;
1148                         }
1149                         
1150         return some_arr;
1151 }
1152 uint32_t __attribute__((export_name("TS_LDKAmount_ty_from_ptr"))) TS_LDKAmount_ty_from_ptr(uint64_t ptr) {
1153         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1154         switch(obj->tag) {
1155                 case LDKAmount_Bitcoin: return 0;
1156                 case LDKAmount_Currency: return 1;
1157                 default: abort();
1158         }
1159 }
1160 int64_t __attribute__((export_name("TS_LDKAmount_Bitcoin_get_amount_msats"))) TS_LDKAmount_Bitcoin_get_amount_msats(uint64_t ptr) {
1161         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1162         assert(obj->tag == LDKAmount_Bitcoin);
1163         int64_t amount_msats_conv = obj->bitcoin.amount_msats;
1164         return amount_msats_conv;
1165 }
1166 int8_tArray __attribute__((export_name("TS_LDKAmount_Currency_get_iso4217_code"))) TS_LDKAmount_Currency_get_iso4217_code(uint64_t ptr) {
1167         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1168         assert(obj->tag == LDKAmount_Currency);
1169         int8_tArray iso4217_code_arr = init_int8_tArray(3, __LINE__);
1170         memcpy(iso4217_code_arr->elems, obj->currency.iso4217_code.data, 3);
1171         return iso4217_code_arr;
1172 }
1173 int64_t __attribute__((export_name("TS_LDKAmount_Currency_get_amount"))) TS_LDKAmount_Currency_get_amount(uint64_t ptr) {
1174         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1175         assert(obj->tag == LDKAmount_Currency);
1176         int64_t amount_conv = obj->currency.amount;
1177         return amount_conv;
1178 }
1179 uint32_t __attribute__((export_name("TS_LDKCOption_AmountZ_ty_from_ptr"))) TS_LDKCOption_AmountZ_ty_from_ptr(uint64_t ptr) {
1180         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
1181         switch(obj->tag) {
1182                 case LDKCOption_AmountZ_Some: return 0;
1183                 case LDKCOption_AmountZ_None: return 1;
1184                 default: abort();
1185         }
1186 }
1187 uint64_t __attribute__((export_name("TS_LDKCOption_AmountZ_Some_get_some"))) TS_LDKCOption_AmountZ_Some_get_some(uint64_t ptr) {
1188         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
1189         assert(obj->tag == LDKCOption_AmountZ_Some);
1190         uint64_t some_ref = tag_ptr(&obj->some, false);
1191         return some_ref;
1192 }
1193 uint32_t __attribute__((export_name("TS_LDKQuantity_ty_from_ptr"))) TS_LDKQuantity_ty_from_ptr(uint64_t ptr) {
1194         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
1195         switch(obj->tag) {
1196                 case LDKQuantity_Bounded: return 0;
1197                 case LDKQuantity_Unbounded: return 1;
1198                 case LDKQuantity_One: return 2;
1199                 default: abort();
1200         }
1201 }
1202 int64_t __attribute__((export_name("TS_LDKQuantity_Bounded_get_bounded"))) TS_LDKQuantity_Bounded_get_bounded(uint64_t ptr) {
1203         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
1204         assert(obj->tag == LDKQuantity_Bounded);
1205         int64_t bounded_conv = obj->bounded;
1206         return bounded_conv;
1207 }
1208 uint32_t __attribute__((export_name("TS_LDKCOption_QuantityZ_ty_from_ptr"))) TS_LDKCOption_QuantityZ_ty_from_ptr(uint64_t ptr) {
1209         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
1210         switch(obj->tag) {
1211                 case LDKCOption_QuantityZ_Some: return 0;
1212                 case LDKCOption_QuantityZ_None: return 1;
1213                 default: abort();
1214         }
1215 }
1216 uint64_t __attribute__((export_name("TS_LDKCOption_QuantityZ_Some_get_some"))) TS_LDKCOption_QuantityZ_Some_get_some(uint64_t ptr) {
1217         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
1218         assert(obj->tag == LDKCOption_QuantityZ_Some);
1219         uint64_t some_ref = tag_ptr(&obj->some, false);
1220         return some_ref;
1221 }
1222 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1223 CHECK(owner->result_ok);
1224         return ThirtyTwoBytes_clone(&*owner->contents.result);
1225 }
1226 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_get_ok(uint64_t owner) {
1227         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1228         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1229         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1230         return ret_arr;
1231 }
1232
1233 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1234 CHECK(!owner->result_ok);
1235         return *owner->contents.err;
1236 }
1237 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_err"))) TS_CResult_ThirtyTwoBytesNoneZ_get_err(uint64_t owner) {
1238         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1239         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1240 }
1241
1242 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1243         LDKBlindedPayInfo ret = *owner->contents.result;
1244         ret.is_owned = false;
1245         return ret;
1246 }
1247 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1248         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1249         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1250         uint64_t ret_ref = 0;
1251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1253         return ret_ref;
1254 }
1255
1256 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1257 CHECK(!owner->result_ok);
1258         return DecodeError_clone(&*owner->contents.err);
1259 }
1260 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1261         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1262         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1263         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1264         uint64_t ret_ref = tag_ptr(ret_copy, true);
1265         return ret_ref;
1266 }
1267
1268 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1269         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1270         ret.is_owned = false;
1271         return ret;
1272 }
1273 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1274         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1275         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1276         uint64_t ret_ref = 0;
1277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1279         return ret_ref;
1280 }
1281
1282 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1283 CHECK(!owner->result_ok);
1284         return DecodeError_clone(&*owner->contents.err);
1285 }
1286 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1287         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1288         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1289         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1290         uint64_t ret_ref = tag_ptr(ret_copy, true);
1291         return ret_ref;
1292 }
1293
1294 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1295         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1296         ret.is_owned = false;
1297         return ret;
1298 }
1299 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1300         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1301         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1302         uint64_t ret_ref = 0;
1303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1305         return ret_ref;
1306 }
1307
1308 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1309 CHECK(!owner->result_ok);
1310         return DecodeError_clone(&*owner->contents.err);
1311 }
1312 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1313         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1314         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1315         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1316         uint64_t ret_ref = tag_ptr(ret_copy, true);
1317         return ret_ref;
1318 }
1319
1320 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1321         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1322         switch(obj->tag) {
1323                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1324                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1325                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1326                 default: abort();
1327         }
1328 }
1329 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1330         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1331         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1332         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1333                         uint64_t outpoint_ref = 0;
1334                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1335                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1336         return outpoint_ref;
1337 }
1338 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1339         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1340         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1341         LDKTxOut* output_ref = &obj->static_output.output;
1342         return tag_ptr(output_ref, false);
1343 }
1344 int8_tArray __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id(uint64_t ptr) {
1345         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1346         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1347         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
1348         memcpy(channel_keys_id_arr->elems, obj->static_output.channel_keys_id.data, 32);
1349         return channel_keys_id_arr;
1350 }
1351 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1352         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1353         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1354         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1355                         uint64_t delayed_payment_output_ref = 0;
1356                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1357                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1358         return delayed_payment_output_ref;
1359 }
1360 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1361         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1362         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1363         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1364                         uint64_t static_payment_output_ref = 0;
1365                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1366                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1367         return static_payment_output_ref;
1368 }
1369 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1370 CHECK(owner->result_ok);
1371         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1372 }
1373 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1374         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1375         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1376         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1377         uint64_t ret_ref = tag_ptr(ret_copy, true);
1378         return ret_ref;
1379 }
1380
1381 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1382 CHECK(!owner->result_ok);
1383         return DecodeError_clone(&*owner->contents.err);
1384 }
1385 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1386         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1387         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1388         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1389         uint64_t ret_ref = tag_ptr(ret_copy, true);
1390         return ret_ref;
1391 }
1392
1393 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1394         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1395         for (size_t i = 0; i < ret.datalen; i++) {
1396                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1397         }
1398         return ret;
1399 }
1400 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1401         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1402         for (size_t i = 0; i < ret.datalen; i++) {
1403                 ret.data[i] = TxOut_clone(&orig->data[i]);
1404         }
1405         return ret;
1406 }
1407 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
1408         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1409         switch(obj->tag) {
1410                 case LDKCOption_u32Z_Some: return 0;
1411                 case LDKCOption_u32Z_None: return 1;
1412                 default: abort();
1413         }
1414 }
1415 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
1416         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1417         assert(obj->tag == LDKCOption_u32Z_Some);
1418         int32_t some_conv = obj->some;
1419         return some_conv;
1420 }
1421 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1422         return CVec_u8Z_clone(&owner->a);
1423 }
1424 int8_tArray  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_get_a"))) TS_C2Tuple_CVec_u8Zu64Z_get_a(uint64_t owner) {
1425         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1426         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
1427         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1428         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1429         CVec_u8Z_free(ret_var);
1430         return ret_arr;
1431 }
1432
1433 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1434         return owner->b;
1435 }
1436 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_get_b"))) TS_C2Tuple_CVec_u8Zu64Z_get_b(uint64_t owner) {
1437         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1438         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
1439         return ret_conv;
1440 }
1441
1442 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1443 CHECK(owner->result_ok);
1444         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
1445 }
1446 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(uint64_t owner) {
1447         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1448         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
1449         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
1450         return tag_ptr(ret_conv, true);
1451 }
1452
1453 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1454 CHECK(!owner->result_ok);
1455         return *owner->contents.err;
1456 }
1457 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(uint64_t owner) {
1458         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1459         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
1460 }
1461
1462 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1463         LDKChannelDerivationParameters ret = *owner->contents.result;
1464         ret.is_owned = false;
1465         return ret;
1466 }
1467 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(uint64_t owner) {
1468         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1469         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
1470         uint64_t ret_ref = 0;
1471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1473         return ret_ref;
1474 }
1475
1476 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1477 CHECK(!owner->result_ok);
1478         return DecodeError_clone(&*owner->contents.err);
1479 }
1480 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(uint64_t owner) {
1481         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1482         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1483         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
1484         uint64_t ret_ref = tag_ptr(ret_copy, true);
1485         return ret_ref;
1486 }
1487
1488 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1489         LDKHTLCDescriptor ret = *owner->contents.result;
1490         ret.is_owned = false;
1491         return ret;
1492 }
1493 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1494         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1495         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
1496         uint64_t ret_ref = 0;
1497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1499         return ret_ref;
1500 }
1501
1502 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1503 CHECK(!owner->result_ok);
1504         return DecodeError_clone(&*owner->contents.err);
1505 }
1506 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1507         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1508         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1509         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
1510         uint64_t ret_ref = tag_ptr(ret_copy, true);
1511         return ret_ref;
1512 }
1513
1514 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1515 CHECK(owner->result_ok);
1516         return *owner->contents.result;
1517 }
1518 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
1519         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1520         CResult_NoneNoneZ_get_ok(owner_conv);
1521 }
1522
1523 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1524 CHECK(!owner->result_ok);
1525         return *owner->contents.err;
1526 }
1527 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
1528         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1529         CResult_NoneNoneZ_get_err(owner_conv);
1530 }
1531
1532 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1533 CHECK(owner->result_ok);
1534         return *owner->contents.result;
1535 }
1536 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
1537         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1538         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1539         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1540         return ret_arr;
1541 }
1542
1543 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1544 CHECK(!owner->result_ok);
1545         return *owner->contents.err;
1546 }
1547 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
1548         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1549         CResult_PublicKeyNoneZ_get_err(owner_conv);
1550 }
1551
1552 uint32_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_ty_from_ptr"))) TS_LDKCOption_BigEndianScalarZ_ty_from_ptr(uint64_t ptr) {
1553         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1554         switch(obj->tag) {
1555                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1556                 case LDKCOption_BigEndianScalarZ_None: return 1;
1557                 default: abort();
1558         }
1559 }
1560 uint64_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_Some_get_some"))) TS_LDKCOption_BigEndianScalarZ_Some_get_some(uint64_t ptr) {
1561         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1562         assert(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1563         LDKBigEndianScalar* some_ref = &obj->some;
1564         return tag_ptr(some_ref, false);
1565 }
1566 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1567 CHECK(owner->result_ok);
1568         return *owner->contents.result;
1569 }
1570 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
1571         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1572         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1573         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1574         return ret_arr;
1575 }
1576
1577 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1578 CHECK(!owner->result_ok);
1579         return *owner->contents.err;
1580 }
1581 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
1582         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1583         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1584 }
1585
1586 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1587 CHECK(owner->result_ok);
1588         return *owner->contents.result;
1589 }
1590 int8_tArray  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_ok"))) TS_CResult_ECDSASignatureNoneZ_get_ok(uint64_t owner) {
1591         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1592         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1593         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1594         return ret_arr;
1595 }
1596
1597 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1598 CHECK(!owner->result_ok);
1599         return *owner->contents.err;
1600 }
1601 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_err"))) TS_CResult_ECDSASignatureNoneZ_get_err(uint64_t owner) {
1602         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1603         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1604 }
1605
1606 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
1607 CHECK(owner->result_ok);
1608         return *owner->contents.result;
1609 }
1610 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
1611         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
1612         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
1613         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1614         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1615         return ret_arr;
1616 }
1617
1618 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
1619 CHECK(!owner->result_ok);
1620         return *owner->contents.err;
1621 }
1622 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
1623         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
1624         CResult_TransactionNoneZ_get_err(owner_conv);
1625 }
1626
1627 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1628         return owner->a;
1629 }
1630 int8_tArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(uint64_t owner) {
1631         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1632         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1633         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1634         return ret_arr;
1635 }
1636
1637 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1638         return owner->b;
1639 }
1640 ptrArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(uint64_t owner) {
1641         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1642         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1643         ptrArray ret_arr = NULL;
1644         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1645         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1646         for (size_t m = 0; m < ret_var.datalen; m++) {
1647                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1648                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1649                 ret_arr_ptr[m] = ret_conv_12_arr;
1650         }
1651         
1652         return ret_arr;
1653 }
1654
1655 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1656 CHECK(owner->result_ok);
1657         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1658 }
1659 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(uint64_t owner) {
1660         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1661         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1662         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1663         return tag_ptr(ret_conv, true);
1664 }
1665
1666 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1667 CHECK(!owner->result_ok);
1668         return *owner->contents.err;
1669 }
1670 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(uint64_t owner) {
1671         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1672         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1673 }
1674
1675 typedef struct LDKChannelSigner_JCalls {
1676         atomic_size_t refcnt;
1677         uint32_t instance_ptr;
1678 } LDKChannelSigner_JCalls;
1679 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1680         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1681         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1682                 FREE(j_calls);
1683         }
1684 }
1685 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1686         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1687         int64_t idx_conv = idx;
1688         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 0, idx_conv, 0, 0, 0, 0, 0);
1689         LDKPublicKey ret_ref;
1690         CHECK(ret->arr_len == 33);
1691         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1692         return ret_ref;
1693 }
1694 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1695         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1696         int64_t idx_conv = idx;
1697         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 1, idx_conv, 0, 0, 0, 0, 0);
1698         LDKThirtyTwoBytes ret_ref;
1699         CHECK(ret->arr_len == 32);
1700         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1701         return ret_ref;
1702 }
1703 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
1704         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1705         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1706         uint64_t holder_tx_ref = 0;
1707         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1708         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1709         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1710         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1711         ptrArray outbound_htlc_preimages_arr = NULL;
1712         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1713         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1714         for (size_t m = 0; m < outbound_htlc_preimages_var.datalen; m++) {
1715                 int8_tArray outbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1716                 memcpy(outbound_htlc_preimages_conv_12_arr->elems, outbound_htlc_preimages_var.data[m].data, 32);
1717                 outbound_htlc_preimages_arr_ptr[m] = outbound_htlc_preimages_conv_12_arr;
1718         }
1719         
1720         FREE(outbound_htlc_preimages_var.data);
1721         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);
1722         void* ret_ptr = untag_ptr(ret);
1723         CHECK_ACCESS(ret_ptr);
1724         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1725         FREE(untag_ptr(ret));
1726         return ret_conv;
1727 }
1728 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1729         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1730         int64_t idx_conv = idx;
1731         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1732         memcpy(secret_arr->elems, *secret, 32);
1733         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
1734         void* ret_ptr = untag_ptr(ret);
1735         CHECK_ACCESS(ret_ptr);
1736         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1737         FREE(untag_ptr(ret));
1738         return ret_conv;
1739 }
1740 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1741         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1742         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 4, 0, 0, 0, 0, 0, 0);
1743         LDKThirtyTwoBytes ret_ref;
1744         CHECK(ret->arr_len == 32);
1745         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1746         return ret_ref;
1747 }
1748 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1749         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1750         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1751         uint64_t channel_parameters_ref = 0;
1752         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1753         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1754         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1755         js_invoke_function_buuuuu(j_calls->instance_ptr, 5, channel_parameters_ref, 0, 0, 0, 0, 0);
1756 }
1757 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1758         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1759         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1760 }
1761 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
1762         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1763         atomic_init(&calls->refcnt, 1);
1764         calls->instance_ptr = o;
1765
1766         LDKChannelPublicKeys pubkeys_conv;
1767         pubkeys_conv.inner = untag_ptr(pubkeys);
1768         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1769         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1770
1771         LDKChannelSigner ret = {
1772                 .this_arg = (void*) calls,
1773                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1774                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1775                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1776                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
1777                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1778                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1779                 .free = LDKChannelSigner_JCalls_free,
1780                 .pubkeys = pubkeys_conv,
1781                 .set_pubkeys = NULL,
1782         };
1783         return ret;
1784 }
1785 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
1786         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1787         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1788         return tag_ptr(res_ptr, true);
1789 }
1790 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
1791         void* this_arg_ptr = untag_ptr(this_arg);
1792         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1793         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1794         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1795         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1796         return ret_arr;
1797 }
1798
1799 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
1800         void* this_arg_ptr = untag_ptr(this_arg);
1801         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1802         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1803         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1804         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1805         return ret_arr;
1806 }
1807
1808 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) {
1809         void* this_arg_ptr = untag_ptr(this_arg);
1810         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1811         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1812         LDKHolderCommitmentTransaction holder_tx_conv;
1813         holder_tx_conv.inner = untag_ptr(holder_tx);
1814         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1815         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1816         holder_tx_conv.is_owned = false;
1817         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
1818         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
1819         if (outbound_htlc_preimages_constr.datalen > 0)
1820                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1821         else
1822                 outbound_htlc_preimages_constr.data = NULL;
1823         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
1824         for (size_t m = 0; m < outbound_htlc_preimages_constr.datalen; m++) {
1825                 int8_tArray outbound_htlc_preimages_conv_12 = outbound_htlc_preimages_vals[m];
1826                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_12_ref;
1827                 CHECK(outbound_htlc_preimages_conv_12->arr_len == 32);
1828                 memcpy(outbound_htlc_preimages_conv_12_ref.data, outbound_htlc_preimages_conv_12->elems, 32); FREE(outbound_htlc_preimages_conv_12);
1829                 outbound_htlc_preimages_constr.data[m] = outbound_htlc_preimages_conv_12_ref;
1830         }
1831         FREE(outbound_htlc_preimages);
1832         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1833         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
1834         return tag_ptr(ret_conv, true);
1835 }
1836
1837 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) {
1838         void* this_arg_ptr = untag_ptr(this_arg);
1839         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1840         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1841         uint8_t secret_arr[32];
1842         CHECK(secret->arr_len == 32);
1843         memcpy(secret_arr, secret->elems, 32); FREE(secret);
1844         uint8_t (*secret_ref)[32] = &secret_arr;
1845         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1846         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1847         return tag_ptr(ret_conv, true);
1848 }
1849
1850 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
1851         void* this_arg_ptr = untag_ptr(this_arg);
1852         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1853         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1854         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1855         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1856         return ret_arr;
1857 }
1858
1859 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
1860         void* this_arg_ptr = untag_ptr(this_arg);
1861         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1862         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1863         LDKChannelTransactionParameters channel_parameters_conv;
1864         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1865         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1866         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1867         channel_parameters_conv.is_owned = false;
1868         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1869 }
1870
1871 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1872         if (this_arg->set_pubkeys != NULL)
1873                 this_arg->set_pubkeys(this_arg);
1874         return this_arg->pubkeys;
1875 }
1876 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
1877         void* this_arg_ptr = untag_ptr(this_arg);
1878         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1879         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1880         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1881         uint64_t ret_ref = 0;
1882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1884         return ret_ref;
1885 }
1886
1887 typedef struct LDKEcdsaChannelSigner_JCalls {
1888         atomic_size_t refcnt;
1889         uint32_t instance_ptr;
1890         LDKChannelSigner_JCalls* ChannelSigner;
1891 } LDKEcdsaChannelSigner_JCalls;
1892 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1893         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1894         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1895                 FREE(j_calls);
1896         }
1897 }
1898 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) {
1899         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1900         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1901         uint64_t commitment_tx_ref = 0;
1902         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1903         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1904         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1905         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
1906         ptrArray inbound_htlc_preimages_arr = NULL;
1907         inbound_htlc_preimages_arr = init_ptrArray(inbound_htlc_preimages_var.datalen, __LINE__);
1908         int8_tArray *inbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)inbound_htlc_preimages_arr) + 8);
1909         for (size_t m = 0; m < inbound_htlc_preimages_var.datalen; m++) {
1910                 int8_tArray inbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1911                 memcpy(inbound_htlc_preimages_conv_12_arr->elems, inbound_htlc_preimages_var.data[m].data, 32);
1912                 inbound_htlc_preimages_arr_ptr[m] = inbound_htlc_preimages_conv_12_arr;
1913         }
1914         
1915         FREE(inbound_htlc_preimages_var.data);
1916         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1917         ptrArray outbound_htlc_preimages_arr = NULL;
1918         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1919         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1920         for (size_t m = 0; m < outbound_htlc_preimages_var.datalen; m++) {
1921                 int8_tArray outbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1922                 memcpy(outbound_htlc_preimages_conv_12_arr->elems, outbound_htlc_preimages_var.data[m].data, 32);
1923                 outbound_htlc_preimages_arr_ptr[m] = outbound_htlc_preimages_conv_12_arr;
1924         }
1925         
1926         FREE(outbound_htlc_preimages_var.data);
1927         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);
1928         void* ret_ptr = untag_ptr(ret);
1929         CHECK_ACCESS(ret_ptr);
1930         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1931         FREE(untag_ptr(ret));
1932         return ret_conv;
1933 }
1934 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1935         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1936         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1937         uint64_t commitment_tx_ref = 0;
1938         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
1939         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1940         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1941         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, 0, 0, 0, 0, 0);
1942         void* ret_ptr = untag_ptr(ret);
1943         CHECK_ACCESS(ret_ptr);
1944         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1945         FREE(untag_ptr(ret));
1946         return ret_conv;
1947 }
1948 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]) {
1949         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1950         LDKTransaction justice_tx_var = justice_tx;
1951         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1952         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1953         Transaction_free(justice_tx_var);
1954         uint32_t input_conv = input;
1955         int64_t amount_conv = amount;
1956         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1957         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1958         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);
1959         void* ret_ptr = untag_ptr(ret);
1960         CHECK_ACCESS(ret_ptr);
1961         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1962         FREE(untag_ptr(ret));
1963         return ret_conv;
1964 }
1965 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) {
1966         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1967         LDKTransaction justice_tx_var = justice_tx;
1968         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1969         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1970         Transaction_free(justice_tx_var);
1971         uint32_t input_conv = input;
1972         int64_t amount_conv = amount;
1973         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1974         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1975         LDKHTLCOutputInCommitment htlc_var = *htlc;
1976         uint64_t htlc_ref = 0;
1977         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1978         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1979         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1980         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);
1981         void* ret_ptr = untag_ptr(ret);
1982         CHECK_ACCESS(ret_ptr);
1983         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1984         FREE(untag_ptr(ret));
1985         return ret_conv;
1986 }
1987 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
1988         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1989         LDKTransaction htlc_tx_var = htlc_tx;
1990         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1991         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1992         Transaction_free(htlc_tx_var);
1993         uint32_t input_conv = input;
1994         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
1995         uint64_t htlc_descriptor_ref = 0;
1996         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
1997         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
1998         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
1999         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);
2000         void* ret_ptr = untag_ptr(ret);
2001         CHECK_ACCESS(ret_ptr);
2002         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2003         FREE(untag_ptr(ret));
2004         return ret_conv;
2005 }
2006 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) {
2007         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2008         LDKTransaction htlc_tx_var = htlc_tx;
2009         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2010         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2011         Transaction_free(htlc_tx_var);
2012         uint32_t input_conv = input;
2013         int64_t amount_conv = amount;
2014         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
2015         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
2016         LDKHTLCOutputInCommitment htlc_var = *htlc;
2017         uint64_t htlc_ref = 0;
2018         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2019         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2020         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2021         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);
2022         void* ret_ptr = untag_ptr(ret);
2023         CHECK_ACCESS(ret_ptr);
2024         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2025         FREE(untag_ptr(ret));
2026         return ret_conv;
2027 }
2028 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2029         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2030         LDKClosingTransaction closing_tx_var = *closing_tx;
2031         uint64_t closing_tx_ref = 0;
2032         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
2033         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2034         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
2035         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
2036         void* ret_ptr = untag_ptr(ret);
2037         CHECK_ACCESS(ret_ptr);
2038         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2039         FREE(untag_ptr(ret));
2040         return ret_conv;
2041 }
2042 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
2043         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2044         LDKTransaction anchor_tx_var = anchor_tx;
2045         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
2046         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
2047         Transaction_free(anchor_tx_var);
2048         uint32_t input_conv = input;
2049         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
2050         void* ret_ptr = untag_ptr(ret);
2051         CHECK_ACCESS(ret_ptr);
2052         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2053         FREE(untag_ptr(ret));
2054         return ret_conv;
2055 }
2056 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2057         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2058         LDKUnsignedChannelAnnouncement msg_var = *msg;
2059         uint64_t msg_ref = 0;
2060         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
2061         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2062         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
2063         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
2064         void* ret_ptr = untag_ptr(ret);
2065         CHECK_ACCESS(ret_ptr);
2066         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2067         FREE(untag_ptr(ret));
2068         return ret_conv;
2069 }
2070 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
2071         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2072         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2073         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
2074 }
2075 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
2076         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
2077         atomic_init(&calls->refcnt, 1);
2078         calls->instance_ptr = o;
2079
2080         LDKChannelPublicKeys pubkeys_conv;
2081         pubkeys_conv.inner = untag_ptr(pubkeys);
2082         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2083         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2084
2085         LDKEcdsaChannelSigner ret = {
2086                 .this_arg = (void*) calls,
2087                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
2088                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
2089                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
2090                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
2091                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2092                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2093                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
2094                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
2095                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
2096                 .free = LDKEcdsaChannelSigner_JCalls_free,
2097                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
2098         };
2099         calls->ChannelSigner = ret.ChannelSigner.this_arg;
2100         return ret;
2101 }
2102 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
2103         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
2104         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
2105         return tag_ptr(res_ptr, true);
2106 }
2107 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) {
2108         void* this_arg_ptr = untag_ptr(this_arg);
2109         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2110         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2111         LDKCommitmentTransaction commitment_tx_conv;
2112         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2113         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2114         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2115         commitment_tx_conv.is_owned = false;
2116         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
2117         inbound_htlc_preimages_constr.datalen = inbound_htlc_preimages->arr_len;
2118         if (inbound_htlc_preimages_constr.datalen > 0)
2119                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2120         else
2121                 inbound_htlc_preimages_constr.data = NULL;
2122         int8_tArray* inbound_htlc_preimages_vals = (void*) inbound_htlc_preimages->elems;
2123         for (size_t m = 0; m < inbound_htlc_preimages_constr.datalen; m++) {
2124                 int8_tArray inbound_htlc_preimages_conv_12 = inbound_htlc_preimages_vals[m];
2125                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_12_ref;
2126                 CHECK(inbound_htlc_preimages_conv_12->arr_len == 32);
2127                 memcpy(inbound_htlc_preimages_conv_12_ref.data, inbound_htlc_preimages_conv_12->elems, 32); FREE(inbound_htlc_preimages_conv_12);
2128                 inbound_htlc_preimages_constr.data[m] = inbound_htlc_preimages_conv_12_ref;
2129         }
2130         FREE(inbound_htlc_preimages);
2131         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
2132         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
2133         if (outbound_htlc_preimages_constr.datalen > 0)
2134                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2135         else
2136                 outbound_htlc_preimages_constr.data = NULL;
2137         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
2138         for (size_t m = 0; m < outbound_htlc_preimages_constr.datalen; m++) {
2139                 int8_tArray outbound_htlc_preimages_conv_12 = outbound_htlc_preimages_vals[m];
2140                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_12_ref;
2141                 CHECK(outbound_htlc_preimages_conv_12->arr_len == 32);
2142                 memcpy(outbound_htlc_preimages_conv_12_ref.data, outbound_htlc_preimages_conv_12->elems, 32); FREE(outbound_htlc_preimages_conv_12);
2143                 outbound_htlc_preimages_constr.data[m] = outbound_htlc_preimages_conv_12_ref;
2144         }
2145         FREE(outbound_htlc_preimages);
2146         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
2147         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
2148         return tag_ptr(ret_conv, true);
2149 }
2150
2151 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_commitment"))) TS_EcdsaChannelSigner_sign_holder_commitment(uint64_t this_arg, uint64_t commitment_tx) {
2152         void* this_arg_ptr = untag_ptr(this_arg);
2153         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2154         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2155         LDKHolderCommitmentTransaction commitment_tx_conv;
2156         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2157         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2158         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2159         commitment_tx_conv.is_owned = false;
2160         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2161         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2162         return tag_ptr(ret_conv, true);
2163 }
2164
2165 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) {
2166         void* this_arg_ptr = untag_ptr(this_arg);
2167         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2168         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2169         LDKTransaction justice_tx_ref;
2170         justice_tx_ref.datalen = justice_tx->arr_len;
2171         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2172         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2173         justice_tx_ref.data_is_owned = true;
2174         uint8_t per_commitment_key_arr[32];
2175         CHECK(per_commitment_key->arr_len == 32);
2176         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2177         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2178         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2179         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2180         return tag_ptr(ret_conv, true);
2181 }
2182
2183 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) {
2184         void* this_arg_ptr = untag_ptr(this_arg);
2185         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2186         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2187         LDKTransaction justice_tx_ref;
2188         justice_tx_ref.datalen = justice_tx->arr_len;
2189         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2190         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2191         justice_tx_ref.data_is_owned = true;
2192         uint8_t per_commitment_key_arr[32];
2193         CHECK(per_commitment_key->arr_len == 32);
2194         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2195         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2196         LDKHTLCOutputInCommitment htlc_conv;
2197         htlc_conv.inner = untag_ptr(htlc);
2198         htlc_conv.is_owned = ptr_is_owned(htlc);
2199         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2200         htlc_conv.is_owned = false;
2201         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2202         *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);
2203         return tag_ptr(ret_conv, true);
2204 }
2205
2206 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) {
2207         void* this_arg_ptr = untag_ptr(this_arg);
2208         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2209         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2210         LDKTransaction htlc_tx_ref;
2211         htlc_tx_ref.datalen = htlc_tx->arr_len;
2212         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2213         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2214         htlc_tx_ref.data_is_owned = true;
2215         LDKHTLCDescriptor htlc_descriptor_conv;
2216         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
2217         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
2218         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
2219         htlc_descriptor_conv.is_owned = false;
2220         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2221         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
2222         return tag_ptr(ret_conv, true);
2223 }
2224
2225 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) {
2226         void* this_arg_ptr = untag_ptr(this_arg);
2227         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2228         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2229         LDKTransaction htlc_tx_ref;
2230         htlc_tx_ref.datalen = htlc_tx->arr_len;
2231         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2232         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2233         htlc_tx_ref.data_is_owned = true;
2234         LDKPublicKey per_commitment_point_ref;
2235         CHECK(per_commitment_point->arr_len == 33);
2236         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2237         LDKHTLCOutputInCommitment htlc_conv;
2238         htlc_conv.inner = untag_ptr(htlc);
2239         htlc_conv.is_owned = ptr_is_owned(htlc);
2240         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2241         htlc_conv.is_owned = false;
2242         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2243         *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);
2244         return tag_ptr(ret_conv, true);
2245 }
2246
2247 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
2248         void* this_arg_ptr = untag_ptr(this_arg);
2249         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2250         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2251         LDKClosingTransaction closing_tx_conv;
2252         closing_tx_conv.inner = untag_ptr(closing_tx);
2253         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2254         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2255         closing_tx_conv.is_owned = false;
2256         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2257         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2258         return tag_ptr(ret_conv, true);
2259 }
2260
2261 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) {
2262         void* this_arg_ptr = untag_ptr(this_arg);
2263         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2264         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2265         LDKTransaction anchor_tx_ref;
2266         anchor_tx_ref.datalen = anchor_tx->arr_len;
2267         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2268         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2269         anchor_tx_ref.data_is_owned = true;
2270         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2271         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2272         return tag_ptr(ret_conv, true);
2273 }
2274
2275 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) {
2276         void* this_arg_ptr = untag_ptr(this_arg);
2277         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2278         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2279         LDKUnsignedChannelAnnouncement msg_conv;
2280         msg_conv.inner = untag_ptr(msg);
2281         msg_conv.is_owned = ptr_is_owned(msg);
2282         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2283         msg_conv.is_owned = false;
2284         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2285         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2286         return tag_ptr(ret_conv, true);
2287 }
2288
2289 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2290         atomic_size_t refcnt;
2291         uint32_t instance_ptr;
2292         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2293         LDKChannelSigner_JCalls* ChannelSigner;
2294 } LDKWriteableEcdsaChannelSigner_JCalls;
2295 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2296         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2297         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2298                 FREE(j_calls);
2299         }
2300 }
2301 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2302         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2303         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
2304         LDKCVec_u8Z ret_ref;
2305         ret_ref.datalen = ret->arr_len;
2306         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2307         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2308         return ret_ref;
2309 }
2310 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2311         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2312         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2313         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2314         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2315 }
2316 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2317         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2318         atomic_init(&calls->refcnt, 1);
2319         calls->instance_ptr = o;
2320
2321         LDKChannelPublicKeys pubkeys_conv;
2322         pubkeys_conv.inner = untag_ptr(pubkeys);
2323         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2324         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2325
2326         LDKWriteableEcdsaChannelSigner ret = {
2327                 .this_arg = (void*) calls,
2328                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2329                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2330                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2331                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2332         };
2333         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2334         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2335         return ret;
2336 }
2337 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2338         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2339         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2340         return tag_ptr(res_ptr, true);
2341 }
2342 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
2343         void* this_arg_ptr = untag_ptr(this_arg);
2344         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2345         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2346         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2347         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2348         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2349         CVec_u8Z_free(ret_var);
2350         return ret_arr;
2351 }
2352
2353 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2354 CHECK(owner->result_ok);
2355         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2356 }
2357 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
2358         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2359         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2360         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2361         return tag_ptr(ret_ret, true);
2362 }
2363
2364 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2365 CHECK(!owner->result_ok);
2366         return DecodeError_clone(&*owner->contents.err);
2367 }
2368 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
2369         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2370         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2371         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2372         uint64_t ret_ref = tag_ptr(ret_copy, true);
2373         return ret_ref;
2374 }
2375
2376 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2377 CHECK(owner->result_ok);
2378         return CVec_u8Z_clone(&*owner->contents.result);
2379 }
2380 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_ok"))) TS_CResult_CVec_u8ZNoneZ_get_ok(uint64_t owner) {
2381         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2382         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2383         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2384         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2385         CVec_u8Z_free(ret_var);
2386         return ret_arr;
2387 }
2388
2389 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2390 CHECK(!owner->result_ok);
2391         return *owner->contents.err;
2392 }
2393 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_err"))) TS_CResult_CVec_u8ZNoneZ_get_err(uint64_t owner) {
2394         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2395         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2396 }
2397
2398 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2399         LDKShutdownScript ret = *owner->contents.result;
2400         ret.is_owned = false;
2401         return ret;
2402 }
2403 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_ok"))) TS_CResult_ShutdownScriptNoneZ_get_ok(uint64_t owner) {
2404         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2405         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2406         uint64_t ret_ref = 0;
2407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2409         return ret_ref;
2410 }
2411
2412 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2413 CHECK(!owner->result_ok);
2414         return *owner->contents.err;
2415 }
2416 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_err"))) TS_CResult_ShutdownScriptNoneZ_get_err(uint64_t owner) {
2417         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2418         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2419 }
2420
2421 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
2422         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2423         switch(obj->tag) {
2424                 case LDKCOption_u16Z_Some: return 0;
2425                 case LDKCOption_u16Z_None: return 1;
2426                 default: abort();
2427         }
2428 }
2429 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
2430         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2431         assert(obj->tag == LDKCOption_u16Z_Some);
2432         int16_t some_conv = obj->some;
2433         return some_conv;
2434 }
2435 uint32_t __attribute__((export_name("TS_LDKCOption_boolZ_ty_from_ptr"))) TS_LDKCOption_boolZ_ty_from_ptr(uint64_t ptr) {
2436         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2437         switch(obj->tag) {
2438                 case LDKCOption_boolZ_Some: return 0;
2439                 case LDKCOption_boolZ_None: return 1;
2440                 default: abort();
2441         }
2442 }
2443 jboolean __attribute__((export_name("TS_LDKCOption_boolZ_Some_get_some"))) TS_LDKCOption_boolZ_Some_get_some(uint64_t ptr) {
2444         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2445         assert(obj->tag == LDKCOption_boolZ_Some);
2446         jboolean some_conv = obj->some;
2447         return some_conv;
2448 }
2449 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2450 CHECK(owner->result_ok);
2451         return Witness_clone(&*owner->contents.result);
2452 }
2453 int8_tArray  __attribute__((export_name("TS_CResult_WitnessNoneZ_get_ok"))) TS_CResult_WitnessNoneZ_get_ok(uint64_t owner) {
2454         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2455         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
2456         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2457         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2458         Witness_free(ret_var);
2459         return ret_arr;
2460 }
2461
2462 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2463 CHECK(!owner->result_ok);
2464         return *owner->contents.err;
2465 }
2466 void  __attribute__((export_name("TS_CResult_WitnessNoneZ_get_err"))) TS_CResult_WitnessNoneZ_get_err(uint64_t owner) {
2467         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2468         CResult_WitnessNoneZ_get_err(owner_conv);
2469 }
2470
2471 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2472         LDKInMemorySigner ret = *owner->contents.result;
2473         ret.is_owned = false;
2474         return ret;
2475 }
2476 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
2477         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2478         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2479         uint64_t ret_ref = 0;
2480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2482         return ret_ref;
2483 }
2484
2485 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2486 CHECK(!owner->result_ok);
2487         return DecodeError_clone(&*owner->contents.err);
2488 }
2489 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
2490         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2491         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2492         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2493         uint64_t ret_ref = tag_ptr(ret_copy, true);
2494         return ret_ref;
2495 }
2496
2497 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2498         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2499         for (size_t i = 0; i < ret.datalen; i++) {
2500                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2501         }
2502         return ret;
2503 }
2504 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2505         LDKRoute ret = *owner->contents.result;
2506         ret.is_owned = false;
2507         return ret;
2508 }
2509 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
2510         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2511         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2512         uint64_t ret_ref = 0;
2513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2515         return ret_ref;
2516 }
2517
2518 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2519         LDKLightningError ret = *owner->contents.err;
2520         ret.is_owned = false;
2521         return ret;
2522 }
2523 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
2524         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2525         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2526         uint64_t ret_ref = 0;
2527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2529         return ret_ref;
2530 }
2531
2532 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2533         LDKBlindedPayInfo ret = owner->a;
2534         ret.is_owned = false;
2535         return ret;
2536 }
2537 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
2538         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2539         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2540         uint64_t ret_ref = 0;
2541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2543         return ret_ref;
2544 }
2545
2546 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2547         LDKBlindedPath ret = owner->b;
2548         ret.is_owned = false;
2549         return ret;
2550 }
2551 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
2552         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2553         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2554         uint64_t ret_ref = 0;
2555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2557         return ret_ref;
2558 }
2559
2560 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
2561         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
2562         for (size_t i = 0; i < ret.datalen; i++) {
2563                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
2564         }
2565         return ret;
2566 }
2567 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
2568 CHECK(owner->result_ok);
2569         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
2570 }
2571 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(uint64_t owner) {
2572         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
2573         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
2574         uint64_tArray ret_arr = NULL;
2575         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2576         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2577         for (size_t l = 0; l < ret_var.datalen; l++) {
2578                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
2579                 *ret_conv_37_conv = ret_var.data[l];
2580                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
2581         }
2582         
2583         FREE(ret_var.data);
2584         return ret_arr;
2585 }
2586
2587 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
2588 CHECK(!owner->result_ok);
2589         return *owner->contents.err;
2590 }
2591 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(uint64_t owner) {
2592         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
2593         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
2594 }
2595
2596 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
2597         LDKOnionMessagePath ret = *owner->contents.result;
2598         ret.is_owned = false;
2599         return ret;
2600 }
2601 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_ok"))) TS_CResult_OnionMessagePathNoneZ_get_ok(uint64_t owner) {
2602         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
2603         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
2604         uint64_t ret_ref = 0;
2605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2607         return ret_ref;
2608 }
2609
2610 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
2611 CHECK(!owner->result_ok);
2612         return *owner->contents.err;
2613 }
2614 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_err"))) TS_CResult_OnionMessagePathNoneZ_get_err(uint64_t owner) {
2615         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
2616         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
2617 }
2618
2619 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
2620 CHECK(owner->result_ok);
2621         return CVec_BlindedPathZ_clone(&*owner->contents.result);
2622 }
2623 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_get_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_get_ok(uint64_t owner) {
2624         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
2625         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
2626         uint64_tArray ret_arr = NULL;
2627         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2628         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2629         for (size_t n = 0; n < ret_var.datalen; n++) {
2630                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
2631                 uint64_t ret_conv_13_ref = 0;
2632                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
2633                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
2634                 ret_arr_ptr[n] = ret_conv_13_ref;
2635         }
2636         
2637         FREE(ret_var.data);
2638         return ret_arr;
2639 }
2640
2641 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
2642 CHECK(!owner->result_ok);
2643         return *owner->contents.err;
2644 }
2645 void  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_get_err"))) TS_CResult_CVec_BlindedPathZNoneZ_get_err(uint64_t owner) {
2646         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
2647         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
2648 }
2649
2650 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2651         LDKInFlightHtlcs ret = *owner->contents.result;
2652         ret.is_owned = false;
2653         return ret;
2654 }
2655 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
2656         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2657         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
2658         uint64_t ret_ref = 0;
2659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2661         return ret_ref;
2662 }
2663
2664 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2665 CHECK(!owner->result_ok);
2666         return DecodeError_clone(&*owner->contents.err);
2667 }
2668 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
2669         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2670         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2671         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
2672         uint64_t ret_ref = tag_ptr(ret_copy, true);
2673         return ret_ref;
2674 }
2675
2676 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2677         LDKRouteHop ret = *owner->contents.result;
2678         ret.is_owned = false;
2679         return ret;
2680 }
2681 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
2682         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2683         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2684         uint64_t ret_ref = 0;
2685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2687         return ret_ref;
2688 }
2689
2690 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2691 CHECK(!owner->result_ok);
2692         return DecodeError_clone(&*owner->contents.err);
2693 }
2694 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
2695         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2696         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2697         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2698         uint64_t ret_ref = tag_ptr(ret_copy, true);
2699         return ret_ref;
2700 }
2701
2702 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
2703         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
2704         for (size_t i = 0; i < ret.datalen; i++) {
2705                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
2706         }
2707         return ret;
2708 }
2709 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2710         LDKBlindedTail ret = *owner->contents.result;
2711         ret.is_owned = false;
2712         return ret;
2713 }
2714 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
2715         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2716         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
2717         uint64_t ret_ref = 0;
2718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2720         return ret_ref;
2721 }
2722
2723 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2724 CHECK(!owner->result_ok);
2725         return DecodeError_clone(&*owner->contents.err);
2726 }
2727 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
2728         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2729         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2730         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
2731         uint64_t ret_ref = tag_ptr(ret_copy, true);
2732         return ret_ref;
2733 }
2734
2735 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2736         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2737         for (size_t i = 0; i < ret.datalen; i++) {
2738                 ret.data[i] = RouteHop_clone(&orig->data[i]);
2739         }
2740         return ret;
2741 }
2742 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
2743         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
2744         for (size_t i = 0; i < ret.datalen; i++) {
2745                 ret.data[i] = Path_clone(&orig->data[i]);
2746         }
2747         return ret;
2748 }
2749 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2750         LDKRoute ret = *owner->contents.result;
2751         ret.is_owned = false;
2752         return ret;
2753 }
2754 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
2755         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2756         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2757         uint64_t ret_ref = 0;
2758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2760         return ret_ref;
2761 }
2762
2763 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2764 CHECK(!owner->result_ok);
2765         return DecodeError_clone(&*owner->contents.err);
2766 }
2767 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
2768         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2769         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2770         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2771         uint64_t ret_ref = tag_ptr(ret_copy, true);
2772         return ret_ref;
2773 }
2774
2775 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2776         LDKRouteParameters ret = *owner->contents.result;
2777         ret.is_owned = false;
2778         return ret;
2779 }
2780 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
2781         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2782         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2783         uint64_t ret_ref = 0;
2784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2786         return ret_ref;
2787 }
2788
2789 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2790 CHECK(!owner->result_ok);
2791         return DecodeError_clone(&*owner->contents.err);
2792 }
2793 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
2794         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2795         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2796         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2797         uint64_t ret_ref = tag_ptr(ret_copy, true);
2798         return ret_ref;
2799 }
2800
2801 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2802         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2803         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2804         return ret;
2805 }
2806 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2807         LDKPaymentParameters ret = *owner->contents.result;
2808         ret.is_owned = false;
2809         return ret;
2810 }
2811 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
2812         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2813         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2814         uint64_t ret_ref = 0;
2815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2817         return ret_ref;
2818 }
2819
2820 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2821 CHECK(!owner->result_ok);
2822         return DecodeError_clone(&*owner->contents.err);
2823 }
2824 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
2825         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2826         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2827         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2828         uint64_t ret_ref = tag_ptr(ret_copy, true);
2829         return ret_ref;
2830 }
2831
2832 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2833         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2834         for (size_t i = 0; i < ret.datalen; i++) {
2835                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2836         }
2837         return ret;
2838 }
2839 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2840         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2841         for (size_t i = 0; i < ret.datalen; i++) {
2842                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2843         }
2844         return ret;
2845 }
2846 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2847         LDKRouteHint ret = *owner->contents.result;
2848         ret.is_owned = false;
2849         return ret;
2850 }
2851 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
2852         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2853         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2854         uint64_t ret_ref = 0;
2855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2857         return ret_ref;
2858 }
2859
2860 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2861 CHECK(!owner->result_ok);
2862         return DecodeError_clone(&*owner->contents.err);
2863 }
2864 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
2865         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2866         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2867         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2868         uint64_t ret_ref = tag_ptr(ret_copy, true);
2869         return ret_ref;
2870 }
2871
2872 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2873         LDKRouteHintHop ret = *owner->contents.result;
2874         ret.is_owned = false;
2875         return ret;
2876 }
2877 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
2878         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2879         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2880         uint64_t ret_ref = 0;
2881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2883         return ret_ref;
2884 }
2885
2886 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2887 CHECK(!owner->result_ok);
2888         return DecodeError_clone(&*owner->contents.err);
2889 }
2890 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
2891         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2892         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2893         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2894         uint64_t ret_ref = tag_ptr(ret_copy, true);
2895         return ret_ref;
2896 }
2897
2898 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2899         LDKFixedPenaltyScorer ret = *owner->contents.result;
2900         ret.is_owned = false;
2901         return ret;
2902 }
2903 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2904         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2905         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2906         uint64_t ret_ref = 0;
2907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2909         return ret_ref;
2910 }
2911
2912 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2913 CHECK(!owner->result_ok);
2914         return DecodeError_clone(&*owner->contents.err);
2915 }
2916 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2917         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2918         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2919         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2920         uint64_t ret_ref = tag_ptr(ret_copy, true);
2921         return ret_ref;
2922 }
2923
2924 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2925         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2926         for (size_t i = 0; i < ret.datalen; i++) {
2927                 ret.data[i] = NodeId_clone(&orig->data[i]);
2928         }
2929         return ret;
2930 }
2931 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2932         return owner->a;
2933 }
2934 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2935         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2936         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2937         return ret_conv;
2938 }
2939
2940 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2941         return owner->b;
2942 }
2943 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2944         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2945         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2946         return ret_conv;
2947 }
2948
2949 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2950         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2951         switch(obj->tag) {
2952                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2953                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2954                 default: abort();
2955         }
2956 }
2957 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2958         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2959         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2960         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2961         *some_conv = obj->some;
2962                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2963         return tag_ptr(some_conv, true);
2964 }
2965 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
2966         return owner->a;
2967 }
2968 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
2969         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2970         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2971         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
2972         return ret_arr;
2973 }
2974
2975 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
2976         return owner->b;
2977 }
2978 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
2979         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2980         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2981         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
2982         return ret_arr;
2983 }
2984
2985 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2986         return owner->a;
2987 }
2988 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_a"))) TS_C2Tuple__u1632_u1632Z_get_a(uint64_t owner) {
2989         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2990         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2991         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
2992         return ret_arr;
2993 }
2994
2995 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2996         return owner->b;
2997 }
2998 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_b"))) TS_C2Tuple__u1632_u1632Z_get_b(uint64_t owner) {
2999         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
3000         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3001         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
3002         return ret_arr;
3003 }
3004
3005 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(uint64_t ptr) {
3006         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3007         switch(obj->tag) {
3008                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
3009                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
3010                 default: abort();
3011         }
3012 }
3013 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(uint64_t ptr) {
3014         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3015         assert(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
3016         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
3017                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
3018         return tag_ptr(some_conv, false);
3019 }
3020 uint32_t __attribute__((export_name("TS_LDKCOption_f64Z_ty_from_ptr"))) TS_LDKCOption_f64Z_ty_from_ptr(uint64_t ptr) {
3021         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3022         switch(obj->tag) {
3023                 case LDKCOption_f64Z_Some: return 0;
3024                 case LDKCOption_f64Z_None: return 1;
3025                 default: abort();
3026         }
3027 }
3028 double __attribute__((export_name("TS_LDKCOption_f64Z_Some_get_some"))) TS_LDKCOption_f64Z_Some_get_some(uint64_t ptr) {
3029         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3030         assert(obj->tag == LDKCOption_f64Z_Some);
3031         double some_conv = obj->some;
3032         return some_conv;
3033 }
3034 typedef struct LDKLogger_JCalls {
3035         atomic_size_t refcnt;
3036         uint32_t instance_ptr;
3037 } LDKLogger_JCalls;
3038 static void LDKLogger_JCalls_free(void* this_arg) {
3039         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3040         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3041                 FREE(j_calls);
3042         }
3043 }
3044 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
3045         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3046         LDKRecord record_var = record;
3047         uint64_t record_ref = 0;
3048         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3049         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3050         js_invoke_function_buuuuu(j_calls->instance_ptr, 16, record_ref, 0, 0, 0, 0, 0);
3051 }
3052 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3053         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3054         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3055 }
3056 static inline LDKLogger LDKLogger_init (JSValue o) {
3057         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3058         atomic_init(&calls->refcnt, 1);
3059         calls->instance_ptr = o;
3060
3061         LDKLogger ret = {
3062                 .this_arg = (void*) calls,
3063                 .log = log_LDKLogger_jcall,
3064                 .free = LDKLogger_JCalls_free,
3065         };
3066         return ret;
3067 }
3068 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
3069         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3070         *res_ptr = LDKLogger_init(o);
3071         return tag_ptr(res_ptr, true);
3072 }
3073 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3074         LDKProbabilisticScorer ret = *owner->contents.result;
3075         ret.is_owned = false;
3076         return ret;
3077 }
3078 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
3079         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3080         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3081         uint64_t ret_ref = 0;
3082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3084         return ret_ref;
3085 }
3086
3087 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3088 CHECK(!owner->result_ok);
3089         return DecodeError_clone(&*owner->contents.err);
3090 }
3091 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
3092         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3093         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3094         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3095         uint64_t ret_ref = tag_ptr(ret_copy, true);
3096         return ret_ref;
3097 }
3098
3099 static inline struct LDKBestBlock CResult_BestBlockDecodeErrorZ_get_ok(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
3100         LDKBestBlock ret = *owner->contents.result;
3101         ret.is_owned = false;
3102         return ret;
3103 }
3104 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_get_ok"))) TS_CResult_BestBlockDecodeErrorZ_get_ok(uint64_t owner) {
3105         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
3106         LDKBestBlock ret_var = CResult_BestBlockDecodeErrorZ_get_ok(owner_conv);
3107         uint64_t ret_ref = 0;
3108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3110         return ret_ref;
3111 }
3112
3113 static inline struct LDKDecodeError CResult_BestBlockDecodeErrorZ_get_err(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
3114 CHECK(!owner->result_ok);
3115         return DecodeError_clone(&*owner->contents.err);
3116 }
3117 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_get_err"))) TS_CResult_BestBlockDecodeErrorZ_get_err(uint64_t owner) {
3118         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
3119         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3120         *ret_copy = CResult_BestBlockDecodeErrorZ_get_err(owner_conv);
3121         uint64_t ret_ref = tag_ptr(ret_copy, true);
3122         return ret_ref;
3123 }
3124
3125 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3126         return owner->a;
3127 }
3128 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
3129         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3130         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3131         return ret_conv;
3132 }
3133
3134 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3135         return owner->b;
3136 }
3137 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
3138         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3139         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3140         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3141         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3142         return ret_arr;
3143 }
3144
3145 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3146         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3147         for (size_t i = 0; i < ret.datalen; i++) {
3148                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3149         }
3150         return ret;
3151 }
3152 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3153         return ThirtyTwoBytes_clone(&owner->a);
3154 }
3155 int8_tArray  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(uint64_t owner) {
3156         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3157         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3158         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
3159         return ret_arr;
3160 }
3161
3162 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3163         return owner->b;
3164 }
3165 int32_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(uint64_t owner) {
3166         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3167         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
3168         return ret_conv;
3169 }
3170
3171 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3172         return COption_ThirtyTwoBytesZ_clone(&owner->c);
3173 }
3174 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(uint64_t owner) {
3175         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3176         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
3177         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
3178         uint64_t ret_ref = tag_ptr(ret_copy, true);
3179         return ret_ref;
3180 }
3181
3182 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
3183         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
3184         for (size_t i = 0; i < ret.datalen; i++) {
3185                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
3186         }
3187         return ret;
3188 }
3189 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3190 CHECK(owner->result_ok);
3191         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
3192 }
3193 uint32_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(uint64_t owner) {
3194         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3195         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
3196         return ret_conv;
3197 }
3198
3199 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3200 CHECK(!owner->result_ok);
3201         return *owner->contents.err;
3202 }
3203 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(uint64_t owner) {
3204         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3205         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
3206 }
3207
3208 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
3209         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3210         switch(obj->tag) {
3211                 case LDKClosureReason_CounterpartyForceClosed: return 0;
3212                 case LDKClosureReason_HolderForceClosed: return 1;
3213                 case LDKClosureReason_LegacyCooperativeClosure: return 2;
3214                 case LDKClosureReason_CounterpartyInitiatedCooperativeClosure: return 3;
3215                 case LDKClosureReason_LocallyInitiatedCooperativeClosure: return 4;
3216                 case LDKClosureReason_CommitmentTxConfirmed: return 5;
3217                 case LDKClosureReason_FundingTimedOut: return 6;
3218                 case LDKClosureReason_ProcessingError: return 7;
3219                 case LDKClosureReason_DisconnectedPeer: return 8;
3220                 case LDKClosureReason_OutdatedChannelManager: return 9;
3221                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 10;
3222                 case LDKClosureReason_FundingBatchClosure: return 11;
3223                 case LDKClosureReason_HTLCsTimedOut: return 12;
3224                 default: abort();
3225         }
3226 }
3227 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
3228         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3229         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
3230         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
3231                         uint64_t peer_msg_ref = 0;
3232                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
3233                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
3234         return peer_msg_ref;
3235 }
3236 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
3237         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3238         assert(obj->tag == LDKClosureReason_ProcessingError);
3239         LDKStr err_str = obj->processing_error.err;
3240                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3241         return err_conv;
3242 }
3243 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
3244         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3245         switch(obj->tag) {
3246                 case LDKMonitorEvent_HTLCEvent: return 0;
3247                 case LDKMonitorEvent_HolderForceClosedWithInfo: return 1;
3248                 case LDKMonitorEvent_HolderForceClosed: return 2;
3249                 case LDKMonitorEvent_Completed: return 3;
3250                 default: abort();
3251         }
3252 }
3253 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
3254         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3255         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
3256         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3257                         uint64_t htlc_event_ref = 0;
3258                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3259                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3260         return htlc_event_ref;
3261 }
3262 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_reason"))) TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_reason(uint64_t ptr) {
3263         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3264         assert(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3265         uint64_t reason_ref = tag_ptr(&obj->holder_force_closed_with_info.reason, false);
3266         return reason_ref;
3267 }
3268 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_outpoint"))) TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_outpoint(uint64_t ptr) {
3269         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3270         assert(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3271         LDKOutPoint outpoint_var = obj->holder_force_closed_with_info.outpoint;
3272                         uint64_t outpoint_ref = 0;
3273                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
3274                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
3275         return outpoint_ref;
3276 }
3277 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_channel_id"))) TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_channel_id(uint64_t ptr) {
3278         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3279         assert(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3280         LDKChannelId channel_id_var = obj->holder_force_closed_with_info.channel_id;
3281                         uint64_t channel_id_ref = 0;
3282                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
3283                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
3284         return channel_id_ref;
3285 }
3286 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed"))) TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(uint64_t ptr) {
3287         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3288         assert(obj->tag == LDKMonitorEvent_HolderForceClosed);
3289         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
3290                         uint64_t holder_force_closed_ref = 0;
3291                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
3292                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
3293         return holder_force_closed_ref;
3294 }
3295 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
3296         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3297         assert(obj->tag == LDKMonitorEvent_Completed);
3298         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
3299                         uint64_t funding_txo_ref = 0;
3300                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3301                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3302         return funding_txo_ref;
3303 }
3304 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_channel_id"))) TS_LDKMonitorEvent_Completed_get_channel_id(uint64_t ptr) {
3305         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3306         assert(obj->tag == LDKMonitorEvent_Completed);
3307         LDKChannelId channel_id_var = obj->completed.channel_id;
3308                         uint64_t channel_id_ref = 0;
3309                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
3310                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
3311         return channel_id_ref;
3312 }
3313 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
3314         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3315         assert(obj->tag == LDKMonitorEvent_Completed);
3316         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
3317         return monitor_update_id_conv;
3318 }
3319 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3320         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3321         for (size_t i = 0; i < ret.datalen; i++) {
3322                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3323         }
3324         return ret;
3325 }
3326 static inline struct LDKOutPoint C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3327         LDKOutPoint ret = owner->a;
3328         ret.is_owned = false;
3329         return ret;
3330 }
3331 uint64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
3332         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3333         LDKOutPoint ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3334         uint64_t ret_ref = 0;
3335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3337         return ret_ref;
3338 }
3339
3340 static inline struct LDKChannelId C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3341         LDKChannelId ret = owner->b;
3342         ret.is_owned = false;
3343         return ret;
3344 }
3345 uint64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
3346         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3347         LDKChannelId ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3348         uint64_t ret_ref = 0;
3349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3351         return ret_ref;
3352 }
3353
3354 static inline struct LDKCVec_MonitorEventZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3355         return CVec_MonitorEventZ_clone(&owner->c);
3356 }
3357 uint64_tArray  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
3358         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3359         LDKCVec_MonitorEventZ ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(owner_conv);
3360         uint64_tArray ret_arr = NULL;
3361         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
3362         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
3363         for (size_t o = 0; o < ret_var.datalen; o++) {
3364                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3365                 *ret_conv_14_copy = ret_var.data[o];
3366                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3367                 ret_arr_ptr[o] = ret_conv_14_ref;
3368         }
3369         
3370         FREE(ret_var.data);
3371         return ret_arr;
3372 }
3373
3374 static inline struct LDKPublicKey C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3375         return owner->d;
3376 }
3377 int8_tArray  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(uint64_t owner) {
3378         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3379         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3380         memcpy(ret_arr->elems, C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(owner_conv).compressed_form, 33);
3381         return ret_arr;
3382 }
3383
3384 static inline LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ *orig) {
3385         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3386         for (size_t i = 0; i < ret.datalen; i++) {
3387                 ret.data[i] = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3388         }
3389         return ret;
3390 }
3391 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3392         LDKInitFeatures ret = *owner->contents.result;
3393         ret.is_owned = false;
3394         return ret;
3395 }
3396 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3397         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3398         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3399         uint64_t ret_ref = 0;
3400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3402         return ret_ref;
3403 }
3404
3405 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3406 CHECK(!owner->result_ok);
3407         return DecodeError_clone(&*owner->contents.err);
3408 }
3409 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3410         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3411         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3412         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3413         uint64_t ret_ref = tag_ptr(ret_copy, true);
3414         return ret_ref;
3415 }
3416
3417 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3418         LDKChannelFeatures ret = *owner->contents.result;
3419         ret.is_owned = false;
3420         return ret;
3421 }
3422 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3423         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3424         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3425         uint64_t ret_ref = 0;
3426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3428         return ret_ref;
3429 }
3430
3431 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3432 CHECK(!owner->result_ok);
3433         return DecodeError_clone(&*owner->contents.err);
3434 }
3435 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3436         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3437         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3438         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3439         uint64_t ret_ref = tag_ptr(ret_copy, true);
3440         return ret_ref;
3441 }
3442
3443 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3444         LDKNodeFeatures ret = *owner->contents.result;
3445         ret.is_owned = false;
3446         return ret;
3447 }
3448 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3449         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3450         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3451         uint64_t ret_ref = 0;
3452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3454         return ret_ref;
3455 }
3456
3457 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3458 CHECK(!owner->result_ok);
3459         return DecodeError_clone(&*owner->contents.err);
3460 }
3461 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3462         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3463         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3464         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3465         uint64_t ret_ref = tag_ptr(ret_copy, true);
3466         return ret_ref;
3467 }
3468
3469 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3470         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3471         ret.is_owned = false;
3472         return ret;
3473 }
3474 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3475         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3476         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3477         uint64_t ret_ref = 0;
3478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3480         return ret_ref;
3481 }
3482
3483 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3484 CHECK(!owner->result_ok);
3485         return DecodeError_clone(&*owner->contents.err);
3486 }
3487 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3488         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3489         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3490         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3491         uint64_t ret_ref = tag_ptr(ret_copy, true);
3492         return ret_ref;
3493 }
3494
3495 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3496         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3497         ret.is_owned = false;
3498         return ret;
3499 }
3500 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3501         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3502         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3503         uint64_t ret_ref = 0;
3504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3506         return ret_ref;
3507 }
3508
3509 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3510 CHECK(!owner->result_ok);
3511         return DecodeError_clone(&*owner->contents.err);
3512 }
3513 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3514         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3515         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3516         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3517         uint64_t ret_ref = tag_ptr(ret_copy, true);
3518         return ret_ref;
3519 }
3520
3521 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3522         LDKBlindedHopFeatures ret = *owner->contents.result;
3523         ret.is_owned = false;
3524         return ret;
3525 }
3526 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3527         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3528         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3529         uint64_t ret_ref = 0;
3530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3532         return ret_ref;
3533 }
3534
3535 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3536 CHECK(!owner->result_ok);
3537         return DecodeError_clone(&*owner->contents.err);
3538 }
3539 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3540         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3541         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3542         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3543         uint64_t ret_ref = tag_ptr(ret_copy, true);
3544         return ret_ref;
3545 }
3546
3547 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3548         LDKChannelTypeFeatures ret = *owner->contents.result;
3549         ret.is_owned = false;
3550         return ret;
3551 }
3552 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3553         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3554         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3555         uint64_t ret_ref = 0;
3556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3558         return ret_ref;
3559 }
3560
3561 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3562 CHECK(!owner->result_ok);
3563         return DecodeError_clone(&*owner->contents.err);
3564 }
3565 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3566         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3567         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3568         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3569         uint64_t ret_ref = tag_ptr(ret_copy, true);
3570         return ret_ref;
3571 }
3572
3573 static inline struct LDKOfferId CResult_OfferIdDecodeErrorZ_get_ok(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
3574         LDKOfferId ret = *owner->contents.result;
3575         ret.is_owned = false;
3576         return ret;
3577 }
3578 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_get_ok"))) TS_CResult_OfferIdDecodeErrorZ_get_ok(uint64_t owner) {
3579         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
3580         LDKOfferId ret_var = CResult_OfferIdDecodeErrorZ_get_ok(owner_conv);
3581         uint64_t ret_ref = 0;
3582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3584         return ret_ref;
3585 }
3586
3587 static inline struct LDKDecodeError CResult_OfferIdDecodeErrorZ_get_err(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
3588 CHECK(!owner->result_ok);
3589         return DecodeError_clone(&*owner->contents.err);
3590 }
3591 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_get_err"))) TS_CResult_OfferIdDecodeErrorZ_get_err(uint64_t owner) {
3592         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
3593         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3594         *ret_copy = CResult_OfferIdDecodeErrorZ_get_err(owner_conv);
3595         uint64_t ret_ref = tag_ptr(ret_copy, true);
3596         return ret_ref;
3597 }
3598
3599 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
3600 CHECK(owner->result_ok);
3601         return *owner->contents.result;
3602 }
3603 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_get_ok(uint64_t owner) {
3604         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
3605         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
3606 }
3607
3608 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
3609 CHECK(!owner->result_ok);
3610         return Bolt12SemanticError_clone(&*owner->contents.err);
3611 }
3612 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_err"))) TS_CResult_NoneBolt12SemanticErrorZ_get_err(uint64_t owner) {
3613         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
3614         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
3615         return ret_conv;
3616 }
3617
3618 static inline struct LDKOffer CResult_OfferBolt12SemanticErrorZ_get_ok(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
3619         LDKOffer ret = *owner->contents.result;
3620         ret.is_owned = false;
3621         return ret;
3622 }
3623 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_get_ok"))) TS_CResult_OfferBolt12SemanticErrorZ_get_ok(uint64_t owner) {
3624         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
3625         LDKOffer ret_var = CResult_OfferBolt12SemanticErrorZ_get_ok(owner_conv);
3626         uint64_t ret_ref = 0;
3627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3629         return ret_ref;
3630 }
3631
3632 static inline enum LDKBolt12SemanticError CResult_OfferBolt12SemanticErrorZ_get_err(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
3633 CHECK(!owner->result_ok);
3634         return Bolt12SemanticError_clone(&*owner->contents.err);
3635 }
3636 uint32_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_get_err"))) TS_CResult_OfferBolt12SemanticErrorZ_get_err(uint64_t owner) {
3637         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
3638         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_OfferBolt12SemanticErrorZ_get_err(owner_conv));
3639         return ret_conv;
3640 }
3641
3642 static inline struct LDKInvoiceRequestWithDerivedPayerIdBuilder CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
3643         LDKInvoiceRequestWithDerivedPayerIdBuilder ret = *owner->contents.result;
3644         ret.is_owned = false;
3645         return ret;
3646 }
3647 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
3648         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
3649         LDKInvoiceRequestWithDerivedPayerIdBuilder ret_var = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
3650         uint64_t ret_ref = 0;
3651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3653         return ret_ref;
3654 }
3655
3656 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
3657 CHECK(!owner->result_ok);
3658         return Bolt12SemanticError_clone(&*owner->contents.err);
3659 }
3660 uint32_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
3661         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
3662         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
3663         return ret_conv;
3664 }
3665
3666 static inline struct LDKInvoiceRequestWithExplicitPayerIdBuilder CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
3667         LDKInvoiceRequestWithExplicitPayerIdBuilder ret = *owner->contents.result;
3668         ret.is_owned = false;
3669         return ret;
3670 }
3671 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
3672         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
3673         LDKInvoiceRequestWithExplicitPayerIdBuilder ret_var = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
3674         uint64_t ret_ref = 0;
3675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3677         return ret_ref;
3678 }
3679
3680 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
3681 CHECK(!owner->result_ok);
3682         return Bolt12SemanticError_clone(&*owner->contents.err);
3683 }
3684 uint32_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
3685         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
3686         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
3687         return ret_conv;
3688 }
3689
3690 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3691         LDKOffer ret = *owner->contents.result;
3692         ret.is_owned = false;
3693         return ret;
3694 }
3695 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_ok"))) TS_CResult_OfferBolt12ParseErrorZ_get_ok(uint64_t owner) {
3696         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3697         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
3698         uint64_t ret_ref = 0;
3699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3701         return ret_ref;
3702 }
3703
3704 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3705         LDKBolt12ParseError ret = *owner->contents.err;
3706         ret.is_owned = false;
3707         return ret;
3708 }
3709 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_err"))) TS_CResult_OfferBolt12ParseErrorZ_get_err(uint64_t owner) {
3710         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3711         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
3712         uint64_t ret_ref = 0;
3713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3715         return ret_ref;
3716 }
3717
3718 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3719         LDKNodeId ret = *owner->contents.result;
3720         ret.is_owned = false;
3721         return ret;
3722 }
3723 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3724         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3725         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3726         uint64_t ret_ref = 0;
3727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3729         return ret_ref;
3730 }
3731
3732 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3733 CHECK(!owner->result_ok);
3734         return DecodeError_clone(&*owner->contents.err);
3735 }
3736 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3737         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3738         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3739         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3740         uint64_t ret_ref = tag_ptr(ret_copy, true);
3741         return ret_ref;
3742 }
3743
3744 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3745 CHECK(owner->result_ok);
3746         return *owner->contents.result;
3747 }
3748 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
3749         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3750         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3751         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
3752         return ret_arr;
3753 }
3754
3755 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3756 CHECK(!owner->result_ok);
3757         return *owner->contents.err;
3758 }
3759 uint32_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_err(uint64_t owner) {
3760         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3761         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
3762         return ret_conv;
3763 }
3764
3765 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
3766         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3767         switch(obj->tag) {
3768                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3769                 case LDKNetworkUpdate_ChannelFailure: return 1;
3770                 case LDKNetworkUpdate_NodeFailure: return 2;
3771                 default: abort();
3772         }
3773 }
3774 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
3775         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3776         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3777         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3778                         uint64_t msg_ref = 0;
3779                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3780                         msg_ref = tag_ptr(msg_var.inner, false);
3781         return msg_ref;
3782 }
3783 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
3784         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3785         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3786         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
3787         return short_channel_id_conv;
3788 }
3789 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
3790         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3791         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3792         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
3793         return is_permanent_conv;
3794 }
3795 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
3796         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3797         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3798         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3799         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
3800         return node_id_arr;
3801 }
3802 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
3803         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3804         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3805         jboolean is_permanent_conv = obj->node_failure.is_permanent;
3806         return is_permanent_conv;
3807 }
3808 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
3809         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3810         switch(obj->tag) {
3811                 case LDKCOption_NetworkUpdateZ_Some: return 0;
3812                 case LDKCOption_NetworkUpdateZ_None: return 1;
3813                 default: abort();
3814         }
3815 }
3816 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
3817         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3818         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
3819         uint64_t some_ref = tag_ptr(&obj->some, false);
3820         return some_ref;
3821 }
3822 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3823 CHECK(owner->result_ok);
3824         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3825 }
3826 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3827         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3828         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3829         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3830         uint64_t ret_ref = tag_ptr(ret_copy, true);
3831         return ret_ref;
3832 }
3833
3834 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3835 CHECK(!owner->result_ok);
3836         return DecodeError_clone(&*owner->contents.err);
3837 }
3838 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3839         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3840         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3841         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3842         uint64_t ret_ref = tag_ptr(ret_copy, true);
3843         return ret_ref;
3844 }
3845
3846 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3847 CHECK(owner->result_ok);
3848         return TxOut_clone(&*owner->contents.result);
3849 }
3850 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3851         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3852         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3853         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3854         return tag_ptr(ret_ref, true);
3855 }
3856
3857 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3858 CHECK(!owner->result_ok);
3859         return UtxoLookupError_clone(&*owner->contents.err);
3860 }
3861 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3862         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3863         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3864         return ret_conv;
3865 }
3866
3867 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3868         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3869         switch(obj->tag) {
3870                 case LDKUtxoResult_Sync: return 0;
3871                 case LDKUtxoResult_Async: return 1;
3872                 default: abort();
3873         }
3874 }
3875 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3876         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3877         assert(obj->tag == LDKUtxoResult_Sync);
3878         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3879         *sync_conv = obj->sync;
3880                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3881         return tag_ptr(sync_conv, true);
3882 }
3883 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3884         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3885         assert(obj->tag == LDKUtxoResult_Async);
3886         LDKUtxoFuture async_var = obj->async;
3887                         uint64_t async_ref = 0;
3888                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3889                         async_ref = tag_ptr(async_var.inner, false);
3890         return async_ref;
3891 }
3892 typedef struct LDKUtxoLookup_JCalls {
3893         atomic_size_t refcnt;
3894         uint32_t instance_ptr;
3895 } LDKUtxoLookup_JCalls;
3896 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3897         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3898         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3899                 FREE(j_calls);
3900         }
3901 }
3902 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
3903         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3904         int8_tArray chain_hash_arr = init_int8_tArray(32, __LINE__);
3905         memcpy(chain_hash_arr->elems, *chain_hash, 32);
3906         int64_t short_channel_id_conv = short_channel_id;
3907         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);
3908         void* ret_ptr = untag_ptr(ret);
3909         CHECK_ACCESS(ret_ptr);
3910         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3911         FREE(untag_ptr(ret));
3912         return ret_conv;
3913 }
3914 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3915         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3916         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3917 }
3918 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3919         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3920         atomic_init(&calls->refcnt, 1);
3921         calls->instance_ptr = o;
3922
3923         LDKUtxoLookup ret = {
3924                 .this_arg = (void*) calls,
3925                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3926                 .free = LDKUtxoLookup_JCalls_free,
3927         };
3928         return ret;
3929 }
3930 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3931         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3932         *res_ptr = LDKUtxoLookup_init(o);
3933         return tag_ptr(res_ptr, true);
3934 }
3935 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) {
3936         void* this_arg_ptr = untag_ptr(this_arg);
3937         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3938         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3939         uint8_t chain_hash_arr[32];
3940         CHECK(chain_hash->arr_len == 32);
3941         memcpy(chain_hash_arr, chain_hash->elems, 32); FREE(chain_hash);
3942         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
3943         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3944         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
3945         uint64_t ret_ref = tag_ptr(ret_copy, true);
3946         return ret_ref;
3947 }
3948
3949 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3950         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3951         switch(obj->tag) {
3952                 case LDKCOption_UtxoLookupZ_Some: return 0;
3953                 case LDKCOption_UtxoLookupZ_None: return 1;
3954                 default: abort();
3955         }
3956 }
3957 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3958         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3959         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3960         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3961         *some_ret = obj->some;
3962                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3963                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
3964                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3965                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
3966                         }
3967         return tag_ptr(some_ret, true);
3968 }
3969 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3970 CHECK(owner->result_ok);
3971         return *owner->contents.result;
3972 }
3973 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3974         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3975         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3976 }
3977
3978 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3979         LDKLightningError ret = *owner->contents.err;
3980         ret.is_owned = false;
3981         return ret;
3982 }
3983 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3984         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3985         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3986         uint64_t ret_ref = 0;
3987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3989         return ret_ref;
3990 }
3991
3992 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3993 CHECK(owner->result_ok);
3994         return *owner->contents.result;
3995 }
3996 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3997         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3998         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3999         return ret_conv;
4000 }
4001
4002 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4003         LDKLightningError ret = *owner->contents.err;
4004         ret.is_owned = false;
4005         return ret;
4006 }
4007 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
4008         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4009         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
4010         uint64_t ret_ref = 0;
4011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4013         return ret_ref;
4014 }
4015
4016 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4017         LDKChannelAnnouncement ret = owner->a;
4018         ret.is_owned = false;
4019         return ret;
4020 }
4021 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
4022         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4023         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
4024         uint64_t ret_ref = 0;
4025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4027         return ret_ref;
4028 }
4029
4030 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4031         LDKChannelUpdate ret = owner->b;
4032         ret.is_owned = false;
4033         return ret;
4034 }
4035 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
4036         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4037         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
4038         uint64_t ret_ref = 0;
4039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4041         return ret_ref;
4042 }
4043
4044 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4045         LDKChannelUpdate ret = owner->c;
4046         ret.is_owned = false;
4047         return ret;
4048 }
4049 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
4050         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4051         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
4052         uint64_t ret_ref = 0;
4053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4055         return ret_ref;
4056 }
4057
4058 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
4059         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4060         switch(obj->tag) {
4061                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
4062                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
4063                 default: abort();
4064         }
4065 }
4066 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
4067         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4068         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
4069         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4070         *some_conv = obj->some;
4071                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
4072         return tag_ptr(some_conv, true);
4073 }
4074 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
4075         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4076         switch(obj->tag) {
4077                 case LDKErrorAction_DisconnectPeer: return 0;
4078                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
4079                 case LDKErrorAction_IgnoreError: return 2;
4080                 case LDKErrorAction_IgnoreAndLog: return 3;
4081                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
4082                 case LDKErrorAction_SendErrorMessage: return 5;
4083                 case LDKErrorAction_SendWarningMessage: return 6;
4084                 default: abort();
4085         }
4086 }
4087 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
4088         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4089         assert(obj->tag == LDKErrorAction_DisconnectPeer);
4090         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
4091                         uint64_t msg_ref = 0;
4092                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4093                         msg_ref = tag_ptr(msg_var.inner, false);
4094         return msg_ref;
4095 }
4096 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg"))) TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg(uint64_t ptr) {
4097         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4098         assert(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
4099         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
4100                         uint64_t msg_ref = 0;
4101                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4102                         msg_ref = tag_ptr(msg_var.inner, false);
4103         return msg_ref;
4104 }
4105 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
4106         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4107         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
4108         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
4109         return ignore_and_log_conv;
4110 }
4111 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
4112         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4113         assert(obj->tag == LDKErrorAction_SendErrorMessage);
4114         LDKErrorMessage msg_var = obj->send_error_message.msg;
4115                         uint64_t msg_ref = 0;
4116                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4117                         msg_ref = tag_ptr(msg_var.inner, false);
4118         return msg_ref;
4119 }
4120 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
4121         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4122         assert(obj->tag == LDKErrorAction_SendWarningMessage);
4123         LDKWarningMessage msg_var = obj->send_warning_message.msg;
4124                         uint64_t msg_ref = 0;
4125                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4126                         msg_ref = tag_ptr(msg_var.inner, false);
4127         return msg_ref;
4128 }
4129 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
4130         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4131         assert(obj->tag == LDKErrorAction_SendWarningMessage);
4132         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
4133         return log_level_conv;
4134 }
4135 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
4136         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4137         switch(obj->tag) {
4138                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
4139                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
4140                 case LDKMessageSendEvent_SendOpenChannel: return 2;
4141                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
4142                 case LDKMessageSendEvent_SendFundingCreated: return 4;
4143                 case LDKMessageSendEvent_SendFundingSigned: return 5;
4144                 case LDKMessageSendEvent_SendStfu: return 6;
4145                 case LDKMessageSendEvent_SendSplice: return 7;
4146                 case LDKMessageSendEvent_SendSpliceAck: return 8;
4147                 case LDKMessageSendEvent_SendSpliceLocked: return 9;
4148                 case LDKMessageSendEvent_SendTxAddInput: return 10;
4149                 case LDKMessageSendEvent_SendTxAddOutput: return 11;
4150                 case LDKMessageSendEvent_SendTxRemoveInput: return 12;
4151                 case LDKMessageSendEvent_SendTxRemoveOutput: return 13;
4152                 case LDKMessageSendEvent_SendTxComplete: return 14;
4153                 case LDKMessageSendEvent_SendTxSignatures: return 15;
4154                 case LDKMessageSendEvent_SendTxInitRbf: return 16;
4155                 case LDKMessageSendEvent_SendTxAckRbf: return 17;
4156                 case LDKMessageSendEvent_SendTxAbort: return 18;
4157                 case LDKMessageSendEvent_SendChannelReady: return 19;
4158                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 20;
4159                 case LDKMessageSendEvent_UpdateHTLCs: return 21;
4160                 case LDKMessageSendEvent_SendRevokeAndACK: return 22;
4161                 case LDKMessageSendEvent_SendClosingSigned: return 23;
4162                 case LDKMessageSendEvent_SendShutdown: return 24;
4163                 case LDKMessageSendEvent_SendChannelReestablish: return 25;
4164                 case LDKMessageSendEvent_SendChannelAnnouncement: return 26;
4165                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 27;
4166                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 28;
4167                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 29;
4168                 case LDKMessageSendEvent_SendChannelUpdate: return 30;
4169                 case LDKMessageSendEvent_HandleError: return 31;
4170                 case LDKMessageSendEvent_SendChannelRangeQuery: return 32;
4171                 case LDKMessageSendEvent_SendShortIdsQuery: return 33;
4172                 case LDKMessageSendEvent_SendReplyChannelRange: return 34;
4173                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 35;
4174                 default: abort();
4175         }
4176 }
4177 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
4178         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4179         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4180         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4181         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
4182         return node_id_arr;
4183 }
4184 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
4185         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4186         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4187         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
4188                         uint64_t msg_ref = 0;
4189                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4190                         msg_ref = tag_ptr(msg_var.inner, false);
4191         return msg_ref;
4192 }
4193 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(uint64_t ptr) {
4194         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4195         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4196         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4197         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
4198         return node_id_arr;
4199 }
4200 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(uint64_t ptr) {
4201         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4202         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4203         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
4204                         uint64_t msg_ref = 0;
4205                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4206                         msg_ref = tag_ptr(msg_var.inner, false);
4207         return msg_ref;
4208 }
4209 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
4210         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4211         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4212         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4213         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
4214         return node_id_arr;
4215 }
4216 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
4217         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4218         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4219         LDKOpenChannel msg_var = obj->send_open_channel.msg;
4220                         uint64_t msg_ref = 0;
4221                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4222                         msg_ref = tag_ptr(msg_var.inner, false);
4223         return msg_ref;
4224 }
4225 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(uint64_t ptr) {
4226         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4227         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4228         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4229         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
4230         return node_id_arr;
4231 }
4232 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg(uint64_t ptr) {
4233         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4234         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4235         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
4236                         uint64_t msg_ref = 0;
4237                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4238                         msg_ref = tag_ptr(msg_var.inner, false);
4239         return msg_ref;
4240 }
4241 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
4242         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4243         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4244         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4245         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
4246         return node_id_arr;
4247 }
4248 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
4249         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4250         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4251         LDKFundingCreated msg_var = obj->send_funding_created.msg;
4252                         uint64_t msg_ref = 0;
4253                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4254                         msg_ref = tag_ptr(msg_var.inner, false);
4255         return msg_ref;
4256 }
4257 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
4258         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4259         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4260         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4261         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
4262         return node_id_arr;
4263 }
4264 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
4265         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4266         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4267         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
4268                         uint64_t msg_ref = 0;
4269                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4270                         msg_ref = tag_ptr(msg_var.inner, false);
4271         return msg_ref;
4272 }
4273 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendStfu_get_node_id"))) TS_LDKMessageSendEvent_SendStfu_get_node_id(uint64_t ptr) {
4274         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4275         assert(obj->tag == LDKMessageSendEvent_SendStfu);
4276         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4277         memcpy(node_id_arr->elems, obj->send_stfu.node_id.compressed_form, 33);
4278         return node_id_arr;
4279 }
4280 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendStfu_get_msg"))) TS_LDKMessageSendEvent_SendStfu_get_msg(uint64_t ptr) {
4281         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4282         assert(obj->tag == LDKMessageSendEvent_SendStfu);
4283         LDKStfu msg_var = obj->send_stfu.msg;
4284                         uint64_t msg_ref = 0;
4285                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4286                         msg_ref = tag_ptr(msg_var.inner, false);
4287         return msg_ref;
4288 }
4289 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSplice_get_node_id"))) TS_LDKMessageSendEvent_SendSplice_get_node_id(uint64_t ptr) {
4290         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4291         assert(obj->tag == LDKMessageSendEvent_SendSplice);
4292         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4293         memcpy(node_id_arr->elems, obj->send_splice.node_id.compressed_form, 33);
4294         return node_id_arr;
4295 }
4296 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSplice_get_msg"))) TS_LDKMessageSendEvent_SendSplice_get_msg(uint64_t ptr) {
4297         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4298         assert(obj->tag == LDKMessageSendEvent_SendSplice);
4299         LDKSplice msg_var = obj->send_splice.msg;
4300                         uint64_t msg_ref = 0;
4301                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4302                         msg_ref = tag_ptr(msg_var.inner, false);
4303         return msg_ref;
4304 }
4305 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceAck_get_node_id"))) TS_LDKMessageSendEvent_SendSpliceAck_get_node_id(uint64_t ptr) {
4306         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4307         assert(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4308         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4309         memcpy(node_id_arr->elems, obj->send_splice_ack.node_id.compressed_form, 33);
4310         return node_id_arr;
4311 }
4312 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceAck_get_msg"))) TS_LDKMessageSendEvent_SendSpliceAck_get_msg(uint64_t ptr) {
4313         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4314         assert(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4315         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
4316                         uint64_t msg_ref = 0;
4317                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4318                         msg_ref = tag_ptr(msg_var.inner, false);
4319         return msg_ref;
4320 }
4321 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceLocked_get_node_id"))) TS_LDKMessageSendEvent_SendSpliceLocked_get_node_id(uint64_t ptr) {
4322         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4323         assert(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
4324         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4325         memcpy(node_id_arr->elems, obj->send_splice_locked.node_id.compressed_form, 33);
4326         return node_id_arr;
4327 }
4328 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceLocked_get_msg"))) TS_LDKMessageSendEvent_SendSpliceLocked_get_msg(uint64_t ptr) {
4329         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4330         assert(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
4331         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
4332                         uint64_t msg_ref = 0;
4333                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4334                         msg_ref = tag_ptr(msg_var.inner, false);
4335         return msg_ref;
4336 }
4337 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddInput_get_node_id(uint64_t ptr) {
4338         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4339         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4340         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4341         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
4342         return node_id_arr;
4343 }
4344 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddInput_get_msg(uint64_t ptr) {
4345         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4346         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4347         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
4348                         uint64_t msg_ref = 0;
4349                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4350                         msg_ref = tag_ptr(msg_var.inner, false);
4351         return msg_ref;
4352 }
4353 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id(uint64_t ptr) {
4354         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4355         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4356         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4357         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
4358         return node_id_arr;
4359 }
4360 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_msg(uint64_t ptr) {
4361         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4362         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4363         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
4364                         uint64_t msg_ref = 0;
4365                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4366                         msg_ref = tag_ptr(msg_var.inner, false);
4367         return msg_ref;
4368 }
4369 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(uint64_t ptr) {
4370         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4371         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4372         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4373         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
4374         return node_id_arr;
4375 }
4376 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg(uint64_t ptr) {
4377         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4378         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4379         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
4380                         uint64_t msg_ref = 0;
4381                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4382                         msg_ref = tag_ptr(msg_var.inner, false);
4383         return msg_ref;
4384 }
4385 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(uint64_t ptr) {
4386         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4387         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4388         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4389         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
4390         return node_id_arr;
4391 }
4392 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(uint64_t ptr) {
4393         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4394         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4395         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
4396                         uint64_t msg_ref = 0;
4397                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4398                         msg_ref = tag_ptr(msg_var.inner, false);
4399         return msg_ref;
4400 }
4401 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_node_id"))) TS_LDKMessageSendEvent_SendTxComplete_get_node_id(uint64_t ptr) {
4402         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4403         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
4404         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4405         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
4406         return node_id_arr;
4407 }
4408 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_msg"))) TS_LDKMessageSendEvent_SendTxComplete_get_msg(uint64_t ptr) {
4409         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4410         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
4411         LDKTxComplete msg_var = obj->send_tx_complete.msg;
4412                         uint64_t msg_ref = 0;
4413                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4414                         msg_ref = tag_ptr(msg_var.inner, false);
4415         return msg_ref;
4416 }
4417 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendTxSignatures_get_node_id(uint64_t ptr) {
4418         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4419         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4420         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4421         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
4422         return node_id_arr;
4423 }
4424 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_msg"))) TS_LDKMessageSendEvent_SendTxSignatures_get_msg(uint64_t ptr) {
4425         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4426         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4427         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
4428                         uint64_t msg_ref = 0;
4429                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4430                         msg_ref = tag_ptr(msg_var.inner, false);
4431         return msg_ref;
4432 }
4433 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id(uint64_t ptr) {
4434         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4435         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4436         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4437         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
4438         return node_id_arr;
4439 }
4440 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_msg(uint64_t ptr) {
4441         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4442         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4443         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
4444                         uint64_t msg_ref = 0;
4445                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4446                         msg_ref = tag_ptr(msg_var.inner, false);
4447         return msg_ref;
4448 }
4449 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id(uint64_t ptr) {
4450         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4451         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4452         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4453         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
4454         return node_id_arr;
4455 }
4456 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_msg(uint64_t ptr) {
4457         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4458         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4459         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
4460                         uint64_t msg_ref = 0;
4461                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4462                         msg_ref = tag_ptr(msg_var.inner, false);
4463         return msg_ref;
4464 }
4465 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_node_id"))) TS_LDKMessageSendEvent_SendTxAbort_get_node_id(uint64_t ptr) {
4466         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4467         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4468         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4469         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
4470         return node_id_arr;
4471 }
4472 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_msg"))) TS_LDKMessageSendEvent_SendTxAbort_get_msg(uint64_t ptr) {
4473         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4474         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4475         LDKTxAbort msg_var = obj->send_tx_abort.msg;
4476                         uint64_t msg_ref = 0;
4477                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4478                         msg_ref = tag_ptr(msg_var.inner, false);
4479         return msg_ref;
4480 }
4481 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
4482         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4483         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4484         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4485         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
4486         return node_id_arr;
4487 }
4488 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
4489         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4490         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4491         LDKChannelReady msg_var = obj->send_channel_ready.msg;
4492                         uint64_t msg_ref = 0;
4493                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4494                         msg_ref = tag_ptr(msg_var.inner, false);
4495         return msg_ref;
4496 }
4497 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
4498         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4499         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4500         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4501         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
4502         return node_id_arr;
4503 }
4504 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
4505         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4506         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4507         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
4508                         uint64_t msg_ref = 0;
4509                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4510                         msg_ref = tag_ptr(msg_var.inner, false);
4511         return msg_ref;
4512 }
4513 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
4514         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4515         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4516         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4517         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
4518         return node_id_arr;
4519 }
4520 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
4521         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4522         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4523         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
4524                         uint64_t updates_ref = 0;
4525                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
4526                         updates_ref = tag_ptr(updates_var.inner, false);
4527         return updates_ref;
4528 }
4529 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
4530         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4531         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4532         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4533         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
4534         return node_id_arr;
4535 }
4536 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
4537         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4538         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4539         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
4540                         uint64_t msg_ref = 0;
4541                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4542                         msg_ref = tag_ptr(msg_var.inner, false);
4543         return msg_ref;
4544 }
4545 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
4546         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4547         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4548         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4549         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
4550         return node_id_arr;
4551 }
4552 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
4553         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4554         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4555         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
4556                         uint64_t msg_ref = 0;
4557                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4558                         msg_ref = tag_ptr(msg_var.inner, false);
4559         return msg_ref;
4560 }
4561 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
4562         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4563         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4564         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4565         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
4566         return node_id_arr;
4567 }
4568 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
4569         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4570         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4571         LDKShutdown msg_var = obj->send_shutdown.msg;
4572                         uint64_t msg_ref = 0;
4573                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4574                         msg_ref = tag_ptr(msg_var.inner, false);
4575         return msg_ref;
4576 }
4577 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
4578         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4579         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4580         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4581         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
4582         return node_id_arr;
4583 }
4584 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
4585         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4586         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4587         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
4588                         uint64_t msg_ref = 0;
4589                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4590                         msg_ref = tag_ptr(msg_var.inner, false);
4591         return msg_ref;
4592 }
4593 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
4594         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4595         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4596         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4597         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
4598         return node_id_arr;
4599 }
4600 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
4601         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4602         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4603         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
4604                         uint64_t msg_ref = 0;
4605                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4606                         msg_ref = tag_ptr(msg_var.inner, false);
4607         return msg_ref;
4608 }
4609 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
4610         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4611         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4612         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
4613                         uint64_t update_msg_ref = 0;
4614                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4615                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4616         return update_msg_ref;
4617 }
4618 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
4619         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4620         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4621         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
4622                         uint64_t msg_ref = 0;
4623                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4624                         msg_ref = tag_ptr(msg_var.inner, false);
4625         return msg_ref;
4626 }
4627 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
4628         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4629         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4630         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
4631                         uint64_t update_msg_ref = 0;
4632                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4633                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4634         return update_msg_ref;
4635 }
4636 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
4637         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4638         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
4639         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
4640                         uint64_t msg_ref = 0;
4641                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4642                         msg_ref = tag_ptr(msg_var.inner, false);
4643         return msg_ref;
4644 }
4645 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
4646         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4647         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
4648         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
4649                         uint64_t msg_ref = 0;
4650                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4651                         msg_ref = tag_ptr(msg_var.inner, false);
4652         return msg_ref;
4653 }
4654 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
4655         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4656         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4657         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4658         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
4659         return node_id_arr;
4660 }
4661 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
4662         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4663         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4664         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
4665                         uint64_t msg_ref = 0;
4666                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4667                         msg_ref = tag_ptr(msg_var.inner, false);
4668         return msg_ref;
4669 }
4670 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
4671         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4672         assert(obj->tag == LDKMessageSendEvent_HandleError);
4673         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4674         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
4675         return node_id_arr;
4676 }
4677 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
4678         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4679         assert(obj->tag == LDKMessageSendEvent_HandleError);
4680         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
4681         return action_ref;
4682 }
4683 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
4684         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4685         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4686         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4687         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
4688         return node_id_arr;
4689 }
4690 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
4691         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4692         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4693         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
4694                         uint64_t msg_ref = 0;
4695                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4696                         msg_ref = tag_ptr(msg_var.inner, false);
4697         return msg_ref;
4698 }
4699 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
4700         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4701         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4702         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4703         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
4704         return node_id_arr;
4705 }
4706 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
4707         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4708         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4709         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
4710                         uint64_t msg_ref = 0;
4711                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4712                         msg_ref = tag_ptr(msg_var.inner, false);
4713         return msg_ref;
4714 }
4715 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
4716         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4717         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4718         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4719         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
4720         return node_id_arr;
4721 }
4722 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
4723         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4724         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4725         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
4726                         uint64_t msg_ref = 0;
4727                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4728                         msg_ref = tag_ptr(msg_var.inner, false);
4729         return msg_ref;
4730 }
4731 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
4732         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4733         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4734         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4735         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
4736         return node_id_arr;
4737 }
4738 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
4739         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4740         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4741         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
4742                         uint64_t msg_ref = 0;
4743                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4744                         msg_ref = tag_ptr(msg_var.inner, false);
4745         return msg_ref;
4746 }
4747 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
4748         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
4749         for (size_t i = 0; i < ret.datalen; i++) {
4750                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
4751         }
4752         return ret;
4753 }
4754 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4755         LDKChannelUpdateInfo ret = *owner->contents.result;
4756         ret.is_owned = false;
4757         return ret;
4758 }
4759 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
4760         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4761         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4762         uint64_t ret_ref = 0;
4763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4765         return ret_ref;
4766 }
4767
4768 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4769 CHECK(!owner->result_ok);
4770         return DecodeError_clone(&*owner->contents.err);
4771 }
4772 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
4773         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4774         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4775         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4776         uint64_t ret_ref = tag_ptr(ret_copy, true);
4777         return ret_ref;
4778 }
4779
4780 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4781         LDKChannelInfo ret = *owner->contents.result;
4782         ret.is_owned = false;
4783         return ret;
4784 }
4785 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
4786         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4787         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4788         uint64_t ret_ref = 0;
4789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4791         return ret_ref;
4792 }
4793
4794 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4795 CHECK(!owner->result_ok);
4796         return DecodeError_clone(&*owner->contents.err);
4797 }
4798 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
4799         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4800         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4801         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4802         uint64_t ret_ref = tag_ptr(ret_copy, true);
4803         return ret_ref;
4804 }
4805
4806 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4807         LDKRoutingFees ret = *owner->contents.result;
4808         ret.is_owned = false;
4809         return ret;
4810 }
4811 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
4812         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4813         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4814         uint64_t ret_ref = 0;
4815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4817         return ret_ref;
4818 }
4819
4820 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4821 CHECK(!owner->result_ok);
4822         return DecodeError_clone(&*owner->contents.err);
4823 }
4824 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
4825         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4826         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4827         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4828         uint64_t ret_ref = tag_ptr(ret_copy, true);
4829         return ret_ref;
4830 }
4831
4832 uint32_t __attribute__((export_name("TS_LDKSocketAddress_ty_from_ptr"))) TS_LDKSocketAddress_ty_from_ptr(uint64_t ptr) {
4833         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4834         switch(obj->tag) {
4835                 case LDKSocketAddress_TcpIpV4: return 0;
4836                 case LDKSocketAddress_TcpIpV6: return 1;
4837                 case LDKSocketAddress_OnionV2: return 2;
4838                 case LDKSocketAddress_OnionV3: return 3;
4839                 case LDKSocketAddress_Hostname: return 4;
4840                 default: abort();
4841         }
4842 }
4843 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_addr"))) TS_LDKSocketAddress_TcpIpV4_get_addr(uint64_t ptr) {
4844         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4845         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4846         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
4847         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
4848         return addr_arr;
4849 }
4850 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_port"))) TS_LDKSocketAddress_TcpIpV4_get_port(uint64_t ptr) {
4851         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4852         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4853         int16_t port_conv = obj->tcp_ip_v4.port;
4854         return port_conv;
4855 }
4856 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_addr"))) TS_LDKSocketAddress_TcpIpV6_get_addr(uint64_t ptr) {
4857         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4858         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4859         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
4860         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
4861         return addr_arr;
4862 }
4863 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_port"))) TS_LDKSocketAddress_TcpIpV6_get_port(uint64_t ptr) {
4864         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4865         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4866         int16_t port_conv = obj->tcp_ip_v6.port;
4867         return port_conv;
4868 }
4869 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV2_get_onion_v2"))) TS_LDKSocketAddress_OnionV2_get_onion_v2(uint64_t ptr) {
4870         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4871         assert(obj->tag == LDKSocketAddress_OnionV2);
4872         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
4873         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
4874         return onion_v2_arr;
4875 }
4876 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
4877         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4878         assert(obj->tag == LDKSocketAddress_OnionV3);
4879         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
4880         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
4881         return ed25519_pubkey_arr;
4882 }
4883 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_checksum"))) TS_LDKSocketAddress_OnionV3_get_checksum(uint64_t ptr) {
4884         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4885         assert(obj->tag == LDKSocketAddress_OnionV3);
4886         int16_t checksum_conv = obj->onion_v3.checksum;
4887         return checksum_conv;
4888 }
4889 int8_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_version"))) TS_LDKSocketAddress_OnionV3_get_version(uint64_t ptr) {
4890         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4891         assert(obj->tag == LDKSocketAddress_OnionV3);
4892         int8_t version_conv = obj->onion_v3.version;
4893         return version_conv;
4894 }
4895 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_port"))) TS_LDKSocketAddress_OnionV3_get_port(uint64_t ptr) {
4896         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4897         assert(obj->tag == LDKSocketAddress_OnionV3);
4898         int16_t port_conv = obj->onion_v3.port;
4899         return port_conv;
4900 }
4901 uint64_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_hostname"))) TS_LDKSocketAddress_Hostname_get_hostname(uint64_t ptr) {
4902         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4903         assert(obj->tag == LDKSocketAddress_Hostname);
4904         LDKHostname hostname_var = obj->hostname.hostname;
4905                         uint64_t hostname_ref = 0;
4906                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4907                         hostname_ref = tag_ptr(hostname_var.inner, false);
4908         return hostname_ref;
4909 }
4910 int16_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_port"))) TS_LDKSocketAddress_Hostname_get_port(uint64_t ptr) {
4911         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4912         assert(obj->tag == LDKSocketAddress_Hostname);
4913         int16_t port_conv = obj->hostname.port;
4914         return port_conv;
4915 }
4916 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
4917         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
4918         for (size_t i = 0; i < ret.datalen; i++) {
4919                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
4920         }
4921         return ret;
4922 }
4923 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4924         LDKNodeAnnouncementInfo ret = *owner->contents.result;
4925         ret.is_owned = false;
4926         return ret;
4927 }
4928 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
4929         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4930         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4931         uint64_t ret_ref = 0;
4932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4934         return ret_ref;
4935 }
4936
4937 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4938 CHECK(!owner->result_ok);
4939         return DecodeError_clone(&*owner->contents.err);
4940 }
4941 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
4942         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4943         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4944         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4945         uint64_t ret_ref = tag_ptr(ret_copy, true);
4946         return ret_ref;
4947 }
4948
4949 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4950         LDKNodeAlias ret = *owner->contents.result;
4951         ret.is_owned = false;
4952         return ret;
4953 }
4954 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
4955         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4956         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4957         uint64_t ret_ref = 0;
4958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4960         return ret_ref;
4961 }
4962
4963 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4964 CHECK(!owner->result_ok);
4965         return DecodeError_clone(&*owner->contents.err);
4966 }
4967 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
4968         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4969         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4970         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4971         uint64_t ret_ref = tag_ptr(ret_copy, true);
4972         return ret_ref;
4973 }
4974
4975 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4976         LDKNodeInfo ret = *owner->contents.result;
4977         ret.is_owned = false;
4978         return ret;
4979 }
4980 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
4981         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4982         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4983         uint64_t ret_ref = 0;
4984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4986         return ret_ref;
4987 }
4988
4989 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4990 CHECK(!owner->result_ok);
4991         return DecodeError_clone(&*owner->contents.err);
4992 }
4993 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
4994         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4995         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4996         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4997         uint64_t ret_ref = tag_ptr(ret_copy, true);
4998         return ret_ref;
4999 }
5000
5001 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5002         LDKNetworkGraph ret = *owner->contents.result;
5003         ret.is_owned = false;
5004         return ret;
5005 }
5006 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
5007         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5008         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
5009         uint64_t ret_ref = 0;
5010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5012         return ret_ref;
5013 }
5014
5015 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5016 CHECK(!owner->result_ok);
5017         return DecodeError_clone(&*owner->contents.err);
5018 }
5019 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
5020         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5021         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5022         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
5023         uint64_t ret_ref = tag_ptr(ret_copy, true);
5024         return ret_ref;
5025 }
5026
5027 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(uint64_t ptr) {
5028         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5029         switch(obj->tag) {
5030                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
5031                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
5032                 default: abort();
5033         }
5034 }
5035 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some(uint64_t ptr) {
5036         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5037         assert(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
5038         LDKCVec_SocketAddressZ some_var = obj->some;
5039                         uint64_tArray some_arr = NULL;
5040                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
5041                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
5042                         for (size_t p = 0; p < some_var.datalen; p++) {
5043                                 uint64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
5044                                 some_arr_ptr[p] = some_conv_15_ref;
5045                         }
5046                         
5047         return some_arr;
5048 }
5049 static inline uint64_t CResult_u64ShortChannelIdErrorZ_get_ok(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
5050 CHECK(owner->result_ok);
5051         return *owner->contents.result;
5052 }
5053 int64_t  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_get_ok"))) TS_CResult_u64ShortChannelIdErrorZ_get_ok(uint64_t owner) {
5054         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
5055         int64_t ret_conv = CResult_u64ShortChannelIdErrorZ_get_ok(owner_conv);
5056         return ret_conv;
5057 }
5058
5059 static inline enum LDKShortChannelIdError CResult_u64ShortChannelIdErrorZ_get_err(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
5060 CHECK(!owner->result_ok);
5061         return ShortChannelIdError_clone(&*owner->contents.err);
5062 }
5063 uint32_t  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_get_err"))) TS_CResult_u64ShortChannelIdErrorZ_get_err(uint64_t owner) {
5064         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
5065         uint32_t ret_conv = LDKShortChannelIdError_to_js(CResult_u64ShortChannelIdErrorZ_get_err(owner_conv));
5066         return ret_conv;
5067 }
5068
5069 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5070         LDKPendingHTLCInfo ret = *owner->contents.result;
5071         ret.is_owned = false;
5072         return ret;
5073 }
5074 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(uint64_t owner) {
5075         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5076         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
5077         uint64_t ret_ref = 0;
5078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5080         return ret_ref;
5081 }
5082
5083 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5084         LDKInboundHTLCErr ret = *owner->contents.err;
5085         ret.is_owned = false;
5086         return ret;
5087 }
5088 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(uint64_t owner) {
5089         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5090         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
5091         uint64_t ret_ref = 0;
5092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5094         return ret_ref;
5095 }
5096
5097 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
5098         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
5099         for (size_t i = 0; i < ret.datalen; i++) {
5100                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
5101         }
5102         return ret;
5103 }
5104 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
5105         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
5106         for (size_t i = 0; i < ret.datalen; i++) {
5107                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
5108         }
5109         return ret;
5110 }
5111 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
5112         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
5113         for (size_t i = 0; i < ret.datalen; i++) {
5114                 ret.data[i] = Utxo_clone(&orig->data[i]);
5115         }
5116         return ret;
5117 }
5118 uint32_t __attribute__((export_name("TS_LDKCOption_TxOutZ_ty_from_ptr"))) TS_LDKCOption_TxOutZ_ty_from_ptr(uint64_t ptr) {
5119         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5120         switch(obj->tag) {
5121                 case LDKCOption_TxOutZ_Some: return 0;
5122                 case LDKCOption_TxOutZ_None: return 1;
5123                 default: abort();
5124         }
5125 }
5126 uint64_t __attribute__((export_name("TS_LDKCOption_TxOutZ_Some_get_some"))) TS_LDKCOption_TxOutZ_Some_get_some(uint64_t ptr) {
5127         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5128         assert(obj->tag == LDKCOption_TxOutZ_Some);
5129         LDKTxOut* some_ref = &obj->some;
5130         return tag_ptr(some_ref, false);
5131 }
5132 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
5133         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
5134         for (size_t i = 0; i < ret.datalen; i++) {
5135                 ret.data[i] = Input_clone(&orig->data[i]);
5136         }
5137         return ret;
5138 }
5139 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5140         LDKCoinSelection ret = *owner->contents.result;
5141         ret.is_owned = false;
5142         return ret;
5143 }
5144 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_ok"))) TS_CResult_CoinSelectionNoneZ_get_ok(uint64_t owner) {
5145         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5146         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
5147         uint64_t ret_ref = 0;
5148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5150         return ret_ref;
5151 }
5152
5153 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5154 CHECK(!owner->result_ok);
5155         return *owner->contents.err;
5156 }
5157 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_err"))) TS_CResult_CoinSelectionNoneZ_get_err(uint64_t owner) {
5158         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5159         CResult_CoinSelectionNoneZ_get_err(owner_conv);
5160 }
5161
5162 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5163 CHECK(owner->result_ok);
5164         return CVec_UtxoZ_clone(&*owner->contents.result);
5165 }
5166 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_ok"))) TS_CResult_CVec_UtxoZNoneZ_get_ok(uint64_t owner) {
5167         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5168         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
5169         uint64_tArray ret_arr = NULL;
5170         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5171         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5172         for (size_t g = 0; g < ret_var.datalen; g++) {
5173                 LDKUtxo ret_conv_6_var = ret_var.data[g];
5174                 uint64_t ret_conv_6_ref = 0;
5175                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
5176                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
5177                 ret_arr_ptr[g] = ret_conv_6_ref;
5178         }
5179         
5180         FREE(ret_var.data);
5181         return ret_arr;
5182 }
5183
5184 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5185 CHECK(!owner->result_ok);
5186         return *owner->contents.err;
5187 }
5188 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_err"))) TS_CResult_CVec_UtxoZNoneZ_get_err(uint64_t owner) {
5189         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5190         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
5191 }
5192
5193 uint32_t __attribute__((export_name("TS_LDKPaymentContext_ty_from_ptr"))) TS_LDKPaymentContext_ty_from_ptr(uint64_t ptr) {
5194         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5195         switch(obj->tag) {
5196                 case LDKPaymentContext_Unknown: return 0;
5197                 case LDKPaymentContext_Bolt12Offer: return 1;
5198                 case LDKPaymentContext_Bolt12Refund: return 2;
5199                 default: abort();
5200         }
5201 }
5202 uint64_t __attribute__((export_name("TS_LDKPaymentContext_Unknown_get_unknown"))) TS_LDKPaymentContext_Unknown_get_unknown(uint64_t ptr) {
5203         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5204         assert(obj->tag == LDKPaymentContext_Unknown);
5205         LDKUnknownPaymentContext unknown_var = obj->unknown;
5206                         uint64_t unknown_ref = 0;
5207                         CHECK_INNER_FIELD_ACCESS_OR_NULL(unknown_var);
5208                         unknown_ref = tag_ptr(unknown_var.inner, false);
5209         return unknown_ref;
5210 }
5211 uint64_t __attribute__((export_name("TS_LDKPaymentContext_Bolt12Offer_get_bolt12_offer"))) TS_LDKPaymentContext_Bolt12Offer_get_bolt12_offer(uint64_t ptr) {
5212         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5213         assert(obj->tag == LDKPaymentContext_Bolt12Offer);
5214         LDKBolt12OfferContext bolt12_offer_var = obj->bolt12_offer;
5215                         uint64_t bolt12_offer_ref = 0;
5216                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_offer_var);
5217                         bolt12_offer_ref = tag_ptr(bolt12_offer_var.inner, false);
5218         return bolt12_offer_ref;
5219 }
5220 uint64_t __attribute__((export_name("TS_LDKPaymentContext_Bolt12Refund_get_bolt12_refund"))) TS_LDKPaymentContext_Bolt12Refund_get_bolt12_refund(uint64_t ptr) {
5221         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5222         assert(obj->tag == LDKPaymentContext_Bolt12Refund);
5223         LDKBolt12RefundContext bolt12_refund_var = obj->bolt12_refund;
5224                         uint64_t bolt12_refund_ref = 0;
5225                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_refund_var);
5226                         bolt12_refund_ref = tag_ptr(bolt12_refund_var.inner, false);
5227         return bolt12_refund_ref;
5228 }
5229 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentContextZ_ty_from_ptr"))) TS_LDKCOption_PaymentContextZ_ty_from_ptr(uint64_t ptr) {
5230         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
5231         switch(obj->tag) {
5232                 case LDKCOption_PaymentContextZ_Some: return 0;
5233                 case LDKCOption_PaymentContextZ_None: return 1;
5234                 default: abort();
5235         }
5236 }
5237 uint64_t __attribute__((export_name("TS_LDKCOption_PaymentContextZ_Some_get_some"))) TS_LDKCOption_PaymentContextZ_Some_get_some(uint64_t ptr) {
5238         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
5239         assert(obj->tag == LDKCOption_PaymentContextZ_Some);
5240         uint64_t some_ref = tag_ptr(&obj->some, false);
5241         return some_ref;
5242 }
5243 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5244         return owner->a;
5245 }
5246 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_a"))) TS_C2Tuple_u64u16Z_get_a(uint64_t owner) {
5247         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5248         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
5249         return ret_conv;
5250 }
5251
5252 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5253         return owner->b;
5254 }
5255 int16_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_b"))) TS_C2Tuple_u64u16Z_get_b(uint64_t owner) {
5256         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5257         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
5258         return ret_conv;
5259 }
5260
5261 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(uint64_t ptr) {
5262         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5263         switch(obj->tag) {
5264                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
5265                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
5266                 default: abort();
5267         }
5268 }
5269 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(uint64_t ptr) {
5270         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5271         assert(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
5272         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
5273         *some_conv = obj->some;
5274                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
5275         return tag_ptr(some_conv, true);
5276 }
5277 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr"))) TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(uint64_t ptr) {
5278         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5279         switch(obj->tag) {
5280                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
5281                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
5282                 default: abort();
5283         }
5284 }
5285 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_Some_get_some"))) TS_LDKCOption_ChannelShutdownStateZ_Some_get_some(uint64_t ptr) {
5286         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5287         assert(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
5288         uint32_t some_conv = LDKChannelShutdownState_to_js(obj->some);
5289         return some_conv;
5290 }
5291 static inline struct LDKChannelId CResult_ChannelIdAPIErrorZ_get_ok(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
5292         LDKChannelId ret = *owner->contents.result;
5293         ret.is_owned = false;
5294         return ret;
5295 }
5296 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_get_ok"))) TS_CResult_ChannelIdAPIErrorZ_get_ok(uint64_t owner) {
5297         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
5298         LDKChannelId ret_var = CResult_ChannelIdAPIErrorZ_get_ok(owner_conv);
5299         uint64_t ret_ref = 0;
5300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5302         return ret_ref;
5303 }
5304
5305 static inline struct LDKAPIError CResult_ChannelIdAPIErrorZ_get_err(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
5306 CHECK(!owner->result_ok);
5307         return APIError_clone(&*owner->contents.err);
5308 }
5309 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_get_err"))) TS_CResult_ChannelIdAPIErrorZ_get_err(uint64_t owner) {
5310         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
5311         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5312         *ret_copy = CResult_ChannelIdAPIErrorZ_get_err(owner_conv);
5313         uint64_t ret_ref = tag_ptr(ret_copy, true);
5314         return ret_ref;
5315 }
5316
5317 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
5318         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5319         switch(obj->tag) {
5320                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
5321                 case LDKRecentPaymentDetails_Pending: return 1;
5322                 case LDKRecentPaymentDetails_Fulfilled: return 2;
5323                 case LDKRecentPaymentDetails_Abandoned: return 3;
5324                 default: abort();
5325         }
5326 }
5327 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id"))) TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(uint64_t ptr) {
5328         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5329         assert(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
5330         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5331         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
5332         return payment_id_arr;
5333 }
5334 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_id"))) TS_LDKRecentPaymentDetails_Pending_get_payment_id(uint64_t ptr) {
5335         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5336         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5337         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5338         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
5339         return payment_id_arr;
5340 }
5341 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
5342         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5343         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5344         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5345         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
5346         return payment_hash_arr;
5347 }
5348 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
5349         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5350         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5351         int64_t total_msat_conv = obj->pending.total_msat;
5352         return total_msat_conv;
5353 }
5354 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id(uint64_t ptr) {
5355         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5356         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5357         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5358         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
5359         return payment_id_arr;
5360 }
5361 uint64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
5362         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5363         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5364         uint64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
5365         return payment_hash_ref;
5366 }
5367 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_id"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_id(uint64_t ptr) {
5368         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5369         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
5370         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5371         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
5372         return payment_id_arr;
5373 }
5374 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
5375         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5376         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
5377         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5378         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
5379         return payment_hash_arr;
5380 }
5381 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
5382         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
5383         for (size_t i = 0; i < ret.datalen; i++) {
5384                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
5385         }
5386         return ret;
5387 }
5388 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
5389         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5390         switch(obj->tag) {
5391                 case LDKPaymentSendFailure_ParameterError: return 0;
5392                 case LDKPaymentSendFailure_PathParameterError: return 1;
5393                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
5394                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
5395                 case LDKPaymentSendFailure_PartialFailure: return 4;
5396                 default: abort();
5397         }
5398 }
5399 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
5400         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5401         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
5402         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
5403         return parameter_error_ref;
5404 }
5405 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
5406         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5407         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
5408         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5409                         uint64_tArray path_parameter_error_arr = NULL;
5410                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
5411                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
5412                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5413                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5414                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5415                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5416                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
5417                         }
5418                         
5419         return path_parameter_error_arr;
5420 }
5421 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
5422         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5423         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
5424         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
5425                         uint64_tArray all_failed_resend_safe_arr = NULL;
5426                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
5427                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
5428                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
5429                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
5430                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
5431                         }
5432                         
5433         return all_failed_resend_safe_arr;
5434 }
5435 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
5436         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5437         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5438         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5439                         uint64_tArray results_arr = NULL;
5440                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
5441                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
5442                         for (size_t w = 0; w < results_var.datalen; w++) {
5443                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5444                                 *results_conv_22_conv = results_var.data[w];
5445                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5446                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
5447                         }
5448                         
5449         return results_arr;
5450 }
5451 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
5452         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5453         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5454         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5455                         uint64_t failed_paths_retry_ref = 0;
5456                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5457                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
5458         return failed_paths_retry_ref;
5459 }
5460 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
5461         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5462         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5463         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5464         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
5465         return payment_id_arr;
5466 }
5467 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5468 CHECK(owner->result_ok);
5469         return *owner->contents.result;
5470 }
5471 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
5472         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5473         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5474 }
5475
5476 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5477 CHECK(!owner->result_ok);
5478         return PaymentSendFailure_clone(&*owner->contents.err);
5479 }
5480 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
5481         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5482         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5483         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5484         uint64_t ret_ref = tag_ptr(ret_copy, true);
5485         return ret_ref;
5486 }
5487
5488 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5489 CHECK(owner->result_ok);
5490         return *owner->contents.result;
5491 }
5492 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
5493         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5494         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
5495 }
5496
5497 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5498 CHECK(!owner->result_ok);
5499         return RetryableSendFailure_clone(&*owner->contents.err);
5500 }
5501 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
5502         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5503         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
5504         return ret_conv;
5505 }
5506
5507 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5508 CHECK(owner->result_ok);
5509         return ThirtyTwoBytes_clone(&*owner->contents.result);
5510 }
5511 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(uint64_t owner) {
5512         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5513         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5514         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
5515         return ret_arr;
5516 }
5517
5518 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5519 CHECK(!owner->result_ok);
5520         return PaymentSendFailure_clone(&*owner->contents.err);
5521 }
5522 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(uint64_t owner) {
5523         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5524         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5525         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
5526         uint64_t ret_ref = tag_ptr(ret_copy, true);
5527         return ret_ref;
5528 }
5529
5530 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5531 CHECK(owner->result_ok);
5532         return ThirtyTwoBytes_clone(&*owner->contents.result);
5533 }
5534 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(uint64_t owner) {
5535         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5536         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5537         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
5538         return ret_arr;
5539 }
5540
5541 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5542 CHECK(!owner->result_ok);
5543         return RetryableSendFailure_clone(&*owner->contents.err);
5544 }
5545 uint32_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(uint64_t owner) {
5546         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5547         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
5548         return ret_conv;
5549 }
5550
5551 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5552         return ThirtyTwoBytes_clone(&owner->a);
5553 }
5554 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(uint64_t owner) {
5555         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5556         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5557         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
5558         return ret_arr;
5559 }
5560
5561 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5562         return ThirtyTwoBytes_clone(&owner->b);
5563 }
5564 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(uint64_t owner) {
5565         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5566         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5567         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
5568         return ret_arr;
5569 }
5570
5571 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5572 CHECK(owner->result_ok);
5573         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5574 }
5575 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(uint64_t owner) {
5576         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5577         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5578         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
5579         return tag_ptr(ret_conv, true);
5580 }
5581
5582 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5583 CHECK(!owner->result_ok);
5584         return PaymentSendFailure_clone(&*owner->contents.err);
5585 }
5586 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(uint64_t owner) {
5587         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5588         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5589         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
5590         uint64_t ret_ref = tag_ptr(ret_copy, true);
5591         return ret_ref;
5592 }
5593
5594 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
5595         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
5596         for (size_t i = 0; i < ret.datalen; i++) {
5597                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
5598         }
5599         return ret;
5600 }
5601 uint32_t __attribute__((export_name("TS_LDKProbeSendFailure_ty_from_ptr"))) TS_LDKProbeSendFailure_ty_from_ptr(uint64_t ptr) {
5602         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5603         switch(obj->tag) {
5604                 case LDKProbeSendFailure_RouteNotFound: return 0;
5605                 case LDKProbeSendFailure_SendingFailed: return 1;
5606                 default: abort();
5607         }
5608 }
5609 uint64_t __attribute__((export_name("TS_LDKProbeSendFailure_SendingFailed_get_sending_failed"))) TS_LDKProbeSendFailure_SendingFailed_get_sending_failed(uint64_t ptr) {
5610         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5611         assert(obj->tag == LDKProbeSendFailure_SendingFailed);
5612         uint64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
5613         return sending_failed_ref;
5614 }
5615 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5616 CHECK(owner->result_ok);
5617         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
5618 }
5619 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(uint64_t owner) {
5620         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5621         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
5622         uint64_tArray ret_arr = NULL;
5623         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5624         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5625         for (size_t o = 0; o < ret_var.datalen; o++) {
5626                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5627                 *ret_conv_40_conv = ret_var.data[o];
5628                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
5629         }
5630         
5631         FREE(ret_var.data);
5632         return ret_arr;
5633 }
5634
5635 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5636 CHECK(!owner->result_ok);
5637         return ProbeSendFailure_clone(&*owner->contents.err);
5638 }
5639 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(uint64_t owner) {
5640         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5641         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
5642         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
5643         uint64_t ret_ref = tag_ptr(ret_copy, true);
5644         return ret_ref;
5645 }
5646
5647 static inline struct LDKChannelId C2Tuple_ChannelIdPublicKeyZ_get_a(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
5648         LDKChannelId ret = owner->a;
5649         ret.is_owned = false;
5650         return ret;
5651 }
5652 uint64_t  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_get_a"))) TS_C2Tuple_ChannelIdPublicKeyZ_get_a(uint64_t owner) {
5653         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
5654         LDKChannelId ret_var = C2Tuple_ChannelIdPublicKeyZ_get_a(owner_conv);
5655         uint64_t ret_ref = 0;
5656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5658         return ret_ref;
5659 }
5660
5661 static inline struct LDKPublicKey C2Tuple_ChannelIdPublicKeyZ_get_b(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
5662         return owner->b;
5663 }
5664 int8_tArray  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_get_b"))) TS_C2Tuple_ChannelIdPublicKeyZ_get_b(uint64_t owner) {
5665         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
5666         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5667         memcpy(ret_arr->elems, C2Tuple_ChannelIdPublicKeyZ_get_b(owner_conv).compressed_form, 33);
5668         return ret_arr;
5669 }
5670
5671 static inline LDKCVec_C2Tuple_ChannelIdPublicKeyZZ CVec_C2Tuple_ChannelIdPublicKeyZZ_clone(const LDKCVec_C2Tuple_ChannelIdPublicKeyZZ *orig) {
5672         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5673         for (size_t i = 0; i < ret.datalen; i++) {
5674                 ret.data[i] = C2Tuple_ChannelIdPublicKeyZ_clone(&orig->data[i]);
5675         }
5676         return ret;
5677 }
5678 static inline LDKCVec_ChannelIdZ CVec_ChannelIdZ_clone(const LDKCVec_ChannelIdZ *orig) {
5679         LDKCVec_ChannelIdZ ret = { .data = MALLOC(sizeof(LDKChannelId) * orig->datalen, "LDKCVec_ChannelIdZ clone bytes"), .datalen = orig->datalen };
5680         for (size_t i = 0; i < ret.datalen; i++) {
5681                 ret.data[i] = ChannelId_clone(&orig->data[i]);
5682         }
5683         return ret;
5684 }
5685 static inline struct LDKOfferWithDerivedMetadataBuilder CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
5686         LDKOfferWithDerivedMetadataBuilder ret = *owner->contents.result;
5687         ret.is_owned = false;
5688         return ret;
5689 }
5690 uint64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
5691         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
5692         LDKOfferWithDerivedMetadataBuilder ret_var = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
5693         uint64_t ret_ref = 0;
5694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5696         return ret_ref;
5697 }
5698
5699 static inline enum LDKBolt12SemanticError CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
5700 CHECK(!owner->result_ok);
5701         return Bolt12SemanticError_clone(&*owner->contents.err);
5702 }
5703 uint32_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
5704         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
5705         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
5706         return ret_conv;
5707 }
5708
5709 uint32_t __attribute__((export_name("TS_LDKCOption_StrZ_ty_from_ptr"))) TS_LDKCOption_StrZ_ty_from_ptr(uint64_t ptr) {
5710         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5711         switch(obj->tag) {
5712                 case LDKCOption_StrZ_Some: return 0;
5713                 case LDKCOption_StrZ_None: return 1;
5714                 default: abort();
5715         }
5716 }
5717 jstring __attribute__((export_name("TS_LDKCOption_StrZ_Some_get_some"))) TS_LDKCOption_StrZ_Some_get_some(uint64_t ptr) {
5718         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5719         assert(obj->tag == LDKCOption_StrZ_Some);
5720         LDKStr some_str = obj->some;
5721                         jstring some_conv = str_ref_to_ts(some_str.chars, some_str.len);
5722         return some_conv;
5723 }
5724 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5725 CHECK(owner->result_ok);
5726         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5727 }
5728 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(uint64_t owner) {
5729         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5730         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5731         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
5732         return tag_ptr(ret_conv, true);
5733 }
5734
5735 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5736 CHECK(!owner->result_ok);
5737         return *owner->contents.err;
5738 }
5739 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(uint64_t owner) {
5740         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5741         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
5742 }
5743
5744 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
5745 CHECK(owner->result_ok);
5746         return ThirtyTwoBytes_clone(&*owner->contents.result);
5747 }
5748 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(uint64_t owner) {
5749         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
5750         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5751         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
5752         return ret_arr;
5753 }
5754
5755 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
5756 CHECK(!owner->result_ok);
5757         return APIError_clone(&*owner->contents.err);
5758 }
5759 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err(uint64_t owner) {
5760         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
5761         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5762         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
5763         uint64_t ret_ref = tag_ptr(ret_copy, true);
5764         return ret_ref;
5765 }
5766
5767 uint32_t __attribute__((export_name("TS_LDKOffersMessage_ty_from_ptr"))) TS_LDKOffersMessage_ty_from_ptr(uint64_t ptr) {
5768         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5769         switch(obj->tag) {
5770                 case LDKOffersMessage_InvoiceRequest: return 0;
5771                 case LDKOffersMessage_Invoice: return 1;
5772                 case LDKOffersMessage_InvoiceError: return 2;
5773                 default: abort();
5774         }
5775 }
5776 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceRequest_get_invoice_request"))) TS_LDKOffersMessage_InvoiceRequest_get_invoice_request(uint64_t ptr) {
5777         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5778         assert(obj->tag == LDKOffersMessage_InvoiceRequest);
5779         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
5780                         uint64_t invoice_request_ref = 0;
5781                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5782                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
5783         return invoice_request_ref;
5784 }
5785 uint64_t __attribute__((export_name("TS_LDKOffersMessage_Invoice_get_invoice"))) TS_LDKOffersMessage_Invoice_get_invoice(uint64_t ptr) {
5786         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5787         assert(obj->tag == LDKOffersMessage_Invoice);
5788         LDKBolt12Invoice invoice_var = obj->invoice;
5789                         uint64_t invoice_ref = 0;
5790                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5791                         invoice_ref = tag_ptr(invoice_var.inner, false);
5792         return invoice_ref;
5793 }
5794 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceError_get_invoice_error"))) TS_LDKOffersMessage_InvoiceError_get_invoice_error(uint64_t ptr) {
5795         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5796         assert(obj->tag == LDKOffersMessage_InvoiceError);
5797         LDKInvoiceError invoice_error_var = obj->invoice_error;
5798                         uint64_t invoice_error_ref = 0;
5799                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
5800                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
5801         return invoice_error_ref;
5802 }
5803 uint32_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_ty_from_ptr"))) TS_LDKCOption_OffersMessageZ_ty_from_ptr(uint64_t ptr) {
5804         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5805         switch(obj->tag) {
5806                 case LDKCOption_OffersMessageZ_Some: return 0;
5807                 case LDKCOption_OffersMessageZ_None: return 1;
5808                 default: abort();
5809         }
5810 }
5811 uint64_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_Some_get_some"))) TS_LDKCOption_OffersMessageZ_Some_get_some(uint64_t ptr) {
5812         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5813         assert(obj->tag == LDKCOption_OffersMessageZ_Some);
5814         uint64_t some_ref = tag_ptr(&obj->some, false);
5815         return some_ref;
5816 }
5817 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
5818         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5819         switch(obj->tag) {
5820                 case LDKDestination_Node: return 0;
5821                 case LDKDestination_BlindedPath: return 1;
5822                 default: abort();
5823         }
5824 }
5825 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
5826         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5827         assert(obj->tag == LDKDestination_Node);
5828         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
5829         memcpy(node_arr->elems, obj->node.compressed_form, 33);
5830         return node_arr;
5831 }
5832 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
5833         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5834         assert(obj->tag == LDKDestination_BlindedPath);
5835         LDKBlindedPath blinded_path_var = obj->blinded_path;
5836                         uint64_t blinded_path_ref = 0;
5837                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
5838                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
5839         return blinded_path_ref;
5840 }
5841 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5842         return OffersMessage_clone(&owner->a);
5843 }
5844 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(uint64_t owner) {
5845         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5846         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
5847         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
5848         uint64_t ret_ref = tag_ptr(ret_copy, true);
5849         return ret_ref;
5850 }
5851
5852 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5853         return Destination_clone(&owner->b);
5854 }
5855 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(uint64_t owner) {
5856         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5857         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
5858         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
5859         uint64_t ret_ref = tag_ptr(ret_copy, true);
5860         return ret_ref;
5861 }
5862
5863 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5864         LDKBlindedPath ret = owner->c;
5865         ret.is_owned = false;
5866         return ret;
5867 }
5868 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(uint64_t owner) {
5869         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5870         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
5871         uint64_t ret_ref = 0;
5872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5874         return ret_ref;
5875 }
5876
5877 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
5878         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
5879         for (size_t i = 0; i < ret.datalen; i++) {
5880                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
5881         }
5882         return ret;
5883 }
5884 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5885         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5886         ret.is_owned = false;
5887         return ret;
5888 }
5889 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5890         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5891         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5892         uint64_t ret_ref = 0;
5893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5895         return ret_ref;
5896 }
5897
5898 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5899 CHECK(!owner->result_ok);
5900         return DecodeError_clone(&*owner->contents.err);
5901 }
5902 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5903         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5904         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5905         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5906         uint64_t ret_ref = tag_ptr(ret_copy, true);
5907         return ret_ref;
5908 }
5909
5910 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5911         LDKChannelCounterparty ret = *owner->contents.result;
5912         ret.is_owned = false;
5913         return ret;
5914 }
5915 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5916         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5917         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5918         uint64_t ret_ref = 0;
5919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5921         return ret_ref;
5922 }
5923
5924 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5925 CHECK(!owner->result_ok);
5926         return DecodeError_clone(&*owner->contents.err);
5927 }
5928 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5929         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5930         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5931         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5932         uint64_t ret_ref = tag_ptr(ret_copy, true);
5933         return ret_ref;
5934 }
5935
5936 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5937         LDKChannelDetails ret = *owner->contents.result;
5938         ret.is_owned = false;
5939         return ret;
5940 }
5941 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5942         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5943         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5944         uint64_t ret_ref = 0;
5945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5947         return ret_ref;
5948 }
5949
5950 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5951 CHECK(!owner->result_ok);
5952         return DecodeError_clone(&*owner->contents.err);
5953 }
5954 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5955         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5956         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5957         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5958         uint64_t ret_ref = tag_ptr(ret_copy, true);
5959         return ret_ref;
5960 }
5961
5962 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5963         LDKPhantomRouteHints ret = *owner->contents.result;
5964         ret.is_owned = false;
5965         return ret;
5966 }
5967 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5968         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5969         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5970         uint64_t ret_ref = 0;
5971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5973         return ret_ref;
5974 }
5975
5976 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5977 CHECK(!owner->result_ok);
5978         return DecodeError_clone(&*owner->contents.err);
5979 }
5980 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5981         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5982         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5983         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5984         uint64_t ret_ref = tag_ptr(ret_copy, true);
5985         return ret_ref;
5986 }
5987
5988 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
5989         LDKBlindedForward ret = *owner->contents.result;
5990         ret.is_owned = false;
5991         return ret;
5992 }
5993 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_get_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_get_ok(uint64_t owner) {
5994         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
5995         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
5996         uint64_t ret_ref = 0;
5997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5999         return ret_ref;
6000 }
6001
6002 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
6003 CHECK(!owner->result_ok);
6004         return DecodeError_clone(&*owner->contents.err);
6005 }
6006 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_get_err"))) TS_CResult_BlindedForwardDecodeErrorZ_get_err(uint64_t owner) {
6007         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
6008         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6009         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
6010         uint64_t ret_ref = tag_ptr(ret_copy, true);
6011         return ret_ref;
6012 }
6013
6014 uint32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ty_from_ptr"))) TS_LDKPendingHTLCRouting_ty_from_ptr(uint64_t ptr) {
6015         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6016         switch(obj->tag) {
6017                 case LDKPendingHTLCRouting_Forward: return 0;
6018                 case LDKPendingHTLCRouting_Receive: return 1;
6019                 case LDKPendingHTLCRouting_ReceiveKeysend: return 2;
6020                 default: abort();
6021         }
6022 }
6023 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_onion_packet"))) TS_LDKPendingHTLCRouting_Forward_get_onion_packet(uint64_t ptr) {
6024         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6025         assert(obj->tag == LDKPendingHTLCRouting_Forward);
6026         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
6027                         uint64_t onion_packet_ref = 0;
6028                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
6029                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
6030         return onion_packet_ref;
6031 }
6032 int64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_short_channel_id"))) TS_LDKPendingHTLCRouting_Forward_get_short_channel_id(uint64_t ptr) {
6033         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6034         assert(obj->tag == LDKPendingHTLCRouting_Forward);
6035         int64_t short_channel_id_conv = obj->forward.short_channel_id;
6036         return short_channel_id_conv;
6037 }
6038 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_blinded"))) TS_LDKPendingHTLCRouting_Forward_get_blinded(uint64_t ptr) {
6039         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6040         assert(obj->tag == LDKPendingHTLCRouting_Forward);
6041         LDKBlindedForward blinded_var = obj->forward.blinded;
6042                         uint64_t blinded_ref = 0;
6043                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
6044                         blinded_ref = tag_ptr(blinded_var.inner, false);
6045         return blinded_ref;
6046 }
6047 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_data"))) TS_LDKPendingHTLCRouting_Receive_get_payment_data(uint64_t ptr) {
6048         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6049         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6050         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
6051                         uint64_t payment_data_ref = 0;
6052                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6053                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6054         return payment_data_ref;
6055 }
6056 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_metadata"))) TS_LDKPendingHTLCRouting_Receive_get_payment_metadata(uint64_t ptr) {
6057         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6058         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6059         uint64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
6060         return payment_metadata_ref;
6061 }
6062 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_context"))) TS_LDKPendingHTLCRouting_Receive_get_payment_context(uint64_t ptr) {
6063         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6064         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6065         uint64_t payment_context_ref = tag_ptr(&obj->receive.payment_context, false);
6066         return payment_context_ref;
6067 }
6068 int32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry"))) TS_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry(uint64_t ptr) {
6069         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6070         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6071         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
6072         return incoming_cltv_expiry_conv;
6073 }
6074 int8_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret"))) TS_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret(uint64_t ptr) {
6075         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6076         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6077         int8_tArray phantom_shared_secret_arr = init_int8_tArray(32, __LINE__);
6078         memcpy(phantom_shared_secret_arr->elems, obj->receive.phantom_shared_secret.data, 32);
6079         return phantom_shared_secret_arr;
6080 }
6081 uint64_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_custom_tlvs"))) TS_LDKPendingHTLCRouting_Receive_get_custom_tlvs(uint64_t ptr) {
6082         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6083         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6084         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
6085                         uint64_tArray custom_tlvs_arr = NULL;
6086                         custom_tlvs_arr = init_uint64_tArray(custom_tlvs_var.datalen, __LINE__);
6087                         uint64_t *custom_tlvs_arr_ptr = (uint64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6088                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6089                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6090                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6091                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6092                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6093                         }
6094                         
6095         return custom_tlvs_arr;
6096 }
6097 jboolean __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_requires_blinded_error"))) TS_LDKPendingHTLCRouting_Receive_get_requires_blinded_error(uint64_t ptr) {
6098         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6099         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6100         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
6101         return requires_blinded_error_conv;
6102 }
6103 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data(uint64_t ptr) {
6104         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6105         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6106         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
6107                         uint64_t payment_data_ref = 0;
6108                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6109                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6110         return payment_data_ref;
6111 }
6112 int8_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage(uint64_t ptr) {
6113         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6114         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6115         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
6116         memcpy(payment_preimage_arr->elems, obj->receive_keysend.payment_preimage.data, 32);
6117         return payment_preimage_arr;
6118 }
6119 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata(uint64_t ptr) {
6120         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6121         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6122         uint64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
6123         return payment_metadata_ref;
6124 }
6125 int32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry(uint64_t ptr) {
6126         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6127         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6128         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
6129         return incoming_cltv_expiry_conv;
6130 }
6131 uint64_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs(uint64_t ptr) {
6132         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6133         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6134         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
6135                         uint64_tArray custom_tlvs_arr = NULL;
6136                         custom_tlvs_arr = init_uint64_tArray(custom_tlvs_var.datalen, __LINE__);
6137                         uint64_t *custom_tlvs_arr_ptr = (uint64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6138                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6139                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6140                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6141                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6142                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6143                         }
6144                         
6145         return custom_tlvs_arr;
6146 }
6147 jboolean __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_requires_blinded_error"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_requires_blinded_error(uint64_t ptr) {
6148         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6149         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6150         jboolean requires_blinded_error_conv = obj->receive_keysend.requires_blinded_error;
6151         return requires_blinded_error_conv;
6152 }
6153 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6154 CHECK(owner->result_ok);
6155         return PendingHTLCRouting_clone(&*owner->contents.result);
6156 }
6157 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(uint64_t owner) {
6158         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6159         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
6160         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
6161         uint64_t ret_ref = tag_ptr(ret_copy, true);
6162         return ret_ref;
6163 }
6164
6165 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6166 CHECK(!owner->result_ok);
6167         return DecodeError_clone(&*owner->contents.err);
6168 }
6169 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_err"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_err(uint64_t owner) {
6170         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6171         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6172         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
6173         uint64_t ret_ref = tag_ptr(ret_copy, true);
6174         return ret_ref;
6175 }
6176
6177 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6178         LDKPendingHTLCInfo ret = *owner->contents.result;
6179         ret.is_owned = false;
6180         return ret;
6181 }
6182 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_get_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_get_ok(uint64_t owner) {
6183         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6184         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
6185         uint64_t ret_ref = 0;
6186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6188         return ret_ref;
6189 }
6190
6191 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6192 CHECK(!owner->result_ok);
6193         return DecodeError_clone(&*owner->contents.err);
6194 }
6195 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_get_err"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_get_err(uint64_t owner) {
6196         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6197         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6198         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
6199         uint64_t ret_ref = tag_ptr(ret_copy, true);
6200         return ret_ref;
6201 }
6202
6203 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6204 CHECK(owner->result_ok);
6205         return BlindedFailure_clone(&*owner->contents.result);
6206 }
6207 uint32_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_get_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_get_ok(uint64_t owner) {
6208         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6209         uint32_t ret_conv = LDKBlindedFailure_to_js(CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
6210         return ret_conv;
6211 }
6212
6213 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6214 CHECK(!owner->result_ok);
6215         return DecodeError_clone(&*owner->contents.err);
6216 }
6217 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_get_err"))) TS_CResult_BlindedFailureDecodeErrorZ_get_err(uint64_t owner) {
6218         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6219         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6220         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
6221         uint64_t ret_ref = tag_ptr(ret_copy, true);
6222         return ret_ref;
6223 }
6224
6225 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6226 CHECK(owner->result_ok);
6227         return ChannelShutdownState_clone(&*owner->contents.result);
6228 }
6229 uint32_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(uint64_t owner) {
6230         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6231         uint32_t ret_conv = LDKChannelShutdownState_to_js(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
6232         return ret_conv;
6233 }
6234
6235 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6236 CHECK(!owner->result_ok);
6237         return DecodeError_clone(&*owner->contents.err);
6238 }
6239 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err(uint64_t owner) {
6240         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6241         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6242         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
6243         uint64_t ret_ref = tag_ptr(ret_copy, true);
6244         return ret_ref;
6245 }
6246
6247 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6248         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6249         for (size_t i = 0; i < ret.datalen; i++) {
6250                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6251         }
6252         return ret;
6253 }
6254 typedef struct LDKWatch_JCalls {
6255         atomic_size_t refcnt;
6256         uint32_t instance_ptr;
6257 } LDKWatch_JCalls;
6258 static void LDKWatch_JCalls_free(void* this_arg) {
6259         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6260         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6261                 FREE(j_calls);
6262         }
6263 }
6264 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6265         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6266         LDKOutPoint funding_txo_var = funding_txo;
6267         uint64_t funding_txo_ref = 0;
6268         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6269         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6270         LDKChannelMonitor monitor_var = monitor;
6271         uint64_t monitor_ref = 0;
6272         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6273         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
6274         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
6275         void* ret_ptr = untag_ptr(ret);
6276         CHECK_ACCESS(ret_ptr);
6277         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
6278         FREE(untag_ptr(ret));
6279         return ret_conv;
6280 }
6281 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
6282         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6283         LDKOutPoint funding_txo_var = funding_txo;
6284         uint64_t funding_txo_ref = 0;
6285         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6286         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6287         LDKChannelMonitorUpdate update_var = *update;
6288         uint64_t update_ref = 0;
6289         update_var = ChannelMonitorUpdate_clone(&update_var);
6290         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6291         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6292         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 19, funding_txo_ref, update_ref, 0, 0, 0, 0);
6293         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
6294         return ret_conv;
6295 }
6296 LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6297         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6298         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, 0, 0, 0, 0, 0, 0);
6299         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_constr;
6300         ret_constr.datalen = ret->arr_len;
6301         if (ret_constr.datalen > 0)
6302                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
6303         else
6304                 ret_constr.data = NULL;
6305         uint64_t* ret_vals = ret->elems;
6306         for (size_t f = 0; f < ret_constr.datalen; f++) {
6307                 uint64_t ret_conv_57 = ret_vals[f];
6308                 void* ret_conv_57_ptr = untag_ptr(ret_conv_57);
6309                 CHECK_ACCESS(ret_conv_57_ptr);
6310                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ ret_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(ret_conv_57_ptr);
6311                 FREE(untag_ptr(ret_conv_57));
6312                 ret_constr.data[f] = ret_conv_57_conv;
6313         }
6314         FREE(ret);
6315         return ret_constr;
6316 }
6317 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6318         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6319         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6320 }
6321 static inline LDKWatch LDKWatch_init (JSValue o) {
6322         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6323         atomic_init(&calls->refcnt, 1);
6324         calls->instance_ptr = o;
6325
6326         LDKWatch ret = {
6327                 .this_arg = (void*) calls,
6328                 .watch_channel = watch_channel_LDKWatch_jcall,
6329                 .update_channel = update_channel_LDKWatch_jcall,
6330                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6331                 .free = LDKWatch_JCalls_free,
6332         };
6333         return ret;
6334 }
6335 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
6336         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6337         *res_ptr = LDKWatch_init(o);
6338         return tag_ptr(res_ptr, true);
6339 }
6340 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
6341         void* this_arg_ptr = untag_ptr(this_arg);
6342         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6343         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6344         LDKOutPoint funding_txo_conv;
6345         funding_txo_conv.inner = untag_ptr(funding_txo);
6346         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6347         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6348         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6349         LDKChannelMonitor monitor_conv;
6350         monitor_conv.inner = untag_ptr(monitor);
6351         monitor_conv.is_owned = ptr_is_owned(monitor);
6352         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6353         monitor_conv = ChannelMonitor_clone(&monitor_conv);
6354         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
6355         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6356         return tag_ptr(ret_conv, true);
6357 }
6358
6359 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
6360         void* this_arg_ptr = untag_ptr(this_arg);
6361         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6362         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6363         LDKOutPoint funding_txo_conv;
6364         funding_txo_conv.inner = untag_ptr(funding_txo);
6365         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6366         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6367         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6368         LDKChannelMonitorUpdate update_conv;
6369         update_conv.inner = untag_ptr(update);
6370         update_conv.is_owned = ptr_is_owned(update);
6371         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6372         update_conv.is_owned = false;
6373         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
6374         return ret_conv;
6375 }
6376
6377 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
6378         void* this_arg_ptr = untag_ptr(this_arg);
6379         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6380         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6381         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6382         uint64_tArray ret_arr = NULL;
6383         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6384         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6385         for (size_t f = 0; f < ret_var.datalen; f++) {
6386                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv_57_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
6387                 *ret_conv_57_conv = ret_var.data[f];
6388                 ret_arr_ptr[f] = tag_ptr(ret_conv_57_conv, true);
6389         }
6390         
6391         FREE(ret_var.data);
6392         return ret_arr;
6393 }
6394
6395 typedef struct LDKBroadcasterInterface_JCalls {
6396         atomic_size_t refcnt;
6397         uint32_t instance_ptr;
6398 } LDKBroadcasterInterface_JCalls;
6399 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6400         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6401         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6402                 FREE(j_calls);
6403         }
6404 }
6405 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
6406         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6407         LDKCVec_TransactionZ txs_var = txs;
6408         ptrArray txs_arr = NULL;
6409         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
6410         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
6411         for (size_t m = 0; m < txs_var.datalen; m++) {
6412                 LDKTransaction txs_conv_12_var = txs_var.data[m];
6413                 int8_tArray txs_conv_12_arr = init_int8_tArray(txs_conv_12_var.datalen, __LINE__);
6414                 memcpy(txs_conv_12_arr->elems, txs_conv_12_var.data, txs_conv_12_var.datalen);
6415                 Transaction_free(txs_conv_12_var);
6416                 txs_arr_ptr[m] = txs_conv_12_arr;
6417         }
6418         
6419         FREE(txs_var.data);
6420         js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, (uint32_t)txs_arr, 0, 0, 0, 0, 0);
6421 }
6422 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6423         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6424         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6425 }
6426 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
6427         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6428         atomic_init(&calls->refcnt, 1);
6429         calls->instance_ptr = o;
6430
6431         LDKBroadcasterInterface ret = {
6432                 .this_arg = (void*) calls,
6433                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
6434                 .free = LDKBroadcasterInterface_JCalls_free,
6435         };
6436         return ret;
6437 }
6438 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
6439         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6440         *res_ptr = LDKBroadcasterInterface_init(o);
6441         return tag_ptr(res_ptr, true);
6442 }
6443 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transactions"))) TS_BroadcasterInterface_broadcast_transactions(uint64_t this_arg, ptrArray txs) {
6444         void* this_arg_ptr = untag_ptr(this_arg);
6445         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6446         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6447         LDKCVec_TransactionZ txs_constr;
6448         txs_constr.datalen = txs->arr_len;
6449         if (txs_constr.datalen > 0)
6450                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6451         else
6452                 txs_constr.data = NULL;
6453         int8_tArray* txs_vals = (void*) txs->elems;
6454         for (size_t m = 0; m < txs_constr.datalen; m++) {
6455                 int8_tArray txs_conv_12 = txs_vals[m];
6456                 LDKTransaction txs_conv_12_ref;
6457                 txs_conv_12_ref.datalen = txs_conv_12->arr_len;
6458                 txs_conv_12_ref.data = MALLOC(txs_conv_12_ref.datalen, "LDKTransaction Bytes");
6459                 memcpy(txs_conv_12_ref.data, txs_conv_12->elems, txs_conv_12_ref.datalen); FREE(txs_conv_12);
6460                 txs_conv_12_ref.data_is_owned = true;
6461                 txs_constr.data[m] = txs_conv_12_ref;
6462         }
6463         FREE(txs);
6464         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
6465 }
6466
6467 typedef struct LDKEntropySource_JCalls {
6468         atomic_size_t refcnt;
6469         uint32_t instance_ptr;
6470 } LDKEntropySource_JCalls;
6471 static void LDKEntropySource_JCalls_free(void* this_arg) {
6472         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6473         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6474                 FREE(j_calls);
6475         }
6476 }
6477 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
6478         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6479         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
6480         LDKThirtyTwoBytes ret_ref;
6481         CHECK(ret->arr_len == 32);
6482         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6483         return ret_ref;
6484 }
6485 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
6486         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
6487         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6488 }
6489 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
6490         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
6491         atomic_init(&calls->refcnt, 1);
6492         calls->instance_ptr = o;
6493
6494         LDKEntropySource ret = {
6495                 .this_arg = (void*) calls,
6496                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
6497                 .free = LDKEntropySource_JCalls_free,
6498         };
6499         return ret;
6500 }
6501 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
6502         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
6503         *res_ptr = LDKEntropySource_init(o);
6504         return tag_ptr(res_ptr, true);
6505 }
6506 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
6507         void* this_arg_ptr = untag_ptr(this_arg);
6508         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6509         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
6510         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6511         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
6512         return ret_arr;
6513 }
6514
6515 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
6516         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6517         switch(obj->tag) {
6518                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
6519                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
6520                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
6521                 default: abort();
6522         }
6523 }
6524 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
6525         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6526         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
6527         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
6528                         uint64_t channel_announcement_ref = 0;
6529                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
6530                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
6531         return channel_announcement_ref;
6532 }
6533 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
6534         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6535         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
6536         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
6537                         uint64_t channel_update_ref = 0;
6538                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
6539                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
6540         return channel_update_ref;
6541 }
6542 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
6543         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6544         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
6545         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
6546                         uint64_t node_announcement_ref = 0;
6547                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
6548                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
6549         return node_announcement_ref;
6550 }
6551 typedef struct LDKNodeSigner_JCalls {
6552         atomic_size_t refcnt;
6553         uint32_t instance_ptr;
6554 } LDKNodeSigner_JCalls;
6555 static void LDKNodeSigner_JCalls_free(void* this_arg) {
6556         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6557         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6558                 FREE(j_calls);
6559         }
6560 }
6561 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
6562         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6563         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
6564         LDKThirtyTwoBytes ret_ref;
6565         CHECK(ret->arr_len == 32);
6566         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6567         return ret_ref;
6568 }
6569 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
6570         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6571         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6572         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, recipient_conv, 0, 0, 0, 0, 0);
6573         void* ret_ptr = untag_ptr(ret);
6574         CHECK_ACCESS(ret_ptr);
6575         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
6576         FREE(untag_ptr(ret));
6577         return ret_conv;
6578 }
6579 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
6580         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6581         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6582         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
6583         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
6584         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
6585         *tweak_copy = tweak;
6586         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
6587         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 25, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
6588         void* ret_ptr = untag_ptr(ret);
6589         CHECK_ACCESS(ret_ptr);
6590         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
6591         FREE(untag_ptr(ret));
6592         return ret_conv;
6593 }
6594 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
6595         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6596         LDKu8slice hrp_bytes_var = hrp_bytes;
6597         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
6598         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
6599         LDKCVec_U5Z invoice_data_var = invoice_data;
6600         ptrArray invoice_data_arr = NULL;
6601         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
6602         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
6603         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6604                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6605                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6606         }
6607         
6608         FREE(invoice_data_var.data);
6609         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6610         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);
6611         void* ret_ptr = untag_ptr(ret);
6612         CHECK_ACCESS(ret_ptr);
6613         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6614         FREE(untag_ptr(ret));
6615         return ret_conv;
6616 }
6617 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
6618         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6619         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
6620         uint64_t invoice_request_ref = 0;
6621         invoice_request_var = UnsignedInvoiceRequest_clone(&invoice_request_var);
6622         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
6623         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
6624         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, invoice_request_ref, 0, 0, 0, 0, 0);
6625         void* ret_ptr = untag_ptr(ret);
6626         CHECK_ACCESS(ret_ptr);
6627         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6628         FREE(untag_ptr(ret));
6629         return ret_conv;
6630 }
6631 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
6632         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6633         LDKUnsignedBolt12Invoice invoice_var = *invoice;
6634         uint64_t invoice_ref = 0;
6635         invoice_var = UnsignedBolt12Invoice_clone(&invoice_var);
6636         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
6637         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
6638         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 28, invoice_ref, 0, 0, 0, 0, 0);
6639         void* ret_ptr = untag_ptr(ret);
6640         CHECK_ACCESS(ret_ptr);
6641         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6642         FREE(untag_ptr(ret));
6643         return ret_conv;
6644 }
6645 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
6646         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6647         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
6648         *msg_copy = msg;
6649         uint64_t msg_ref = tag_ptr(msg_copy, true);
6650         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 29, msg_ref, 0, 0, 0, 0, 0);
6651         void* ret_ptr = untag_ptr(ret);
6652         CHECK_ACCESS(ret_ptr);
6653         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
6654         FREE(untag_ptr(ret));
6655         return ret_conv;
6656 }
6657 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
6658         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
6659         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6660 }
6661 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
6662         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
6663         atomic_init(&calls->refcnt, 1);
6664         calls->instance_ptr = o;
6665
6666         LDKNodeSigner ret = {
6667                 .this_arg = (void*) calls,
6668                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
6669                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
6670                 .ecdh = ecdh_LDKNodeSigner_jcall,
6671                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
6672                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
6673                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
6674                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
6675                 .free = LDKNodeSigner_JCalls_free,
6676         };
6677         return ret;
6678 }
6679 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
6680         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
6681         *res_ptr = LDKNodeSigner_init(o);
6682         return tag_ptr(res_ptr, true);
6683 }
6684 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
6685         void* this_arg_ptr = untag_ptr(this_arg);
6686         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6687         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6688         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6689         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6690         return ret_arr;
6691 }
6692
6693 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
6694         void* this_arg_ptr = untag_ptr(this_arg);
6695         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6696         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6697         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6698         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
6699         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
6700         return tag_ptr(ret_conv, true);
6701 }
6702
6703 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) {
6704         void* this_arg_ptr = untag_ptr(this_arg);
6705         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6706         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6707         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6708         LDKPublicKey other_key_ref;
6709         CHECK(other_key->arr_len == 33);
6710         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
6711         void* tweak_ptr = untag_ptr(tweak);
6712         CHECK_ACCESS(tweak_ptr);
6713         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
6714         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
6715         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
6716         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
6717         return tag_ptr(ret_conv, true);
6718 }
6719
6720 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) {
6721         void* this_arg_ptr = untag_ptr(this_arg);
6722         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6723         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6724         LDKu8slice hrp_bytes_ref;
6725         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
6726         hrp_bytes_ref.data = hrp_bytes->elems;
6727         LDKCVec_U5Z invoice_data_constr;
6728         invoice_data_constr.datalen = invoice_data->arr_len;
6729         if (invoice_data_constr.datalen > 0)
6730                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
6731         else
6732                 invoice_data_constr.data = NULL;
6733         int8_t* invoice_data_vals = (void*) invoice_data->elems;
6734         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6735                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6736                 
6737                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
6738         }
6739         FREE(invoice_data);
6740         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6741         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6742         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
6743         FREE(hrp_bytes);
6744         return tag_ptr(ret_conv, true);
6745 }
6746
6747 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) {
6748         void* this_arg_ptr = untag_ptr(this_arg);
6749         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6750         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6751         LDKUnsignedInvoiceRequest invoice_request_conv;
6752         invoice_request_conv.inner = untag_ptr(invoice_request);
6753         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
6754         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
6755         invoice_request_conv.is_owned = false;
6756         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6757         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
6758         return tag_ptr(ret_conv, true);
6759 }
6760
6761 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_bolt12_invoice"))) TS_NodeSigner_sign_bolt12_invoice(uint64_t this_arg, uint64_t invoice) {
6762         void* this_arg_ptr = untag_ptr(this_arg);
6763         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6764         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6765         LDKUnsignedBolt12Invoice invoice_conv;
6766         invoice_conv.inner = untag_ptr(invoice);
6767         invoice_conv.is_owned = ptr_is_owned(invoice);
6768         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
6769         invoice_conv.is_owned = false;
6770         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6771         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
6772         return tag_ptr(ret_conv, true);
6773 }
6774
6775 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
6776         void* this_arg_ptr = untag_ptr(this_arg);
6777         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6778         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6779         void* msg_ptr = untag_ptr(msg);
6780         CHECK_ACCESS(msg_ptr);
6781         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
6782         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
6783         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
6784         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
6785         return tag_ptr(ret_conv, true);
6786 }
6787
6788 typedef struct LDKSignerProvider_JCalls {
6789         atomic_size_t refcnt;
6790         uint32_t instance_ptr;
6791 } LDKSignerProvider_JCalls;
6792 static void LDKSignerProvider_JCalls_free(void* this_arg) {
6793         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6794         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6795                 FREE(j_calls);
6796         }
6797 }
6798 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
6799         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6800         jboolean inbound_conv = inbound;
6801         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6802         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
6803         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
6804         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);
6805         LDKThirtyTwoBytes ret_ref;
6806         CHECK(ret->arr_len == 32);
6807         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6808         return ret_ref;
6809 }
6810 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
6811         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6812         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6813         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6814         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6815         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);
6816         void* ret_ptr = untag_ptr(ret);
6817         CHECK_ACCESS(ret_ptr);
6818         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
6819         FREE(untag_ptr(ret));
6820         return ret_conv;
6821 }
6822 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
6823         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6824         LDKu8slice reader_var = reader;
6825         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
6826         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6827         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
6828         void* ret_ptr = untag_ptr(ret);
6829         CHECK_ACCESS(ret_ptr);
6830         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
6831         FREE(untag_ptr(ret));
6832         return ret_conv;
6833 }
6834 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
6835         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6836         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6837         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6838         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0, 0);
6839         void* ret_ptr = untag_ptr(ret);
6840         CHECK_ACCESS(ret_ptr);
6841         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
6842         FREE(untag_ptr(ret));
6843         return ret_conv;
6844 }
6845 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
6846         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6847         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
6848         void* ret_ptr = untag_ptr(ret);
6849         CHECK_ACCESS(ret_ptr);
6850         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
6851         FREE(untag_ptr(ret));
6852         return ret_conv;
6853 }
6854 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
6855         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
6856         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6857 }
6858 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
6859         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
6860         atomic_init(&calls->refcnt, 1);
6861         calls->instance_ptr = o;
6862
6863         LDKSignerProvider ret = {
6864                 .this_arg = (void*) calls,
6865                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
6866                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
6867                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
6868                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
6869                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
6870                 .free = LDKSignerProvider_JCalls_free,
6871         };
6872         return ret;
6873 }
6874 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
6875         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
6876         *res_ptr = LDKSignerProvider_init(o);
6877         return tag_ptr(res_ptr, true);
6878 }
6879 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) {
6880         void* this_arg_ptr = untag_ptr(this_arg);
6881         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6882         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6883         LDKU128 user_channel_id_ref;
6884         CHECK(user_channel_id->arr_len == 16);
6885         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
6886         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6887         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);
6888         return ret_arr;
6889 }
6890
6891 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) {
6892         void* this_arg_ptr = untag_ptr(this_arg);
6893         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6894         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6895         LDKThirtyTwoBytes channel_keys_id_ref;
6896         CHECK(channel_keys_id->arr_len == 32);
6897         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6898         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
6899         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
6900         return tag_ptr(ret_ret, true);
6901 }
6902
6903 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
6904         void* this_arg_ptr = untag_ptr(this_arg);
6905         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6906         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6907         LDKu8slice reader_ref;
6908         reader_ref.datalen = reader->arr_len;
6909         reader_ref.data = reader->elems;
6910         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
6911         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6912         FREE(reader);
6913         return tag_ptr(ret_conv, true);
6914 }
6915
6916 uint64_t  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg, int8_tArray channel_keys_id) {
6917         void* this_arg_ptr = untag_ptr(this_arg);
6918         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6919         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6920         LDKThirtyTwoBytes channel_keys_id_ref;
6921         CHECK(channel_keys_id->arr_len == 32);
6922         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6923         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
6924         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
6925         return tag_ptr(ret_conv, true);
6926 }
6927
6928 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
6929         void* this_arg_ptr = untag_ptr(this_arg);
6930         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6931         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6932         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
6933         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6934         return tag_ptr(ret_conv, true);
6935 }
6936
6937 typedef struct LDKFeeEstimator_JCalls {
6938         atomic_size_t refcnt;
6939         uint32_t instance_ptr;
6940 } LDKFeeEstimator_JCalls;
6941 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6942         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6943         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6944                 FREE(j_calls);
6945         }
6946 }
6947 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6948         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6949         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6950         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, confirmation_target_conv, 0, 0, 0, 0, 0);
6951 }
6952 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6953         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6954         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6955 }
6956 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
6957         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6958         atomic_init(&calls->refcnt, 1);
6959         calls->instance_ptr = o;
6960
6961         LDKFeeEstimator ret = {
6962                 .this_arg = (void*) calls,
6963                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6964                 .free = LDKFeeEstimator_JCalls_free,
6965         };
6966         return ret;
6967 }
6968 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
6969         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6970         *res_ptr = LDKFeeEstimator_init(o);
6971         return tag_ptr(res_ptr, true);
6972 }
6973 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) {
6974         void* this_arg_ptr = untag_ptr(this_arg);
6975         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6976         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6977         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6978         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6979         return ret_conv;
6980 }
6981
6982 typedef struct LDKMessageRouter_JCalls {
6983         atomic_size_t refcnt;
6984         uint32_t instance_ptr;
6985 } LDKMessageRouter_JCalls;
6986 static void LDKMessageRouter_JCalls_free(void* this_arg) {
6987         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6988         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6989                 FREE(j_calls);
6990         }
6991 }
6992 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
6993         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6994         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
6995         memcpy(sender_arr->elems, sender.compressed_form, 33);
6996         LDKCVec_PublicKeyZ peers_var = peers;
6997         ptrArray peers_arr = NULL;
6998         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
6999         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
7000         for (size_t m = 0; m < peers_var.datalen; m++) {
7001                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
7002                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
7003                 peers_arr_ptr[m] = peers_conv_12_arr;
7004         }
7005         
7006         FREE(peers_var.data);
7007         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7008         *destination_copy = destination;
7009         uint64_t destination_ref = tag_ptr(destination_copy, true);
7010         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);
7011         void* ret_ptr = untag_ptr(ret);
7012         CHECK_ACCESS(ret_ptr);
7013         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
7014         FREE(untag_ptr(ret));
7015         return ret_conv;
7016 }
7017 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
7018         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7019         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7020         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7021         LDKCVec_PublicKeyZ peers_var = peers;
7022         ptrArray peers_arr = NULL;
7023         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
7024         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
7025         for (size_t m = 0; m < peers_var.datalen; m++) {
7026                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
7027                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
7028                 peers_arr_ptr[m] = peers_conv_12_arr;
7029         }
7030         
7031         FREE(peers_var.data);
7032         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, (uint32_t)recipient_arr, (uint32_t)peers_arr, 0, 0, 0, 0);
7033         void* ret_ptr = untag_ptr(ret);
7034         CHECK_ACCESS(ret_ptr);
7035         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
7036         FREE(untag_ptr(ret));
7037         return ret_conv;
7038 }
7039 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
7040         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
7041         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7042 }
7043 static inline LDKMessageRouter LDKMessageRouter_init (JSValue o) {
7044         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
7045         atomic_init(&calls->refcnt, 1);
7046         calls->instance_ptr = o;
7047
7048         LDKMessageRouter ret = {
7049                 .this_arg = (void*) calls,
7050                 .find_path = find_path_LDKMessageRouter_jcall,
7051                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
7052                 .free = LDKMessageRouter_JCalls_free,
7053         };
7054         return ret;
7055 }
7056 uint64_t  __attribute__((export_name("TS_LDKMessageRouter_new"))) TS_LDKMessageRouter_new(JSValue o) {
7057         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
7058         *res_ptr = LDKMessageRouter_init(o);
7059         return tag_ptr(res_ptr, true);
7060 }
7061 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) {
7062         void* this_arg_ptr = untag_ptr(this_arg);
7063         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7064         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7065         LDKPublicKey sender_ref;
7066         CHECK(sender->arr_len == 33);
7067         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
7068         LDKCVec_PublicKeyZ peers_constr;
7069         peers_constr.datalen = peers->arr_len;
7070         if (peers_constr.datalen > 0)
7071                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7072         else
7073                 peers_constr.data = NULL;
7074         int8_tArray* peers_vals = (void*) peers->elems;
7075         for (size_t m = 0; m < peers_constr.datalen; m++) {
7076                 int8_tArray peers_conv_12 = peers_vals[m];
7077                 LDKPublicKey peers_conv_12_ref;
7078                 CHECK(peers_conv_12->arr_len == 33);
7079                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
7080                 peers_constr.data[m] = peers_conv_12_ref;
7081         }
7082         FREE(peers);
7083         void* destination_ptr = untag_ptr(destination);
7084         CHECK_ACCESS(destination_ptr);
7085         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
7086         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
7087         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
7088         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
7089         return tag_ptr(ret_conv, true);
7090 }
7091
7092 uint64_t  __attribute__((export_name("TS_MessageRouter_create_blinded_paths"))) TS_MessageRouter_create_blinded_paths(uint64_t this_arg, int8_tArray recipient, ptrArray peers) {
7093         void* this_arg_ptr = untag_ptr(this_arg);
7094         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7095         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7096         LDKPublicKey recipient_ref;
7097         CHECK(recipient->arr_len == 33);
7098         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7099         LDKCVec_PublicKeyZ peers_constr;
7100         peers_constr.datalen = peers->arr_len;
7101         if (peers_constr.datalen > 0)
7102                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7103         else
7104                 peers_constr.data = NULL;
7105         int8_tArray* peers_vals = (void*) peers->elems;
7106         for (size_t m = 0; m < peers_constr.datalen; m++) {
7107                 int8_tArray peers_conv_12 = peers_vals[m];
7108                 LDKPublicKey peers_conv_12_ref;
7109                 CHECK(peers_conv_12->arr_len == 33);
7110                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
7111                 peers_constr.data[m] = peers_conv_12_ref;
7112         }
7113         FREE(peers);
7114         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
7115         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
7116         return tag_ptr(ret_conv, true);
7117 }
7118
7119 typedef struct LDKRouter_JCalls {
7120         atomic_size_t refcnt;
7121         uint32_t instance_ptr;
7122         LDKMessageRouter_JCalls* MessageRouter;
7123 } LDKRouter_JCalls;
7124 static void LDKRouter_JCalls_free(void* this_arg) {
7125         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7126         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7127                 FREE(j_calls);
7128         }
7129 }
7130 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
7131         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7132         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7133         memcpy(payer_arr->elems, payer.compressed_form, 33);
7134         LDKRouteParameters route_params_var = *route_params;
7135         uint64_t route_params_ref = 0;
7136         route_params_var = RouteParameters_clone(&route_params_var);
7137         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7138         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7139         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7140         uint64_tArray first_hops_arr = NULL;
7141         if (first_hops != NULL) {
7142                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7143                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7144                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7145                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7146                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7147                         uint64_t first_hops_conv_16_ref = 0;
7148                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7149                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7150                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7151                 }
7152         
7153         }
7154         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7155         uint64_t inflight_htlcs_ref = 0;
7156         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7157         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7158         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);
7159         void* ret_ptr = untag_ptr(ret);
7160         CHECK_ACCESS(ret_ptr);
7161         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7162         FREE(untag_ptr(ret));
7163         return ret_conv;
7164 }
7165 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) {
7166         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7167         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7168         memcpy(payer_arr->elems, payer.compressed_form, 33);
7169         LDKRouteParameters route_params_var = *route_params;
7170         uint64_t route_params_ref = 0;
7171         route_params_var = RouteParameters_clone(&route_params_var);
7172         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7173         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7174         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7175         uint64_tArray first_hops_arr = NULL;
7176         if (first_hops != NULL) {
7177                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7178                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7179                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7180                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7181                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7182                         uint64_t first_hops_conv_16_ref = 0;
7183                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7184                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7185                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7186                 }
7187         
7188         }
7189         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7190         uint64_t inflight_htlcs_ref = 0;
7191         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7192         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7193         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
7194         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
7195         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
7196         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
7197         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);
7198         void* ret_ptr = untag_ptr(ret);
7199         CHECK_ACCESS(ret_ptr);
7200         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7201         FREE(untag_ptr(ret));
7202         return ret_conv;
7203 }
7204 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) {
7205         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7206         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7207         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7208         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
7209         uint64_tArray first_hops_arr = NULL;
7210         first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7211         uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7212         for (size_t q = 0; q < first_hops_var.datalen; q++) {
7213                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
7214                 uint64_t first_hops_conv_16_ref = 0;
7215                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7216                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7217                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7218         }
7219         
7220         FREE(first_hops_var.data);
7221         LDKReceiveTlvs tlvs_var = tlvs;
7222         uint64_t tlvs_ref = 0;
7223         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
7224         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
7225         int64_t amount_msats_conv = amount_msats;
7226         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);
7227         void* ret_ptr = untag_ptr(ret);
7228         CHECK_ACCESS(ret_ptr);
7229         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
7230         FREE(untag_ptr(ret));
7231         return ret_conv;
7232 }
7233 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
7234         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
7235         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7236         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
7237 }
7238 static inline LDKRouter LDKRouter_init (JSValue o, JSValue MessageRouter) {
7239         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
7240         atomic_init(&calls->refcnt, 1);
7241         calls->instance_ptr = o;
7242
7243         LDKRouter ret = {
7244                 .this_arg = (void*) calls,
7245                 .find_route = find_route_LDKRouter_jcall,
7246                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
7247                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
7248                 .free = LDKRouter_JCalls_free,
7249                 .MessageRouter = LDKMessageRouter_init(MessageRouter),
7250         };
7251         calls->MessageRouter = ret.MessageRouter.this_arg;
7252         return ret;
7253 }
7254 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o, JSValue MessageRouter) {
7255         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
7256         *res_ptr = LDKRouter_init(o, MessageRouter);
7257         return tag_ptr(res_ptr, true);
7258 }
7259 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) {
7260         void* this_arg_ptr = untag_ptr(this_arg);
7261         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7262         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7263         LDKPublicKey payer_ref;
7264         CHECK(payer->arr_len == 33);
7265         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7266         LDKRouteParameters route_params_conv;
7267         route_params_conv.inner = untag_ptr(route_params);
7268         route_params_conv.is_owned = ptr_is_owned(route_params);
7269         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7270         route_params_conv.is_owned = false;
7271         LDKCVec_ChannelDetailsZ first_hops_constr;
7272         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7273         if (first_hops != 0) {
7274                 first_hops_constr.datalen = first_hops->arr_len;
7275                 if (first_hops_constr.datalen > 0)
7276                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7277                 else
7278                         first_hops_constr.data = NULL;
7279                 uint64_t* first_hops_vals = first_hops->elems;
7280                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7281                         uint64_t first_hops_conv_16 = first_hops_vals[q];
7282                         LDKChannelDetails first_hops_conv_16_conv;
7283                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7284                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7285                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7286                         first_hops_conv_16_conv.is_owned = false;
7287                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7288                 }
7289                 FREE(first_hops);
7290                 first_hops_ptr = &first_hops_constr;
7291         }
7292         LDKInFlightHtlcs inflight_htlcs_conv;
7293         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7294         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7295         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7296         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7297         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7298         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
7299         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7300         return tag_ptr(ret_conv, true);
7301 }
7302
7303 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) {
7304         void* this_arg_ptr = untag_ptr(this_arg);
7305         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7306         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7307         LDKPublicKey payer_ref;
7308         CHECK(payer->arr_len == 33);
7309         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7310         LDKRouteParameters route_params_conv;
7311         route_params_conv.inner = untag_ptr(route_params);
7312         route_params_conv.is_owned = ptr_is_owned(route_params);
7313         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7314         route_params_conv.is_owned = false;
7315         LDKCVec_ChannelDetailsZ first_hops_constr;
7316         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7317         if (first_hops != 0) {
7318                 first_hops_constr.datalen = first_hops->arr_len;
7319                 if (first_hops_constr.datalen > 0)
7320                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7321                 else
7322                         first_hops_constr.data = NULL;
7323                 uint64_t* first_hops_vals = first_hops->elems;
7324                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7325                         uint64_t first_hops_conv_16 = first_hops_vals[q];
7326                         LDKChannelDetails first_hops_conv_16_conv;
7327                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7328                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7329                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7330                         first_hops_conv_16_conv.is_owned = false;
7331                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7332                 }
7333                 FREE(first_hops);
7334                 first_hops_ptr = &first_hops_constr;
7335         }
7336         LDKInFlightHtlcs inflight_htlcs_conv;
7337         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7338         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7339         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7340         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7341         LDKThirtyTwoBytes _payment_hash_ref;
7342         CHECK(_payment_hash->arr_len == 32);
7343         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
7344         LDKThirtyTwoBytes _payment_id_ref;
7345         CHECK(_payment_id->arr_len == 32);
7346         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
7347         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7348         *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);
7349         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7350         return tag_ptr(ret_conv, true);
7351 }
7352
7353 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) {
7354         void* this_arg_ptr = untag_ptr(this_arg);
7355         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7356         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7357         LDKPublicKey recipient_ref;
7358         CHECK(recipient->arr_len == 33);
7359         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7360         LDKCVec_ChannelDetailsZ first_hops_constr;
7361         first_hops_constr.datalen = first_hops->arr_len;
7362         if (first_hops_constr.datalen > 0)
7363                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7364         else
7365                 first_hops_constr.data = NULL;
7366         uint64_t* first_hops_vals = first_hops->elems;
7367         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7368                 uint64_t first_hops_conv_16 = first_hops_vals[q];
7369                 LDKChannelDetails first_hops_conv_16_conv;
7370                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7371                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7372                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7373                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
7374                 first_hops_constr.data[q] = first_hops_conv_16_conv;
7375         }
7376         FREE(first_hops);
7377         LDKReceiveTlvs tlvs_conv;
7378         tlvs_conv.inner = untag_ptr(tlvs);
7379         tlvs_conv.is_owned = ptr_is_owned(tlvs);
7380         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
7381         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
7382         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
7383         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
7384         return tag_ptr(ret_conv, true);
7385 }
7386
7387 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
7388         return ThirtyTwoBytes_clone(&owner->a);
7389 }
7390 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(uint64_t owner) {
7391         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
7392         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7393         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
7394         return ret_arr;
7395 }
7396
7397 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
7398         LDKChannelManager ret = owner->b;
7399         ret.is_owned = false;
7400         return ret;
7401 }
7402 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(uint64_t owner) {
7403         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
7404         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
7405         uint64_t ret_ref = 0;
7406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7408         return ret_ref;
7409 }
7410
7411 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7412 CHECK(owner->result_ok);
7413         return &*owner->contents.result;
7414 }
7415 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
7416         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7417         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
7418         return ret_ret;
7419 }
7420
7421 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7422 CHECK(!owner->result_ok);
7423         return DecodeError_clone(&*owner->contents.err);
7424 }
7425 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
7426         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7427         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7428         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
7429         uint64_t ret_ref = tag_ptr(ret_copy, true);
7430         return ret_ref;
7431 }
7432
7433 uint32_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_ty_from_ptr"))) TS_LDKMaxDustHTLCExposure_ty_from_ptr(uint64_t ptr) {
7434         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7435         switch(obj->tag) {
7436                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
7437                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
7438                 default: abort();
7439         }
7440 }
7441 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat"))) TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(uint64_t ptr) {
7442         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7443         assert(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
7444         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
7445         return fixed_limit_msat_conv;
7446 }
7447 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier"))) TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(uint64_t ptr) {
7448         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7449         assert(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
7450         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
7451         return fee_rate_multiplier_conv;
7452 }
7453 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7454 CHECK(owner->result_ok);
7455         return MaxDustHTLCExposure_clone(&*owner->contents.result);
7456 }
7457 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(uint64_t owner) {
7458         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7459         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
7460         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
7461         uint64_t ret_ref = tag_ptr(ret_copy, true);
7462         return ret_ref;
7463 }
7464
7465 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7466 CHECK(!owner->result_ok);
7467         return DecodeError_clone(&*owner->contents.err);
7468 }
7469 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(uint64_t owner) {
7470         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7471         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7472         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
7473         uint64_t ret_ref = tag_ptr(ret_copy, true);
7474         return ret_ref;
7475 }
7476
7477 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7478         LDKChannelConfig ret = *owner->contents.result;
7479         ret.is_owned = false;
7480         return ret;
7481 }
7482 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
7483         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7484         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
7485         uint64_t ret_ref = 0;
7486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7488         return ret_ref;
7489 }
7490
7491 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7492 CHECK(!owner->result_ok);
7493         return DecodeError_clone(&*owner->contents.err);
7494 }
7495 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
7496         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7497         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7498         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
7499         uint64_t ret_ref = tag_ptr(ret_copy, true);
7500         return ret_ref;
7501 }
7502
7503 uint32_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr"))) TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(uint64_t ptr) {
7504         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7505         switch(obj->tag) {
7506                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
7507                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
7508                 default: abort();
7509         }
7510 }
7511 uint64_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some"))) TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(uint64_t ptr) {
7512         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7513         assert(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
7514         uint64_t some_ref = tag_ptr(&obj->some, false);
7515         return some_ref;
7516 }
7517 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
7518         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7519         switch(obj->tag) {
7520                 case LDKCOption_APIErrorZ_Some: return 0;
7521                 case LDKCOption_APIErrorZ_None: return 1;
7522                 default: abort();
7523         }
7524 }
7525 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
7526         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7527         assert(obj->tag == LDKCOption_APIErrorZ_Some);
7528         uint64_t some_ref = tag_ptr(&obj->some, false);
7529         return some_ref;
7530 }
7531 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7532 CHECK(owner->result_ok);
7533         return COption_APIErrorZ_clone(&*owner->contents.result);
7534 }
7535 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
7536         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7537         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
7538         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
7539         uint64_t ret_ref = tag_ptr(ret_copy, true);
7540         return ret_ref;
7541 }
7542
7543 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7544 CHECK(!owner->result_ok);
7545         return DecodeError_clone(&*owner->contents.err);
7546 }
7547 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
7548         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7549         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7550         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
7551         uint64_t ret_ref = tag_ptr(ret_copy, true);
7552         return ret_ref;
7553 }
7554
7555 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7556         LDKChannelMonitorUpdate ret = *owner->contents.result;
7557         ret.is_owned = false;
7558         return ret;
7559 }
7560 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7561         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7562         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7563         uint64_t ret_ref = 0;
7564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7566         return ret_ref;
7567 }
7568
7569 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7570 CHECK(!owner->result_ok);
7571         return DecodeError_clone(&*owner->contents.err);
7572 }
7573 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
7574         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7575         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7576         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7577         uint64_t ret_ref = tag_ptr(ret_copy, true);
7578         return ret_ref;
7579 }
7580
7581 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
7582         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7583         switch(obj->tag) {
7584                 case LDKCOption_MonitorEventZ_Some: return 0;
7585                 case LDKCOption_MonitorEventZ_None: return 1;
7586                 default: abort();
7587         }
7588 }
7589 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
7590         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7591         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
7592         uint64_t some_ref = tag_ptr(&obj->some, false);
7593         return some_ref;
7594 }
7595 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7596 CHECK(owner->result_ok);
7597         return COption_MonitorEventZ_clone(&*owner->contents.result);
7598 }
7599 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
7600         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7601         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7602         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7603         uint64_t ret_ref = tag_ptr(ret_copy, true);
7604         return ret_ref;
7605 }
7606
7607 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7608 CHECK(!owner->result_ok);
7609         return DecodeError_clone(&*owner->contents.err);
7610 }
7611 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
7612         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7613         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7614         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7615         uint64_t ret_ref = tag_ptr(ret_copy, true);
7616         return ret_ref;
7617 }
7618
7619 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7620         LDKHTLCUpdate ret = *owner->contents.result;
7621         ret.is_owned = false;
7622         return ret;
7623 }
7624 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7625         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7626         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7627         uint64_t ret_ref = 0;
7628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7630         return ret_ref;
7631 }
7632
7633 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7634 CHECK(!owner->result_ok);
7635         return DecodeError_clone(&*owner->contents.err);
7636 }
7637 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
7638         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7639         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7640         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7641         uint64_t ret_ref = tag_ptr(ret_copy, true);
7642         return ret_ref;
7643 }
7644
7645 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7646         LDKOutPoint ret = owner->a;
7647         ret.is_owned = false;
7648         return ret;
7649 }
7650 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_a"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_a(uint64_t owner) {
7651         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7652         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
7653         uint64_t ret_ref = 0;
7654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7656         return ret_ref;
7657 }
7658
7659 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7660         return CVec_u8Z_clone(&owner->b);
7661 }
7662 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_b"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_b(uint64_t owner) {
7663         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7664         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
7665         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7666         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7667         CVec_u8Z_free(ret_var);
7668         return ret_arr;
7669 }
7670
7671 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7672         return owner->a;
7673 }
7674 int32_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_a"))) TS_C2Tuple_u32CVec_u8ZZ_get_a(uint64_t owner) {
7675         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7676         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
7677         return ret_conv;
7678 }
7679
7680 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7681         return CVec_u8Z_clone(&owner->b);
7682 }
7683 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_b"))) TS_C2Tuple_u32CVec_u8ZZ_get_b(uint64_t owner) {
7684         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7685         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
7686         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7687         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7688         CVec_u8Z_free(ret_var);
7689         return ret_arr;
7690 }
7691
7692 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
7693         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
7694         for (size_t i = 0; i < ret.datalen; i++) {
7695                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
7696         }
7697         return ret;
7698 }
7699 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7700         return ThirtyTwoBytes_clone(&owner->a);
7701 }
7702 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(uint64_t owner) {
7703         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7704         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7705         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
7706         return ret_arr;
7707 }
7708
7709 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7710         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
7711 }
7712 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(uint64_t owner) {
7713         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7714         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
7715         uint64_tArray ret_arr = NULL;
7716         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7717         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7718         for (size_t x = 0; x < ret_var.datalen; x++) {
7719                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
7720                 *ret_conv_23_conv = ret_var.data[x];
7721                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
7722         }
7723         
7724         FREE(ret_var.data);
7725         return ret_arr;
7726 }
7727
7728 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
7729         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 };
7730         for (size_t i = 0; i < ret.datalen; i++) {
7731                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
7732         }
7733         return ret;
7734 }
7735 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
7736         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
7737         for (size_t i = 0; i < ret.datalen; i++) {
7738                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
7739         }
7740         return ret;
7741 }
7742 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7743         return owner->a;
7744 }
7745 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
7746         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7747         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
7748         return ret_conv;
7749 }
7750
7751 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7752         return TxOut_clone(&owner->b);
7753 }
7754 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
7755         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7756         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7757         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7758         return tag_ptr(ret_ref, true);
7759 }
7760
7761 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7762         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7763         for (size_t i = 0; i < ret.datalen; i++) {
7764                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7765         }
7766         return ret;
7767 }
7768 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7769         return ThirtyTwoBytes_clone(&owner->a);
7770 }
7771 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
7772         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7773         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7774         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
7775         return ret_arr;
7776 }
7777
7778 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7779         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7780 }
7781 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
7782         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7783         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7784         uint64_tArray ret_arr = NULL;
7785         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7786         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7787         for (size_t u = 0; u < ret_var.datalen; u++) {
7788                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7789                 *ret_conv_20_conv = ret_var.data[u];
7790                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
7791         }
7792         
7793         FREE(ret_var.data);
7794         return ret_arr;
7795 }
7796
7797 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
7798         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 };
7799         for (size_t i = 0; i < ret.datalen; i++) {
7800                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7801         }
7802         return ret;
7803 }
7804 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
7805         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7806         switch(obj->tag) {
7807                 case LDKBalance_ClaimableOnChannelClose: return 0;
7808                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
7809                 case LDKBalance_ContentiousClaimable: return 2;
7810                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
7811                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
7812                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
7813                 default: abort();
7814         }
7815 }
7816 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(uint64_t ptr) {
7817         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7818         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
7819         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
7820         return amount_satoshis_conv;
7821 }
7822 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(uint64_t ptr) {
7823         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7824         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7825         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
7826         return amount_satoshis_conv;
7827 }
7828 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
7829         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7830         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7831         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
7832         return confirmation_height_conv;
7833 }
7834 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_amount_satoshis(uint64_t ptr) {
7835         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7836         assert(obj->tag == LDKBalance_ContentiousClaimable);
7837         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
7838         return amount_satoshis_conv;
7839 }
7840 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
7841         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7842         assert(obj->tag == LDKBalance_ContentiousClaimable);
7843         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
7844         return timeout_height_conv;
7845 }
7846 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_hash"))) TS_LDKBalance_ContentiousClaimable_get_payment_hash(uint64_t ptr) {
7847         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7848         assert(obj->tag == LDKBalance_ContentiousClaimable);
7849         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7850         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
7851         return payment_hash_arr;
7852 }
7853 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_preimage"))) TS_LDKBalance_ContentiousClaimable_get_payment_preimage(uint64_t ptr) {
7854         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7855         assert(obj->tag == LDKBalance_ContentiousClaimable);
7856         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
7857         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
7858         return payment_preimage_arr;
7859 }
7860 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
7861         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7862         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7863         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
7864         return amount_satoshis_conv;
7865 }
7866 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
7867         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7868         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7869         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
7870         return claimable_height_conv;
7871 }
7872 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(uint64_t ptr) {
7873         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7874         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7875         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7876         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
7877         return payment_hash_arr;
7878 }
7879 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
7880         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7881         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7882         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
7883         return amount_satoshis_conv;
7884 }
7885 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
7886         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7887         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7888         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
7889         return expiry_height_conv;
7890 }
7891 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(uint64_t ptr) {
7892         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7893         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7894         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7895         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
7896         return payment_hash_arr;
7897 }
7898 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(uint64_t ptr) {
7899         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7900         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
7901         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
7902         return amount_satoshis_conv;
7903 }
7904 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7905         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7906         for (size_t i = 0; i < ret.datalen; i++) {
7907                 ret.data[i] = Balance_clone(&orig->data[i]);
7908         }
7909         return ret;
7910 }
7911 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
7912         return ThirtyTwoBytes_clone(&owner->a);
7913 }
7914 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(uint64_t owner) {
7915         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
7916         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7917         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
7918         return ret_arr;
7919 }
7920
7921 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
7922         LDKChannelMonitor ret = owner->b;
7923         ret.is_owned = false;
7924         return ret;
7925 }
7926 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(uint64_t owner) {
7927         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
7928         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
7929         uint64_t ret_ref = 0;
7930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7932         return ret_ref;
7933 }
7934
7935 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7936 CHECK(owner->result_ok);
7937         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
7938 }
7939 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
7940         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7941         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7942         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
7943         return tag_ptr(ret_conv, true);
7944 }
7945
7946 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7947 CHECK(!owner->result_ok);
7948         return DecodeError_clone(&*owner->contents.err);
7949 }
7950 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
7951         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7952         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7953         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
7954         uint64_t ret_ref = tag_ptr(ret_copy, true);
7955         return ret_ref;
7956 }
7957
7958 typedef struct LDKType_JCalls {
7959         atomic_size_t refcnt;
7960         uint32_t instance_ptr;
7961 } LDKType_JCalls;
7962 static void LDKType_JCalls_free(void* this_arg) {
7963         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7964         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7965                 FREE(j_calls);
7966         }
7967 }
7968 uint16_t type_id_LDKType_jcall(const void* this_arg) {
7969         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7970         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, 0, 0, 0, 0, 0, 0);
7971 }
7972 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
7973         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7974         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
7975         LDKStr ret_conv = str_ref_to_owned_c(ret);
7976         return ret_conv;
7977 }
7978 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
7979         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7980         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, 0, 0, 0, 0, 0, 0);
7981         LDKCVec_u8Z ret_ref;
7982         ret_ref.datalen = ret->arr_len;
7983         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7984         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7985         return ret_ref;
7986 }
7987 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7988         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7989         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7990 }
7991 static inline LDKType LDKType_init (JSValue o) {
7992         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7993         atomic_init(&calls->refcnt, 1);
7994         calls->instance_ptr = o;
7995
7996         LDKType ret = {
7997                 .this_arg = (void*) calls,
7998                 .type_id = type_id_LDKType_jcall,
7999                 .debug_str = debug_str_LDKType_jcall,
8000                 .write = write_LDKType_jcall,
8001                 .cloned = LDKType_JCalls_cloned,
8002                 .free = LDKType_JCalls_free,
8003         };
8004         return ret;
8005 }
8006 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
8007         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
8008         *res_ptr = LDKType_init(o);
8009         return tag_ptr(res_ptr, true);
8010 }
8011 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
8012         void* this_arg_ptr = untag_ptr(this_arg);
8013         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8014         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8015         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
8016         return ret_conv;
8017 }
8018
8019 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
8020         void* this_arg_ptr = untag_ptr(this_arg);
8021         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8022         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8023         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8024         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8025         Str_free(ret_str);
8026         return ret_conv;
8027 }
8028
8029 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
8030         void* this_arg_ptr = untag_ptr(this_arg);
8031         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8032         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8033         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8034         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8035         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8036         CVec_u8Z_free(ret_var);
8037         return ret_arr;
8038 }
8039
8040 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8041         return owner->a;
8042 }
8043 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
8044         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8045         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8046         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
8047         return ret_arr;
8048 }
8049
8050 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8051         return Type_clone(&owner->b);
8052 }
8053 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
8054         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8055         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8056         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8057         return tag_ptr(ret_ret, true);
8058 }
8059
8060 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8061         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8062         for (size_t i = 0; i < ret.datalen; i++) {
8063                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8064         }
8065         return ret;
8066 }
8067 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8068         return owner->a;
8069 }
8070 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(uint64_t owner) {
8071         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8072         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8073         memcpy(ret_arr->elems, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
8074         return ret_arr;
8075 }
8076
8077 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8078         return CVec_SocketAddressZ_clone(&owner->b);
8079 }
8080 uint64_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(uint64_t owner) {
8081         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8082         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
8083         uint64_tArray ret_arr = NULL;
8084         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8085         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8086         for (size_t p = 0; p < ret_var.datalen; p++) {
8087                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8088                 *ret_conv_15_copy = ret_var.data[p];
8089                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
8090                 ret_arr_ptr[p] = ret_conv_15_ref;
8091         }
8092         
8093         FREE(ret_var.data);
8094         return ret_arr;
8095 }
8096
8097 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
8098         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
8099         for (size_t i = 0; i < ret.datalen; i++) {
8100                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
8101         }
8102         return ret;
8103 }
8104 typedef struct LDKOnionMessageContents_JCalls {
8105         atomic_size_t refcnt;
8106         uint32_t instance_ptr;
8107 } LDKOnionMessageContents_JCalls;
8108 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
8109         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8110         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8111                 FREE(j_calls);
8112         }
8113 }
8114 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
8115         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8116         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 44, 0, 0, 0, 0, 0, 0);
8117 }
8118 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
8119         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8120         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, 0, 0, 0, 0, 0, 0);
8121         LDKCVec_u8Z ret_ref;
8122         ret_ref.datalen = ret->arr_len;
8123         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8124         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8125         return ret_ref;
8126 }
8127 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
8128         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8129         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, 0, 0, 0, 0, 0, 0);
8130         LDKStr ret_conv = str_ref_to_owned_c(ret);
8131         return ret_conv;
8132 }
8133 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
8134         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
8135         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8136 }
8137 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JSValue o) {
8138         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
8139         atomic_init(&calls->refcnt, 1);
8140         calls->instance_ptr = o;
8141
8142         LDKOnionMessageContents ret = {
8143                 .this_arg = (void*) calls,
8144                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
8145                 .write = write_LDKOnionMessageContents_jcall,
8146                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
8147                 .cloned = LDKOnionMessageContents_JCalls_cloned,
8148                 .free = LDKOnionMessageContents_JCalls_free,
8149         };
8150         return ret;
8151 }
8152 uint64_t  __attribute__((export_name("TS_LDKOnionMessageContents_new"))) TS_LDKOnionMessageContents_new(JSValue o) {
8153         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8154         *res_ptr = LDKOnionMessageContents_init(o);
8155         return tag_ptr(res_ptr, true);
8156 }
8157 int64_t  __attribute__((export_name("TS_OnionMessageContents_tlv_type"))) TS_OnionMessageContents_tlv_type(uint64_t this_arg) {
8158         void* this_arg_ptr = untag_ptr(this_arg);
8159         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8160         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8161         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
8162         return ret_conv;
8163 }
8164
8165 int8_tArray  __attribute__((export_name("TS_OnionMessageContents_write"))) TS_OnionMessageContents_write(uint64_t this_arg) {
8166         void* this_arg_ptr = untag_ptr(this_arg);
8167         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8168         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8169         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8170         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8171         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8172         CVec_u8Z_free(ret_var);
8173         return ret_arr;
8174 }
8175
8176 jstring  __attribute__((export_name("TS_OnionMessageContents_debug_str"))) TS_OnionMessageContents_debug_str(uint64_t this_arg) {
8177         void* this_arg_ptr = untag_ptr(this_arg);
8178         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8179         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8180         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8181         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8182         Str_free(ret_str);
8183         return ret_conv;
8184 }
8185
8186 uint32_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
8187         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8188         switch(obj->tag) {
8189                 case LDKCOption_OnionMessageContentsZ_Some: return 0;
8190                 case LDKCOption_OnionMessageContentsZ_None: return 1;
8191                 default: abort();
8192         }
8193 }
8194 uint64_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_OnionMessageContentsZ_Some_get_some(uint64_t ptr) {
8195         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8196         assert(obj->tag == LDKCOption_OnionMessageContentsZ_Some);
8197         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8198         *some_ret = OnionMessageContents_clone(&obj->some);
8199         return tag_ptr(some_ret, true);
8200 }
8201 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8202 CHECK(owner->result_ok);
8203         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
8204 }
8205 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
8206         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8207         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
8208         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
8209         uint64_t ret_ref = tag_ptr(ret_copy, true);
8210         return ret_ref;
8211 }
8212
8213 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8214 CHECK(!owner->result_ok);
8215         return DecodeError_clone(&*owner->contents.err);
8216 }
8217 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
8218         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8219         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8220         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
8221         uint64_t ret_ref = tag_ptr(ret_copy, true);
8222         return ret_ref;
8223 }
8224
8225 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8226         return OnionMessageContents_clone(&owner->a);
8227 }
8228 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(uint64_t owner) {
8229         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8230         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8231         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
8232         return tag_ptr(ret_ret, true);
8233 }
8234
8235 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8236         return Destination_clone(&owner->b);
8237 }
8238 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(uint64_t owner) {
8239         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8240         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
8241         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
8242         uint64_t ret_ref = tag_ptr(ret_copy, true);
8243         return ret_ref;
8244 }
8245
8246 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8247         LDKBlindedPath ret = owner->c;
8248         ret.is_owned = false;
8249         return ret;
8250 }
8251 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(uint64_t owner) {
8252         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8253         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
8254         uint64_t ret_ref = 0;
8255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8257         return ret_ref;
8258 }
8259
8260 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
8261         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
8262         for (size_t i = 0; i < ret.datalen; i++) {
8263                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
8264         }
8265         return ret;
8266 }
8267 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
8268         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8269         switch(obj->tag) {
8270                 case LDKCOption_TypeZ_Some: return 0;
8271                 case LDKCOption_TypeZ_None: return 1;
8272                 default: abort();
8273         }
8274 }
8275 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
8276         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8277         assert(obj->tag == LDKCOption_TypeZ_Some);
8278         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
8279         *some_ret = Type_clone(&obj->some);
8280         return tag_ptr(some_ret, true);
8281 }
8282 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8283 CHECK(owner->result_ok);
8284         return COption_TypeZ_clone(&*owner->contents.result);
8285 }
8286 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
8287         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8288         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
8289         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
8290         uint64_t ret_ref = tag_ptr(ret_copy, true);
8291         return ret_ref;
8292 }
8293
8294 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8295 CHECK(!owner->result_ok);
8296         return DecodeError_clone(&*owner->contents.err);
8297 }
8298 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
8299         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8300         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8301         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
8302         uint64_t ret_ref = tag_ptr(ret_copy, true);
8303         return ret_ref;
8304 }
8305
8306 uint32_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_ty_from_ptr"))) TS_LDKCOption_SocketAddressZ_ty_from_ptr(uint64_t ptr) {
8307         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8308         switch(obj->tag) {
8309                 case LDKCOption_SocketAddressZ_Some: return 0;
8310                 case LDKCOption_SocketAddressZ_None: return 1;
8311                 default: abort();
8312         }
8313 }
8314 uint64_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_Some_get_some"))) TS_LDKCOption_SocketAddressZ_Some_get_some(uint64_t ptr) {
8315         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8316         assert(obj->tag == LDKCOption_SocketAddressZ_Some);
8317         uint64_t some_ref = tag_ptr(&obj->some, false);
8318         return some_ref;
8319 }
8320 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8321 CHECK(owner->result_ok);
8322         return CVec_u8Z_clone(&*owner->contents.result);
8323 }
8324 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
8325         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8326         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8327         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8328         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8329         CVec_u8Z_free(ret_var);
8330         return ret_arr;
8331 }
8332
8333 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8334         LDKPeerHandleError ret = *owner->contents.err;
8335         ret.is_owned = false;
8336         return ret;
8337 }
8338 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
8339         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8340         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8341         uint64_t ret_ref = 0;
8342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8344         return ret_ref;
8345 }
8346
8347 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8348 CHECK(owner->result_ok);
8349         return *owner->contents.result;
8350 }
8351 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
8352         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8353         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8354 }
8355
8356 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8357         LDKPeerHandleError ret = *owner->contents.err;
8358         ret.is_owned = false;
8359         return ret;
8360 }
8361 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
8362         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8363         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8364         uint64_t ret_ref = 0;
8365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8367         return ret_ref;
8368 }
8369
8370 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8371 CHECK(owner->result_ok);
8372         return *owner->contents.result;
8373 }
8374 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
8375         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8376         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8377         return ret_conv;
8378 }
8379
8380 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8381         LDKPeerHandleError ret = *owner->contents.err;
8382         ret.is_owned = false;
8383         return ret;
8384 }
8385 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
8386         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8387         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8388         uint64_t ret_ref = 0;
8389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8391         return ret_ref;
8392 }
8393
8394 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
8395         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8396         switch(obj->tag) {
8397                 case LDKGraphSyncError_DecodeError: return 0;
8398                 case LDKGraphSyncError_LightningError: return 1;
8399                 default: abort();
8400         }
8401 }
8402 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
8403         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8404         assert(obj->tag == LDKGraphSyncError_DecodeError);
8405         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
8406         return decode_error_ref;
8407 }
8408 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
8409         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8410         assert(obj->tag == LDKGraphSyncError_LightningError);
8411         LDKLightningError lightning_error_var = obj->lightning_error;
8412                         uint64_t lightning_error_ref = 0;
8413                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8414                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
8415         return lightning_error_ref;
8416 }
8417 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8418 CHECK(owner->result_ok);
8419         return *owner->contents.result;
8420 }
8421 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
8422         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8423         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8424         return ret_conv;
8425 }
8426
8427 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8428 CHECK(!owner->result_ok);
8429         return GraphSyncError_clone(&*owner->contents.err);
8430 }
8431 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
8432         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8433         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8434         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8435         uint64_t ret_ref = tag_ptr(ret_copy, true);
8436         return ret_ref;
8437 }
8438
8439 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
8440 CHECK(owner->result_ok);
8441         return CVec_u8Z_clone(&*owner->contents.result);
8442 }
8443 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_ok"))) TS_CResult_CVec_u8ZIOErrorZ_get_ok(uint64_t owner) {
8444         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
8445         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
8446         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8447         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8448         CVec_u8Z_free(ret_var);
8449         return ret_arr;
8450 }
8451
8452 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
8453 CHECK(!owner->result_ok);
8454         return *owner->contents.err;
8455 }
8456 uint32_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_err"))) TS_CResult_CVec_u8ZIOErrorZ_get_err(uint64_t owner) {
8457         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
8458         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
8459         return ret_conv;
8460 }
8461
8462 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
8463 CHECK(owner->result_ok);
8464         return *owner->contents.result;
8465 }
8466 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_ok"))) TS_CResult_NoneIOErrorZ_get_ok(uint64_t owner) {
8467         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
8468         CResult_NoneIOErrorZ_get_ok(owner_conv);
8469 }
8470
8471 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
8472 CHECK(!owner->result_ok);
8473         return *owner->contents.err;
8474 }
8475 uint32_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_err"))) TS_CResult_NoneIOErrorZ_get_err(uint64_t owner) {
8476         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
8477         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneIOErrorZ_get_err(owner_conv));
8478         return ret_conv;
8479 }
8480
8481 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
8482 CHECK(owner->result_ok);
8483         return *owner->contents.result;
8484 }
8485 ptrArray  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_ok"))) TS_CResult_CVec_StrZIOErrorZ_get_ok(uint64_t owner) {
8486         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
8487         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
8488         ptrArray ret_arr = NULL;
8489         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8490         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
8491         for (size_t i = 0; i < ret_var.datalen; i++) {
8492                 LDKStr ret_conv_8_str = ret_var.data[i];
8493                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
8494                 ret_arr_ptr[i] = ret_conv_8_conv;
8495         }
8496         
8497         return ret_arr;
8498 }
8499
8500 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
8501 CHECK(!owner->result_ok);
8502         return *owner->contents.err;
8503 }
8504 uint32_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_err"))) TS_CResult_CVec_StrZIOErrorZ_get_err(uint64_t owner) {
8505         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
8506         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
8507         return ret_conv;
8508 }
8509
8510 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
8511         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
8512         for (size_t i = 0; i < ret.datalen; i++) {
8513                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
8514         }
8515         return ret;
8516 }
8517 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
8518 CHECK(owner->result_ok);
8519         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
8520 }
8521 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(uint64_t owner) {
8522         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8523         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
8524         uint64_tArray ret_arr = NULL;
8525         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8526         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8527         for (size_t o = 0; o < ret_var.datalen; o++) {
8528                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8529                 *ret_conv_40_conv = ret_var.data[o];
8530                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
8531         }
8532         
8533         FREE(ret_var.data);
8534         return ret_arr;
8535 }
8536
8537 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
8538 CHECK(!owner->result_ok);
8539         return *owner->contents.err;
8540 }
8541 uint32_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(uint64_t owner) {
8542         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8543         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
8544         return ret_conv;
8545 }
8546
8547 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8548 CHECK(owner->result_ok);
8549         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
8550 }
8551 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(uint64_t owner) {
8552         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8553         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8554         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
8555         return tag_ptr(ret_conv, true);
8556 }
8557
8558 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8559 CHECK(!owner->result_ok);
8560         return *owner->contents.err;
8561 }
8562 uint32_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(uint64_t owner) {
8563         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8564         uint32_t ret_conv = LDKIOError_to_js(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
8565         return ret_conv;
8566 }
8567
8568 static inline struct LDKUnsignedInvoiceRequest CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
8569         LDKUnsignedInvoiceRequest ret = *owner->contents.result;
8570         ret.is_owned = false;
8571         return ret;
8572 }
8573 uint64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(uint64_t owner) {
8574         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
8575         LDKUnsignedInvoiceRequest ret_var = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
8576         uint64_t ret_ref = 0;
8577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8579         return ret_ref;
8580 }
8581
8582 static inline enum LDKBolt12SemanticError CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
8583 CHECK(!owner->result_ok);
8584         return Bolt12SemanticError_clone(&*owner->contents.err);
8585 }
8586 uint32_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(uint64_t owner) {
8587         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
8588         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
8589         return ret_conv;
8590 }
8591
8592 static inline struct LDKInvoiceRequest CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
8593         LDKInvoiceRequest ret = *owner->contents.result;
8594         ret.is_owned = false;
8595         return ret;
8596 }
8597 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(uint64_t owner) {
8598         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
8599         LDKInvoiceRequest ret_var = CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
8600         uint64_t ret_ref = 0;
8601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8603         return ret_ref;
8604 }
8605
8606 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
8607 CHECK(!owner->result_ok);
8608         return Bolt12SemanticError_clone(&*owner->contents.err);
8609 }
8610 uint32_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(uint64_t owner) {
8611         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
8612         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
8613         return ret_conv;
8614 }
8615
8616 uint32_t __attribute__((export_name("TS_LDKCOption_SecretKeyZ_ty_from_ptr"))) TS_LDKCOption_SecretKeyZ_ty_from_ptr(uint64_t ptr) {
8617         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8618         switch(obj->tag) {
8619                 case LDKCOption_SecretKeyZ_Some: return 0;
8620                 case LDKCOption_SecretKeyZ_None: return 1;
8621                 default: abort();
8622         }
8623 }
8624 int8_tArray __attribute__((export_name("TS_LDKCOption_SecretKeyZ_Some_get_some"))) TS_LDKCOption_SecretKeyZ_Some_get_some(uint64_t ptr) {
8625         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8626         assert(obj->tag == LDKCOption_SecretKeyZ_Some);
8627         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
8628         memcpy(some_arr->elems, obj->some.bytes, 32);
8629         return some_arr;
8630 }
8631 static inline struct LDKInvoiceWithExplicitSigningPubkeyBuilder CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8632         LDKInvoiceWithExplicitSigningPubkeyBuilder ret = *owner->contents.result;
8633         ret.is_owned = false;
8634         return ret;
8635 }
8636 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
8637         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8638         LDKInvoiceWithExplicitSigningPubkeyBuilder ret_var = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
8639         uint64_t ret_ref = 0;
8640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8642         return ret_ref;
8643 }
8644
8645 static inline enum LDKBolt12SemanticError CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8646 CHECK(!owner->result_ok);
8647         return Bolt12SemanticError_clone(&*owner->contents.err);
8648 }
8649 uint32_t  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
8650         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8651         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
8652         return ret_conv;
8653 }
8654
8655 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8656         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
8657         ret.is_owned = false;
8658         return ret;
8659 }
8660 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok(uint64_t owner) {
8661         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8662         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
8663         uint64_t ret_ref = 0;
8664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8666         return ret_ref;
8667 }
8668
8669 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8670 CHECK(!owner->result_ok);
8671         return *owner->contents.err;
8672 }
8673 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_err(uint64_t owner) {
8674         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8675         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
8676 }
8677
8678 static inline struct LDKInvoiceWithDerivedSigningPubkeyBuilder CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8679         LDKInvoiceWithDerivedSigningPubkeyBuilder ret = *owner->contents.result;
8680         ret.is_owned = false;
8681         return ret;
8682 }
8683 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
8684         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8685         LDKInvoiceWithDerivedSigningPubkeyBuilder ret_var = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
8686         uint64_t ret_ref = 0;
8687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8689         return ret_ref;
8690 }
8691
8692 static inline enum LDKBolt12SemanticError CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8693 CHECK(!owner->result_ok);
8694         return Bolt12SemanticError_clone(&*owner->contents.err);
8695 }
8696 uint32_t  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
8697         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8698         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
8699         return ret_conv;
8700 }
8701
8702 static inline struct LDKInvoiceRequestFields CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
8703         LDKInvoiceRequestFields ret = *owner->contents.result;
8704         ret.is_owned = false;
8705         return ret;
8706 }
8707 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(uint64_t owner) {
8708         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
8709         LDKInvoiceRequestFields ret_var = CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(owner_conv);
8710         uint64_t ret_ref = 0;
8711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8713         return ret_ref;
8714 }
8715
8716 static inline struct LDKDecodeError CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
8717 CHECK(!owner->result_ok);
8718         return DecodeError_clone(&*owner->contents.err);
8719 }
8720 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_get_err"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(uint64_t owner) {
8721         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
8722         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8723         *ret_copy = CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(owner_conv);
8724         uint64_t ret_ref = tag_ptr(ret_copy, true);
8725         return ret_ref;
8726 }
8727
8728 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
8729         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
8730         for (size_t i = 0; i < ret.datalen; i++) {
8731                 ret.data[i] = Witness_clone(&orig->data[i]);
8732         }
8733         return ret;
8734 }
8735 uint32_t __attribute__((export_name("TS_LDKCOption_ECDSASignatureZ_ty_from_ptr"))) TS_LDKCOption_ECDSASignatureZ_ty_from_ptr(uint64_t ptr) {
8736         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
8737         switch(obj->tag) {
8738                 case LDKCOption_ECDSASignatureZ_Some: return 0;
8739                 case LDKCOption_ECDSASignatureZ_None: return 1;
8740                 default: abort();
8741         }
8742 }
8743 int8_tArray __attribute__((export_name("TS_LDKCOption_ECDSASignatureZ_Some_get_some"))) TS_LDKCOption_ECDSASignatureZ_Some_get_some(uint64_t ptr) {
8744         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
8745         assert(obj->tag == LDKCOption_ECDSASignatureZ_Some);
8746         int8_tArray some_arr = init_int8_tArray(64, __LINE__);
8747         memcpy(some_arr->elems, obj->some.compact_form, 64);
8748         return some_arr;
8749 }
8750 uint32_t __attribute__((export_name("TS_LDKCOption_i64Z_ty_from_ptr"))) TS_LDKCOption_i64Z_ty_from_ptr(uint64_t ptr) {
8751         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8752         switch(obj->tag) {
8753                 case LDKCOption_i64Z_Some: return 0;
8754                 case LDKCOption_i64Z_None: return 1;
8755                 default: abort();
8756         }
8757 }
8758 int64_t __attribute__((export_name("TS_LDKCOption_i64Z_Some_get_some"))) TS_LDKCOption_i64Z_Some_get_some(uint64_t ptr) {
8759         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8760         assert(obj->tag == LDKCOption_i64Z_Some);
8761         int64_t some_conv = obj->some;
8762         return some_conv;
8763 }
8764 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8765 CHECK(owner->result_ok);
8766         return SocketAddress_clone(&*owner->contents.result);
8767 }
8768 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_ok"))) TS_CResult_SocketAddressDecodeErrorZ_get_ok(uint64_t owner) {
8769         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8770         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8771         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
8772         uint64_t ret_ref = tag_ptr(ret_copy, true);
8773         return ret_ref;
8774 }
8775
8776 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8777 CHECK(!owner->result_ok);
8778         return DecodeError_clone(&*owner->contents.err);
8779 }
8780 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_err"))) TS_CResult_SocketAddressDecodeErrorZ_get_err(uint64_t owner) {
8781         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8782         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8783         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
8784         uint64_t ret_ref = tag_ptr(ret_copy, true);
8785         return ret_ref;
8786 }
8787
8788 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8789 CHECK(owner->result_ok);
8790         return SocketAddress_clone(&*owner->contents.result);
8791 }
8792 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(uint64_t owner) {
8793         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8794         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8795         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
8796         uint64_t ret_ref = tag_ptr(ret_copy, true);
8797         return ret_ref;
8798 }
8799
8800 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8801 CHECK(!owner->result_ok);
8802         return SocketAddressParseError_clone(&*owner->contents.err);
8803 }
8804 uint32_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err(uint64_t owner) {
8805         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8806         uint32_t ret_conv = LDKSocketAddressParseError_to_js(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
8807         return ret_conv;
8808 }
8809
8810 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8811         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8812         for (size_t i = 0; i < ret.datalen; i++) {
8813                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8814         }
8815         return ret;
8816 }
8817 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8818         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8819         for (size_t i = 0; i < ret.datalen; i++) {
8820                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8821         }
8822         return ret;
8823 }
8824 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8825         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8826         for (size_t i = 0; i < ret.datalen; i++) {
8827                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8828         }
8829         return ret;
8830 }
8831 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8832         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8833         for (size_t i = 0; i < ret.datalen; i++) {
8834                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8835         }
8836         return ret;
8837 }
8838 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8839         LDKAcceptChannel ret = *owner->contents.result;
8840         ret.is_owned = false;
8841         return ret;
8842 }
8843 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
8844         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8845         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8846         uint64_t ret_ref = 0;
8847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8849         return ret_ref;
8850 }
8851
8852 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8853 CHECK(!owner->result_ok);
8854         return DecodeError_clone(&*owner->contents.err);
8855 }
8856 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
8857         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8858         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8859         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8860         uint64_t ret_ref = tag_ptr(ret_copy, true);
8861         return ret_ref;
8862 }
8863
8864 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8865         LDKAcceptChannelV2 ret = *owner->contents.result;
8866         ret.is_owned = false;
8867         return ret;
8868 }
8869 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
8870         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8871         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
8872         uint64_t ret_ref = 0;
8873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8875         return ret_ref;
8876 }
8877
8878 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8879 CHECK(!owner->result_ok);
8880         return DecodeError_clone(&*owner->contents.err);
8881 }
8882 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_err(uint64_t owner) {
8883         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8884         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8885         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
8886         uint64_t ret_ref = tag_ptr(ret_copy, true);
8887         return ret_ref;
8888 }
8889
8890 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8891         LDKStfu ret = *owner->contents.result;
8892         ret.is_owned = false;
8893         return ret;
8894 }
8895 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_get_ok"))) TS_CResult_StfuDecodeErrorZ_get_ok(uint64_t owner) {
8896         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8897         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
8898         uint64_t ret_ref = 0;
8899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8901         return ret_ref;
8902 }
8903
8904 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8905 CHECK(!owner->result_ok);
8906         return DecodeError_clone(&*owner->contents.err);
8907 }
8908 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_get_err"))) TS_CResult_StfuDecodeErrorZ_get_err(uint64_t owner) {
8909         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8910         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8911         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
8912         uint64_t ret_ref = tag_ptr(ret_copy, true);
8913         return ret_ref;
8914 }
8915
8916 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8917         LDKSplice ret = *owner->contents.result;
8918         ret.is_owned = false;
8919         return ret;
8920 }
8921 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_get_ok"))) TS_CResult_SpliceDecodeErrorZ_get_ok(uint64_t owner) {
8922         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8923         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
8924         uint64_t ret_ref = 0;
8925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8927         return ret_ref;
8928 }
8929
8930 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8931 CHECK(!owner->result_ok);
8932         return DecodeError_clone(&*owner->contents.err);
8933 }
8934 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_get_err"))) TS_CResult_SpliceDecodeErrorZ_get_err(uint64_t owner) {
8935         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8936         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8937         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
8938         uint64_t ret_ref = tag_ptr(ret_copy, true);
8939         return ret_ref;
8940 }
8941
8942 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8943         LDKSpliceAck ret = *owner->contents.result;
8944         ret.is_owned = false;
8945         return ret;
8946 }
8947 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_get_ok"))) TS_CResult_SpliceAckDecodeErrorZ_get_ok(uint64_t owner) {
8948         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8949         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
8950         uint64_t ret_ref = 0;
8951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8953         return ret_ref;
8954 }
8955
8956 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8957 CHECK(!owner->result_ok);
8958         return DecodeError_clone(&*owner->contents.err);
8959 }
8960 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_get_err"))) TS_CResult_SpliceAckDecodeErrorZ_get_err(uint64_t owner) {
8961         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8962         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8963         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
8964         uint64_t ret_ref = tag_ptr(ret_copy, true);
8965         return ret_ref;
8966 }
8967
8968 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8969         LDKSpliceLocked ret = *owner->contents.result;
8970         ret.is_owned = false;
8971         return ret;
8972 }
8973 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_get_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_get_ok(uint64_t owner) {
8974         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8975         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
8976         uint64_t ret_ref = 0;
8977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8979         return ret_ref;
8980 }
8981
8982 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8983 CHECK(!owner->result_ok);
8984         return DecodeError_clone(&*owner->contents.err);
8985 }
8986 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_get_err"))) TS_CResult_SpliceLockedDecodeErrorZ_get_err(uint64_t owner) {
8987         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8988         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8989         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
8990         uint64_t ret_ref = tag_ptr(ret_copy, true);
8991         return ret_ref;
8992 }
8993
8994 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8995         LDKTxAddInput ret = *owner->contents.result;
8996         ret.is_owned = false;
8997         return ret;
8998 }
8999 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_ok"))) TS_CResult_TxAddInputDecodeErrorZ_get_ok(uint64_t owner) {
9000         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
9001         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
9002         uint64_t ret_ref = 0;
9003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9005         return ret_ref;
9006 }
9007
9008 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
9009 CHECK(!owner->result_ok);
9010         return DecodeError_clone(&*owner->contents.err);
9011 }
9012 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_err"))) TS_CResult_TxAddInputDecodeErrorZ_get_err(uint64_t owner) {
9013         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
9014         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9015         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
9016         uint64_t ret_ref = tag_ptr(ret_copy, true);
9017         return ret_ref;
9018 }
9019
9020 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
9021         LDKTxAddOutput ret = *owner->contents.result;
9022         ret.is_owned = false;
9023         return ret;
9024 }
9025 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_get_ok(uint64_t owner) {
9026         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
9027         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
9028         uint64_t ret_ref = 0;
9029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9031         return ret_ref;
9032 }
9033
9034 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
9035 CHECK(!owner->result_ok);
9036         return DecodeError_clone(&*owner->contents.err);
9037 }
9038 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_err"))) TS_CResult_TxAddOutputDecodeErrorZ_get_err(uint64_t owner) {
9039         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
9040         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9041         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
9042         uint64_t ret_ref = tag_ptr(ret_copy, true);
9043         return ret_ref;
9044 }
9045
9046 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
9047         LDKTxRemoveInput ret = *owner->contents.result;
9048         ret.is_owned = false;
9049         return ret;
9050 }
9051 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_ok(uint64_t owner) {
9052         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
9053         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
9054         uint64_t ret_ref = 0;
9055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9057         return ret_ref;
9058 }
9059
9060 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
9061 CHECK(!owner->result_ok);
9062         return DecodeError_clone(&*owner->contents.err);
9063 }
9064 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_err(uint64_t owner) {
9065         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
9066         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9067         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
9068         uint64_t ret_ref = tag_ptr(ret_copy, true);
9069         return ret_ref;
9070 }
9071
9072 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9073         LDKTxRemoveOutput ret = *owner->contents.result;
9074         ret.is_owned = false;
9075         return ret;
9076 }
9077 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok(uint64_t owner) {
9078         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9079         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
9080         uint64_t ret_ref = 0;
9081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9083         return ret_ref;
9084 }
9085
9086 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9087 CHECK(!owner->result_ok);
9088         return DecodeError_clone(&*owner->contents.err);
9089 }
9090 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_err(uint64_t owner) {
9091         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9092         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9093         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
9094         uint64_t ret_ref = tag_ptr(ret_copy, true);
9095         return ret_ref;
9096 }
9097
9098 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9099         LDKTxComplete ret = *owner->contents.result;
9100         ret.is_owned = false;
9101         return ret;
9102 }
9103 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_ok"))) TS_CResult_TxCompleteDecodeErrorZ_get_ok(uint64_t owner) {
9104         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9105         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
9106         uint64_t ret_ref = 0;
9107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9109         return ret_ref;
9110 }
9111
9112 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9113 CHECK(!owner->result_ok);
9114         return DecodeError_clone(&*owner->contents.err);
9115 }
9116 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_err"))) TS_CResult_TxCompleteDecodeErrorZ_get_err(uint64_t owner) {
9117         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9118         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9119         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
9120         uint64_t ret_ref = tag_ptr(ret_copy, true);
9121         return ret_ref;
9122 }
9123
9124 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9125         LDKTxSignatures ret = *owner->contents.result;
9126         ret.is_owned = false;
9127         return ret;
9128 }
9129 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
9130         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9131         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
9132         uint64_t ret_ref = 0;
9133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9135         return ret_ref;
9136 }
9137
9138 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9139 CHECK(!owner->result_ok);
9140         return DecodeError_clone(&*owner->contents.err);
9141 }
9142 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_err"))) TS_CResult_TxSignaturesDecodeErrorZ_get_err(uint64_t owner) {
9143         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9144         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9145         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
9146         uint64_t ret_ref = tag_ptr(ret_copy, true);
9147         return ret_ref;
9148 }
9149
9150 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9151         LDKTxInitRbf ret = *owner->contents.result;
9152         ret.is_owned = false;
9153         return ret;
9154 }
9155 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_get_ok(uint64_t owner) {
9156         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9157         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
9158         uint64_t ret_ref = 0;
9159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9161         return ret_ref;
9162 }
9163
9164 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9165 CHECK(!owner->result_ok);
9166         return DecodeError_clone(&*owner->contents.err);
9167 }
9168 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_err"))) TS_CResult_TxInitRbfDecodeErrorZ_get_err(uint64_t owner) {
9169         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9170         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9171         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
9172         uint64_t ret_ref = tag_ptr(ret_copy, true);
9173         return ret_ref;
9174 }
9175
9176 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9177         LDKTxAckRbf ret = *owner->contents.result;
9178         ret.is_owned = false;
9179         return ret;
9180 }
9181 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_get_ok(uint64_t owner) {
9182         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9183         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
9184         uint64_t ret_ref = 0;
9185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9187         return ret_ref;
9188 }
9189
9190 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9191 CHECK(!owner->result_ok);
9192         return DecodeError_clone(&*owner->contents.err);
9193 }
9194 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_err"))) TS_CResult_TxAckRbfDecodeErrorZ_get_err(uint64_t owner) {
9195         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9196         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9197         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
9198         uint64_t ret_ref = tag_ptr(ret_copy, true);
9199         return ret_ref;
9200 }
9201
9202 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9203         LDKTxAbort ret = *owner->contents.result;
9204         ret.is_owned = false;
9205         return ret;
9206 }
9207 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_ok"))) TS_CResult_TxAbortDecodeErrorZ_get_ok(uint64_t owner) {
9208         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9209         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
9210         uint64_t ret_ref = 0;
9211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9213         return ret_ref;
9214 }
9215
9216 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9217 CHECK(!owner->result_ok);
9218         return DecodeError_clone(&*owner->contents.err);
9219 }
9220 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_err"))) TS_CResult_TxAbortDecodeErrorZ_get_err(uint64_t owner) {
9221         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9222         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9223         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
9224         uint64_t ret_ref = tag_ptr(ret_copy, true);
9225         return ret_ref;
9226 }
9227
9228 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9229         LDKAnnouncementSignatures ret = *owner->contents.result;
9230         ret.is_owned = false;
9231         return ret;
9232 }
9233 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
9234         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9235         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
9236         uint64_t ret_ref = 0;
9237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9239         return ret_ref;
9240 }
9241
9242 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9243 CHECK(!owner->result_ok);
9244         return DecodeError_clone(&*owner->contents.err);
9245 }
9246 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
9247         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9248         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9249         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
9250         uint64_t ret_ref = tag_ptr(ret_copy, true);
9251         return ret_ref;
9252 }
9253
9254 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9255         LDKChannelReestablish ret = *owner->contents.result;
9256         ret.is_owned = false;
9257         return ret;
9258 }
9259 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
9260         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9261         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
9262         uint64_t ret_ref = 0;
9263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9265         return ret_ref;
9266 }
9267
9268 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9269 CHECK(!owner->result_ok);
9270         return DecodeError_clone(&*owner->contents.err);
9271 }
9272 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
9273         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9274         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9275         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
9276         uint64_t ret_ref = tag_ptr(ret_copy, true);
9277         return ret_ref;
9278 }
9279
9280 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9281         LDKClosingSigned ret = *owner->contents.result;
9282         ret.is_owned = false;
9283         return ret;
9284 }
9285 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
9286         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9287         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
9288         uint64_t ret_ref = 0;
9289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9291         return ret_ref;
9292 }
9293
9294 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9295 CHECK(!owner->result_ok);
9296         return DecodeError_clone(&*owner->contents.err);
9297 }
9298 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
9299         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9300         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9301         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
9302         uint64_t ret_ref = tag_ptr(ret_copy, true);
9303         return ret_ref;
9304 }
9305
9306 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9307         LDKClosingSignedFeeRange ret = *owner->contents.result;
9308         ret.is_owned = false;
9309         return ret;
9310 }
9311 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
9312         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9313         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
9314         uint64_t ret_ref = 0;
9315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9317         return ret_ref;
9318 }
9319
9320 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9321 CHECK(!owner->result_ok);
9322         return DecodeError_clone(&*owner->contents.err);
9323 }
9324 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
9325         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9326         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9327         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
9328         uint64_t ret_ref = tag_ptr(ret_copy, true);
9329         return ret_ref;
9330 }
9331
9332 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9333         LDKCommitmentSigned ret = *owner->contents.result;
9334         ret.is_owned = false;
9335         return ret;
9336 }
9337 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
9338         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9339         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
9340         uint64_t ret_ref = 0;
9341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9343         return ret_ref;
9344 }
9345
9346 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9347 CHECK(!owner->result_ok);
9348         return DecodeError_clone(&*owner->contents.err);
9349 }
9350 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
9351         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9352         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9353         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
9354         uint64_t ret_ref = tag_ptr(ret_copy, true);
9355         return ret_ref;
9356 }
9357
9358 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9359         LDKFundingCreated ret = *owner->contents.result;
9360         ret.is_owned = false;
9361         return ret;
9362 }
9363 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
9364         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9365         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
9366         uint64_t ret_ref = 0;
9367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9369         return ret_ref;
9370 }
9371
9372 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9373 CHECK(!owner->result_ok);
9374         return DecodeError_clone(&*owner->contents.err);
9375 }
9376 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
9377         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9378         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9379         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
9380         uint64_t ret_ref = tag_ptr(ret_copy, true);
9381         return ret_ref;
9382 }
9383
9384 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9385         LDKFundingSigned ret = *owner->contents.result;
9386         ret.is_owned = false;
9387         return ret;
9388 }
9389 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
9390         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9391         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
9392         uint64_t ret_ref = 0;
9393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9395         return ret_ref;
9396 }
9397
9398 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9399 CHECK(!owner->result_ok);
9400         return DecodeError_clone(&*owner->contents.err);
9401 }
9402 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
9403         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9404         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9405         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
9406         uint64_t ret_ref = tag_ptr(ret_copy, true);
9407         return ret_ref;
9408 }
9409
9410 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9411         LDKChannelReady ret = *owner->contents.result;
9412         ret.is_owned = false;
9413         return ret;
9414 }
9415 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
9416         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9417         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
9418         uint64_t ret_ref = 0;
9419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9421         return ret_ref;
9422 }
9423
9424 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9425 CHECK(!owner->result_ok);
9426         return DecodeError_clone(&*owner->contents.err);
9427 }
9428 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
9429         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9430         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9431         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
9432         uint64_t ret_ref = tag_ptr(ret_copy, true);
9433         return ret_ref;
9434 }
9435
9436 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9437         LDKInit ret = *owner->contents.result;
9438         ret.is_owned = false;
9439         return ret;
9440 }
9441 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
9442         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9443         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
9444         uint64_t ret_ref = 0;
9445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9447         return ret_ref;
9448 }
9449
9450 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9451 CHECK(!owner->result_ok);
9452         return DecodeError_clone(&*owner->contents.err);
9453 }
9454 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
9455         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9456         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9457         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
9458         uint64_t ret_ref = tag_ptr(ret_copy, true);
9459         return ret_ref;
9460 }
9461
9462 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9463         LDKOpenChannel ret = *owner->contents.result;
9464         ret.is_owned = false;
9465         return ret;
9466 }
9467 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
9468         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9469         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
9470         uint64_t ret_ref = 0;
9471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9473         return ret_ref;
9474 }
9475
9476 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9477 CHECK(!owner->result_ok);
9478         return DecodeError_clone(&*owner->contents.err);
9479 }
9480 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
9481         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9482         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9483         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
9484         uint64_t ret_ref = tag_ptr(ret_copy, true);
9485         return ret_ref;
9486 }
9487
9488 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9489         LDKOpenChannelV2 ret = *owner->contents.result;
9490         ret.is_owned = false;
9491         return ret;
9492 }
9493 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
9494         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9495         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
9496         uint64_t ret_ref = 0;
9497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9499         return ret_ref;
9500 }
9501
9502 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9503 CHECK(!owner->result_ok);
9504         return DecodeError_clone(&*owner->contents.err);
9505 }
9506 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_err(uint64_t owner) {
9507         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9508         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9509         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
9510         uint64_t ret_ref = tag_ptr(ret_copy, true);
9511         return ret_ref;
9512 }
9513
9514 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9515         LDKRevokeAndACK ret = *owner->contents.result;
9516         ret.is_owned = false;
9517         return ret;
9518 }
9519 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
9520         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9521         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
9522         uint64_t ret_ref = 0;
9523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9525         return ret_ref;
9526 }
9527
9528 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9529 CHECK(!owner->result_ok);
9530         return DecodeError_clone(&*owner->contents.err);
9531 }
9532 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
9533         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9534         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9535         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
9536         uint64_t ret_ref = tag_ptr(ret_copy, true);
9537         return ret_ref;
9538 }
9539
9540 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9541         LDKShutdown ret = *owner->contents.result;
9542         ret.is_owned = false;
9543         return ret;
9544 }
9545 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
9546         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9547         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
9548         uint64_t ret_ref = 0;
9549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9551         return ret_ref;
9552 }
9553
9554 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9555 CHECK(!owner->result_ok);
9556         return DecodeError_clone(&*owner->contents.err);
9557 }
9558 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
9559         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9560         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9561         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
9562         uint64_t ret_ref = tag_ptr(ret_copy, true);
9563         return ret_ref;
9564 }
9565
9566 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9567         LDKUpdateFailHTLC ret = *owner->contents.result;
9568         ret.is_owned = false;
9569         return ret;
9570 }
9571 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9572         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9573         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
9574         uint64_t ret_ref = 0;
9575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9577         return ret_ref;
9578 }
9579
9580 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9581 CHECK(!owner->result_ok);
9582         return DecodeError_clone(&*owner->contents.err);
9583 }
9584 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
9585         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9586         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9587         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
9588         uint64_t ret_ref = tag_ptr(ret_copy, true);
9589         return ret_ref;
9590 }
9591
9592 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9593         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
9594         ret.is_owned = false;
9595         return ret;
9596 }
9597 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9598         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9599         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
9600         uint64_t ret_ref = 0;
9601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9603         return ret_ref;
9604 }
9605
9606 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9607 CHECK(!owner->result_ok);
9608         return DecodeError_clone(&*owner->contents.err);
9609 }
9610 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
9611         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9612         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9613         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9614         uint64_t ret_ref = tag_ptr(ret_copy, true);
9615         return ret_ref;
9616 }
9617
9618 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9619         LDKUpdateFee ret = *owner->contents.result;
9620         ret.is_owned = false;
9621         return ret;
9622 }
9623 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
9624         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9625         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9626         uint64_t ret_ref = 0;
9627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9629         return ret_ref;
9630 }
9631
9632 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9633 CHECK(!owner->result_ok);
9634         return DecodeError_clone(&*owner->contents.err);
9635 }
9636 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
9637         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9638         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9639         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9640         uint64_t ret_ref = tag_ptr(ret_copy, true);
9641         return ret_ref;
9642 }
9643
9644 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9645         LDKUpdateFulfillHTLC ret = *owner->contents.result;
9646         ret.is_owned = false;
9647         return ret;
9648 }
9649 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9650         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9651         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9652         uint64_t ret_ref = 0;
9653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9655         return ret_ref;
9656 }
9657
9658 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9659 CHECK(!owner->result_ok);
9660         return DecodeError_clone(&*owner->contents.err);
9661 }
9662 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
9663         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9664         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9665         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9666         uint64_t ret_ref = tag_ptr(ret_copy, true);
9667         return ret_ref;
9668 }
9669
9670 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9671         LDKOnionPacket ret = *owner->contents.result;
9672         ret.is_owned = false;
9673         return ret;
9674 }
9675 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_get_ok"))) TS_CResult_OnionPacketDecodeErrorZ_get_ok(uint64_t owner) {
9676         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9677         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
9678         uint64_t ret_ref = 0;
9679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9681         return ret_ref;
9682 }
9683
9684 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9685 CHECK(!owner->result_ok);
9686         return DecodeError_clone(&*owner->contents.err);
9687 }
9688 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_get_err"))) TS_CResult_OnionPacketDecodeErrorZ_get_err(uint64_t owner) {
9689         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9690         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9691         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
9692         uint64_t ret_ref = tag_ptr(ret_copy, true);
9693         return ret_ref;
9694 }
9695
9696 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9697         LDKUpdateAddHTLC ret = *owner->contents.result;
9698         ret.is_owned = false;
9699         return ret;
9700 }
9701 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9702         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9703         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9704         uint64_t ret_ref = 0;
9705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9707         return ret_ref;
9708 }
9709
9710 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9711 CHECK(!owner->result_ok);
9712         return DecodeError_clone(&*owner->contents.err);
9713 }
9714 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
9715         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9716         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9717         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9718         uint64_t ret_ref = tag_ptr(ret_copy, true);
9719         return ret_ref;
9720 }
9721
9722 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9723         LDKOnionMessage ret = *owner->contents.result;
9724         ret.is_owned = false;
9725         return ret;
9726 }
9727 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
9728         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9729         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
9730         uint64_t ret_ref = 0;
9731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9733         return ret_ref;
9734 }
9735
9736 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9737 CHECK(!owner->result_ok);
9738         return DecodeError_clone(&*owner->contents.err);
9739 }
9740 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
9741         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9742         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9743         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
9744         uint64_t ret_ref = tag_ptr(ret_copy, true);
9745         return ret_ref;
9746 }
9747
9748 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9749         LDKFinalOnionHopData ret = *owner->contents.result;
9750         ret.is_owned = false;
9751         return ret;
9752 }
9753 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_get_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_get_ok(uint64_t owner) {
9754         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9755         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
9756         uint64_t ret_ref = 0;
9757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9759         return ret_ref;
9760 }
9761
9762 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9763 CHECK(!owner->result_ok);
9764         return DecodeError_clone(&*owner->contents.err);
9765 }
9766 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_get_err"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_get_err(uint64_t owner) {
9767         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9768         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9769         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
9770         uint64_t ret_ref = tag_ptr(ret_copy, true);
9771         return ret_ref;
9772 }
9773
9774 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9775         LDKPing ret = *owner->contents.result;
9776         ret.is_owned = false;
9777         return ret;
9778 }
9779 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
9780         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9781         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9782         uint64_t ret_ref = 0;
9783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9785         return ret_ref;
9786 }
9787
9788 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9789 CHECK(!owner->result_ok);
9790         return DecodeError_clone(&*owner->contents.err);
9791 }
9792 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
9793         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9794         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9795         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
9796         uint64_t ret_ref = tag_ptr(ret_copy, true);
9797         return ret_ref;
9798 }
9799
9800 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9801         LDKPong ret = *owner->contents.result;
9802         ret.is_owned = false;
9803         return ret;
9804 }
9805 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
9806         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9807         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9808         uint64_t ret_ref = 0;
9809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9811         return ret_ref;
9812 }
9813
9814 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9815 CHECK(!owner->result_ok);
9816         return DecodeError_clone(&*owner->contents.err);
9817 }
9818 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
9819         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9820         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9821         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
9822         uint64_t ret_ref = tag_ptr(ret_copy, true);
9823         return ret_ref;
9824 }
9825
9826 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9827         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
9828         ret.is_owned = false;
9829         return ret;
9830 }
9831 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9832         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9833         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9834         uint64_t ret_ref = 0;
9835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9837         return ret_ref;
9838 }
9839
9840 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9841 CHECK(!owner->result_ok);
9842         return DecodeError_clone(&*owner->contents.err);
9843 }
9844 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9845         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9846         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9847         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9848         uint64_t ret_ref = tag_ptr(ret_copy, true);
9849         return ret_ref;
9850 }
9851
9852 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9853         LDKChannelAnnouncement ret = *owner->contents.result;
9854         ret.is_owned = false;
9855         return ret;
9856 }
9857 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9858         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9859         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9860         uint64_t ret_ref = 0;
9861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9863         return ret_ref;
9864 }
9865
9866 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9867 CHECK(!owner->result_ok);
9868         return DecodeError_clone(&*owner->contents.err);
9869 }
9870 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9871         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9872         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9873         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9874         uint64_t ret_ref = tag_ptr(ret_copy, true);
9875         return ret_ref;
9876 }
9877
9878 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9879         LDKUnsignedChannelUpdate ret = *owner->contents.result;
9880         ret.is_owned = false;
9881         return ret;
9882 }
9883 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9884         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9885         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9886         uint64_t ret_ref = 0;
9887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9889         return ret_ref;
9890 }
9891
9892 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9893 CHECK(!owner->result_ok);
9894         return DecodeError_clone(&*owner->contents.err);
9895 }
9896 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9897         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9898         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9899         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9900         uint64_t ret_ref = tag_ptr(ret_copy, true);
9901         return ret_ref;
9902 }
9903
9904 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9905         LDKChannelUpdate ret = *owner->contents.result;
9906         ret.is_owned = false;
9907         return ret;
9908 }
9909 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9910         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9911         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9912         uint64_t ret_ref = 0;
9913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9915         return ret_ref;
9916 }
9917
9918 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9919 CHECK(!owner->result_ok);
9920         return DecodeError_clone(&*owner->contents.err);
9921 }
9922 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9923         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9924         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9925         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9926         uint64_t ret_ref = tag_ptr(ret_copy, true);
9927         return ret_ref;
9928 }
9929
9930 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9931         LDKErrorMessage ret = *owner->contents.result;
9932         ret.is_owned = false;
9933         return ret;
9934 }
9935 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
9936         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9937         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9938         uint64_t ret_ref = 0;
9939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9941         return ret_ref;
9942 }
9943
9944 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9945 CHECK(!owner->result_ok);
9946         return DecodeError_clone(&*owner->contents.err);
9947 }
9948 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
9949         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9950         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9951         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9952         uint64_t ret_ref = tag_ptr(ret_copy, true);
9953         return ret_ref;
9954 }
9955
9956 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9957         LDKWarningMessage ret = *owner->contents.result;
9958         ret.is_owned = false;
9959         return ret;
9960 }
9961 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
9962         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9963         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9964         uint64_t ret_ref = 0;
9965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9967         return ret_ref;
9968 }
9969
9970 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9971 CHECK(!owner->result_ok);
9972         return DecodeError_clone(&*owner->contents.err);
9973 }
9974 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
9975         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9976         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9977         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9978         uint64_t ret_ref = tag_ptr(ret_copy, true);
9979         return ret_ref;
9980 }
9981
9982 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9983         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
9984         ret.is_owned = false;
9985         return ret;
9986 }
9987 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9988         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9989         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9990         uint64_t ret_ref = 0;
9991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9993         return ret_ref;
9994 }
9995
9996 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9997 CHECK(!owner->result_ok);
9998         return DecodeError_clone(&*owner->contents.err);
9999 }
10000 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
10001         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10002         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10003         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
10004         uint64_t ret_ref = tag_ptr(ret_copy, true);
10005         return ret_ref;
10006 }
10007
10008 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10009         LDKNodeAnnouncement ret = *owner->contents.result;
10010         ret.is_owned = false;
10011         return ret;
10012 }
10013 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
10014         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10015         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
10016         uint64_t ret_ref = 0;
10017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10019         return ret_ref;
10020 }
10021
10022 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10023 CHECK(!owner->result_ok);
10024         return DecodeError_clone(&*owner->contents.err);
10025 }
10026 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
10027         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10028         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10029         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
10030         uint64_t ret_ref = tag_ptr(ret_copy, true);
10031         return ret_ref;
10032 }
10033
10034 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
10035         LDKQueryShortChannelIds ret = *owner->contents.result;
10036         ret.is_owned = false;
10037         return ret;
10038 }
10039 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
10040         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10041         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
10042         uint64_t ret_ref = 0;
10043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10045         return ret_ref;
10046 }
10047
10048 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
10049 CHECK(!owner->result_ok);
10050         return DecodeError_clone(&*owner->contents.err);
10051 }
10052 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
10053         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10054         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10055         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
10056         uint64_t ret_ref = tag_ptr(ret_copy, true);
10057         return ret_ref;
10058 }
10059
10060 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10061         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
10062         ret.is_owned = false;
10063         return ret;
10064 }
10065 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
10066         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10067         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
10068         uint64_t ret_ref = 0;
10069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10071         return ret_ref;
10072 }
10073
10074 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10075 CHECK(!owner->result_ok);
10076         return DecodeError_clone(&*owner->contents.err);
10077 }
10078 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
10079         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10080         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10081         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
10082         uint64_t ret_ref = tag_ptr(ret_copy, true);
10083         return ret_ref;
10084 }
10085
10086 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10087         LDKQueryChannelRange ret = *owner->contents.result;
10088         ret.is_owned = false;
10089         return ret;
10090 }
10091 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
10092         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10093         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
10094         uint64_t ret_ref = 0;
10095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10097         return ret_ref;
10098 }
10099
10100 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10101 CHECK(!owner->result_ok);
10102         return DecodeError_clone(&*owner->contents.err);
10103 }
10104 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
10105         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10106         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10107         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
10108         uint64_t ret_ref = tag_ptr(ret_copy, true);
10109         return ret_ref;
10110 }
10111
10112 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10113         LDKReplyChannelRange ret = *owner->contents.result;
10114         ret.is_owned = false;
10115         return ret;
10116 }
10117 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
10118         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10119         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
10120         uint64_t ret_ref = 0;
10121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10123         return ret_ref;
10124 }
10125
10126 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10127 CHECK(!owner->result_ok);
10128         return DecodeError_clone(&*owner->contents.err);
10129 }
10130 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
10131         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10132         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10133         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
10134         uint64_t ret_ref = tag_ptr(ret_copy, true);
10135         return ret_ref;
10136 }
10137
10138 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10139         LDKGossipTimestampFilter ret = *owner->contents.result;
10140         ret.is_owned = false;
10141         return ret;
10142 }
10143 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
10144         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10145         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
10146         uint64_t ret_ref = 0;
10147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10149         return ret_ref;
10150 }
10151
10152 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10153 CHECK(!owner->result_ok);
10154         return DecodeError_clone(&*owner->contents.err);
10155 }
10156 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
10157         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10158         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10159         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
10160         uint64_t ret_ref = tag_ptr(ret_copy, true);
10161         return ret_ref;
10162 }
10163
10164 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
10165         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
10166         for (size_t i = 0; i < ret.datalen; i++) {
10167                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
10168         }
10169         return ret;
10170 }
10171 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
10172         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10173         switch(obj->tag) {
10174                 case LDKSignOrCreationError_SignError: return 0;
10175                 case LDKSignOrCreationError_CreationError: return 1;
10176                 default: abort();
10177         }
10178 }
10179 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
10180         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10181         assert(obj->tag == LDKSignOrCreationError_CreationError);
10182         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
10183         return creation_error_conv;
10184 }
10185 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10186         LDKBolt11Invoice ret = *owner->contents.result;
10187         ret.is_owned = false;
10188         return ret;
10189 }
10190 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
10191         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10192         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
10193         uint64_t ret_ref = 0;
10194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10196         return ret_ref;
10197 }
10198
10199 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10200 CHECK(!owner->result_ok);
10201         return SignOrCreationError_clone(&*owner->contents.err);
10202 }
10203 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
10204         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10205         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
10206         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
10207         uint64_t ret_ref = tag_ptr(ret_copy, true);
10208         return ret_ref;
10209 }
10210
10211 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
10212 CHECK(owner->result_ok);
10213         return OffersMessage_clone(&*owner->contents.result);
10214 }
10215 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_ok"))) TS_CResult_OffersMessageDecodeErrorZ_get_ok(uint64_t owner) {
10216         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
10217         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
10218         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
10219         uint64_t ret_ref = tag_ptr(ret_copy, true);
10220         return ret_ref;
10221 }
10222
10223 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
10224 CHECK(!owner->result_ok);
10225         return DecodeError_clone(&*owner->contents.err);
10226 }
10227 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_err"))) TS_CResult_OffersMessageDecodeErrorZ_get_err(uint64_t owner) {
10228         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
10229         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10230         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
10231         uint64_t ret_ref = tag_ptr(ret_copy, true);
10232         return ret_ref;
10233 }
10234
10235 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
10236         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
10237         switch(obj->tag) {
10238                 case LDKCOption_HTLCClaimZ_Some: return 0;
10239                 case LDKCOption_HTLCClaimZ_None: return 1;
10240                 default: abort();
10241         }
10242 }
10243 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
10244         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
10245         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
10246         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
10247         return some_conv;
10248 }
10249 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
10250         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
10251         ret.is_owned = false;
10252         return ret;
10253 }
10254 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
10255         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
10256         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
10257         uint64_t ret_ref = 0;
10258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10260         return ret_ref;
10261 }
10262
10263 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
10264 CHECK(!owner->result_ok);
10265         return DecodeError_clone(&*owner->contents.err);
10266 }
10267 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
10268         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
10269         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10270         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
10271         uint64_t ret_ref = tag_ptr(ret_copy, true);
10272         return ret_ref;
10273 }
10274
10275 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
10276         LDKTxCreationKeys ret = *owner->contents.result;
10277         ret.is_owned = false;
10278         return ret;
10279 }
10280 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
10281         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
10282         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
10283         uint64_t ret_ref = 0;
10284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10286         return ret_ref;
10287 }
10288
10289 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
10290 CHECK(!owner->result_ok);
10291         return DecodeError_clone(&*owner->contents.err);
10292 }
10293 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
10294         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
10295         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10296         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
10297         uint64_t ret_ref = tag_ptr(ret_copy, true);
10298         return ret_ref;
10299 }
10300
10301 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
10302         LDKChannelPublicKeys ret = *owner->contents.result;
10303         ret.is_owned = false;
10304         return ret;
10305 }
10306 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
10307         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
10308         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
10309         uint64_t ret_ref = 0;
10310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10312         return ret_ref;
10313 }
10314
10315 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
10316 CHECK(!owner->result_ok);
10317         return DecodeError_clone(&*owner->contents.err);
10318 }
10319 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
10320         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
10321         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10322         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
10323         uint64_t ret_ref = tag_ptr(ret_copy, true);
10324         return ret_ref;
10325 }
10326
10327 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
10328         LDKHTLCOutputInCommitment ret = *owner->contents.result;
10329         ret.is_owned = false;
10330         return ret;
10331 }
10332 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
10333         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
10334         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
10335         uint64_t ret_ref = 0;
10336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10338         return ret_ref;
10339 }
10340
10341 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
10342 CHECK(!owner->result_ok);
10343         return DecodeError_clone(&*owner->contents.err);
10344 }
10345 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
10346         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
10347         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10348         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
10349         uint64_t ret_ref = tag_ptr(ret_copy, true);
10350         return ret_ref;
10351 }
10352
10353 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10354         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
10355         ret.is_owned = false;
10356         return ret;
10357 }
10358 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
10359         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10360         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
10361         uint64_t ret_ref = 0;
10362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10364         return ret_ref;
10365 }
10366
10367 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10368 CHECK(!owner->result_ok);
10369         return DecodeError_clone(&*owner->contents.err);
10370 }
10371 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
10372         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10373         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10374         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
10375         uint64_t ret_ref = tag_ptr(ret_copy, true);
10376         return ret_ref;
10377 }
10378
10379 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10380         LDKChannelTransactionParameters ret = *owner->contents.result;
10381         ret.is_owned = false;
10382         return ret;
10383 }
10384 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
10385         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10386         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
10387         uint64_t ret_ref = 0;
10388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10390         return ret_ref;
10391 }
10392
10393 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10394 CHECK(!owner->result_ok);
10395         return DecodeError_clone(&*owner->contents.err);
10396 }
10397 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
10398         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10399         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10400         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
10401         uint64_t ret_ref = tag_ptr(ret_copy, true);
10402         return ret_ref;
10403 }
10404
10405 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10406         LDKHolderCommitmentTransaction ret = *owner->contents.result;
10407         ret.is_owned = false;
10408         return ret;
10409 }
10410 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
10411         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10412         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10413         uint64_t ret_ref = 0;
10414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10416         return ret_ref;
10417 }
10418
10419 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10420 CHECK(!owner->result_ok);
10421         return DecodeError_clone(&*owner->contents.err);
10422 }
10423 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
10424         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10425         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10426         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10427         uint64_t ret_ref = tag_ptr(ret_copy, true);
10428         return ret_ref;
10429 }
10430
10431 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10432         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
10433         ret.is_owned = false;
10434         return ret;
10435 }
10436 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
10437         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10438         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10439         uint64_t ret_ref = 0;
10440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10442         return ret_ref;
10443 }
10444
10445 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10446 CHECK(!owner->result_ok);
10447         return DecodeError_clone(&*owner->contents.err);
10448 }
10449 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
10450         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10451         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10452         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10453         uint64_t ret_ref = tag_ptr(ret_copy, true);
10454         return ret_ref;
10455 }
10456
10457 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
10458         LDKTrustedClosingTransaction ret = *owner->contents.result;
10459         ret.is_owned = false;
10460         return ret;
10461 }
10462 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
10463         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
10464         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
10465         uint64_t ret_ref = 0;
10466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10468         return ret_ref;
10469 }
10470
10471 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
10472 CHECK(!owner->result_ok);
10473         return *owner->contents.err;
10474 }
10475 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
10476         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
10477         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
10478 }
10479
10480 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10481         LDKCommitmentTransaction ret = *owner->contents.result;
10482         ret.is_owned = false;
10483         return ret;
10484 }
10485 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
10486         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10487         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10488         uint64_t ret_ref = 0;
10489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10491         return ret_ref;
10492 }
10493
10494 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10495 CHECK(!owner->result_ok);
10496         return DecodeError_clone(&*owner->contents.err);
10497 }
10498 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
10499         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10500         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10501         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10502         uint64_t ret_ref = tag_ptr(ret_copy, true);
10503         return ret_ref;
10504 }
10505
10506 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
10507         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
10508         ret.is_owned = false;
10509         return ret;
10510 }
10511 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
10512         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
10513         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
10514         uint64_t ret_ref = 0;
10515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10517         return ret_ref;
10518 }
10519
10520 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
10521 CHECK(!owner->result_ok);
10522         return *owner->contents.err;
10523 }
10524 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
10525         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
10526         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
10527 }
10528
10529 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
10530 CHECK(owner->result_ok);
10531         return *owner->contents.result;
10532 }
10533 ptrArray  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok(uint64_t owner) {
10534         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
10535         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
10536         ptrArray ret_arr = NULL;
10537         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
10538         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
10539         for (size_t m = 0; m < ret_var.datalen; m++) {
10540                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
10541                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
10542                 ret_arr_ptr[m] = ret_conv_12_arr;
10543         }
10544         
10545         return ret_arr;
10546 }
10547
10548 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
10549 CHECK(!owner->result_ok);
10550         return *owner->contents.err;
10551 }
10552 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_err(uint64_t owner) {
10553         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
10554         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
10555 }
10556
10557 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_ty_from_ptr"))) TS_LDKCOption_usizeZ_ty_from_ptr(uint64_t ptr) {
10558         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
10559         switch(obj->tag) {
10560                 case LDKCOption_usizeZ_Some: return 0;
10561                 case LDKCOption_usizeZ_None: return 1;
10562                 default: abort();
10563         }
10564 }
10565 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_Some_get_some"))) TS_LDKCOption_usizeZ_Some_get_some(uint64_t ptr) {
10566         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
10567         assert(obj->tag == LDKCOption_usizeZ_Some);
10568         uint32_t some_conv = obj->some;
10569         return some_conv;
10570 }
10571 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
10572         LDKShutdownScript ret = *owner->contents.result;
10573         ret.is_owned = false;
10574         return ret;
10575 }
10576 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
10577         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
10578         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
10579         uint64_t ret_ref = 0;
10580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10582         return ret_ref;
10583 }
10584
10585 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
10586 CHECK(!owner->result_ok);
10587         return DecodeError_clone(&*owner->contents.err);
10588 }
10589 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
10590         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
10591         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10592         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
10593         uint64_t ret_ref = tag_ptr(ret_copy, true);
10594         return ret_ref;
10595 }
10596
10597 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
10598         LDKShutdownScript ret = *owner->contents.result;
10599         ret.is_owned = false;
10600         return ret;
10601 }
10602 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
10603         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
10604         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
10605         uint64_t ret_ref = 0;
10606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10608         return ret_ref;
10609 }
10610
10611 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
10612         LDKInvalidShutdownScript ret = *owner->contents.err;
10613         ret.is_owned = false;
10614         return ret;
10615 }
10616 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
10617         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
10618         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
10619         uint64_t ret_ref = 0;
10620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10622         return ret_ref;
10623 }
10624
10625 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
10626         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10627         switch(obj->tag) {
10628                 case LDKPaymentPurpose_Bolt11InvoicePayment: return 0;
10629                 case LDKPaymentPurpose_Bolt12OfferPayment: return 1;
10630                 case LDKPaymentPurpose_Bolt12RefundPayment: return 2;
10631                 case LDKPaymentPurpose_SpontaneousPayment: return 3;
10632                 default: abort();
10633         }
10634 }
10635 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_preimage(uint64_t ptr) {
10636         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10637         assert(obj->tag == LDKPaymentPurpose_Bolt11InvoicePayment);
10638         uint64_t payment_preimage_ref = tag_ptr(&obj->bolt11_invoice_payment.payment_preimage, false);
10639         return payment_preimage_ref;
10640 }
10641 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_secret(uint64_t ptr) {
10642         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10643         assert(obj->tag == LDKPaymentPurpose_Bolt11InvoicePayment);
10644         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10645         memcpy(payment_secret_arr->elems, obj->bolt11_invoice_payment.payment_secret.data, 32);
10646         return payment_secret_arr;
10647 }
10648 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_preimage"))) TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_preimage(uint64_t ptr) {
10649         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10650         assert(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
10651         uint64_t payment_preimage_ref = tag_ptr(&obj->bolt12_offer_payment.payment_preimage, false);
10652         return payment_preimage_ref;
10653 }
10654 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_secret"))) TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_secret(uint64_t ptr) {
10655         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10656         assert(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
10657         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10658         memcpy(payment_secret_arr->elems, obj->bolt12_offer_payment.payment_secret.data, 32);
10659         return payment_secret_arr;
10660 }
10661 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_context"))) TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_context(uint64_t ptr) {
10662         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10663         assert(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
10664         LDKBolt12OfferContext payment_context_var = obj->bolt12_offer_payment.payment_context;
10665                         uint64_t payment_context_ref = 0;
10666                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
10667                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
10668         return payment_context_ref;
10669 }
10670 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_preimage"))) TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_preimage(uint64_t ptr) {
10671         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10672         assert(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
10673         uint64_t payment_preimage_ref = tag_ptr(&obj->bolt12_refund_payment.payment_preimage, false);
10674         return payment_preimage_ref;
10675 }
10676 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_secret"))) TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_secret(uint64_t ptr) {
10677         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10678         assert(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
10679         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10680         memcpy(payment_secret_arr->elems, obj->bolt12_refund_payment.payment_secret.data, 32);
10681         return payment_secret_arr;
10682 }
10683 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_context"))) TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_context(uint64_t ptr) {
10684         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10685         assert(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
10686         LDKBolt12RefundContext payment_context_var = obj->bolt12_refund_payment.payment_context;
10687                         uint64_t payment_context_ref = 0;
10688                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
10689                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
10690         return payment_context_ref;
10691 }
10692 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
10693         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10694         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
10695         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
10696         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
10697         return spontaneous_payment_arr;
10698 }
10699 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
10700 CHECK(owner->result_ok);
10701         return PaymentPurpose_clone(&*owner->contents.result);
10702 }
10703 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
10704         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
10705         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
10706         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
10707         uint64_t ret_ref = tag_ptr(ret_copy, true);
10708         return ret_ref;
10709 }
10710
10711 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
10712 CHECK(!owner->result_ok);
10713         return DecodeError_clone(&*owner->contents.err);
10714 }
10715 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
10716         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
10717         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10718         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
10719         uint64_t ret_ref = tag_ptr(ret_copy, true);
10720         return ret_ref;
10721 }
10722
10723 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10724         LDKClaimedHTLC ret = *owner->contents.result;
10725         ret.is_owned = false;
10726         return ret;
10727 }
10728 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
10729         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10730         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
10731         uint64_t ret_ref = 0;
10732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10734         return ret_ref;
10735 }
10736
10737 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10738 CHECK(!owner->result_ok);
10739         return DecodeError_clone(&*owner->contents.err);
10740 }
10741 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_err(uint64_t owner) {
10742         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10743         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10744         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
10745         uint64_t ret_ref = tag_ptr(ret_copy, true);
10746         return ret_ref;
10747 }
10748
10749 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
10750         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10751         switch(obj->tag) {
10752                 case LDKPathFailure_InitialSend: return 0;
10753                 case LDKPathFailure_OnPath: return 1;
10754                 default: abort();
10755         }
10756 }
10757 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
10758         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10759         assert(obj->tag == LDKPathFailure_InitialSend);
10760         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
10761         return err_ref;
10762 }
10763 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
10764         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10765         assert(obj->tag == LDKPathFailure_OnPath);
10766         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
10767         return network_update_ref;
10768 }
10769 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
10770         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10771         switch(obj->tag) {
10772                 case LDKCOption_PathFailureZ_Some: return 0;
10773                 case LDKCOption_PathFailureZ_None: return 1;
10774                 default: abort();
10775         }
10776 }
10777 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
10778         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10779         assert(obj->tag == LDKCOption_PathFailureZ_Some);
10780         uint64_t some_ref = tag_ptr(&obj->some, false);
10781         return some_ref;
10782 }
10783 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10784 CHECK(owner->result_ok);
10785         return COption_PathFailureZ_clone(&*owner->contents.result);
10786 }
10787 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
10788         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10789         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
10790         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
10791         uint64_t ret_ref = tag_ptr(ret_copy, true);
10792         return ret_ref;
10793 }
10794
10795 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10796 CHECK(!owner->result_ok);
10797         return DecodeError_clone(&*owner->contents.err);
10798 }
10799 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
10800         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10801         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10802         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
10803         uint64_t ret_ref = tag_ptr(ret_copy, true);
10804         return ret_ref;
10805 }
10806
10807 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
10808         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10809         switch(obj->tag) {
10810                 case LDKCOption_ClosureReasonZ_Some: return 0;
10811                 case LDKCOption_ClosureReasonZ_None: return 1;
10812                 default: abort();
10813         }
10814 }
10815 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
10816         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10817         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
10818         uint64_t some_ref = tag_ptr(&obj->some, false);
10819         return some_ref;
10820 }
10821 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
10822 CHECK(owner->result_ok);
10823         return COption_ClosureReasonZ_clone(&*owner->contents.result);
10824 }
10825 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
10826         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
10827         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
10828         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
10829         uint64_t ret_ref = tag_ptr(ret_copy, true);
10830         return ret_ref;
10831 }
10832
10833 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
10834 CHECK(!owner->result_ok);
10835         return DecodeError_clone(&*owner->contents.err);
10836 }
10837 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
10838         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
10839         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10840         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
10841         uint64_t ret_ref = tag_ptr(ret_copy, true);
10842         return ret_ref;
10843 }
10844
10845 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
10846         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10847         switch(obj->tag) {
10848                 case LDKHTLCDestination_NextHopChannel: return 0;
10849                 case LDKHTLCDestination_UnknownNextHop: return 1;
10850                 case LDKHTLCDestination_InvalidForward: return 2;
10851                 case LDKHTLCDestination_InvalidOnion: return 3;
10852                 case LDKHTLCDestination_FailedPayment: return 4;
10853                 default: abort();
10854         }
10855 }
10856 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
10857         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10858         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
10859         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
10860         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
10861         return node_id_arr;
10862 }
10863 uint64_t __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
10864         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10865         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
10866         LDKChannelId channel_id_var = obj->next_hop_channel.channel_id;
10867                         uint64_t channel_id_ref = 0;
10868                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10869                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
10870         return channel_id_ref;
10871 }
10872 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
10873         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10874         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
10875         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
10876         return requested_forward_scid_conv;
10877 }
10878 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
10879         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10880         assert(obj->tag == LDKHTLCDestination_InvalidForward);
10881         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
10882         return requested_forward_scid_conv;
10883 }
10884 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
10885         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10886         assert(obj->tag == LDKHTLCDestination_FailedPayment);
10887         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10888         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
10889         return payment_hash_arr;
10890 }
10891 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
10892         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
10893         switch(obj->tag) {
10894                 case LDKCOption_HTLCDestinationZ_Some: return 0;
10895                 case LDKCOption_HTLCDestinationZ_None: return 1;
10896                 default: abort();
10897         }
10898 }
10899 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
10900         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
10901         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
10902         uint64_t some_ref = tag_ptr(&obj->some, false);
10903         return some_ref;
10904 }
10905 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
10906 CHECK(owner->result_ok);
10907         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
10908 }
10909 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
10910         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
10911         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
10912         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
10913         uint64_t ret_ref = tag_ptr(ret_copy, true);
10914         return ret_ref;
10915 }
10916
10917 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
10918 CHECK(!owner->result_ok);
10919         return DecodeError_clone(&*owner->contents.err);
10920 }
10921 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
10922         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
10923         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10924         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
10925         uint64_t ret_ref = tag_ptr(ret_copy, true);
10926         return ret_ref;
10927 }
10928
10929 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
10930 CHECK(owner->result_ok);
10931         return PaymentFailureReason_clone(&*owner->contents.result);
10932 }
10933 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
10934         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
10935         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
10936         return ret_conv;
10937 }
10938
10939 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
10940 CHECK(!owner->result_ok);
10941         return DecodeError_clone(&*owner->contents.err);
10942 }
10943 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
10944         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
10945         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10946         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
10947         uint64_t ret_ref = tag_ptr(ret_copy, true);
10948         return ret_ref;
10949 }
10950
10951 uint32_t __attribute__((export_name("TS_LDKCOption_U128Z_ty_from_ptr"))) TS_LDKCOption_U128Z_ty_from_ptr(uint64_t ptr) {
10952         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
10953         switch(obj->tag) {
10954                 case LDKCOption_U128Z_Some: return 0;
10955                 case LDKCOption_U128Z_None: return 1;
10956                 default: abort();
10957         }
10958 }
10959 int8_tArray __attribute__((export_name("TS_LDKCOption_U128Z_Some_get_some"))) TS_LDKCOption_U128Z_Some_get_some(uint64_t ptr) {
10960         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
10961         assert(obj->tag == LDKCOption_U128Z_Some);
10962         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
10963         memcpy(some_arr->elems, obj->some.le_bytes, 16);
10964         return some_arr;
10965 }
10966 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
10967         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
10968         for (size_t i = 0; i < ret.datalen; i++) {
10969                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
10970         }
10971         return ret;
10972 }
10973 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
10974         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
10975         switch(obj->tag) {
10976                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
10977                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
10978                 default: abort();
10979         }
10980 }
10981 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
10982         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
10983         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
10984         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
10985         return some_conv;
10986 }
10987 uint32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ty_from_ptr"))) TS_LDKBumpTransactionEvent_ty_from_ptr(uint64_t ptr) {
10988         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10989         switch(obj->tag) {
10990                 case LDKBumpTransactionEvent_ChannelClose: return 0;
10991                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
10992                 default: abort();
10993         }
10994 }
10995 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_channel_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_channel_id(uint64_t ptr) {
10996         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10997         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10998         LDKChannelId channel_id_var = obj->channel_close.channel_id;
10999                         uint64_t channel_id_ref = 0;
11000                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11001                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11002         return channel_id_ref;
11003 }
11004 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_counterparty_node_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_counterparty_node_id(uint64_t ptr) {
11005         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11006         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11007         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11008         memcpy(counterparty_node_id_arr->elems, obj->channel_close.counterparty_node_id.compressed_form, 33);
11009         return counterparty_node_id_arr;
11010 }
11011 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id(uint64_t ptr) {
11012         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11013         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11014         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
11015         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
11016         return claim_id_arr;
11017 }
11018 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) {
11019         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11020         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11021         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
11022         return package_target_feerate_sat_per_1000_weight_conv;
11023 }
11024 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(uint64_t ptr) {
11025         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11026         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11027         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
11028                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
11029                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
11030         return commitment_tx_arr;
11031 }
11032 int64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(uint64_t ptr) {
11033         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11034         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11035         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
11036         return commitment_tx_fee_satoshis_conv;
11037 }
11038 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor"))) TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(uint64_t ptr) {
11039         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11040         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11041         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
11042                         uint64_t anchor_descriptor_ref = 0;
11043                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
11044                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
11045         return anchor_descriptor_ref;
11046 }
11047 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs"))) TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(uint64_t ptr) {
11048         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11049         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11050         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
11051                         uint64_tArray pending_htlcs_arr = NULL;
11052                         pending_htlcs_arr = init_uint64_tArray(pending_htlcs_var.datalen, __LINE__);
11053                         uint64_t *pending_htlcs_arr_ptr = (uint64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
11054                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
11055                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
11056                                 uint64_t pending_htlcs_conv_24_ref = 0;
11057                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
11058                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
11059                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
11060                         }
11061                         
11062         return pending_htlcs_arr;
11063 }
11064 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_channel_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_channel_id(uint64_t ptr) {
11065         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11066         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11067         LDKChannelId channel_id_var = obj->htlc_resolution.channel_id;
11068                         uint64_t channel_id_ref = 0;
11069                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11070                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11071         return channel_id_ref;
11072 }
11073 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_counterparty_node_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_counterparty_node_id(uint64_t ptr) {
11074         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11075         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11076         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11077         memcpy(counterparty_node_id_arr->elems, obj->htlc_resolution.counterparty_node_id.compressed_form, 33);
11078         return counterparty_node_id_arr;
11079 }
11080 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(uint64_t ptr) {
11081         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11082         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11083         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
11084         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
11085         return claim_id_arr;
11086 }
11087 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) {
11088         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11089         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11090         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
11091         return target_feerate_sat_per_1000_weight_conv;
11092 }
11093 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(uint64_t ptr) {
11094         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11095         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11096         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
11097                         uint64_tArray htlc_descriptors_arr = NULL;
11098                         htlc_descriptors_arr = init_uint64_tArray(htlc_descriptors_var.datalen, __LINE__);
11099                         uint64_t *htlc_descriptors_arr_ptr = (uint64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
11100                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
11101                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
11102                                 uint64_t htlc_descriptors_conv_16_ref = 0;
11103                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
11104                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
11105                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
11106                         }
11107                         
11108         return htlc_descriptors_arr;
11109 }
11110 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(uint64_t ptr) {
11111         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11112         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11113         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
11114         return tx_lock_time_conv;
11115 }
11116 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
11117         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11118         switch(obj->tag) {
11119                 case LDKEvent_FundingGenerationReady: return 0;
11120                 case LDKEvent_PaymentClaimable: return 1;
11121                 case LDKEvent_PaymentClaimed: return 2;
11122                 case LDKEvent_ConnectionNeeded: return 3;
11123                 case LDKEvent_InvoiceRequestFailed: return 4;
11124                 case LDKEvent_PaymentSent: return 5;
11125                 case LDKEvent_PaymentFailed: return 6;
11126                 case LDKEvent_PaymentPathSuccessful: return 7;
11127                 case LDKEvent_PaymentPathFailed: return 8;
11128                 case LDKEvent_ProbeSuccessful: return 9;
11129                 case LDKEvent_ProbeFailed: return 10;
11130                 case LDKEvent_PendingHTLCsForwardable: return 11;
11131                 case LDKEvent_HTLCIntercepted: return 12;
11132                 case LDKEvent_SpendableOutputs: return 13;
11133                 case LDKEvent_PaymentForwarded: return 14;
11134                 case LDKEvent_ChannelPending: return 15;
11135                 case LDKEvent_ChannelReady: return 16;
11136                 case LDKEvent_ChannelClosed: return 17;
11137                 case LDKEvent_DiscardFunding: return 18;
11138                 case LDKEvent_OpenChannelRequest: return 19;
11139                 case LDKEvent_HTLCHandlingFailed: return 20;
11140                 case LDKEvent_BumpTransaction: return 21;
11141                 default: abort();
11142         }
11143 }
11144 uint64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
11145         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11146         assert(obj->tag == LDKEvent_FundingGenerationReady);
11147         LDKChannelId temporary_channel_id_var = obj->funding_generation_ready.temporary_channel_id;
11148                         uint64_t temporary_channel_id_ref = 0;
11149                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
11150                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
11151         return temporary_channel_id_ref;
11152 }
11153 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
11154         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11155         assert(obj->tag == LDKEvent_FundingGenerationReady);
11156         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11157         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
11158         return counterparty_node_id_arr;
11159 }
11160 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
11161         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11162         assert(obj->tag == LDKEvent_FundingGenerationReady);
11163         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
11164         return channel_value_satoshis_conv;
11165 }
11166 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
11167         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11168         assert(obj->tag == LDKEvent_FundingGenerationReady);
11169         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
11170                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
11171                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
11172         return output_script_arr;
11173 }
11174 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
11175         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11176         assert(obj->tag == LDKEvent_FundingGenerationReady);
11177         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11178         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
11179         return user_channel_id_arr;
11180 }
11181 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
11182         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11183         assert(obj->tag == LDKEvent_PaymentClaimable);
11184         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11185         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
11186         return receiver_node_id_arr;
11187 }
11188 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
11189         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11190         assert(obj->tag == LDKEvent_PaymentClaimable);
11191         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11192         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
11193         return payment_hash_arr;
11194 }
11195 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
11196         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11197         assert(obj->tag == LDKEvent_PaymentClaimable);
11198         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
11199                         uint64_t onion_fields_ref = 0;
11200                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
11201                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
11202         return onion_fields_ref;
11203 }
11204 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
11205         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11206         assert(obj->tag == LDKEvent_PaymentClaimable);
11207         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
11208         return amount_msat_conv;
11209 }
11210 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat"))) TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(uint64_t ptr) {
11211         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11212         assert(obj->tag == LDKEvent_PaymentClaimable);
11213         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
11214         return counterparty_skimmed_fee_msat_conv;
11215 }
11216 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
11217         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11218         assert(obj->tag == LDKEvent_PaymentClaimable);
11219         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
11220         return purpose_ref;
11221 }
11222 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
11223         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11224         assert(obj->tag == LDKEvent_PaymentClaimable);
11225         LDKChannelId via_channel_id_var = obj->payment_claimable.via_channel_id;
11226                         uint64_t via_channel_id_ref = 0;
11227                         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_var);
11228                         via_channel_id_ref = tag_ptr(via_channel_id_var.inner, false);
11229         return via_channel_id_ref;
11230 }
11231 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
11232         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11233         assert(obj->tag == LDKEvent_PaymentClaimable);
11234         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
11235         return via_user_channel_id_ref;
11236 }
11237 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
11238         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11239         assert(obj->tag == LDKEvent_PaymentClaimable);
11240         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
11241         return claim_deadline_ref;
11242 }
11243 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
11244         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11245         assert(obj->tag == LDKEvent_PaymentClaimed);
11246         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11247         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
11248         return receiver_node_id_arr;
11249 }
11250 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
11251         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11252         assert(obj->tag == LDKEvent_PaymentClaimed);
11253         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11254         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
11255         return payment_hash_arr;
11256 }
11257 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
11258         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11259         assert(obj->tag == LDKEvent_PaymentClaimed);
11260         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
11261         return amount_msat_conv;
11262 }
11263 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
11264         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11265         assert(obj->tag == LDKEvent_PaymentClaimed);
11266         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
11267         return purpose_ref;
11268 }
11269 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_htlcs"))) TS_LDKEvent_PaymentClaimed_get_htlcs(uint64_t ptr) {
11270         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11271         assert(obj->tag == LDKEvent_PaymentClaimed);
11272         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
11273                         uint64_tArray htlcs_arr = NULL;
11274                         htlcs_arr = init_uint64_tArray(htlcs_var.datalen, __LINE__);
11275                         uint64_t *htlcs_arr_ptr = (uint64_t*)(((uint8_t*)htlcs_arr) + 8);
11276                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
11277                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
11278                                 uint64_t htlcs_conv_13_ref = 0;
11279                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
11280                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
11281                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
11282                         }
11283                         
11284         return htlcs_arr;
11285 }
11286 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat"))) TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(uint64_t ptr) {
11287         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11288         assert(obj->tag == LDKEvent_PaymentClaimed);
11289         uint64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
11290         return sender_intended_total_msat_ref;
11291 }
11292 int8_tArray __attribute__((export_name("TS_LDKEvent_ConnectionNeeded_get_node_id"))) TS_LDKEvent_ConnectionNeeded_get_node_id(uint64_t ptr) {
11293         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11294         assert(obj->tag == LDKEvent_ConnectionNeeded);
11295         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
11296         memcpy(node_id_arr->elems, obj->connection_needed.node_id.compressed_form, 33);
11297         return node_id_arr;
11298 }
11299 uint64_tArray __attribute__((export_name("TS_LDKEvent_ConnectionNeeded_get_addresses"))) TS_LDKEvent_ConnectionNeeded_get_addresses(uint64_t ptr) {
11300         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11301         assert(obj->tag == LDKEvent_ConnectionNeeded);
11302         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
11303                         uint64_tArray addresses_arr = NULL;
11304                         addresses_arr = init_uint64_tArray(addresses_var.datalen, __LINE__);
11305                         uint64_t *addresses_arr_ptr = (uint64_t*)(((uint8_t*)addresses_arr) + 8);
11306                         for (size_t p = 0; p < addresses_var.datalen; p++) {
11307                                 uint64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
11308                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
11309                         }
11310                         
11311         return addresses_arr;
11312 }
11313 int8_tArray __attribute__((export_name("TS_LDKEvent_InvoiceRequestFailed_get_payment_id"))) TS_LDKEvent_InvoiceRequestFailed_get_payment_id(uint64_t ptr) {
11314         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11315         assert(obj->tag == LDKEvent_InvoiceRequestFailed);
11316         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11317         memcpy(payment_id_arr->elems, obj->invoice_request_failed.payment_id.data, 32);
11318         return payment_id_arr;
11319 }
11320 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
11321         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11322         assert(obj->tag == LDKEvent_PaymentSent);
11323         uint64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
11324         return payment_id_ref;
11325 }
11326 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
11327         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11328         assert(obj->tag == LDKEvent_PaymentSent);
11329         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
11330         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
11331         return payment_preimage_arr;
11332 }
11333 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
11334         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11335         assert(obj->tag == LDKEvent_PaymentSent);
11336         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11337         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
11338         return payment_hash_arr;
11339 }
11340 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
11341         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11342         assert(obj->tag == LDKEvent_PaymentSent);
11343         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
11344         return fee_paid_msat_ref;
11345 }
11346 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
11347         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11348         assert(obj->tag == LDKEvent_PaymentFailed);
11349         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11350         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
11351         return payment_id_arr;
11352 }
11353 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
11354         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11355         assert(obj->tag == LDKEvent_PaymentFailed);
11356         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11357         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
11358         return payment_hash_arr;
11359 }
11360 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
11361         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11362         assert(obj->tag == LDKEvent_PaymentFailed);
11363         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
11364         return reason_ref;
11365 }
11366 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
11367         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11368         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
11369         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11370         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
11371         return payment_id_arr;
11372 }
11373 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
11374         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11375         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
11376         uint64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
11377         return payment_hash_ref;
11378 }
11379 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
11380         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11381         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
11382         LDKPath path_var = obj->payment_path_successful.path;
11383                         uint64_t path_ref = 0;
11384                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11385                         path_ref = tag_ptr(path_var.inner, false);
11386         return path_ref;
11387 }
11388 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
11389         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11390         assert(obj->tag == LDKEvent_PaymentPathFailed);
11391         uint64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
11392         return payment_id_ref;
11393 }
11394 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
11395         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11396         assert(obj->tag == LDKEvent_PaymentPathFailed);
11397         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11398         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
11399         return payment_hash_arr;
11400 }
11401 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
11402         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11403         assert(obj->tag == LDKEvent_PaymentPathFailed);
11404         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
11405         return payment_failed_permanently_conv;
11406 }
11407 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
11408         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11409         assert(obj->tag == LDKEvent_PaymentPathFailed);
11410         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
11411         return failure_ref;
11412 }
11413 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
11414         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11415         assert(obj->tag == LDKEvent_PaymentPathFailed);
11416         LDKPath path_var = obj->payment_path_failed.path;
11417                         uint64_t path_ref = 0;
11418                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11419                         path_ref = tag_ptr(path_var.inner, false);
11420         return path_ref;
11421 }
11422 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
11423         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11424         assert(obj->tag == LDKEvent_PaymentPathFailed);
11425         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
11426         return short_channel_id_ref;
11427 }
11428 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
11429         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11430         assert(obj->tag == LDKEvent_ProbeSuccessful);
11431         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11432         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
11433         return payment_id_arr;
11434 }
11435 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
11436         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11437         assert(obj->tag == LDKEvent_ProbeSuccessful);
11438         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11439         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
11440         return payment_hash_arr;
11441 }
11442 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
11443         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11444         assert(obj->tag == LDKEvent_ProbeSuccessful);
11445         LDKPath path_var = obj->probe_successful.path;
11446                         uint64_t path_ref = 0;
11447                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11448                         path_ref = tag_ptr(path_var.inner, false);
11449         return path_ref;
11450 }
11451 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
11452         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11453         assert(obj->tag == LDKEvent_ProbeFailed);
11454         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11455         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
11456         return payment_id_arr;
11457 }
11458 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
11459         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11460         assert(obj->tag == LDKEvent_ProbeFailed);
11461         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11462         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
11463         return payment_hash_arr;
11464 }
11465 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
11466         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11467         assert(obj->tag == LDKEvent_ProbeFailed);
11468         LDKPath path_var = obj->probe_failed.path;
11469                         uint64_t path_ref = 0;
11470                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11471                         path_ref = tag_ptr(path_var.inner, false);
11472         return path_ref;
11473 }
11474 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
11475         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11476         assert(obj->tag == LDKEvent_ProbeFailed);
11477         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
11478         return short_channel_id_ref;
11479 }
11480 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
11481         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11482         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
11483         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
11484         return time_forwardable_conv;
11485 }
11486 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
11487         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11488         assert(obj->tag == LDKEvent_HTLCIntercepted);
11489         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
11490         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
11491         return intercept_id_arr;
11492 }
11493 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
11494         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11495         assert(obj->tag == LDKEvent_HTLCIntercepted);
11496         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
11497         return requested_next_hop_scid_conv;
11498 }
11499 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
11500         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11501         assert(obj->tag == LDKEvent_HTLCIntercepted);
11502         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11503         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
11504         return payment_hash_arr;
11505 }
11506 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
11507         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11508         assert(obj->tag == LDKEvent_HTLCIntercepted);
11509         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
11510         return inbound_amount_msat_conv;
11511 }
11512 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
11513         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11514         assert(obj->tag == LDKEvent_HTLCIntercepted);
11515         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
11516         return expected_outbound_amount_msat_conv;
11517 }
11518 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
11519         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11520         assert(obj->tag == LDKEvent_SpendableOutputs);
11521         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
11522                         uint64_tArray outputs_arr = NULL;
11523                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
11524                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
11525                         for (size_t b = 0; b < outputs_var.datalen; b++) {
11526                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
11527                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
11528                         }
11529                         
11530         return outputs_arr;
11531 }
11532 uint64_t __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_channel_id"))) TS_LDKEvent_SpendableOutputs_get_channel_id(uint64_t ptr) {
11533         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11534         assert(obj->tag == LDKEvent_SpendableOutputs);
11535         LDKChannelId channel_id_var = obj->spendable_outputs.channel_id;
11536                         uint64_t channel_id_ref = 0;
11537                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11538                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11539         return channel_id_ref;
11540 }
11541 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
11542         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11543         assert(obj->tag == LDKEvent_PaymentForwarded);
11544         LDKChannelId prev_channel_id_var = obj->payment_forwarded.prev_channel_id;
11545                         uint64_t prev_channel_id_ref = 0;
11546                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
11547                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
11548         return prev_channel_id_ref;
11549 }
11550 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
11551         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11552         assert(obj->tag == LDKEvent_PaymentForwarded);
11553         LDKChannelId next_channel_id_var = obj->payment_forwarded.next_channel_id;
11554                         uint64_t next_channel_id_ref = 0;
11555                         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_var);
11556                         next_channel_id_ref = tag_ptr(next_channel_id_var.inner, false);
11557         return next_channel_id_ref;
11558 }
11559 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_user_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_user_channel_id(uint64_t ptr) {
11560         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11561         assert(obj->tag == LDKEvent_PaymentForwarded);
11562         uint64_t prev_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_user_channel_id, false);
11563         return prev_user_channel_id_ref;
11564 }
11565 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_user_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_user_channel_id(uint64_t ptr) {
11566         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11567         assert(obj->tag == LDKEvent_PaymentForwarded);
11568         uint64_t next_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_user_channel_id, false);
11569         return next_user_channel_id_ref;
11570 }
11571 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_total_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_total_fee_earned_msat(uint64_t ptr) {
11572         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11573         assert(obj->tag == LDKEvent_PaymentForwarded);
11574         uint64_t total_fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.total_fee_earned_msat, false);
11575         return total_fee_earned_msat_ref;
11576 }
11577 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_skimmed_fee_msat"))) TS_LDKEvent_PaymentForwarded_get_skimmed_fee_msat(uint64_t ptr) {
11578         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11579         assert(obj->tag == LDKEvent_PaymentForwarded);
11580         uint64_t skimmed_fee_msat_ref = tag_ptr(&obj->payment_forwarded.skimmed_fee_msat, false);
11581         return skimmed_fee_msat_ref;
11582 }
11583 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
11584         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11585         assert(obj->tag == LDKEvent_PaymentForwarded);
11586         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
11587         return claim_from_onchain_tx_conv;
11588 }
11589 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
11590         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11591         assert(obj->tag == LDKEvent_PaymentForwarded);
11592         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
11593         return outbound_amount_forwarded_msat_ref;
11594 }
11595 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
11596         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11597         assert(obj->tag == LDKEvent_ChannelPending);
11598         LDKChannelId channel_id_var = obj->channel_pending.channel_id;
11599                         uint64_t channel_id_ref = 0;
11600                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11601                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11602         return channel_id_ref;
11603 }
11604 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
11605         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11606         assert(obj->tag == LDKEvent_ChannelPending);
11607         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11608         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
11609         return user_channel_id_arr;
11610 }
11611 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
11612         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11613         assert(obj->tag == LDKEvent_ChannelPending);
11614         LDKChannelId former_temporary_channel_id_var = obj->channel_pending.former_temporary_channel_id;
11615                         uint64_t former_temporary_channel_id_ref = 0;
11616                         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_var);
11617                         former_temporary_channel_id_ref = tag_ptr(former_temporary_channel_id_var.inner, false);
11618         return former_temporary_channel_id_ref;
11619 }
11620 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
11621         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11622         assert(obj->tag == LDKEvent_ChannelPending);
11623         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11624         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
11625         return counterparty_node_id_arr;
11626 }
11627 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
11628         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11629         assert(obj->tag == LDKEvent_ChannelPending);
11630         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
11631                         uint64_t funding_txo_ref = 0;
11632                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
11633                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
11634         return funding_txo_ref;
11635 }
11636 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_type"))) TS_LDKEvent_ChannelPending_get_channel_type(uint64_t ptr) {
11637         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11638         assert(obj->tag == LDKEvent_ChannelPending);
11639         LDKChannelTypeFeatures channel_type_var = obj->channel_pending.channel_type;
11640                         uint64_t channel_type_ref = 0;
11641                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11642                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11643         return channel_type_ref;
11644 }
11645 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
11646         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11647         assert(obj->tag == LDKEvent_ChannelReady);
11648         LDKChannelId channel_id_var = obj->channel_ready.channel_id;
11649                         uint64_t channel_id_ref = 0;
11650                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11651                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11652         return channel_id_ref;
11653 }
11654 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
11655         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11656         assert(obj->tag == LDKEvent_ChannelReady);
11657         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11658         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
11659         return user_channel_id_arr;
11660 }
11661 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
11662         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11663         assert(obj->tag == LDKEvent_ChannelReady);
11664         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11665         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
11666         return counterparty_node_id_arr;
11667 }
11668 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
11669         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11670         assert(obj->tag == LDKEvent_ChannelReady);
11671         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
11672                         uint64_t channel_type_ref = 0;
11673                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11674                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11675         return channel_type_ref;
11676 }
11677 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
11678         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11679         assert(obj->tag == LDKEvent_ChannelClosed);
11680         LDKChannelId channel_id_var = obj->channel_closed.channel_id;
11681                         uint64_t channel_id_ref = 0;
11682                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11683                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11684         return channel_id_ref;
11685 }
11686 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
11687         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11688         assert(obj->tag == LDKEvent_ChannelClosed);
11689         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11690         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
11691         return user_channel_id_arr;
11692 }
11693 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
11694         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11695         assert(obj->tag == LDKEvent_ChannelClosed);
11696         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
11697         return reason_ref;
11698 }
11699 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_counterparty_node_id"))) TS_LDKEvent_ChannelClosed_get_counterparty_node_id(uint64_t ptr) {
11700         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11701         assert(obj->tag == LDKEvent_ChannelClosed);
11702         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11703         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
11704         return counterparty_node_id_arr;
11705 }
11706 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_capacity_sats"))) TS_LDKEvent_ChannelClosed_get_channel_capacity_sats(uint64_t ptr) {
11707         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11708         assert(obj->tag == LDKEvent_ChannelClosed);
11709         uint64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
11710         return channel_capacity_sats_ref;
11711 }
11712 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_funding_txo"))) TS_LDKEvent_ChannelClosed_get_channel_funding_txo(uint64_t ptr) {
11713         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11714         assert(obj->tag == LDKEvent_ChannelClosed);
11715         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
11716                         uint64_t channel_funding_txo_ref = 0;
11717                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
11718                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
11719         return channel_funding_txo_ref;
11720 }
11721 uint64_t __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
11722         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11723         assert(obj->tag == LDKEvent_DiscardFunding);
11724         LDKChannelId channel_id_var = obj->discard_funding.channel_id;
11725                         uint64_t channel_id_ref = 0;
11726                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11727                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11728         return channel_id_ref;
11729 }
11730 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
11731         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11732         assert(obj->tag == LDKEvent_DiscardFunding);
11733         LDKTransaction transaction_var = obj->discard_funding.transaction;
11734                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
11735                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
11736         return transaction_arr;
11737 }
11738 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
11739         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11740         assert(obj->tag == LDKEvent_OpenChannelRequest);
11741         LDKChannelId temporary_channel_id_var = obj->open_channel_request.temporary_channel_id;
11742                         uint64_t temporary_channel_id_ref = 0;
11743                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
11744                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
11745         return temporary_channel_id_ref;
11746 }
11747 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
11748         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11749         assert(obj->tag == LDKEvent_OpenChannelRequest);
11750         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11751         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
11752         return counterparty_node_id_arr;
11753 }
11754 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
11755         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11756         assert(obj->tag == LDKEvent_OpenChannelRequest);
11757         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
11758         return funding_satoshis_conv;
11759 }
11760 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
11761         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11762         assert(obj->tag == LDKEvent_OpenChannelRequest);
11763         int64_t push_msat_conv = obj->open_channel_request.push_msat;
11764         return push_msat_conv;
11765 }
11766 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
11767         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11768         assert(obj->tag == LDKEvent_OpenChannelRequest);
11769         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
11770                         uint64_t channel_type_ref = 0;
11771                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11772                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11773         return channel_type_ref;
11774 }
11775 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
11776         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11777         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
11778         LDKChannelId prev_channel_id_var = obj->htlc_handling_failed.prev_channel_id;
11779                         uint64_t prev_channel_id_ref = 0;
11780                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
11781                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
11782         return prev_channel_id_ref;
11783 }
11784 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
11785         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11786         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
11787         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
11788         return failed_next_destination_ref;
11789 }
11790 uint64_t __attribute__((export_name("TS_LDKEvent_BumpTransaction_get_bump_transaction"))) TS_LDKEvent_BumpTransaction_get_bump_transaction(uint64_t ptr) {
11791         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11792         assert(obj->tag == LDKEvent_BumpTransaction);
11793         uint64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
11794         return bump_transaction_ref;
11795 }
11796 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
11797         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11798         switch(obj->tag) {
11799                 case LDKCOption_EventZ_Some: return 0;
11800                 case LDKCOption_EventZ_None: return 1;
11801                 default: abort();
11802         }
11803 }
11804 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
11805         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11806         assert(obj->tag == LDKCOption_EventZ_Some);
11807         uint64_t some_ref = tag_ptr(&obj->some, false);
11808         return some_ref;
11809 }
11810 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11811 CHECK(owner->result_ok);
11812         return COption_EventZ_clone(&*owner->contents.result);
11813 }
11814 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
11815         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11816         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11817         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
11818         uint64_t ret_ref = tag_ptr(ret_copy, true);
11819         return ret_ref;
11820 }
11821
11822 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11823 CHECK(!owner->result_ok);
11824         return DecodeError_clone(&*owner->contents.err);
11825 }
11826 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
11827         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11828         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11829         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
11830         uint64_t ret_ref = tag_ptr(ret_copy, true);
11831         return ret_ref;
11832 }
11833
11834 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_ty_from_ptr"))) TS_LDKBolt11ParseError_ty_from_ptr(uint64_t ptr) {
11835         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11836         switch(obj->tag) {
11837                 case LDKBolt11ParseError_Bech32Error: return 0;
11838                 case LDKBolt11ParseError_ParseAmountError: return 1;
11839                 case LDKBolt11ParseError_MalformedSignature: return 2;
11840                 case LDKBolt11ParseError_BadPrefix: return 3;
11841                 case LDKBolt11ParseError_UnknownCurrency: return 4;
11842                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
11843                 case LDKBolt11ParseError_MalformedHRP: return 6;
11844                 case LDKBolt11ParseError_TooShortDataPart: return 7;
11845                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
11846                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
11847                 case LDKBolt11ParseError_PaddingError: return 10;
11848                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
11849                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
11850                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
11851                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
11852                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
11853                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
11854                 case LDKBolt11ParseError_Skip: return 17;
11855                 default: abort();
11856         }
11857 }
11858 uint64_t __attribute__((export_name("TS_LDKBolt11ParseError_Bech32Error_get_bech32_error"))) TS_LDKBolt11ParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
11859         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11860         assert(obj->tag == LDKBolt11ParseError_Bech32Error);
11861         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
11862         return bech32_error_ref;
11863 }
11864 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
11865         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11866         assert(obj->tag == LDKBolt11ParseError_ParseAmountError);
11867         /*obj->parse_amount_error*/
11868         return 0;
11869 }
11870 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature"))) TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
11871         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11872         assert(obj->tag == LDKBolt11ParseError_MalformedSignature);
11873         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
11874         return malformed_signature_conv;
11875 }
11876 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
11877         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11878         assert(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
11879         /*obj->description_decode_error*/
11880         return 0;
11881 }
11882 jstring __attribute__((export_name("TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
11883         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11884         assert(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
11885         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
11886                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
11887         return invalid_slice_length_conv;
11888 }
11889 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
11890 CHECK(owner->result_ok);
11891         return SiPrefix_clone(&*owner->contents.result);
11892 }
11893 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok(uint64_t owner) {
11894         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
11895         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
11896         return ret_conv;
11897 }
11898
11899 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
11900 CHECK(!owner->result_ok);
11901         return Bolt11ParseError_clone(&*owner->contents.err);
11902 }
11903 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_err(uint64_t owner) {
11904         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
11905         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
11906         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
11907         uint64_t ret_ref = tag_ptr(ret_copy, true);
11908         return ret_ref;
11909 }
11910
11911 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
11912         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11913         switch(obj->tag) {
11914                 case LDKParseOrSemanticError_ParseError: return 0;
11915                 case LDKParseOrSemanticError_SemanticError: return 1;
11916                 default: abort();
11917         }
11918 }
11919 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
11920         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11921         assert(obj->tag == LDKParseOrSemanticError_ParseError);
11922         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
11923         return parse_error_ref;
11924 }
11925 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
11926         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11927         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
11928         uint32_t semantic_error_conv = LDKBolt11SemanticError_to_js(obj->semantic_error);
11929         return semantic_error_conv;
11930 }
11931 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
11932         LDKBolt11Invoice ret = *owner->contents.result;
11933         ret.is_owned = false;
11934         return ret;
11935 }
11936 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
11937         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
11938         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
11939         uint64_t ret_ref = 0;
11940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11942         return ret_ref;
11943 }
11944
11945 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
11946 CHECK(!owner->result_ok);
11947         return ParseOrSemanticError_clone(&*owner->contents.err);
11948 }
11949 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
11950         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
11951         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
11952         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
11953         uint64_t ret_ref = tag_ptr(ret_copy, true);
11954         return ret_ref;
11955 }
11956
11957 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
11958         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
11959         ret.is_owned = false;
11960         return ret;
11961 }
11962 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(uint64_t owner) {
11963         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
11964         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
11965         uint64_t ret_ref = 0;
11966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11968         return ret_ref;
11969 }
11970
11971 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
11972 CHECK(!owner->result_ok);
11973         return Bolt11ParseError_clone(&*owner->contents.err);
11974 }
11975 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(uint64_t owner) {
11976         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
11977         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
11978         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
11979         uint64_t ret_ref = tag_ptr(ret_copy, true);
11980         return ret_ref;
11981 }
11982
11983 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11984         LDKRawBolt11Invoice ret = owner->a;
11985         ret.is_owned = false;
11986         return ret;
11987 }
11988 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(uint64_t owner) {
11989         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11990         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
11991         uint64_t ret_ref = 0;
11992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11994         return ret_ref;
11995 }
11996
11997 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11998         return ThirtyTwoBytes_clone(&owner->b);
11999 }
12000 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(uint64_t owner) {
12001         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12002         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12003         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
12004         return ret_arr;
12005 }
12006
12007 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12008         LDKBolt11InvoiceSignature ret = owner->c;
12009         ret.is_owned = false;
12010         return ret;
12011 }
12012 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(uint64_t owner) {
12013         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12014         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
12015         uint64_t ret_ref = 0;
12016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12018         return ret_ref;
12019 }
12020
12021 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
12022         LDKPayeePubKey ret = *owner->contents.result;
12023         ret.is_owned = false;
12024         return ret;
12025 }
12026 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
12027         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
12028         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
12029         uint64_t ret_ref = 0;
12030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12032         return ret_ref;
12033 }
12034
12035 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
12036 CHECK(!owner->result_ok);
12037         return *owner->contents.err;
12038 }
12039 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err(uint64_t owner) {
12040         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
12041         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
12042         return ret_conv;
12043 }
12044
12045 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
12046         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
12047         for (size_t i = 0; i < ret.datalen; i++) {
12048                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
12049         }
12050         return ret;
12051 }
12052 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
12053         LDKPositiveTimestamp ret = *owner->contents.result;
12054         ret.is_owned = false;
12055         return ret;
12056 }
12057 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
12058         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
12059         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
12060         uint64_t ret_ref = 0;
12061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12063         return ret_ref;
12064 }
12065
12066 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
12067 CHECK(!owner->result_ok);
12068         return CreationError_clone(&*owner->contents.err);
12069 }
12070 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
12071         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
12072         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
12073         return ret_conv;
12074 }
12075
12076 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
12077 CHECK(owner->result_ok);
12078         return *owner->contents.result;
12079 }
12080 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_get_ok(uint64_t owner) {
12081         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
12082         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
12083 }
12084
12085 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
12086 CHECK(!owner->result_ok);
12087         return Bolt11SemanticError_clone(&*owner->contents.err);
12088 }
12089 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_err"))) TS_CResult_NoneBolt11SemanticErrorZ_get_err(uint64_t owner) {
12090         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
12091         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
12092         return ret_conv;
12093 }
12094
12095 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
12096         LDKBolt11Invoice ret = *owner->contents.result;
12097         ret.is_owned = false;
12098         return ret;
12099 }
12100 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(uint64_t owner) {
12101         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
12102         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
12103         uint64_t ret_ref = 0;
12104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12106         return ret_ref;
12107 }
12108
12109 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
12110 CHECK(!owner->result_ok);
12111         return Bolt11SemanticError_clone(&*owner->contents.err);
12112 }
12113 uint32_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(uint64_t owner) {
12114         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
12115         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
12116         return ret_conv;
12117 }
12118
12119 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
12120         LDKDescription ret = *owner->contents.result;
12121         ret.is_owned = false;
12122         return ret;
12123 }
12124 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
12125         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
12126         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
12127         uint64_t ret_ref = 0;
12128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12130         return ret_ref;
12131 }
12132
12133 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
12134 CHECK(!owner->result_ok);
12135         return CreationError_clone(&*owner->contents.err);
12136 }
12137 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
12138         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
12139         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
12140         return ret_conv;
12141 }
12142
12143 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12144         LDKPrivateRoute ret = *owner->contents.result;
12145         ret.is_owned = false;
12146         return ret;
12147 }
12148 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
12149         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12150         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
12151         uint64_t ret_ref = 0;
12152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12154         return ret_ref;
12155 }
12156
12157 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12158 CHECK(!owner->result_ok);
12159         return CreationError_clone(&*owner->contents.err);
12160 }
12161 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
12162         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12163         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
12164         return ret_conv;
12165 }
12166
12167 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12168         LDKOutPoint ret = *owner->contents.result;
12169         ret.is_owned = false;
12170         return ret;
12171 }
12172 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
12173         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12174         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
12175         uint64_t ret_ref = 0;
12176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12178         return ret_ref;
12179 }
12180
12181 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12182 CHECK(!owner->result_ok);
12183         return DecodeError_clone(&*owner->contents.err);
12184 }
12185 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
12186         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12187         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12188         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
12189         uint64_t ret_ref = tag_ptr(ret_copy, true);
12190         return ret_ref;
12191 }
12192
12193 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
12194         LDKBigSize ret = *owner->contents.result;
12195         ret.is_owned = false;
12196         return ret;
12197 }
12198 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_ok"))) TS_CResult_BigSizeDecodeErrorZ_get_ok(uint64_t owner) {
12199         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
12200         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
12201         uint64_t ret_ref = 0;
12202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12204         return ret_ref;
12205 }
12206
12207 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
12208 CHECK(!owner->result_ok);
12209         return DecodeError_clone(&*owner->contents.err);
12210 }
12211 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_err"))) TS_CResult_BigSizeDecodeErrorZ_get_err(uint64_t owner) {
12212         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
12213         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12214         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
12215         uint64_t ret_ref = tag_ptr(ret_copy, true);
12216         return ret_ref;
12217 }
12218
12219 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
12220         LDKHostname ret = *owner->contents.result;
12221         ret.is_owned = false;
12222         return ret;
12223 }
12224 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_ok"))) TS_CResult_HostnameDecodeErrorZ_get_ok(uint64_t owner) {
12225         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
12226         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
12227         uint64_t ret_ref = 0;
12228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12230         return ret_ref;
12231 }
12232
12233 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
12234 CHECK(!owner->result_ok);
12235         return DecodeError_clone(&*owner->contents.err);
12236 }
12237 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_err"))) TS_CResult_HostnameDecodeErrorZ_get_err(uint64_t owner) {
12238         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
12239         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12240         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
12241         uint64_t ret_ref = tag_ptr(ret_copy, true);
12242         return ret_ref;
12243 }
12244
12245 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
12246         LDKTransactionU16LenLimited ret = *owner->contents.result;
12247         ret.is_owned = false;
12248         return ret;
12249 }
12250 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_ok(uint64_t owner) {
12251         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
12252         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
12253         uint64_t ret_ref = 0;
12254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12256         return ret_ref;
12257 }
12258
12259 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
12260 CHECK(!owner->result_ok);
12261         return *owner->contents.err;
12262 }
12263 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_err(uint64_t owner) {
12264         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
12265         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
12266 }
12267
12268 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
12269         LDKTransactionU16LenLimited ret = *owner->contents.result;
12270         ret.is_owned = false;
12271         return ret;
12272 }
12273 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(uint64_t owner) {
12274         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
12275         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
12276         uint64_t ret_ref = 0;
12277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12279         return ret_ref;
12280 }
12281
12282 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
12283 CHECK(!owner->result_ok);
12284         return DecodeError_clone(&*owner->contents.err);
12285 }
12286 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(uint64_t owner) {
12287         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
12288         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12289         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
12290         uint64_t ret_ref = tag_ptr(ret_copy, true);
12291         return ret_ref;
12292 }
12293
12294 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
12295         LDKUntrustedString ret = *owner->contents.result;
12296         ret.is_owned = false;
12297         return ret;
12298 }
12299 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
12300         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
12301         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
12302         uint64_t ret_ref = 0;
12303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12305         return ret_ref;
12306 }
12307
12308 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
12309 CHECK(!owner->result_ok);
12310         return DecodeError_clone(&*owner->contents.err);
12311 }
12312 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
12313         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
12314         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12315         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
12316         uint64_t ret_ref = tag_ptr(ret_copy, true);
12317         return ret_ref;
12318 }
12319
12320 static inline struct LDKChannelId CResult_ChannelIdDecodeErrorZ_get_ok(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
12321         LDKChannelId ret = *owner->contents.result;
12322         ret.is_owned = false;
12323         return ret;
12324 }
12325 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_get_ok"))) TS_CResult_ChannelIdDecodeErrorZ_get_ok(uint64_t owner) {
12326         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
12327         LDKChannelId ret_var = CResult_ChannelIdDecodeErrorZ_get_ok(owner_conv);
12328         uint64_t ret_ref = 0;
12329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12331         return ret_ref;
12332 }
12333
12334 static inline struct LDKDecodeError CResult_ChannelIdDecodeErrorZ_get_err(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
12335 CHECK(!owner->result_ok);
12336         return DecodeError_clone(&*owner->contents.err);
12337 }
12338 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_get_err"))) TS_CResult_ChannelIdDecodeErrorZ_get_err(uint64_t owner) {
12339         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
12340         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12341         *ret_copy = CResult_ChannelIdDecodeErrorZ_get_err(owner_conv);
12342         uint64_t ret_ref = tag_ptr(ret_copy, true);
12343         return ret_ref;
12344 }
12345
12346 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
12347         return ThirtyTwoBytes_clone(&owner->a);
12348 }
12349 int8_tArray  __attribute__((export_name("TS_C2Tuple__u832u16Z_get_a"))) TS_C2Tuple__u832u16Z_get_a(uint64_t owner) {
12350         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
12351         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12352         memcpy(ret_arr->elems, C2Tuple__u832u16Z_get_a(owner_conv).data, 32);
12353         return ret_arr;
12354 }
12355
12356 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
12357         return owner->b;
12358 }
12359 int16_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_get_b"))) TS_C2Tuple__u832u16Z_get_b(uint64_t owner) {
12360         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
12361         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
12362         return ret_conv;
12363 }
12364
12365 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
12366         LDKPaymentRelay ret = *owner->contents.result;
12367         ret.is_owned = false;
12368         return ret;
12369 }
12370 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_get_ok(uint64_t owner) {
12371         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
12372         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
12373         uint64_t ret_ref = 0;
12374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12376         return ret_ref;
12377 }
12378
12379 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
12380 CHECK(!owner->result_ok);
12381         return DecodeError_clone(&*owner->contents.err);
12382 }
12383 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_err"))) TS_CResult_PaymentRelayDecodeErrorZ_get_err(uint64_t owner) {
12384         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
12385         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12386         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
12387         uint64_t ret_ref = tag_ptr(ret_copy, true);
12388         return ret_ref;
12389 }
12390
12391 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
12392         LDKPaymentConstraints ret = *owner->contents.result;
12393         ret.is_owned = false;
12394         return ret;
12395 }
12396 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok(uint64_t owner) {
12397         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
12398         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
12399         uint64_t ret_ref = 0;
12400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12402         return ret_ref;
12403 }
12404
12405 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
12406 CHECK(!owner->result_ok);
12407         return DecodeError_clone(&*owner->contents.err);
12408 }
12409 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_err(uint64_t owner) {
12410         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
12411         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12412         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
12413         uint64_t ret_ref = tag_ptr(ret_copy, true);
12414         return ret_ref;
12415 }
12416
12417 static inline struct LDKPaymentContext CResult_PaymentContextDecodeErrorZ_get_ok(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
12418 CHECK(owner->result_ok);
12419         return PaymentContext_clone(&*owner->contents.result);
12420 }
12421 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_get_ok"))) TS_CResult_PaymentContextDecodeErrorZ_get_ok(uint64_t owner) {
12422         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
12423         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
12424         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_ok(owner_conv);
12425         uint64_t ret_ref = tag_ptr(ret_copy, true);
12426         return ret_ref;
12427 }
12428
12429 static inline struct LDKDecodeError CResult_PaymentContextDecodeErrorZ_get_err(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
12430 CHECK(!owner->result_ok);
12431         return DecodeError_clone(&*owner->contents.err);
12432 }
12433 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_get_err"))) TS_CResult_PaymentContextDecodeErrorZ_get_err(uint64_t owner) {
12434         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
12435         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12436         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_err(owner_conv);
12437         uint64_t ret_ref = tag_ptr(ret_copy, true);
12438         return ret_ref;
12439 }
12440
12441 static inline struct LDKUnknownPaymentContext CResult_UnknownPaymentContextDecodeErrorZ_get_ok(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
12442         LDKUnknownPaymentContext ret = *owner->contents.result;
12443         ret.is_owned = false;
12444         return ret;
12445 }
12446 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_get_ok"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_get_ok(uint64_t owner) {
12447         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
12448         LDKUnknownPaymentContext ret_var = CResult_UnknownPaymentContextDecodeErrorZ_get_ok(owner_conv);
12449         uint64_t ret_ref = 0;
12450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12452         return ret_ref;
12453 }
12454
12455 static inline struct LDKDecodeError CResult_UnknownPaymentContextDecodeErrorZ_get_err(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
12456 CHECK(!owner->result_ok);
12457         return DecodeError_clone(&*owner->contents.err);
12458 }
12459 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_get_err"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_get_err(uint64_t owner) {
12460         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
12461         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12462         *ret_copy = CResult_UnknownPaymentContextDecodeErrorZ_get_err(owner_conv);
12463         uint64_t ret_ref = tag_ptr(ret_copy, true);
12464         return ret_ref;
12465 }
12466
12467 static inline struct LDKBolt12OfferContext CResult_Bolt12OfferContextDecodeErrorZ_get_ok(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
12468         LDKBolt12OfferContext ret = *owner->contents.result;
12469         ret.is_owned = false;
12470         return ret;
12471 }
12472 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_get_ok"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_get_ok(uint64_t owner) {
12473         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
12474         LDKBolt12OfferContext ret_var = CResult_Bolt12OfferContextDecodeErrorZ_get_ok(owner_conv);
12475         uint64_t ret_ref = 0;
12476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12478         return ret_ref;
12479 }
12480
12481 static inline struct LDKDecodeError CResult_Bolt12OfferContextDecodeErrorZ_get_err(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
12482 CHECK(!owner->result_ok);
12483         return DecodeError_clone(&*owner->contents.err);
12484 }
12485 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_get_err"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_get_err(uint64_t owner) {
12486         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
12487         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12488         *ret_copy = CResult_Bolt12OfferContextDecodeErrorZ_get_err(owner_conv);
12489         uint64_t ret_ref = tag_ptr(ret_copy, true);
12490         return ret_ref;
12491 }
12492
12493 static inline struct LDKBolt12RefundContext CResult_Bolt12RefundContextDecodeErrorZ_get_ok(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
12494         LDKBolt12RefundContext ret = *owner->contents.result;
12495         ret.is_owned = false;
12496         return ret;
12497 }
12498 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_get_ok"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_get_ok(uint64_t owner) {
12499         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
12500         LDKBolt12RefundContext ret_var = CResult_Bolt12RefundContextDecodeErrorZ_get_ok(owner_conv);
12501         uint64_t ret_ref = 0;
12502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12504         return ret_ref;
12505 }
12506
12507 static inline struct LDKDecodeError CResult_Bolt12RefundContextDecodeErrorZ_get_err(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
12508 CHECK(!owner->result_ok);
12509         return DecodeError_clone(&*owner->contents.err);
12510 }
12511 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_get_err"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_get_err(uint64_t owner) {
12512         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
12513         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12514         *ret_copy = CResult_Bolt12RefundContextDecodeErrorZ_get_err(owner_conv);
12515         uint64_t ret_ref = tag_ptr(ret_copy, true);
12516         return ret_ref;
12517 }
12518
12519 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
12520 CHECK(owner->result_ok);
12521         return *owner->contents.result;
12522 }
12523 jstring  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_ok"))) TS_CResult_StrSecp256k1ErrorZ_get_ok(uint64_t owner) {
12524         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
12525         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
12526         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
12527         return ret_conv;
12528 }
12529
12530 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
12531 CHECK(!owner->result_ok);
12532         return *owner->contents.err;
12533 }
12534 uint32_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_err"))) TS_CResult_StrSecp256k1ErrorZ_get_err(uint64_t owner) {
12535         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
12536         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
12537         return ret_conv;
12538 }
12539
12540 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12541         return ThirtyTwoBytes_clone(&owner->a);
12542 }
12543 int8_tArray  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(uint64_t owner) {
12544         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12545         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12546         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data, 32);
12547         return ret_arr;
12548 }
12549
12550 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12551         LDKRecipientOnionFields ret = owner->b;
12552         ret.is_owned = false;
12553         return ret;
12554 }
12555 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(uint64_t owner) {
12556         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12557         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
12558         uint64_t ret_ref = 0;
12559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12561         return ret_ref;
12562 }
12563
12564 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12565         LDKRouteParameters ret = owner->c;
12566         ret.is_owned = false;
12567         return ret;
12568 }
12569 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(uint64_t owner) {
12570         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12571         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
12572         uint64_t ret_ref = 0;
12573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12575         return ret_ref;
12576 }
12577
12578 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
12579 CHECK(owner->result_ok);
12580         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
12581 }
12582 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(uint64_t owner) {
12583         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
12584         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
12585         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
12586         return tag_ptr(ret_conv, true);
12587 }
12588
12589 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
12590 CHECK(!owner->result_ok);
12591         return *owner->contents.err;
12592 }
12593 void  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(uint64_t owner) {
12594         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
12595         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
12596 }
12597
12598 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12599         return owner->a;
12600 }
12601 int8_tArray  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(uint64_t owner) {
12602         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12603         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
12604         memcpy(ret_arr->elems, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form, 33);
12605         return ret_arr;
12606 }
12607
12608 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12609         LDKOnionMessage ret = owner->b;
12610         ret.is_owned = false;
12611         return ret;
12612 }
12613 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(uint64_t owner) {
12614         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12615         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
12616         uint64_t ret_ref = 0;
12617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12619         return ret_ref;
12620 }
12621
12622 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12623         return COption_CVec_SocketAddressZZ_clone(&owner->c);
12624 }
12625 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(uint64_t owner) {
12626         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12627         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
12628         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
12629         uint64_t ret_ref = tag_ptr(ret_copy, true);
12630         return ret_ref;
12631 }
12632
12633 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
12634         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12635         switch(obj->tag) {
12636                 case LDKSendError_Secp256k1: return 0;
12637                 case LDKSendError_TooBigPacket: return 1;
12638                 case LDKSendError_TooFewBlindedHops: return 2;
12639                 case LDKSendError_InvalidFirstHop: return 3;
12640                 case LDKSendError_PathNotFound: return 4;
12641                 case LDKSendError_InvalidMessage: return 5;
12642                 case LDKSendError_BufferFull: return 6;
12643                 case LDKSendError_GetNodeIdFailed: return 7;
12644                 case LDKSendError_UnresolvedIntroductionNode: return 8;
12645                 case LDKSendError_BlindedPathAdvanceFailed: return 9;
12646                 default: abort();
12647         }
12648 }
12649 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
12650         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12651         assert(obj->tag == LDKSendError_Secp256k1);
12652         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
12653         return secp256k1_conv;
12654 }
12655 int8_tArray __attribute__((export_name("TS_LDKSendError_InvalidFirstHop_get_invalid_first_hop"))) TS_LDKSendError_InvalidFirstHop_get_invalid_first_hop(uint64_t ptr) {
12656         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12657         assert(obj->tag == LDKSendError_InvalidFirstHop);
12658         int8_tArray invalid_first_hop_arr = init_int8_tArray(33, __LINE__);
12659         memcpy(invalid_first_hop_arr->elems, obj->invalid_first_hop.compressed_form, 33);
12660         return invalid_first_hop_arr;
12661 }
12662 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
12663 CHECK(owner->result_ok);
12664         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
12665 }
12666 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(uint64_t owner) {
12667         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
12668         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
12669         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
12670         return tag_ptr(ret_conv, true);
12671 }
12672
12673 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
12674 CHECK(!owner->result_ok);
12675         return SendError_clone(&*owner->contents.err);
12676 }
12677 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(uint64_t owner) {
12678         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
12679         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
12680         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
12681         uint64_t ret_ref = tag_ptr(ret_copy, true);
12682         return ret_ref;
12683 }
12684
12685 uint32_t __attribute__((export_name("TS_LDKNextMessageHop_ty_from_ptr"))) TS_LDKNextMessageHop_ty_from_ptr(uint64_t ptr) {
12686         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
12687         switch(obj->tag) {
12688                 case LDKNextMessageHop_NodeId: return 0;
12689                 case LDKNextMessageHop_ShortChannelId: return 1;
12690                 default: abort();
12691         }
12692 }
12693 int8_tArray __attribute__((export_name("TS_LDKNextMessageHop_NodeId_get_node_id"))) TS_LDKNextMessageHop_NodeId_get_node_id(uint64_t ptr) {
12694         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
12695         assert(obj->tag == LDKNextMessageHop_NodeId);
12696         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
12697         memcpy(node_id_arr->elems, obj->node_id.compressed_form, 33);
12698         return node_id_arr;
12699 }
12700 int64_t __attribute__((export_name("TS_LDKNextMessageHop_ShortChannelId_get_short_channel_id"))) TS_LDKNextMessageHop_ShortChannelId_get_short_channel_id(uint64_t ptr) {
12701         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
12702         assert(obj->tag == LDKNextMessageHop_ShortChannelId);
12703         int64_t short_channel_id_conv = obj->short_channel_id;
12704         return short_channel_id_conv;
12705 }
12706 uint32_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_ty_from_ptr"))) TS_LDKParsedOnionMessageContents_ty_from_ptr(uint64_t ptr) {
12707         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12708         switch(obj->tag) {
12709                 case LDKParsedOnionMessageContents_Offers: return 0;
12710                 case LDKParsedOnionMessageContents_Custom: return 1;
12711                 default: abort();
12712         }
12713 }
12714 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Offers_get_offers"))) TS_LDKParsedOnionMessageContents_Offers_get_offers(uint64_t ptr) {
12715         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12716         assert(obj->tag == LDKParsedOnionMessageContents_Offers);
12717         uint64_t offers_ref = tag_ptr(&obj->offers, false);
12718         return offers_ref;
12719 }
12720 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Custom_get_custom"))) TS_LDKParsedOnionMessageContents_Custom_get_custom(uint64_t ptr) {
12721         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12722         assert(obj->tag == LDKParsedOnionMessageContents_Custom);
12723         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
12724         *custom_ret = OnionMessageContents_clone(&obj->custom);
12725         return tag_ptr(custom_ret, true);
12726 }
12727 uint32_t __attribute__((export_name("TS_LDKPeeledOnion_ty_from_ptr"))) TS_LDKPeeledOnion_ty_from_ptr(uint64_t ptr) {
12728         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12729         switch(obj->tag) {
12730                 case LDKPeeledOnion_Forward: return 0;
12731                 case LDKPeeledOnion_Receive: return 1;
12732                 default: abort();
12733         }
12734 }
12735 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__0"))) TS_LDKPeeledOnion_Forward_get__0(uint64_t ptr) {
12736         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12737         assert(obj->tag == LDKPeeledOnion_Forward);
12738         uint64_t _0_ref = tag_ptr(&obj->forward._0, false);
12739         return _0_ref;
12740 }
12741 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__1"))) TS_LDKPeeledOnion_Forward_get__1(uint64_t ptr) {
12742         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12743         assert(obj->tag == LDKPeeledOnion_Forward);
12744         LDKOnionMessage _1_var = obj->forward._1;
12745                         uint64_t _1_ref = 0;
12746                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
12747                         _1_ref = tag_ptr(_1_var.inner, false);
12748         return _1_ref;
12749 }
12750 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__0"))) TS_LDKPeeledOnion_Receive_get__0(uint64_t ptr) {
12751         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12752         assert(obj->tag == LDKPeeledOnion_Receive);
12753         uint64_t _0_ref = tag_ptr(&obj->receive._0, false);
12754         return _0_ref;
12755 }
12756 int8_tArray __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__1"))) TS_LDKPeeledOnion_Receive_get__1(uint64_t ptr) {
12757         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12758         assert(obj->tag == LDKPeeledOnion_Receive);
12759         int8_tArray _1_arr = init_int8_tArray(32, __LINE__);
12760         memcpy(_1_arr->elems, obj->receive._1.data, 32);
12761         return _1_arr;
12762 }
12763 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__2"))) TS_LDKPeeledOnion_Receive_get__2(uint64_t ptr) {
12764         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12765         assert(obj->tag == LDKPeeledOnion_Receive);
12766         LDKBlindedPath _2_var = obj->receive._2;
12767                         uint64_t _2_ref = 0;
12768                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
12769                         _2_ref = tag_ptr(_2_var.inner, false);
12770         return _2_ref;
12771 }
12772 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
12773 CHECK(owner->result_ok);
12774         return PeeledOnion_clone(&*owner->contents.result);
12775 }
12776 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_ok"))) TS_CResult_PeeledOnionNoneZ_get_ok(uint64_t owner) {
12777         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
12778         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
12779         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
12780         uint64_t ret_ref = tag_ptr(ret_copy, true);
12781         return ret_ref;
12782 }
12783
12784 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
12785 CHECK(!owner->result_ok);
12786         return *owner->contents.err;
12787 }
12788 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_err"))) TS_CResult_PeeledOnionNoneZ_get_err(uint64_t owner) {
12789         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
12790         CResult_PeeledOnionNoneZ_get_err(owner_conv);
12791 }
12792
12793 uint32_t __attribute__((export_name("TS_LDKSendSuccess_ty_from_ptr"))) TS_LDKSendSuccess_ty_from_ptr(uint64_t ptr) {
12794         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
12795         switch(obj->tag) {
12796                 case LDKSendSuccess_Buffered: return 0;
12797                 case LDKSendSuccess_BufferedAwaitingConnection: return 1;
12798                 default: abort();
12799         }
12800 }
12801 int8_tArray __attribute__((export_name("TS_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection"))) TS_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection(uint64_t ptr) {
12802         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
12803         assert(obj->tag == LDKSendSuccess_BufferedAwaitingConnection);
12804         int8_tArray buffered_awaiting_connection_arr = init_int8_tArray(33, __LINE__);
12805         memcpy(buffered_awaiting_connection_arr->elems, obj->buffered_awaiting_connection.compressed_form, 33);
12806         return buffered_awaiting_connection_arr;
12807 }
12808 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
12809 CHECK(owner->result_ok);
12810         return SendSuccess_clone(&*owner->contents.result);
12811 }
12812 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_get_ok"))) TS_CResult_SendSuccessSendErrorZ_get_ok(uint64_t owner) {
12813         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
12814         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
12815         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
12816         uint64_t ret_ref = tag_ptr(ret_copy, true);
12817         return ret_ref;
12818 }
12819
12820 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
12821 CHECK(!owner->result_ok);
12822         return SendError_clone(&*owner->contents.err);
12823 }
12824 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_get_err"))) TS_CResult_SendSuccessSendErrorZ_get_err(uint64_t owner) {
12825         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
12826         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
12827         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
12828         uint64_t ret_ref = tag_ptr(ret_copy, true);
12829         return ret_ref;
12830 }
12831
12832 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
12833         LDKBlindedPath ret = *owner->contents.result;
12834         ret.is_owned = false;
12835         return ret;
12836 }
12837 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
12838         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
12839         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
12840         uint64_t ret_ref = 0;
12841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12843         return ret_ref;
12844 }
12845
12846 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
12847 CHECK(!owner->result_ok);
12848         return *owner->contents.err;
12849 }
12850 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
12851         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
12852         CResult_BlindedPathNoneZ_get_err(owner_conv);
12853 }
12854
12855 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
12856 CHECK(owner->result_ok);
12857         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
12858 }
12859 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(uint64_t owner) {
12860         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
12861         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
12862         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
12863         return tag_ptr(ret_conv, true);
12864 }
12865
12866 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
12867 CHECK(!owner->result_ok);
12868         return *owner->contents.err;
12869 }
12870 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(uint64_t owner) {
12871         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
12872         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
12873 }
12874
12875 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
12876         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
12877         for (size_t i = 0; i < ret.datalen; i++) {
12878                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
12879         }
12880         return ret;
12881 }
12882 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
12883         LDKBlindedPath ret = *owner->contents.result;
12884         ret.is_owned = false;
12885         return ret;
12886 }
12887 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
12888         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
12889         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
12890         uint64_t ret_ref = 0;
12891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12893         return ret_ref;
12894 }
12895
12896 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
12897 CHECK(!owner->result_ok);
12898         return DecodeError_clone(&*owner->contents.err);
12899 }
12900 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
12901         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
12902         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12903         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
12904         uint64_t ret_ref = tag_ptr(ret_copy, true);
12905         return ret_ref;
12906 }
12907
12908 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
12909         LDKBlindedHop ret = *owner->contents.result;
12910         ret.is_owned = false;
12911         return ret;
12912 }
12913 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
12914         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
12915         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
12916         uint64_t ret_ref = 0;
12917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12919         return ret_ref;
12920 }
12921
12922 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
12923 CHECK(!owner->result_ok);
12924         return DecodeError_clone(&*owner->contents.err);
12925 }
12926 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
12927         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
12928         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12929         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
12930         uint64_t ret_ref = tag_ptr(ret_copy, true);
12931         return ret_ref;
12932 }
12933
12934 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
12935         LDKInvoiceError ret = *owner->contents.result;
12936         ret.is_owned = false;
12937         return ret;
12938 }
12939 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_ok(uint64_t owner) {
12940         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
12941         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
12942         uint64_t ret_ref = 0;
12943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12945         return ret_ref;
12946 }
12947
12948 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
12949 CHECK(!owner->result_ok);
12950         return DecodeError_clone(&*owner->contents.err);
12951 }
12952 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_err(uint64_t owner) {
12953         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
12954         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12955         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
12956         uint64_t ret_ref = tag_ptr(ret_copy, true);
12957         return ret_ref;
12958 }
12959
12960 static inline struct LDKTrackedSpendableOutput CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
12961         LDKTrackedSpendableOutput ret = *owner->contents.result;
12962         ret.is_owned = false;
12963         return ret;
12964 }
12965 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_get_ok"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(uint64_t owner) {
12966         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
12967         LDKTrackedSpendableOutput ret_var = CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(owner_conv);
12968         uint64_t ret_ref = 0;
12969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12971         return ret_ref;
12972 }
12973
12974 static inline struct LDKDecodeError CResult_TrackedSpendableOutputDecodeErrorZ_get_err(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
12975 CHECK(!owner->result_ok);
12976         return DecodeError_clone(&*owner->contents.err);
12977 }
12978 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_get_err"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_get_err(uint64_t owner) {
12979         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
12980         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12981         *ret_copy = CResult_TrackedSpendableOutputDecodeErrorZ_get_err(owner_conv);
12982         uint64_t ret_ref = tag_ptr(ret_copy, true);
12983         return ret_ref;
12984 }
12985
12986 uint32_t __attribute__((export_name("TS_LDKOutputSpendStatus_ty_from_ptr"))) TS_LDKOutputSpendStatus_ty_from_ptr(uint64_t ptr) {
12987         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
12988         switch(obj->tag) {
12989                 case LDKOutputSpendStatus_PendingInitialBroadcast: return 0;
12990                 case LDKOutputSpendStatus_PendingFirstConfirmation: return 1;
12991                 case LDKOutputSpendStatus_PendingThresholdConfirmations: return 2;
12992                 default: abort();
12993         }
12994 }
12995 uint64_t __attribute__((export_name("TS_LDKOutputSpendStatus_PendingInitialBroadcast_get_delayed_until_height"))) TS_LDKOutputSpendStatus_PendingInitialBroadcast_get_delayed_until_height(uint64_t ptr) {
12996         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
12997         assert(obj->tag == LDKOutputSpendStatus_PendingInitialBroadcast);
12998         uint64_t delayed_until_height_ref = tag_ptr(&obj->pending_initial_broadcast.delayed_until_height, false);
12999         return delayed_until_height_ref;
13000 }
13001 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_first_broadcast_hash"))) TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_first_broadcast_hash(uint64_t ptr) {
13002         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13003         assert(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13004         int8_tArray first_broadcast_hash_arr = init_int8_tArray(32, __LINE__);
13005         memcpy(first_broadcast_hash_arr->elems, obj->pending_first_confirmation.first_broadcast_hash.data, 32);
13006         return first_broadcast_hash_arr;
13007 }
13008 int32_t __attribute__((export_name("TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_broadcast_height"))) TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_broadcast_height(uint64_t ptr) {
13009         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13010         assert(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13011         int32_t latest_broadcast_height_conv = obj->pending_first_confirmation.latest_broadcast_height;
13012         return latest_broadcast_height_conv;
13013 }
13014 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_spending_tx"))) TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_spending_tx(uint64_t ptr) {
13015         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13016         assert(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13017         LDKTransaction latest_spending_tx_var = obj->pending_first_confirmation.latest_spending_tx;
13018                         int8_tArray latest_spending_tx_arr = init_int8_tArray(latest_spending_tx_var.datalen, __LINE__);
13019                         memcpy(latest_spending_tx_arr->elems, latest_spending_tx_var.data, latest_spending_tx_var.datalen);
13020         return latest_spending_tx_arr;
13021 }
13022 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_first_broadcast_hash"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_first_broadcast_hash(uint64_t ptr) {
13023         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13024         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13025         int8_tArray first_broadcast_hash_arr = init_int8_tArray(32, __LINE__);
13026         memcpy(first_broadcast_hash_arr->elems, obj->pending_threshold_confirmations.first_broadcast_hash.data, 32);
13027         return first_broadcast_hash_arr;
13028 }
13029 int32_t __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_broadcast_height"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_broadcast_height(uint64_t ptr) {
13030         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13031         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13032         int32_t latest_broadcast_height_conv = obj->pending_threshold_confirmations.latest_broadcast_height;
13033         return latest_broadcast_height_conv;
13034 }
13035 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_spending_tx"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_spending_tx(uint64_t ptr) {
13036         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13037         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13038         LDKTransaction latest_spending_tx_var = obj->pending_threshold_confirmations.latest_spending_tx;
13039                         int8_tArray latest_spending_tx_arr = init_int8_tArray(latest_spending_tx_var.datalen, __LINE__);
13040                         memcpy(latest_spending_tx_arr->elems, latest_spending_tx_var.data, latest_spending_tx_var.datalen);
13041         return latest_spending_tx_arr;
13042 }
13043 int32_t __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_height"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_height(uint64_t ptr) {
13044         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13045         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13046         int32_t confirmation_height_conv = obj->pending_threshold_confirmations.confirmation_height;
13047         return confirmation_height_conv;
13048 }
13049 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_hash"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_hash(uint64_t ptr) {
13050         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13051         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13052         int8_tArray confirmation_hash_arr = init_int8_tArray(32, __LINE__);
13053         memcpy(confirmation_hash_arr->elems, obj->pending_threshold_confirmations.confirmation_hash.data, 32);
13054         return confirmation_hash_arr;
13055 }
13056 static inline struct LDKOutputSpendStatus CResult_OutputSpendStatusDecodeErrorZ_get_ok(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
13057 CHECK(owner->result_ok);
13058         return OutputSpendStatus_clone(&*owner->contents.result);
13059 }
13060 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_get_ok"))) TS_CResult_OutputSpendStatusDecodeErrorZ_get_ok(uint64_t owner) {
13061         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
13062         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
13063         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_ok(owner_conv);
13064         uint64_t ret_ref = tag_ptr(ret_copy, true);
13065         return ret_ref;
13066 }
13067
13068 static inline struct LDKDecodeError CResult_OutputSpendStatusDecodeErrorZ_get_err(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
13069 CHECK(!owner->result_ok);
13070         return DecodeError_clone(&*owner->contents.err);
13071 }
13072 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_get_err"))) TS_CResult_OutputSpendStatusDecodeErrorZ_get_err(uint64_t owner) {
13073         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
13074         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13075         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_err(owner_conv);
13076         uint64_t ret_ref = tag_ptr(ret_copy, true);
13077         return ret_ref;
13078 }
13079
13080 typedef struct LDKFilter_JCalls {
13081         atomic_size_t refcnt;
13082         uint32_t instance_ptr;
13083 } LDKFilter_JCalls;
13084 static void LDKFilter_JCalls_free(void* this_arg) {
13085         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13086         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13087                 FREE(j_calls);
13088         }
13089 }
13090 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
13091         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13092         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
13093         memcpy(txid_arr->elems, *txid, 32);
13094         LDKu8slice script_pubkey_var = script_pubkey;
13095         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
13096         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
13097         js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
13098 }
13099 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
13100         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13101         LDKWatchedOutput output_var = output;
13102         uint64_t output_ref = 0;
13103         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
13104         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
13105         js_invoke_function_buuuuu(j_calls->instance_ptr, 48, output_ref, 0, 0, 0, 0, 0);
13106 }
13107 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
13108         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
13109         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13110 }
13111 static inline LDKFilter LDKFilter_init (JSValue o) {
13112         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
13113         atomic_init(&calls->refcnt, 1);
13114         calls->instance_ptr = o;
13115
13116         LDKFilter ret = {
13117                 .this_arg = (void*) calls,
13118                 .register_tx = register_tx_LDKFilter_jcall,
13119                 .register_output = register_output_LDKFilter_jcall,
13120                 .free = LDKFilter_JCalls_free,
13121         };
13122         return ret;
13123 }
13124 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
13125         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
13126         *res_ptr = LDKFilter_init(o);
13127         return tag_ptr(res_ptr, true);
13128 }
13129 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
13130         void* this_arg_ptr = untag_ptr(this_arg);
13131         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13132         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13133         uint8_t txid_arr[32];
13134         CHECK(txid->arr_len == 32);
13135         memcpy(txid_arr, txid->elems, 32); FREE(txid);
13136         uint8_t (*txid_ref)[32] = &txid_arr;
13137         LDKu8slice script_pubkey_ref;
13138         script_pubkey_ref.datalen = script_pubkey->arr_len;
13139         script_pubkey_ref.data = script_pubkey->elems;
13140         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
13141         FREE(script_pubkey);
13142 }
13143
13144 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
13145         void* this_arg_ptr = untag_ptr(this_arg);
13146         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13147         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13148         LDKWatchedOutput output_conv;
13149         output_conv.inner = untag_ptr(output);
13150         output_conv.is_owned = ptr_is_owned(output);
13151         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
13152         output_conv = WatchedOutput_clone(&output_conv);
13153         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
13154 }
13155
13156 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
13157         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
13158         switch(obj->tag) {
13159                 case LDKCOption_FilterZ_Some: return 0;
13160                 case LDKCOption_FilterZ_None: return 1;
13161                 default: abort();
13162         }
13163 }
13164 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
13165         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
13166         assert(obj->tag == LDKCOption_FilterZ_Some);
13167         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
13168         *some_ret = obj->some;
13169                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
13170                         if ((*some_ret).free == LDKFilter_JCalls_free) {
13171                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13172                                 LDKFilter_JCalls_cloned(&(*some_ret));
13173                         }
13174         return tag_ptr(some_ret, true);
13175 }
13176 static inline LDKCVec_TrackedSpendableOutputZ CVec_TrackedSpendableOutputZ_clone(const LDKCVec_TrackedSpendableOutputZ *orig) {
13177         LDKCVec_TrackedSpendableOutputZ ret = { .data = MALLOC(sizeof(LDKTrackedSpendableOutput) * orig->datalen, "LDKCVec_TrackedSpendableOutputZ clone bytes"), .datalen = orig->datalen };
13178         for (size_t i = 0; i < ret.datalen; i++) {
13179                 ret.data[i] = TrackedSpendableOutput_clone(&orig->data[i]);
13180         }
13181         return ret;
13182 }
13183 typedef struct LDKChangeDestinationSource_JCalls {
13184         atomic_size_t refcnt;
13185         uint32_t instance_ptr;
13186 } LDKChangeDestinationSource_JCalls;
13187 static void LDKChangeDestinationSource_JCalls_free(void* this_arg) {
13188         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
13189         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13190                 FREE(j_calls);
13191         }
13192 }
13193 LDKCResult_CVec_u8ZNoneZ get_change_destination_script_LDKChangeDestinationSource_jcall(const void* this_arg) {
13194         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
13195         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0);
13196         void* ret_ptr = untag_ptr(ret);
13197         CHECK_ACCESS(ret_ptr);
13198         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
13199         FREE(untag_ptr(ret));
13200         return ret_conv;
13201 }
13202 static void LDKChangeDestinationSource_JCalls_cloned(LDKChangeDestinationSource* new_obj) {
13203         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) new_obj->this_arg;
13204         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13205 }
13206 static inline LDKChangeDestinationSource LDKChangeDestinationSource_init (JSValue o) {
13207         LDKChangeDestinationSource_JCalls *calls = MALLOC(sizeof(LDKChangeDestinationSource_JCalls), "LDKChangeDestinationSource_JCalls");
13208         atomic_init(&calls->refcnt, 1);
13209         calls->instance_ptr = o;
13210
13211         LDKChangeDestinationSource ret = {
13212                 .this_arg = (void*) calls,
13213                 .get_change_destination_script = get_change_destination_script_LDKChangeDestinationSource_jcall,
13214                 .free = LDKChangeDestinationSource_JCalls_free,
13215         };
13216         return ret;
13217 }
13218 uint64_t  __attribute__((export_name("TS_LDKChangeDestinationSource_new"))) TS_LDKChangeDestinationSource_new(JSValue o) {
13219         LDKChangeDestinationSource *res_ptr = MALLOC(sizeof(LDKChangeDestinationSource), "LDKChangeDestinationSource");
13220         *res_ptr = LDKChangeDestinationSource_init(o);
13221         return tag_ptr(res_ptr, true);
13222 }
13223 uint64_t  __attribute__((export_name("TS_ChangeDestinationSource_get_change_destination_script"))) TS_ChangeDestinationSource_get_change_destination_script(uint64_t this_arg) {
13224         void* this_arg_ptr = untag_ptr(this_arg);
13225         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13226         LDKChangeDestinationSource* this_arg_conv = (LDKChangeDestinationSource*)this_arg_ptr;
13227         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
13228         *ret_conv = (this_arg_conv->get_change_destination_script)(this_arg_conv->this_arg);
13229         return tag_ptr(ret_conv, true);
13230 }
13231
13232 typedef struct LDKKVStore_JCalls {
13233         atomic_size_t refcnt;
13234         uint32_t instance_ptr;
13235 } LDKKVStore_JCalls;
13236 static void LDKKVStore_JCalls_free(void* this_arg) {
13237         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13238         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13239                 FREE(j_calls);
13240         }
13241 }
13242 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
13243         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13244         LDKStr primary_namespace_str = primary_namespace;
13245         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
13246         Str_free(primary_namespace_str);
13247         LDKStr secondary_namespace_str = secondary_namespace;
13248         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
13249         Str_free(secondary_namespace_str);
13250         LDKStr key_str = key;
13251         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
13252         Str_free(key_str);
13253         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, primary_namespace_conv, secondary_namespace_conv, key_conv, 0, 0, 0);
13254         void* ret_ptr = untag_ptr(ret);
13255         CHECK_ACCESS(ret_ptr);
13256         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
13257         FREE(untag_ptr(ret));
13258         return ret_conv;
13259 }
13260 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
13261         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13262         LDKStr primary_namespace_str = primary_namespace;
13263         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
13264         Str_free(primary_namespace_str);
13265         LDKStr secondary_namespace_str = secondary_namespace;
13266         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
13267         Str_free(secondary_namespace_str);
13268         LDKStr key_str = key;
13269         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
13270         Str_free(key_str);
13271         LDKu8slice buf_var = buf;
13272         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
13273         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
13274         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);
13275         void* ret_ptr = untag_ptr(ret);
13276         CHECK_ACCESS(ret_ptr);
13277         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13278         FREE(untag_ptr(ret));
13279         return ret_conv;
13280 }
13281 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
13282         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13283         LDKStr primary_namespace_str = primary_namespace;
13284         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
13285         Str_free(primary_namespace_str);
13286         LDKStr secondary_namespace_str = secondary_namespace;
13287         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
13288         Str_free(secondary_namespace_str);
13289         LDKStr key_str = key;
13290         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
13291         Str_free(key_str);
13292         jboolean lazy_conv = lazy;
13293         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 52, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv, 0, 0);
13294         void* ret_ptr = untag_ptr(ret);
13295         CHECK_ACCESS(ret_ptr);
13296         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13297         FREE(untag_ptr(ret));
13298         return ret_conv;
13299 }
13300 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
13301         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13302         LDKStr primary_namespace_str = primary_namespace;
13303         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
13304         Str_free(primary_namespace_str);
13305         LDKStr secondary_namespace_str = secondary_namespace;
13306         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
13307         Str_free(secondary_namespace_str);
13308         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 53, primary_namespace_conv, secondary_namespace_conv, 0, 0, 0, 0);
13309         void* ret_ptr = untag_ptr(ret);
13310         CHECK_ACCESS(ret_ptr);
13311         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
13312         FREE(untag_ptr(ret));
13313         return ret_conv;
13314 }
13315 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
13316         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
13317         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13318 }
13319 static inline LDKKVStore LDKKVStore_init (JSValue o) {
13320         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
13321         atomic_init(&calls->refcnt, 1);
13322         calls->instance_ptr = o;
13323
13324         LDKKVStore ret = {
13325                 .this_arg = (void*) calls,
13326                 .read = read_LDKKVStore_jcall,
13327                 .write = write_LDKKVStore_jcall,
13328                 .remove = remove_LDKKVStore_jcall,
13329                 .list = list_LDKKVStore_jcall,
13330                 .free = LDKKVStore_JCalls_free,
13331         };
13332         return ret;
13333 }
13334 uint64_t  __attribute__((export_name("TS_LDKKVStore_new"))) TS_LDKKVStore_new(JSValue o) {
13335         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
13336         *res_ptr = LDKKVStore_init(o);
13337         return tag_ptr(res_ptr, true);
13338 }
13339 uint64_t  __attribute__((export_name("TS_KVStore_read"))) TS_KVStore_read(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
13340         void* this_arg_ptr = untag_ptr(this_arg);
13341         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13342         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13343         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13344         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13345         LDKStr key_conv = str_ref_to_owned_c(key);
13346         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
13347         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
13348         return tag_ptr(ret_conv, true);
13349 }
13350
13351 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) {
13352         void* this_arg_ptr = untag_ptr(this_arg);
13353         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13354         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13355         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13356         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13357         LDKStr key_conv = str_ref_to_owned_c(key);
13358         LDKu8slice buf_ref;
13359         buf_ref.datalen = buf->arr_len;
13360         buf_ref.data = buf->elems;
13361         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13362         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
13363         FREE(buf);
13364         return tag_ptr(ret_conv, true);
13365 }
13366
13367 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) {
13368         void* this_arg_ptr = untag_ptr(this_arg);
13369         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13370         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13371         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13372         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13373         LDKStr key_conv = str_ref_to_owned_c(key);
13374         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13375         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
13376         return tag_ptr(ret_conv, true);
13377 }
13378
13379 uint64_t  __attribute__((export_name("TS_KVStore_list"))) TS_KVStore_list(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
13380         void* this_arg_ptr = untag_ptr(this_arg);
13381         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13382         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13383         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13384         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13385         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
13386         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
13387         return tag_ptr(ret_conv, true);
13388 }
13389
13390 typedef struct LDKOutputSpender_JCalls {
13391         atomic_size_t refcnt;
13392         uint32_t instance_ptr;
13393 } LDKOutputSpender_JCalls;
13394 static void LDKOutputSpender_JCalls_free(void* this_arg) {
13395         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
13396         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13397                 FREE(j_calls);
13398         }
13399 }
13400 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) {
13401         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
13402         LDKCVec_SpendableOutputDescriptorZ descriptors_var = descriptors;
13403         uint64_tArray descriptors_arr = NULL;
13404         descriptors_arr = init_uint64_tArray(descriptors_var.datalen, __LINE__);
13405         uint64_t *descriptors_arr_ptr = (uint64_t*)(((uint8_t*)descriptors_arr) + 8);
13406         for (size_t b = 0; b < descriptors_var.datalen; b++) {
13407                 LDKSpendableOutputDescriptor *descriptors_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13408                 *descriptors_conv_27_copy = descriptors_var.data[b];
13409                 uint64_t descriptors_conv_27_ref = tag_ptr(descriptors_conv_27_copy, true);
13410                 descriptors_arr_ptr[b] = descriptors_conv_27_ref;
13411         }
13412         
13413         FREE(descriptors_var.data);
13414         LDKCVec_TxOutZ outputs_var = outputs;
13415         uint64_tArray outputs_arr = NULL;
13416         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
13417         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
13418         for (size_t h = 0; h < outputs_var.datalen; h++) {
13419                 LDKTxOut* outputs_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13420                 *outputs_conv_7_ref = outputs_var.data[h];
13421                 outputs_arr_ptr[h] = tag_ptr(outputs_conv_7_ref, true);
13422         }
13423         
13424         FREE(outputs_var.data);
13425         LDKCVec_u8Z change_destination_script_var = change_destination_script;
13426         int8_tArray change_destination_script_arr = init_int8_tArray(change_destination_script_var.datalen, __LINE__);
13427         memcpy(change_destination_script_arr->elems, change_destination_script_var.data, change_destination_script_var.datalen);
13428         CVec_u8Z_free(change_destination_script_var);
13429         int32_t feerate_sat_per_1000_weight_conv = feerate_sat_per_1000_weight;
13430         LDKCOption_u32Z *locktime_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
13431         *locktime_copy = locktime;
13432         uint64_t locktime_ref = tag_ptr(locktime_copy, true);
13433         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);
13434         void* ret_ptr = untag_ptr(ret);
13435         CHECK_ACCESS(ret_ptr);
13436         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
13437         FREE(untag_ptr(ret));
13438         return ret_conv;
13439 }
13440 static void LDKOutputSpender_JCalls_cloned(LDKOutputSpender* new_obj) {
13441         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) new_obj->this_arg;
13442         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13443 }
13444 static inline LDKOutputSpender LDKOutputSpender_init (JSValue o) {
13445         LDKOutputSpender_JCalls *calls = MALLOC(sizeof(LDKOutputSpender_JCalls), "LDKOutputSpender_JCalls");
13446         atomic_init(&calls->refcnt, 1);
13447         calls->instance_ptr = o;
13448
13449         LDKOutputSpender ret = {
13450                 .this_arg = (void*) calls,
13451                 .spend_spendable_outputs = spend_spendable_outputs_LDKOutputSpender_jcall,
13452                 .free = LDKOutputSpender_JCalls_free,
13453         };
13454         return ret;
13455 }
13456 uint64_t  __attribute__((export_name("TS_LDKOutputSpender_new"))) TS_LDKOutputSpender_new(JSValue o) {
13457         LDKOutputSpender *res_ptr = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
13458         *res_ptr = LDKOutputSpender_init(o);
13459         return tag_ptr(res_ptr, true);
13460 }
13461 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) {
13462         void* this_arg_ptr = untag_ptr(this_arg);
13463         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13464         LDKOutputSpender* this_arg_conv = (LDKOutputSpender*)this_arg_ptr;
13465         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
13466         descriptors_constr.datalen = descriptors->arr_len;
13467         if (descriptors_constr.datalen > 0)
13468                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13469         else
13470                 descriptors_constr.data = NULL;
13471         uint64_t* descriptors_vals = descriptors->elems;
13472         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
13473                 uint64_t descriptors_conv_27 = descriptors_vals[b];
13474                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
13475                 CHECK_ACCESS(descriptors_conv_27_ptr);
13476                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
13477                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
13478                 descriptors_constr.data[b] = descriptors_conv_27_conv;
13479         }
13480         FREE(descriptors);
13481         LDKCVec_TxOutZ outputs_constr;
13482         outputs_constr.datalen = outputs->arr_len;
13483         if (outputs_constr.datalen > 0)
13484                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
13485         else
13486                 outputs_constr.data = NULL;
13487         uint64_t* outputs_vals = outputs->elems;
13488         for (size_t h = 0; h < outputs_constr.datalen; h++) {
13489                 uint64_t outputs_conv_7 = outputs_vals[h];
13490                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
13491                 CHECK_ACCESS(outputs_conv_7_ptr);
13492                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
13493                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
13494                 outputs_constr.data[h] = outputs_conv_7_conv;
13495         }
13496         FREE(outputs);
13497         LDKCVec_u8Z change_destination_script_ref;
13498         change_destination_script_ref.datalen = change_destination_script->arr_len;
13499         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
13500         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
13501         void* locktime_ptr = untag_ptr(locktime);
13502         CHECK_ACCESS(locktime_ptr);
13503         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
13504         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
13505         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13506         *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);
13507         return tag_ptr(ret_conv, true);
13508 }
13509
13510 static inline struct LDKOutputSweeper CResult_OutputSweeperDecodeErrorZ_get_ok(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
13511         LDKOutputSweeper ret = *owner->contents.result;
13512         ret.is_owned = false;
13513         return ret;
13514 }
13515 uint64_t  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_get_ok"))) TS_CResult_OutputSweeperDecodeErrorZ_get_ok(uint64_t owner) {
13516         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
13517         LDKOutputSweeper ret_var = CResult_OutputSweeperDecodeErrorZ_get_ok(owner_conv);
13518         uint64_t ret_ref = 0;
13519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13521         return ret_ref;
13522 }
13523
13524 static inline struct LDKDecodeError CResult_OutputSweeperDecodeErrorZ_get_err(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
13525 CHECK(!owner->result_ok);
13526         return DecodeError_clone(&*owner->contents.err);
13527 }
13528 uint64_t  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_get_err"))) TS_CResult_OutputSweeperDecodeErrorZ_get_err(uint64_t owner) {
13529         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
13530         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13531         *ret_copy = CResult_OutputSweeperDecodeErrorZ_get_err(owner_conv);
13532         uint64_t ret_ref = tag_ptr(ret_copy, true);
13533         return ret_ref;
13534 }
13535
13536 static inline struct LDKBestBlock C2Tuple_BestBlockOutputSweeperZ_get_a(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
13537         LDKBestBlock ret = owner->a;
13538         ret.is_owned = false;
13539         return ret;
13540 }
13541 uint64_t  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_get_a"))) TS_C2Tuple_BestBlockOutputSweeperZ_get_a(uint64_t owner) {
13542         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
13543         LDKBestBlock ret_var = C2Tuple_BestBlockOutputSweeperZ_get_a(owner_conv);
13544         uint64_t ret_ref = 0;
13545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13547         return ret_ref;
13548 }
13549
13550 static inline struct LDKOutputSweeper C2Tuple_BestBlockOutputSweeperZ_get_b(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
13551         LDKOutputSweeper ret = owner->b;
13552         ret.is_owned = false;
13553         return ret;
13554 }
13555 uint64_t  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_get_b"))) TS_C2Tuple_BestBlockOutputSweeperZ_get_b(uint64_t owner) {
13556         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
13557         LDKOutputSweeper ret_var = C2Tuple_BestBlockOutputSweeperZ_get_b(owner_conv);
13558         uint64_t ret_ref = 0;
13559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13561         return ret_ref;
13562 }
13563
13564 static inline struct LDKC2Tuple_BestBlockOutputSweeperZ *CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
13565 CHECK(owner->result_ok);
13566         return &*owner->contents.result;
13567 }
13568 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(uint64_t owner) {
13569         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
13570         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(owner_conv), false);
13571         return ret_ret;
13572 }
13573
13574 static inline struct LDKDecodeError CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
13575 CHECK(!owner->result_ok);
13576         return DecodeError_clone(&*owner->contents.err);
13577 }
13578 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(uint64_t owner) {
13579         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
13580         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13581         *ret_copy = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(owner_conv);
13582         uint64_t ret_ref = tag_ptr(ret_copy, true);
13583         return ret_ref;
13584 }
13585
13586 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
13587         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
13588         ret.is_owned = false;
13589         return ret;
13590 }
13591 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(uint64_t owner) {
13592         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
13593         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
13594         uint64_t ret_ref = 0;
13595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13597         return ret_ref;
13598 }
13599
13600 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
13601 CHECK(!owner->result_ok);
13602         return DecodeError_clone(&*owner->contents.err);
13603 }
13604 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(uint64_t owner) {
13605         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
13606         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13607         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
13608         uint64_t ret_ref = tag_ptr(ret_copy, true);
13609         return ret_ref;
13610 }
13611
13612 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
13613         LDKDelayedPaymentKey ret = *owner->contents.result;
13614         ret.is_owned = false;
13615         return ret;
13616 }
13617 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(uint64_t owner) {
13618         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
13619         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
13620         uint64_t ret_ref = 0;
13621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13623         return ret_ref;
13624 }
13625
13626 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
13627 CHECK(!owner->result_ok);
13628         return DecodeError_clone(&*owner->contents.err);
13629 }
13630 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_err(uint64_t owner) {
13631         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
13632         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13633         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
13634         uint64_t ret_ref = tag_ptr(ret_copy, true);
13635         return ret_ref;
13636 }
13637
13638 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
13639         LDKHtlcBasepoint ret = *owner->contents.result;
13640         ret.is_owned = false;
13641         return ret;
13642 }
13643 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_get_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_get_ok(uint64_t owner) {
13644         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
13645         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
13646         uint64_t ret_ref = 0;
13647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13649         return ret_ref;
13650 }
13651
13652 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
13653 CHECK(!owner->result_ok);
13654         return DecodeError_clone(&*owner->contents.err);
13655 }
13656 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_get_err"))) TS_CResult_HtlcBasepointDecodeErrorZ_get_err(uint64_t owner) {
13657         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
13658         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13659         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
13660         uint64_t ret_ref = tag_ptr(ret_copy, true);
13661         return ret_ref;
13662 }
13663
13664 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
13665         LDKHtlcKey ret = *owner->contents.result;
13666         ret.is_owned = false;
13667         return ret;
13668 }
13669 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_get_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_get_ok(uint64_t owner) {
13670         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
13671         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
13672         uint64_t ret_ref = 0;
13673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13675         return ret_ref;
13676 }
13677
13678 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
13679 CHECK(!owner->result_ok);
13680         return DecodeError_clone(&*owner->contents.err);
13681 }
13682 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_get_err"))) TS_CResult_HtlcKeyDecodeErrorZ_get_err(uint64_t owner) {
13683         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
13684         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13685         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
13686         uint64_t ret_ref = tag_ptr(ret_copy, true);
13687         return ret_ref;
13688 }
13689
13690 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
13691         LDKRevocationBasepoint ret = *owner->contents.result;
13692         ret.is_owned = false;
13693         return ret;
13694 }
13695 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_get_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_get_ok(uint64_t owner) {
13696         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
13697         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
13698         uint64_t ret_ref = 0;
13699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13701         return ret_ref;
13702 }
13703
13704 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
13705 CHECK(!owner->result_ok);
13706         return DecodeError_clone(&*owner->contents.err);
13707 }
13708 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_get_err"))) TS_CResult_RevocationBasepointDecodeErrorZ_get_err(uint64_t owner) {
13709         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
13710         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13711         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
13712         uint64_t ret_ref = tag_ptr(ret_copy, true);
13713         return ret_ref;
13714 }
13715
13716 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
13717         LDKRevocationKey ret = *owner->contents.result;
13718         ret.is_owned = false;
13719         return ret;
13720 }
13721 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_get_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_get_ok(uint64_t owner) {
13722         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
13723         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
13724         uint64_t ret_ref = 0;
13725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13727         return ret_ref;
13728 }
13729
13730 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
13731 CHECK(!owner->result_ok);
13732         return DecodeError_clone(&*owner->contents.err);
13733 }
13734 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_get_err"))) TS_CResult_RevocationKeyDecodeErrorZ_get_err(uint64_t owner) {
13735         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
13736         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13737         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
13738         uint64_t ret_ref = tag_ptr(ret_copy, true);
13739         return ret_ref;
13740 }
13741
13742 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
13743         LDKLockedChannelMonitor ret = *owner->contents.result;
13744         ret.is_owned = false;
13745         return ret;
13746 }
13747 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
13748         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
13749         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
13750         uint64_t ret_ref = 0;
13751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13753         return ret_ref;
13754 }
13755
13756 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
13757 CHECK(!owner->result_ok);
13758         return *owner->contents.err;
13759 }
13760 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
13761         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
13762         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
13763 }
13764
13765 static inline struct LDKOutPoint C2Tuple_OutPointChannelIdZ_get_a(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
13766         LDKOutPoint ret = owner->a;
13767         ret.is_owned = false;
13768         return ret;
13769 }
13770 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_get_a"))) TS_C2Tuple_OutPointChannelIdZ_get_a(uint64_t owner) {
13771         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
13772         LDKOutPoint ret_var = C2Tuple_OutPointChannelIdZ_get_a(owner_conv);
13773         uint64_t ret_ref = 0;
13774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13776         return ret_ref;
13777 }
13778
13779 static inline struct LDKChannelId C2Tuple_OutPointChannelIdZ_get_b(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
13780         LDKChannelId ret = owner->b;
13781         ret.is_owned = false;
13782         return ret;
13783 }
13784 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_get_b"))) TS_C2Tuple_OutPointChannelIdZ_get_b(uint64_t owner) {
13785         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
13786         LDKChannelId ret_var = C2Tuple_OutPointChannelIdZ_get_b(owner_conv);
13787         uint64_t ret_ref = 0;
13788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13790         return ret_ref;
13791 }
13792
13793 static inline LDKCVec_C2Tuple_OutPointChannelIdZZ CVec_C2Tuple_OutPointChannelIdZZ_clone(const LDKCVec_C2Tuple_OutPointChannelIdZZ *orig) {
13794         LDKCVec_C2Tuple_OutPointChannelIdZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointChannelIdZZ clone bytes"), .datalen = orig->datalen };
13795         for (size_t i = 0; i < ret.datalen; i++) {
13796                 ret.data[i] = C2Tuple_OutPointChannelIdZ_clone(&orig->data[i]);
13797         }
13798         return ret;
13799 }
13800 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
13801         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
13802         for (size_t i = 0; i < ret.datalen; i++) {
13803                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
13804         }
13805         return ret;
13806 }
13807 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
13808         LDKOutPoint ret = owner->a;
13809         ret.is_owned = false;
13810         return ret;
13811 }
13812 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
13813         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
13814         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
13815         uint64_t ret_ref = 0;
13816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13818         return ret_ref;
13819 }
13820
13821 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
13822         return CVec_MonitorUpdateIdZ_clone(&owner->b);
13823 }
13824 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
13825         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
13826         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
13827         uint64_tArray ret_arr = NULL;
13828         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
13829         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
13830         for (size_t r = 0; r < ret_var.datalen; r++) {
13831                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
13832                 uint64_t ret_conv_17_ref = 0;
13833                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
13834                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
13835                 ret_arr_ptr[r] = ret_conv_17_ref;
13836         }
13837         
13838         FREE(ret_var.data);
13839         return ret_arr;
13840 }
13841
13842 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
13843         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
13844         for (size_t i = 0; i < ret.datalen; i++) {
13845                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
13846         }
13847         return ret;
13848 }
13849 uint32_t __attribute__((export_name("TS_LDKCandidateRouteHop_ty_from_ptr"))) TS_LDKCandidateRouteHop_ty_from_ptr(uint64_t ptr) {
13850         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
13851         switch(obj->tag) {
13852                 case LDKCandidateRouteHop_FirstHop: return 0;
13853                 case LDKCandidateRouteHop_PublicHop: return 1;
13854                 case LDKCandidateRouteHop_PrivateHop: return 2;
13855                 case LDKCandidateRouteHop_Blinded: return 3;
13856                 case LDKCandidateRouteHop_OneHopBlinded: return 4;
13857                 default: abort();
13858         }
13859 }
13860 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_FirstHop_get_first_hop"))) TS_LDKCandidateRouteHop_FirstHop_get_first_hop(uint64_t ptr) {
13861         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
13862         assert(obj->tag == LDKCandidateRouteHop_FirstHop);
13863         LDKFirstHopCandidate first_hop_var = obj->first_hop;
13864                         uint64_t first_hop_ref = 0;
13865                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
13866                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
13867         return first_hop_ref;
13868 }
13869 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_PublicHop_get_public_hop"))) TS_LDKCandidateRouteHop_PublicHop_get_public_hop(uint64_t ptr) {
13870         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
13871         assert(obj->tag == LDKCandidateRouteHop_PublicHop);
13872         LDKPublicHopCandidate public_hop_var = obj->public_hop;
13873                         uint64_t public_hop_ref = 0;
13874                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
13875                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
13876         return public_hop_ref;
13877 }
13878 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_PrivateHop_get_private_hop"))) TS_LDKCandidateRouteHop_PrivateHop_get_private_hop(uint64_t ptr) {
13879         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
13880         assert(obj->tag == LDKCandidateRouteHop_PrivateHop);
13881         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
13882                         uint64_t private_hop_ref = 0;
13883                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
13884                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
13885         return private_hop_ref;
13886 }
13887 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_Blinded_get_blinded"))) TS_LDKCandidateRouteHop_Blinded_get_blinded(uint64_t ptr) {
13888         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
13889         assert(obj->tag == LDKCandidateRouteHop_Blinded);
13890         LDKBlindedPathCandidate blinded_var = obj->blinded;
13891                         uint64_t blinded_ref = 0;
13892                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
13893                         blinded_ref = tag_ptr(blinded_var.inner, false);
13894         return blinded_ref;
13895 }
13896 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded"))) TS_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded(uint64_t ptr) {
13897         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
13898         assert(obj->tag == LDKCandidateRouteHop_OneHopBlinded);
13899         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
13900                         uint64_t one_hop_blinded_ref = 0;
13901                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
13902                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
13903         return one_hop_blinded_ref;
13904 }
13905 typedef struct LDKScoreLookUp_JCalls {
13906         atomic_size_t refcnt;
13907         uint32_t instance_ptr;
13908 } LDKScoreLookUp_JCalls;
13909 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
13910         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
13911         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13912                 FREE(j_calls);
13913         }
13914 }
13915 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
13916         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
13917         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
13918         *ret_candidate = CandidateRouteHop_clone(candidate);
13919         uint64_t ref_candidate = tag_ptr(ret_candidate, true);
13920         LDKChannelUsage usage_var = usage;
13921         uint64_t usage_ref = 0;
13922         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
13923         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
13924         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
13925         uint64_t score_params_ref = 0;
13926         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
13927         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
13928         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
13929         return js_invoke_function_bbbuuu(j_calls->instance_ptr, 55, ref_candidate, usage_ref, score_params_ref, 0, 0, 0);
13930 }
13931 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
13932         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
13933         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13934 }
13935 static inline LDKScoreLookUp LDKScoreLookUp_init (JSValue o) {
13936         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
13937         atomic_init(&calls->refcnt, 1);
13938         calls->instance_ptr = o;
13939
13940         LDKScoreLookUp ret = {
13941                 .this_arg = (void*) calls,
13942                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
13943                 .free = LDKScoreLookUp_JCalls_free,
13944         };
13945         return ret;
13946 }
13947 uint64_t  __attribute__((export_name("TS_LDKScoreLookUp_new"))) TS_LDKScoreLookUp_new(JSValue o) {
13948         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
13949         *res_ptr = LDKScoreLookUp_init(o);
13950         return tag_ptr(res_ptr, true);
13951 }
13952 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) {
13953         void* this_arg_ptr = untag_ptr(this_arg);
13954         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13955         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
13956         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
13957         LDKChannelUsage usage_conv;
13958         usage_conv.inner = untag_ptr(usage);
13959         usage_conv.is_owned = ptr_is_owned(usage);
13960         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
13961         usage_conv = ChannelUsage_clone(&usage_conv);
13962         LDKProbabilisticScoringFeeParameters score_params_conv;
13963         score_params_conv.inner = untag_ptr(score_params);
13964         score_params_conv.is_owned = ptr_is_owned(score_params);
13965         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
13966         score_params_conv.is_owned = false;
13967         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
13968         return ret_conv;
13969 }
13970
13971 typedef struct LDKScoreUpdate_JCalls {
13972         atomic_size_t refcnt;
13973         uint32_t instance_ptr;
13974 } LDKScoreUpdate_JCalls;
13975 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
13976         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
13977         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13978                 FREE(j_calls);
13979         }
13980 }
13981 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
13982         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
13983         LDKPath path_var = *path;
13984         uint64_t path_ref = 0;
13985         path_var = Path_clone(&path_var);
13986         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13987         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
13988         int64_t short_channel_id_conv = short_channel_id;
13989         int64_t duration_since_epoch_conv = duration_since_epoch;
13990         js_invoke_function_bbbuuu(j_calls->instance_ptr, 56, path_ref, short_channel_id_conv, duration_since_epoch_conv, 0, 0, 0);
13991 }
13992 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
13993         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
13994         LDKPath path_var = *path;
13995         uint64_t path_ref = 0;
13996         path_var = Path_clone(&path_var);
13997         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13998         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
13999         int64_t duration_since_epoch_conv = duration_since_epoch;
14000         js_invoke_function_bbuuuu(j_calls->instance_ptr, 57, path_ref, duration_since_epoch_conv, 0, 0, 0, 0);
14001 }
14002 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
14003         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
14004         LDKPath path_var = *path;
14005         uint64_t path_ref = 0;
14006         path_var = Path_clone(&path_var);
14007         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14008         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
14009         int64_t short_channel_id_conv = short_channel_id;
14010         int64_t duration_since_epoch_conv = duration_since_epoch;
14011         js_invoke_function_bbbuuu(j_calls->instance_ptr, 58, path_ref, short_channel_id_conv, duration_since_epoch_conv, 0, 0, 0);
14012 }
14013 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
14014         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
14015         LDKPath path_var = *path;
14016         uint64_t path_ref = 0;
14017         path_var = Path_clone(&path_var);
14018         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14019         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
14020         int64_t duration_since_epoch_conv = duration_since_epoch;
14021         js_invoke_function_bbuuuu(j_calls->instance_ptr, 59, path_ref, duration_since_epoch_conv, 0, 0, 0, 0);
14022 }
14023 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
14024         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
14025         int64_t duration_since_epoch_conv = duration_since_epoch;
14026         js_invoke_function_buuuuu(j_calls->instance_ptr, 60, duration_since_epoch_conv, 0, 0, 0, 0, 0);
14027 }
14028 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
14029         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
14030         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14031 }
14032 static inline LDKScoreUpdate LDKScoreUpdate_init (JSValue o) {
14033         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
14034         atomic_init(&calls->refcnt, 1);
14035         calls->instance_ptr = o;
14036
14037         LDKScoreUpdate ret = {
14038                 .this_arg = (void*) calls,
14039                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
14040                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
14041                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
14042                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
14043                 .time_passed = time_passed_LDKScoreUpdate_jcall,
14044                 .free = LDKScoreUpdate_JCalls_free,
14045         };
14046         return ret;
14047 }
14048 uint64_t  __attribute__((export_name("TS_LDKScoreUpdate_new"))) TS_LDKScoreUpdate_new(JSValue o) {
14049         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
14050         *res_ptr = LDKScoreUpdate_init(o);
14051         return tag_ptr(res_ptr, true);
14052 }
14053 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) {
14054         void* this_arg_ptr = untag_ptr(this_arg);
14055         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14056         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14057         LDKPath path_conv;
14058         path_conv.inner = untag_ptr(path);
14059         path_conv.is_owned = ptr_is_owned(path);
14060         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
14061         path_conv.is_owned = false;
14062         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
14063 }
14064
14065 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) {
14066         void* this_arg_ptr = untag_ptr(this_arg);
14067         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14068         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14069         LDKPath path_conv;
14070         path_conv.inner = untag_ptr(path);
14071         path_conv.is_owned = ptr_is_owned(path);
14072         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
14073         path_conv.is_owned = false;
14074         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
14075 }
14076
14077 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) {
14078         void* this_arg_ptr = untag_ptr(this_arg);
14079         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14080         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14081         LDKPath path_conv;
14082         path_conv.inner = untag_ptr(path);
14083         path_conv.is_owned = ptr_is_owned(path);
14084         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
14085         path_conv.is_owned = false;
14086         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
14087 }
14088
14089 void  __attribute__((export_name("TS_ScoreUpdate_probe_successful"))) TS_ScoreUpdate_probe_successful(uint64_t this_arg, uint64_t path, int64_t duration_since_epoch) {
14090         void* this_arg_ptr = untag_ptr(this_arg);
14091         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14092         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14093         LDKPath path_conv;
14094         path_conv.inner = untag_ptr(path);
14095         path_conv.is_owned = ptr_is_owned(path);
14096         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
14097         path_conv.is_owned = false;
14098         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
14099 }
14100
14101 void  __attribute__((export_name("TS_ScoreUpdate_time_passed"))) TS_ScoreUpdate_time_passed(uint64_t this_arg, int64_t duration_since_epoch) {
14102         void* this_arg_ptr = untag_ptr(this_arg);
14103         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14104         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14105         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
14106 }
14107
14108 typedef struct LDKLockableScore_JCalls {
14109         atomic_size_t refcnt;
14110         uint32_t instance_ptr;
14111 } LDKLockableScore_JCalls;
14112 static void LDKLockableScore_JCalls_free(void* this_arg) {
14113         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14114         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14115                 FREE(j_calls);
14116         }
14117 }
14118 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
14119         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14120         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, 0, 0, 0, 0, 0, 0);
14121         void* ret_ptr = untag_ptr(ret);
14122         CHECK_ACCESS(ret_ptr);
14123         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
14124         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
14125                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14126                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
14127         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
14128         
14129         return ret_conv;
14130 }
14131 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
14132         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14133         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, 0, 0, 0, 0, 0, 0);
14134         void* ret_ptr = untag_ptr(ret);
14135         CHECK_ACCESS(ret_ptr);
14136         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
14137         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
14138                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14139                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
14140         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
14141         
14142         return ret_conv;
14143 }
14144 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
14145         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
14146         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14147 }
14148 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
14149         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
14150         atomic_init(&calls->refcnt, 1);
14151         calls->instance_ptr = o;
14152
14153         LDKLockableScore ret = {
14154                 .this_arg = (void*) calls,
14155                 .read_lock = read_lock_LDKLockableScore_jcall,
14156                 .write_lock = write_lock_LDKLockableScore_jcall,
14157                 .free = LDKLockableScore_JCalls_free,
14158         };
14159         return ret;
14160 }
14161 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
14162         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
14163         *res_ptr = LDKLockableScore_init(o);
14164         return tag_ptr(res_ptr, true);
14165 }
14166 uint64_t  __attribute__((export_name("TS_LockableScore_read_lock"))) TS_LockableScore_read_lock(uint64_t this_arg) {
14167         void* this_arg_ptr = untag_ptr(this_arg);
14168         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14169         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
14170         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
14171         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
14172         return tag_ptr(ret_ret, true);
14173 }
14174
14175 uint64_t  __attribute__((export_name("TS_LockableScore_write_lock"))) TS_LockableScore_write_lock(uint64_t this_arg) {
14176         void* this_arg_ptr = untag_ptr(this_arg);
14177         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14178         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
14179         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
14180         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
14181         return tag_ptr(ret_ret, true);
14182 }
14183
14184 typedef struct LDKWriteableScore_JCalls {
14185         atomic_size_t refcnt;
14186         uint32_t instance_ptr;
14187         LDKLockableScore_JCalls* LockableScore;
14188 } LDKWriteableScore_JCalls;
14189 static void LDKWriteableScore_JCalls_free(void* this_arg) {
14190         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
14191         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14192                 FREE(j_calls);
14193         }
14194 }
14195 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
14196         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
14197         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 63, 0, 0, 0, 0, 0, 0);
14198         LDKCVec_u8Z ret_ref;
14199         ret_ref.datalen = ret->arr_len;
14200         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
14201         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
14202         return ret_ref;
14203 }
14204 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
14205         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
14206         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14207         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
14208 }
14209 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
14210         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
14211         atomic_init(&calls->refcnt, 1);
14212         calls->instance_ptr = o;
14213
14214         LDKWriteableScore ret = {
14215                 .this_arg = (void*) calls,
14216                 .write = write_LDKWriteableScore_jcall,
14217                 .free = LDKWriteableScore_JCalls_free,
14218                 .LockableScore = LDKLockableScore_init(LockableScore),
14219         };
14220         calls->LockableScore = ret.LockableScore.this_arg;
14221         return ret;
14222 }
14223 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
14224         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
14225         *res_ptr = LDKWriteableScore_init(o, LockableScore);
14226         return tag_ptr(res_ptr, true);
14227 }
14228 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
14229         void* this_arg_ptr = untag_ptr(this_arg);
14230         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14231         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
14232         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
14233         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
14234         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
14235         CVec_u8Z_free(ret_var);
14236         return ret_arr;
14237 }
14238
14239 typedef struct LDKPersister_JCalls {
14240         atomic_size_t refcnt;
14241         uint32_t instance_ptr;
14242 } LDKPersister_JCalls;
14243 static void LDKPersister_JCalls_free(void* this_arg) {
14244         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14245         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14246                 FREE(j_calls);
14247         }
14248 }
14249 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
14250         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14251         LDKChannelManager channel_manager_var = *channel_manager;
14252         uint64_t channel_manager_ref = 0;
14253         // WARNING: we may need a move here but no clone is available for LDKChannelManager
14254         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
14255         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
14256         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 64, channel_manager_ref, 0, 0, 0, 0, 0);
14257         void* ret_ptr = untag_ptr(ret);
14258         CHECK_ACCESS(ret_ptr);
14259         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14260         FREE(untag_ptr(ret));
14261         return ret_conv;
14262 }
14263 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
14264         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14265         LDKNetworkGraph network_graph_var = *network_graph;
14266         uint64_t network_graph_ref = 0;
14267         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
14268         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
14269         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
14270         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 65, network_graph_ref, 0, 0, 0, 0, 0);
14271         void* ret_ptr = untag_ptr(ret);
14272         CHECK_ACCESS(ret_ptr);
14273         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14274         FREE(untag_ptr(ret));
14275         return ret_conv;
14276 }
14277 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
14278         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14279         // WARNING: This object doesn't live past this scope, needs clone!
14280         uint64_t ret_scorer = tag_ptr(scorer, false);
14281         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 66, ret_scorer, 0, 0, 0, 0, 0);
14282         void* ret_ptr = untag_ptr(ret);
14283         CHECK_ACCESS(ret_ptr);
14284         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14285         FREE(untag_ptr(ret));
14286         return ret_conv;
14287 }
14288 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
14289         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
14290         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14291 }
14292 static inline LDKPersister LDKPersister_init (JSValue o) {
14293         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
14294         atomic_init(&calls->refcnt, 1);
14295         calls->instance_ptr = o;
14296
14297         LDKPersister ret = {
14298                 .this_arg = (void*) calls,
14299                 .persist_manager = persist_manager_LDKPersister_jcall,
14300                 .persist_graph = persist_graph_LDKPersister_jcall,
14301                 .persist_scorer = persist_scorer_LDKPersister_jcall,
14302                 .free = LDKPersister_JCalls_free,
14303         };
14304         return ret;
14305 }
14306 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
14307         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
14308         *res_ptr = LDKPersister_init(o);
14309         return tag_ptr(res_ptr, true);
14310 }
14311 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
14312         void* this_arg_ptr = untag_ptr(this_arg);
14313         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14314         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14315         LDKChannelManager channel_manager_conv;
14316         channel_manager_conv.inner = untag_ptr(channel_manager);
14317         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
14318         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
14319         channel_manager_conv.is_owned = false;
14320         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14321         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
14322         return tag_ptr(ret_conv, true);
14323 }
14324
14325 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
14326         void* this_arg_ptr = untag_ptr(this_arg);
14327         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14328         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14329         LDKNetworkGraph network_graph_conv;
14330         network_graph_conv.inner = untag_ptr(network_graph);
14331         network_graph_conv.is_owned = ptr_is_owned(network_graph);
14332         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
14333         network_graph_conv.is_owned = false;
14334         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14335         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
14336         return tag_ptr(ret_conv, true);
14337 }
14338
14339 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
14340         void* this_arg_ptr = untag_ptr(this_arg);
14341         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14342         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14343         void* scorer_ptr = untag_ptr(scorer);
14344         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
14345         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
14346         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14347         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
14348         return tag_ptr(ret_conv, true);
14349 }
14350
14351 typedef struct LDKPersist_JCalls {
14352         atomic_size_t refcnt;
14353         uint32_t instance_ptr;
14354 } LDKPersist_JCalls;
14355 static void LDKPersist_JCalls_free(void* this_arg) {
14356         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14357         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14358                 FREE(j_calls);
14359         }
14360 }
14361 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14362         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14363         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14364         uint64_t channel_funding_outpoint_ref = 0;
14365         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14366         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14367         LDKChannelMonitor data_var = *data;
14368         uint64_t data_ref = 0;
14369         data_var = ChannelMonitor_clone(&data_var);
14370         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14371         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14372         LDKMonitorUpdateId update_id_var = update_id;
14373         uint64_t update_id_ref = 0;
14374         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14375         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14376         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 67, channel_funding_outpoint_ref, data_ref, update_id_ref, 0, 0, 0);
14377         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
14378         return ret_conv;
14379 }
14380 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14381         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14382         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14383         uint64_t channel_funding_outpoint_ref = 0;
14384         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14385         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14386         LDKChannelMonitorUpdate update_var = update;
14387         uint64_t update_ref = 0;
14388         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
14389         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
14390         LDKChannelMonitor data_var = *data;
14391         uint64_t data_ref = 0;
14392         data_var = ChannelMonitor_clone(&data_var);
14393         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14394         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14395         LDKMonitorUpdateId update_id_var = update_id;
14396         uint64_t update_id_ref = 0;
14397         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14398         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14399         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);
14400         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
14401         return ret_conv;
14402 }
14403 void archive_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint) {
14404         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14405         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14406         uint64_t channel_funding_outpoint_ref = 0;
14407         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14408         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14409         js_invoke_function_buuuuu(j_calls->instance_ptr, 69, channel_funding_outpoint_ref, 0, 0, 0, 0, 0);
14410 }
14411 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
14412         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
14413         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14414 }
14415 static inline LDKPersist LDKPersist_init (JSValue o) {
14416         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
14417         atomic_init(&calls->refcnt, 1);
14418         calls->instance_ptr = o;
14419
14420         LDKPersist ret = {
14421                 .this_arg = (void*) calls,
14422                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
14423                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
14424                 .archive_persisted_channel = archive_persisted_channel_LDKPersist_jcall,
14425                 .free = LDKPersist_JCalls_free,
14426         };
14427         return ret;
14428 }
14429 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
14430         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
14431         *res_ptr = LDKPersist_init(o);
14432         return tag_ptr(res_ptr, true);
14433 }
14434 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) {
14435         void* this_arg_ptr = untag_ptr(this_arg);
14436         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14437         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14438         LDKOutPoint channel_funding_outpoint_conv;
14439         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14440         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14441         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14442         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14443         LDKChannelMonitor data_conv;
14444         data_conv.inner = untag_ptr(data);
14445         data_conv.is_owned = ptr_is_owned(data);
14446         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14447         data_conv.is_owned = false;
14448         LDKMonitorUpdateId update_id_conv;
14449         update_id_conv.inner = untag_ptr(update_id);
14450         update_id_conv.is_owned = ptr_is_owned(update_id);
14451         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14452         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14453         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));
14454         return ret_conv;
14455 }
14456
14457 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) {
14458         void* this_arg_ptr = untag_ptr(this_arg);
14459         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14460         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14461         LDKOutPoint channel_funding_outpoint_conv;
14462         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14463         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14464         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14465         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14466         LDKChannelMonitorUpdate update_conv;
14467         update_conv.inner = untag_ptr(update);
14468         update_conv.is_owned = ptr_is_owned(update);
14469         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
14470         update_conv = ChannelMonitorUpdate_clone(&update_conv);
14471         LDKChannelMonitor data_conv;
14472         data_conv.inner = untag_ptr(data);
14473         data_conv.is_owned = ptr_is_owned(data);
14474         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14475         data_conv.is_owned = false;
14476         LDKMonitorUpdateId update_id_conv;
14477         update_id_conv.inner = untag_ptr(update_id);
14478         update_id_conv.is_owned = ptr_is_owned(update_id);
14479         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14480         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14481         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));
14482         return ret_conv;
14483 }
14484
14485 void  __attribute__((export_name("TS_Persist_archive_persisted_channel"))) TS_Persist_archive_persisted_channel(uint64_t this_arg, uint64_t channel_funding_outpoint) {
14486         void* this_arg_ptr = untag_ptr(this_arg);
14487         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14488         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14489         LDKOutPoint channel_funding_outpoint_conv;
14490         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14491         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14492         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14493         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14494         (this_arg_conv->archive_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv);
14495 }
14496
14497 typedef struct LDKListen_JCalls {
14498         atomic_size_t refcnt;
14499         uint32_t instance_ptr;
14500 } LDKListen_JCalls;
14501 static void LDKListen_JCalls_free(void* this_arg) {
14502         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14503         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14504                 FREE(j_calls);
14505         }
14506 }
14507 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14508         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14509         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14510         memcpy(header_arr->elems, *header, 80);
14511         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14512         uint64_tArray txdata_arr = NULL;
14513         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
14514         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
14515         for (size_t c = 0; c < txdata_var.datalen; c++) {
14516                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14517                 *txdata_conv_28_conv = txdata_var.data[c];
14518                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14519         }
14520         
14521         FREE(txdata_var.data);
14522         int32_t height_conv = height;
14523         js_invoke_function_uuuuuu(j_calls->instance_ptr, 70, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
14524 }
14525 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
14526         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14527         LDKu8slice block_var = block;
14528         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
14529         memcpy(block_arr->elems, block_var.data, block_var.datalen);
14530         int32_t height_conv = height;
14531         js_invoke_function_uuuuuu(j_calls->instance_ptr, 71, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
14532 }
14533 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14534         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14535         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14536         memcpy(header_arr->elems, *header, 80);
14537         int32_t height_conv = height;
14538         js_invoke_function_uuuuuu(j_calls->instance_ptr, 72, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
14539 }
14540 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
14541         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
14542         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14543 }
14544 static inline LDKListen LDKListen_init (JSValue o) {
14545         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
14546         atomic_init(&calls->refcnt, 1);
14547         calls->instance_ptr = o;
14548
14549         LDKListen ret = {
14550                 .this_arg = (void*) calls,
14551                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
14552                 .block_connected = block_connected_LDKListen_jcall,
14553                 .block_disconnected = block_disconnected_LDKListen_jcall,
14554                 .free = LDKListen_JCalls_free,
14555         };
14556         return ret;
14557 }
14558 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
14559         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
14560         *res_ptr = LDKListen_init(o);
14561         return tag_ptr(res_ptr, true);
14562 }
14563 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) {
14564         void* this_arg_ptr = untag_ptr(this_arg);
14565         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14566         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14567         uint8_t header_arr[80];
14568         CHECK(header->arr_len == 80);
14569         memcpy(header_arr, header->elems, 80); FREE(header);
14570         uint8_t (*header_ref)[80] = &header_arr;
14571         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14572         txdata_constr.datalen = txdata->arr_len;
14573         if (txdata_constr.datalen > 0)
14574                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14575         else
14576                 txdata_constr.data = NULL;
14577         uint64_t* txdata_vals = txdata->elems;
14578         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14579                 uint64_t txdata_conv_28 = txdata_vals[c];
14580                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
14581                 CHECK_ACCESS(txdata_conv_28_ptr);
14582                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14583                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
14584                 txdata_constr.data[c] = txdata_conv_28_conv;
14585         }
14586         FREE(txdata);
14587         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
14588 }
14589
14590 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
14591         void* this_arg_ptr = untag_ptr(this_arg);
14592         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14593         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14594         LDKu8slice block_ref;
14595         block_ref.datalen = block->arr_len;
14596         block_ref.data = block->elems;
14597         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
14598         FREE(block);
14599 }
14600
14601 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
14602         void* this_arg_ptr = untag_ptr(this_arg);
14603         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14604         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14605         uint8_t header_arr[80];
14606         CHECK(header->arr_len == 80);
14607         memcpy(header_arr, header->elems, 80); FREE(header);
14608         uint8_t (*header_ref)[80] = &header_arr;
14609         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
14610 }
14611
14612 typedef struct LDKConfirm_JCalls {
14613         atomic_size_t refcnt;
14614         uint32_t instance_ptr;
14615 } LDKConfirm_JCalls;
14616 static void LDKConfirm_JCalls_free(void* this_arg) {
14617         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14618         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14619                 FREE(j_calls);
14620         }
14621 }
14622 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14623         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14624         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14625         memcpy(header_arr->elems, *header, 80);
14626         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14627         uint64_tArray txdata_arr = NULL;
14628         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
14629         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
14630         for (size_t c = 0; c < txdata_var.datalen; c++) {
14631                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14632                 *txdata_conv_28_conv = txdata_var.data[c];
14633                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14634         }
14635         
14636         FREE(txdata_var.data);
14637         int32_t height_conv = height;
14638         js_invoke_function_uuuuuu(j_calls->instance_ptr, 73, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
14639 }
14640 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
14641         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14642         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
14643         memcpy(txid_arr->elems, *txid, 32);
14644         js_invoke_function_uuuuuu(j_calls->instance_ptr, 74, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
14645 }
14646 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14647         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14648         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14649         memcpy(header_arr->elems, *header, 80);
14650         int32_t height_conv = height;
14651         js_invoke_function_uuuuuu(j_calls->instance_ptr, 75, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
14652 }
14653 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
14654         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14655         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 76, 0, 0, 0, 0, 0, 0);
14656         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
14657         ret_constr.datalen = ret->arr_len;
14658         if (ret_constr.datalen > 0)
14659                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
14660         else
14661                 ret_constr.data = NULL;
14662         uint64_t* ret_vals = ret->elems;
14663         for (size_t c = 0; c < ret_constr.datalen; c++) {
14664                 uint64_t ret_conv_54 = ret_vals[c];
14665                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
14666                 CHECK_ACCESS(ret_conv_54_ptr);
14667                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
14668                 FREE(untag_ptr(ret_conv_54));
14669                 ret_constr.data[c] = ret_conv_54_conv;
14670         }
14671         FREE(ret);
14672         return ret_constr;
14673 }
14674 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
14675         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
14676         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14677 }
14678 static inline LDKConfirm LDKConfirm_init (JSValue o) {
14679         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
14680         atomic_init(&calls->refcnt, 1);
14681         calls->instance_ptr = o;
14682
14683         LDKConfirm ret = {
14684                 .this_arg = (void*) calls,
14685                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
14686                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
14687                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
14688                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
14689                 .free = LDKConfirm_JCalls_free,
14690         };
14691         return ret;
14692 }
14693 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
14694         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14695         *res_ptr = LDKConfirm_init(o);
14696         return tag_ptr(res_ptr, true);
14697 }
14698 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) {
14699         void* this_arg_ptr = untag_ptr(this_arg);
14700         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14701         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14702         uint8_t header_arr[80];
14703         CHECK(header->arr_len == 80);
14704         memcpy(header_arr, header->elems, 80); FREE(header);
14705         uint8_t (*header_ref)[80] = &header_arr;
14706         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14707         txdata_constr.datalen = txdata->arr_len;
14708         if (txdata_constr.datalen > 0)
14709                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14710         else
14711                 txdata_constr.data = NULL;
14712         uint64_t* txdata_vals = txdata->elems;
14713         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14714                 uint64_t txdata_conv_28 = txdata_vals[c];
14715                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
14716                 CHECK_ACCESS(txdata_conv_28_ptr);
14717                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14718                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
14719                 txdata_constr.data[c] = txdata_conv_28_conv;
14720         }
14721         FREE(txdata);
14722         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
14723 }
14724
14725 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
14726         void* this_arg_ptr = untag_ptr(this_arg);
14727         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14728         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14729         uint8_t txid_arr[32];
14730         CHECK(txid->arr_len == 32);
14731         memcpy(txid_arr, txid->elems, 32); FREE(txid);
14732         uint8_t (*txid_ref)[32] = &txid_arr;
14733         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
14734 }
14735
14736 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
14737         void* this_arg_ptr = untag_ptr(this_arg);
14738         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14739         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14740         uint8_t header_arr[80];
14741         CHECK(header->arr_len == 80);
14742         memcpy(header_arr, header->elems, 80); FREE(header);
14743         uint8_t (*header_ref)[80] = &header_arr;
14744         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
14745 }
14746
14747 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
14748         void* this_arg_ptr = untag_ptr(this_arg);
14749         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14750         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14751         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
14752         uint64_tArray ret_arr = NULL;
14753         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
14754         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
14755         for (size_t c = 0; c < ret_var.datalen; c++) {
14756                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
14757                 *ret_conv_54_conv = ret_var.data[c];
14758                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
14759         }
14760         
14761         FREE(ret_var.data);
14762         return ret_arr;
14763 }
14764
14765 uint32_t __attribute__((export_name("TS_LDKSpendingDelay_ty_from_ptr"))) TS_LDKSpendingDelay_ty_from_ptr(uint64_t ptr) {
14766         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
14767         switch(obj->tag) {
14768                 case LDKSpendingDelay_Relative: return 0;
14769                 case LDKSpendingDelay_Absolute: return 1;
14770                 default: abort();
14771         }
14772 }
14773 int32_t __attribute__((export_name("TS_LDKSpendingDelay_Relative_get_num_blocks"))) TS_LDKSpendingDelay_Relative_get_num_blocks(uint64_t ptr) {
14774         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
14775         assert(obj->tag == LDKSpendingDelay_Relative);
14776         int32_t num_blocks_conv = obj->relative.num_blocks;
14777         return num_blocks_conv;
14778 }
14779 int32_t __attribute__((export_name("TS_LDKSpendingDelay_Absolute_get_height"))) TS_LDKSpendingDelay_Absolute_get_height(uint64_t ptr) {
14780         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
14781         assert(obj->tag == LDKSpendingDelay_Absolute);
14782         int32_t height_conv = obj->absolute.height;
14783         return height_conv;
14784 }
14785 typedef struct LDKFutureCallback_JCalls {
14786         atomic_size_t refcnt;
14787         uint32_t instance_ptr;
14788 } LDKFutureCallback_JCalls;
14789 static void LDKFutureCallback_JCalls_free(void* this_arg) {
14790         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
14791         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14792                 FREE(j_calls);
14793         }
14794 }
14795 void call_LDKFutureCallback_jcall(const void* this_arg) {
14796         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
14797         js_invoke_function_uuuuuu(j_calls->instance_ptr, 77, 0, 0, 0, 0, 0, 0);
14798 }
14799 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
14800         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
14801         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14802 }
14803 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
14804         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
14805         atomic_init(&calls->refcnt, 1);
14806         calls->instance_ptr = o;
14807
14808         LDKFutureCallback ret = {
14809                 .this_arg = (void*) calls,
14810                 .call = call_LDKFutureCallback_jcall,
14811                 .free = LDKFutureCallback_JCalls_free,
14812         };
14813         return ret;
14814 }
14815 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
14816         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
14817         *res_ptr = LDKFutureCallback_init(o);
14818         return tag_ptr(res_ptr, true);
14819 }
14820 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
14821         void* this_arg_ptr = untag_ptr(this_arg);
14822         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14823         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
14824         (this_arg_conv->call)(this_arg_conv->this_arg);
14825 }
14826
14827 typedef struct LDKEventHandler_JCalls {
14828         atomic_size_t refcnt;
14829         uint32_t instance_ptr;
14830 } LDKEventHandler_JCalls;
14831 static void LDKEventHandler_JCalls_free(void* this_arg) {
14832         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
14833         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14834                 FREE(j_calls);
14835         }
14836 }
14837 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
14838         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
14839         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14840         *event_copy = event;
14841         uint64_t event_ref = tag_ptr(event_copy, true);
14842         js_invoke_function_buuuuu(j_calls->instance_ptr, 78, event_ref, 0, 0, 0, 0, 0);
14843 }
14844 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
14845         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
14846         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14847 }
14848 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
14849         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
14850         atomic_init(&calls->refcnt, 1);
14851         calls->instance_ptr = o;
14852
14853         LDKEventHandler ret = {
14854                 .this_arg = (void*) calls,
14855                 .handle_event = handle_event_LDKEventHandler_jcall,
14856                 .free = LDKEventHandler_JCalls_free,
14857         };
14858         return ret;
14859 }
14860 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
14861         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
14862         *res_ptr = LDKEventHandler_init(o);
14863         return tag_ptr(res_ptr, true);
14864 }
14865 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
14866         void* this_arg_ptr = untag_ptr(this_arg);
14867         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14868         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
14869         void* event_ptr = untag_ptr(event);
14870         CHECK_ACCESS(event_ptr);
14871         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
14872         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
14873         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
14874 }
14875
14876 typedef struct LDKEventsProvider_JCalls {
14877         atomic_size_t refcnt;
14878         uint32_t instance_ptr;
14879 } LDKEventsProvider_JCalls;
14880 static void LDKEventsProvider_JCalls_free(void* this_arg) {
14881         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
14882         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14883                 FREE(j_calls);
14884         }
14885 }
14886 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
14887         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
14888         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
14889         *handler_ret = handler;
14890         js_invoke_function_buuuuu(j_calls->instance_ptr, 79, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
14891 }
14892 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
14893         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
14894         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14895 }
14896 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
14897         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
14898         atomic_init(&calls->refcnt, 1);
14899         calls->instance_ptr = o;
14900
14901         LDKEventsProvider ret = {
14902                 .this_arg = (void*) calls,
14903                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
14904                 .free = LDKEventsProvider_JCalls_free,
14905         };
14906         return ret;
14907 }
14908 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
14909         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14910         *res_ptr = LDKEventsProvider_init(o);
14911         return tag_ptr(res_ptr, true);
14912 }
14913 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
14914         void* this_arg_ptr = untag_ptr(this_arg);
14915         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14916         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
14917         void* handler_ptr = untag_ptr(handler);
14918         CHECK_ACCESS(handler_ptr);
14919         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
14920         if (handler_conv.free == LDKEventHandler_JCalls_free) {
14921                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14922                 LDKEventHandler_JCalls_cloned(&handler_conv);
14923         }
14924         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
14925 }
14926
14927 uint32_t __attribute__((export_name("TS_LDKFailureCode_ty_from_ptr"))) TS_LDKFailureCode_ty_from_ptr(uint64_t ptr) {
14928         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
14929         switch(obj->tag) {
14930                 case LDKFailureCode_TemporaryNodeFailure: return 0;
14931                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
14932                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
14933                 case LDKFailureCode_InvalidOnionPayload: return 3;
14934                 default: abort();
14935         }
14936 }
14937 uint64_t __attribute__((export_name("TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload"))) TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(uint64_t ptr) {
14938         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
14939         assert(obj->tag == LDKFailureCode_InvalidOnionPayload);
14940         uint64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
14941         return invalid_onion_payload_ref;
14942 }
14943 typedef struct LDKMessageSendEventsProvider_JCalls {
14944         atomic_size_t refcnt;
14945         uint32_t instance_ptr;
14946 } LDKMessageSendEventsProvider_JCalls;
14947 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
14948         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
14949         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14950                 FREE(j_calls);
14951         }
14952 }
14953 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
14954         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
14955         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 80, 0, 0, 0, 0, 0, 0);
14956         LDKCVec_MessageSendEventZ ret_constr;
14957         ret_constr.datalen = ret->arr_len;
14958         if (ret_constr.datalen > 0)
14959                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
14960         else
14961                 ret_constr.data = NULL;
14962         uint64_t* ret_vals = ret->elems;
14963         for (size_t s = 0; s < ret_constr.datalen; s++) {
14964                 uint64_t ret_conv_18 = ret_vals[s];
14965                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
14966                 CHECK_ACCESS(ret_conv_18_ptr);
14967                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
14968                 FREE(untag_ptr(ret_conv_18));
14969                 ret_constr.data[s] = ret_conv_18_conv;
14970         }
14971         FREE(ret);
14972         return ret_constr;
14973 }
14974 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
14975         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
14976         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14977 }
14978 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
14979         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
14980         atomic_init(&calls->refcnt, 1);
14981         calls->instance_ptr = o;
14982
14983         LDKMessageSendEventsProvider ret = {
14984                 .this_arg = (void*) calls,
14985                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
14986                 .free = LDKMessageSendEventsProvider_JCalls_free,
14987         };
14988         return ret;
14989 }
14990 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
14991         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
14992         *res_ptr = LDKMessageSendEventsProvider_init(o);
14993         return tag_ptr(res_ptr, true);
14994 }
14995 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) {
14996         void* this_arg_ptr = untag_ptr(this_arg);
14997         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14998         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
14999         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
15000         uint64_tArray ret_arr = NULL;
15001         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
15002         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
15003         for (size_t s = 0; s < ret_var.datalen; s++) {
15004                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15005                 *ret_conv_18_copy = ret_var.data[s];
15006                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
15007                 ret_arr_ptr[s] = ret_conv_18_ref;
15008         }
15009         
15010         FREE(ret_var.data);
15011         return ret_arr;
15012 }
15013
15014 typedef struct LDKChannelMessageHandler_JCalls {
15015         atomic_size_t refcnt;
15016         uint32_t instance_ptr;
15017         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
15018 } LDKChannelMessageHandler_JCalls;
15019 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
15020         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15021         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15022                 FREE(j_calls);
15023         }
15024 }
15025 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
15026         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15027         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15028         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15029         LDKOpenChannel msg_var = *msg;
15030         uint64_t msg_ref = 0;
15031         msg_var = OpenChannel_clone(&msg_var);
15032         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15033         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15034         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15035 }
15036 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
15037         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15038         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15039         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15040         LDKOpenChannelV2 msg_var = *msg;
15041         uint64_t msg_ref = 0;
15042         msg_var = OpenChannelV2_clone(&msg_var);
15043         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15044         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15045         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15046 }
15047 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
15048         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15049         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15050         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15051         LDKAcceptChannel msg_var = *msg;
15052         uint64_t msg_ref = 0;
15053         msg_var = AcceptChannel_clone(&msg_var);
15054         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15055         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15056         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15057 }
15058 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
15059         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15060         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15061         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15062         LDKAcceptChannelV2 msg_var = *msg;
15063         uint64_t msg_ref = 0;
15064         msg_var = AcceptChannelV2_clone(&msg_var);
15065         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15066         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15067         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15068 }
15069 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
15070         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15071         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15072         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15073         LDKFundingCreated msg_var = *msg;
15074         uint64_t msg_ref = 0;
15075         msg_var = FundingCreated_clone(&msg_var);
15076         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15077         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15078         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15079 }
15080 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
15081         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15082         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15083         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15084         LDKFundingSigned msg_var = *msg;
15085         uint64_t msg_ref = 0;
15086         msg_var = FundingSigned_clone(&msg_var);
15087         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15088         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15089         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15090 }
15091 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
15092         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15093         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15094         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15095         LDKChannelReady msg_var = *msg;
15096         uint64_t msg_ref = 0;
15097         msg_var = ChannelReady_clone(&msg_var);
15098         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15099         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15100         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15101 }
15102 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
15103         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15104         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15105         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15106         LDKShutdown msg_var = *msg;
15107         uint64_t msg_ref = 0;
15108         msg_var = Shutdown_clone(&msg_var);
15109         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15110         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15111         js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15112 }
15113 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
15114         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15115         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15116         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15117         LDKClosingSigned msg_var = *msg;
15118         uint64_t msg_ref = 0;
15119         msg_var = ClosingSigned_clone(&msg_var);
15120         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15121         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15122         js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15123 }
15124 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
15125         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15126         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15127         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15128         LDKStfu msg_var = *msg;
15129         uint64_t msg_ref = 0;
15130         msg_var = Stfu_clone(&msg_var);
15131         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15132         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15133         js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15134 }
15135 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
15136         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15137         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15138         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15139         LDKTxAddInput msg_var = *msg;
15140         uint64_t msg_ref = 0;
15141         msg_var = TxAddInput_clone(&msg_var);
15142         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15143         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15144         js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15145 }
15146 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
15147         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15148         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15149         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15150         LDKTxAddOutput msg_var = *msg;
15151         uint64_t msg_ref = 0;
15152         msg_var = TxAddOutput_clone(&msg_var);
15153         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15154         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15155         js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15156 }
15157 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
15158         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15159         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15160         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15161         LDKTxRemoveInput msg_var = *msg;
15162         uint64_t msg_ref = 0;
15163         msg_var = TxRemoveInput_clone(&msg_var);
15164         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15165         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15166         js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15167 }
15168 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
15169         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15170         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15171         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15172         LDKTxRemoveOutput msg_var = *msg;
15173         uint64_t msg_ref = 0;
15174         msg_var = TxRemoveOutput_clone(&msg_var);
15175         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15176         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15177         js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15178 }
15179 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
15180         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15181         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15182         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15183         LDKTxComplete msg_var = *msg;
15184         uint64_t msg_ref = 0;
15185         msg_var = TxComplete_clone(&msg_var);
15186         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15187         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15188         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15189 }
15190 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
15191         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15192         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15193         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15194         LDKTxSignatures msg_var = *msg;
15195         uint64_t msg_ref = 0;
15196         msg_var = TxSignatures_clone(&msg_var);
15197         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15198         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15199         js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15200 }
15201 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
15202         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15203         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15204         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15205         LDKTxInitRbf msg_var = *msg;
15206         uint64_t msg_ref = 0;
15207         msg_var = TxInitRbf_clone(&msg_var);
15208         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15209         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15210         js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15211 }
15212 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
15213         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15214         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15215         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15216         LDKTxAckRbf msg_var = *msg;
15217         uint64_t msg_ref = 0;
15218         msg_var = TxAckRbf_clone(&msg_var);
15219         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15220         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15221         js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15222 }
15223 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
15224         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15225         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15226         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15227         LDKTxAbort msg_var = *msg;
15228         uint64_t msg_ref = 0;
15229         msg_var = TxAbort_clone(&msg_var);
15230         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15231         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15232         js_invoke_function_ubuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15233 }
15234 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
15235         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15236         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15237         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15238         LDKUpdateAddHTLC msg_var = *msg;
15239         uint64_t msg_ref = 0;
15240         msg_var = UpdateAddHTLC_clone(&msg_var);
15241         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15242         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15243         js_invoke_function_ubuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15244 }
15245 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
15246         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15247         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15248         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15249         LDKUpdateFulfillHTLC msg_var = *msg;
15250         uint64_t msg_ref = 0;
15251         msg_var = UpdateFulfillHTLC_clone(&msg_var);
15252         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15253         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15254         js_invoke_function_ubuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15255 }
15256 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
15257         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15258         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15259         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15260         LDKUpdateFailHTLC msg_var = *msg;
15261         uint64_t msg_ref = 0;
15262         msg_var = UpdateFailHTLC_clone(&msg_var);
15263         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15264         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15265         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15266 }
15267 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
15268         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15269         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15270         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15271         LDKUpdateFailMalformedHTLC msg_var = *msg;
15272         uint64_t msg_ref = 0;
15273         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
15274         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15275         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15276         js_invoke_function_ubuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15277 }
15278 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
15279         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15280         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15281         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15282         LDKCommitmentSigned msg_var = *msg;
15283         uint64_t msg_ref = 0;
15284         msg_var = CommitmentSigned_clone(&msg_var);
15285         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15286         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15287         js_invoke_function_ubuuuu(j_calls->instance_ptr, 104, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15288 }
15289 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
15290         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15291         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15292         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15293         LDKRevokeAndACK msg_var = *msg;
15294         uint64_t msg_ref = 0;
15295         msg_var = RevokeAndACK_clone(&msg_var);
15296         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15297         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15298         js_invoke_function_ubuuuu(j_calls->instance_ptr, 105, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15299 }
15300 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
15301         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15302         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15303         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15304         LDKUpdateFee msg_var = *msg;
15305         uint64_t msg_ref = 0;
15306         msg_var = UpdateFee_clone(&msg_var);
15307         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15308         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15309         js_invoke_function_ubuuuu(j_calls->instance_ptr, 106, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15310 }
15311 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
15312         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15313         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15314         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15315         LDKAnnouncementSignatures msg_var = *msg;
15316         uint64_t msg_ref = 0;
15317         msg_var = AnnouncementSignatures_clone(&msg_var);
15318         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15319         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15320         js_invoke_function_ubuuuu(j_calls->instance_ptr, 107, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15321 }
15322 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15323         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15324         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15325         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15326         js_invoke_function_uuuuuu(j_calls->instance_ptr, 108, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
15327 }
15328 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
15329         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15330         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15331         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15332         LDKInit msg_var = *msg;
15333         uint64_t msg_ref = 0;
15334         msg_var = Init_clone(&msg_var);
15335         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15336         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15337         jboolean inbound_conv = inbound;
15338         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);
15339         void* ret_ptr = untag_ptr(ret);
15340         CHECK_ACCESS(ret_ptr);
15341         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15342         FREE(untag_ptr(ret));
15343         return ret_conv;
15344 }
15345 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
15346         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15347         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15348         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15349         LDKChannelReestablish msg_var = *msg;
15350         uint64_t msg_ref = 0;
15351         msg_var = ChannelReestablish_clone(&msg_var);
15352         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15353         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15354         js_invoke_function_ubuuuu(j_calls->instance_ptr, 110, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15355 }
15356 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
15357         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15358         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15359         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15360         LDKChannelUpdate msg_var = *msg;
15361         uint64_t msg_ref = 0;
15362         msg_var = ChannelUpdate_clone(&msg_var);
15363         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15364         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15365         js_invoke_function_ubuuuu(j_calls->instance_ptr, 111, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15366 }
15367 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
15368         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15369         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15370         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15371         LDKErrorMessage msg_var = *msg;
15372         uint64_t msg_ref = 0;
15373         msg_var = ErrorMessage_clone(&msg_var);
15374         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15375         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15376         js_invoke_function_ubuuuu(j_calls->instance_ptr, 112, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15377 }
15378 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
15379         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15380         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 0, 0, 0, 0, 0, 0);
15381         LDKNodeFeatures ret_conv;
15382         ret_conv.inner = untag_ptr(ret);
15383         ret_conv.is_owned = ptr_is_owned(ret);
15384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15385         return ret_conv;
15386 }
15387 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15388         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15389         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15390         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15391         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 114, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
15392         LDKInitFeatures ret_conv;
15393         ret_conv.inner = untag_ptr(ret);
15394         ret_conv.is_owned = ptr_is_owned(ret);
15395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15396         return ret_conv;
15397 }
15398 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
15399         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15400         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 115, 0, 0, 0, 0, 0, 0);
15401         void* ret_ptr = untag_ptr(ret);
15402         CHECK_ACCESS(ret_ptr);
15403         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
15404         FREE(untag_ptr(ret));
15405         return ret_conv;
15406 }
15407 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
15408         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
15409         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15410         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
15411 }
15412 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
15413         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
15414         atomic_init(&calls->refcnt, 1);
15415         calls->instance_ptr = o;
15416
15417         LDKChannelMessageHandler ret = {
15418                 .this_arg = (void*) calls,
15419                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
15420                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
15421                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
15422                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
15423                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
15424                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
15425                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
15426                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
15427                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
15428                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
15429                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
15430                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
15431                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
15432                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
15433                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
15434                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
15435                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
15436                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
15437                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
15438                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
15439                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
15440                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
15441                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
15442                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
15443                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
15444                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
15445                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
15446                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
15447                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
15448                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
15449                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
15450                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
15451                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
15452                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
15453                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
15454                 .free = LDKChannelMessageHandler_JCalls_free,
15455                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
15456         };
15457         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
15458         return ret;
15459 }
15460 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
15461         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15462         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
15463         return tag_ptr(res_ptr, true);
15464 }
15465 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) {
15466         void* this_arg_ptr = untag_ptr(this_arg);
15467         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15468         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15469         LDKPublicKey their_node_id_ref;
15470         CHECK(their_node_id->arr_len == 33);
15471         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15472         LDKOpenChannel msg_conv;
15473         msg_conv.inner = untag_ptr(msg);
15474         msg_conv.is_owned = ptr_is_owned(msg);
15475         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15476         msg_conv.is_owned = false;
15477         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15478 }
15479
15480 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) {
15481         void* this_arg_ptr = untag_ptr(this_arg);
15482         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15483         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15484         LDKPublicKey their_node_id_ref;
15485         CHECK(their_node_id->arr_len == 33);
15486         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15487         LDKOpenChannelV2 msg_conv;
15488         msg_conv.inner = untag_ptr(msg);
15489         msg_conv.is_owned = ptr_is_owned(msg);
15490         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15491         msg_conv.is_owned = false;
15492         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15493 }
15494
15495 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) {
15496         void* this_arg_ptr = untag_ptr(this_arg);
15497         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15498         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15499         LDKPublicKey their_node_id_ref;
15500         CHECK(their_node_id->arr_len == 33);
15501         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15502         LDKAcceptChannel msg_conv;
15503         msg_conv.inner = untag_ptr(msg);
15504         msg_conv.is_owned = ptr_is_owned(msg);
15505         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15506         msg_conv.is_owned = false;
15507         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15508 }
15509
15510 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) {
15511         void* this_arg_ptr = untag_ptr(this_arg);
15512         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15513         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15514         LDKPublicKey their_node_id_ref;
15515         CHECK(their_node_id->arr_len == 33);
15516         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15517         LDKAcceptChannelV2 msg_conv;
15518         msg_conv.inner = untag_ptr(msg);
15519         msg_conv.is_owned = ptr_is_owned(msg);
15520         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15521         msg_conv.is_owned = false;
15522         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15523 }
15524
15525 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) {
15526         void* this_arg_ptr = untag_ptr(this_arg);
15527         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15528         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15529         LDKPublicKey their_node_id_ref;
15530         CHECK(their_node_id->arr_len == 33);
15531         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15532         LDKFundingCreated msg_conv;
15533         msg_conv.inner = untag_ptr(msg);
15534         msg_conv.is_owned = ptr_is_owned(msg);
15535         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15536         msg_conv.is_owned = false;
15537         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15538 }
15539
15540 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) {
15541         void* this_arg_ptr = untag_ptr(this_arg);
15542         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15543         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15544         LDKPublicKey their_node_id_ref;
15545         CHECK(their_node_id->arr_len == 33);
15546         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15547         LDKFundingSigned msg_conv;
15548         msg_conv.inner = untag_ptr(msg);
15549         msg_conv.is_owned = ptr_is_owned(msg);
15550         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15551         msg_conv.is_owned = false;
15552         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15553 }
15554
15555 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) {
15556         void* this_arg_ptr = untag_ptr(this_arg);
15557         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15558         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15559         LDKPublicKey their_node_id_ref;
15560         CHECK(their_node_id->arr_len == 33);
15561         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15562         LDKChannelReady msg_conv;
15563         msg_conv.inner = untag_ptr(msg);
15564         msg_conv.is_owned = ptr_is_owned(msg);
15565         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15566         msg_conv.is_owned = false;
15567         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15568 }
15569
15570 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
15571         void* this_arg_ptr = untag_ptr(this_arg);
15572         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15573         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15574         LDKPublicKey their_node_id_ref;
15575         CHECK(their_node_id->arr_len == 33);
15576         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15577         LDKShutdown msg_conv;
15578         msg_conv.inner = untag_ptr(msg);
15579         msg_conv.is_owned = ptr_is_owned(msg);
15580         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15581         msg_conv.is_owned = false;
15582         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15583 }
15584
15585 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) {
15586         void* this_arg_ptr = untag_ptr(this_arg);
15587         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15588         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15589         LDKPublicKey their_node_id_ref;
15590         CHECK(their_node_id->arr_len == 33);
15591         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15592         LDKClosingSigned msg_conv;
15593         msg_conv.inner = untag_ptr(msg);
15594         msg_conv.is_owned = ptr_is_owned(msg);
15595         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15596         msg_conv.is_owned = false;
15597         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15598 }
15599
15600 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_stfu"))) TS_ChannelMessageHandler_handle_stfu(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
15601         void* this_arg_ptr = untag_ptr(this_arg);
15602         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15603         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15604         LDKPublicKey their_node_id_ref;
15605         CHECK(their_node_id->arr_len == 33);
15606         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15607         LDKStfu msg_conv;
15608         msg_conv.inner = untag_ptr(msg);
15609         msg_conv.is_owned = ptr_is_owned(msg);
15610         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15611         msg_conv.is_owned = false;
15612         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15613 }
15614
15615 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) {
15616         void* this_arg_ptr = untag_ptr(this_arg);
15617         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15618         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15619         LDKPublicKey their_node_id_ref;
15620         CHECK(their_node_id->arr_len == 33);
15621         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15622         LDKTxAddInput msg_conv;
15623         msg_conv.inner = untag_ptr(msg);
15624         msg_conv.is_owned = ptr_is_owned(msg);
15625         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15626         msg_conv.is_owned = false;
15627         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15628 }
15629
15630 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) {
15631         void* this_arg_ptr = untag_ptr(this_arg);
15632         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15633         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15634         LDKPublicKey their_node_id_ref;
15635         CHECK(their_node_id->arr_len == 33);
15636         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15637         LDKTxAddOutput msg_conv;
15638         msg_conv.inner = untag_ptr(msg);
15639         msg_conv.is_owned = ptr_is_owned(msg);
15640         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15641         msg_conv.is_owned = false;
15642         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15643 }
15644
15645 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) {
15646         void* this_arg_ptr = untag_ptr(this_arg);
15647         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15648         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15649         LDKPublicKey their_node_id_ref;
15650         CHECK(their_node_id->arr_len == 33);
15651         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15652         LDKTxRemoveInput msg_conv;
15653         msg_conv.inner = untag_ptr(msg);
15654         msg_conv.is_owned = ptr_is_owned(msg);
15655         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15656         msg_conv.is_owned = false;
15657         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15658 }
15659
15660 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) {
15661         void* this_arg_ptr = untag_ptr(this_arg);
15662         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15663         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15664         LDKPublicKey their_node_id_ref;
15665         CHECK(their_node_id->arr_len == 33);
15666         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15667         LDKTxRemoveOutput msg_conv;
15668         msg_conv.inner = untag_ptr(msg);
15669         msg_conv.is_owned = ptr_is_owned(msg);
15670         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15671         msg_conv.is_owned = false;
15672         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15673 }
15674
15675 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) {
15676         void* this_arg_ptr = untag_ptr(this_arg);
15677         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15678         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15679         LDKPublicKey their_node_id_ref;
15680         CHECK(their_node_id->arr_len == 33);
15681         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15682         LDKTxComplete msg_conv;
15683         msg_conv.inner = untag_ptr(msg);
15684         msg_conv.is_owned = ptr_is_owned(msg);
15685         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15686         msg_conv.is_owned = false;
15687         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15688 }
15689
15690 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) {
15691         void* this_arg_ptr = untag_ptr(this_arg);
15692         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15693         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15694         LDKPublicKey their_node_id_ref;
15695         CHECK(their_node_id->arr_len == 33);
15696         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15697         LDKTxSignatures msg_conv;
15698         msg_conv.inner = untag_ptr(msg);
15699         msg_conv.is_owned = ptr_is_owned(msg);
15700         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15701         msg_conv.is_owned = false;
15702         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15703 }
15704
15705 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) {
15706         void* this_arg_ptr = untag_ptr(this_arg);
15707         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15708         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15709         LDKPublicKey their_node_id_ref;
15710         CHECK(their_node_id->arr_len == 33);
15711         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15712         LDKTxInitRbf msg_conv;
15713         msg_conv.inner = untag_ptr(msg);
15714         msg_conv.is_owned = ptr_is_owned(msg);
15715         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15716         msg_conv.is_owned = false;
15717         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15718 }
15719
15720 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) {
15721         void* this_arg_ptr = untag_ptr(this_arg);
15722         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15723         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15724         LDKPublicKey their_node_id_ref;
15725         CHECK(their_node_id->arr_len == 33);
15726         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15727         LDKTxAckRbf msg_conv;
15728         msg_conv.inner = untag_ptr(msg);
15729         msg_conv.is_owned = ptr_is_owned(msg);
15730         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15731         msg_conv.is_owned = false;
15732         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15733 }
15734
15735 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) {
15736         void* this_arg_ptr = untag_ptr(this_arg);
15737         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15738         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15739         LDKPublicKey their_node_id_ref;
15740         CHECK(their_node_id->arr_len == 33);
15741         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15742         LDKTxAbort msg_conv;
15743         msg_conv.inner = untag_ptr(msg);
15744         msg_conv.is_owned = ptr_is_owned(msg);
15745         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15746         msg_conv.is_owned = false;
15747         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15748 }
15749
15750 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) {
15751         void* this_arg_ptr = untag_ptr(this_arg);
15752         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15753         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15754         LDKPublicKey their_node_id_ref;
15755         CHECK(their_node_id->arr_len == 33);
15756         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15757         LDKUpdateAddHTLC msg_conv;
15758         msg_conv.inner = untag_ptr(msg);
15759         msg_conv.is_owned = ptr_is_owned(msg);
15760         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15761         msg_conv.is_owned = false;
15762         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15763 }
15764
15765 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) {
15766         void* this_arg_ptr = untag_ptr(this_arg);
15767         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15768         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15769         LDKPublicKey their_node_id_ref;
15770         CHECK(their_node_id->arr_len == 33);
15771         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15772         LDKUpdateFulfillHTLC msg_conv;
15773         msg_conv.inner = untag_ptr(msg);
15774         msg_conv.is_owned = ptr_is_owned(msg);
15775         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15776         msg_conv.is_owned = false;
15777         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15778 }
15779
15780 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) {
15781         void* this_arg_ptr = untag_ptr(this_arg);
15782         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15783         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15784         LDKPublicKey their_node_id_ref;
15785         CHECK(their_node_id->arr_len == 33);
15786         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15787         LDKUpdateFailHTLC msg_conv;
15788         msg_conv.inner = untag_ptr(msg);
15789         msg_conv.is_owned = ptr_is_owned(msg);
15790         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15791         msg_conv.is_owned = false;
15792         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15793 }
15794
15795 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) {
15796         void* this_arg_ptr = untag_ptr(this_arg);
15797         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15798         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15799         LDKPublicKey their_node_id_ref;
15800         CHECK(their_node_id->arr_len == 33);
15801         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15802         LDKUpdateFailMalformedHTLC msg_conv;
15803         msg_conv.inner = untag_ptr(msg);
15804         msg_conv.is_owned = ptr_is_owned(msg);
15805         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15806         msg_conv.is_owned = false;
15807         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15808 }
15809
15810 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) {
15811         void* this_arg_ptr = untag_ptr(this_arg);
15812         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15813         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15814         LDKPublicKey their_node_id_ref;
15815         CHECK(their_node_id->arr_len == 33);
15816         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15817         LDKCommitmentSigned msg_conv;
15818         msg_conv.inner = untag_ptr(msg);
15819         msg_conv.is_owned = ptr_is_owned(msg);
15820         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15821         msg_conv.is_owned = false;
15822         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15823 }
15824
15825 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) {
15826         void* this_arg_ptr = untag_ptr(this_arg);
15827         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15828         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15829         LDKPublicKey their_node_id_ref;
15830         CHECK(their_node_id->arr_len == 33);
15831         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15832         LDKRevokeAndACK msg_conv;
15833         msg_conv.inner = untag_ptr(msg);
15834         msg_conv.is_owned = ptr_is_owned(msg);
15835         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15836         msg_conv.is_owned = false;
15837         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15838 }
15839
15840 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) {
15841         void* this_arg_ptr = untag_ptr(this_arg);
15842         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15843         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15844         LDKPublicKey their_node_id_ref;
15845         CHECK(their_node_id->arr_len == 33);
15846         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15847         LDKUpdateFee msg_conv;
15848         msg_conv.inner = untag_ptr(msg);
15849         msg_conv.is_owned = ptr_is_owned(msg);
15850         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15851         msg_conv.is_owned = false;
15852         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15853 }
15854
15855 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) {
15856         void* this_arg_ptr = untag_ptr(this_arg);
15857         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15858         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15859         LDKPublicKey their_node_id_ref;
15860         CHECK(their_node_id->arr_len == 33);
15861         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15862         LDKAnnouncementSignatures msg_conv;
15863         msg_conv.inner = untag_ptr(msg);
15864         msg_conv.is_owned = ptr_is_owned(msg);
15865         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15866         msg_conv.is_owned = false;
15867         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15868 }
15869
15870 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
15871         void* this_arg_ptr = untag_ptr(this_arg);
15872         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15873         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15874         LDKPublicKey their_node_id_ref;
15875         CHECK(their_node_id->arr_len == 33);
15876         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15877         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
15878 }
15879
15880 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) {
15881         void* this_arg_ptr = untag_ptr(this_arg);
15882         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15883         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15884         LDKPublicKey their_node_id_ref;
15885         CHECK(their_node_id->arr_len == 33);
15886         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15887         LDKInit msg_conv;
15888         msg_conv.inner = untag_ptr(msg);
15889         msg_conv.is_owned = ptr_is_owned(msg);
15890         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15891         msg_conv.is_owned = false;
15892         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15893         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
15894         return tag_ptr(ret_conv, true);
15895 }
15896
15897 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) {
15898         void* this_arg_ptr = untag_ptr(this_arg);
15899         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15900         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15901         LDKPublicKey their_node_id_ref;
15902         CHECK(their_node_id->arr_len == 33);
15903         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15904         LDKChannelReestablish msg_conv;
15905         msg_conv.inner = untag_ptr(msg);
15906         msg_conv.is_owned = ptr_is_owned(msg);
15907         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15908         msg_conv.is_owned = false;
15909         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15910 }
15911
15912 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) {
15913         void* this_arg_ptr = untag_ptr(this_arg);
15914         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15915         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15916         LDKPublicKey their_node_id_ref;
15917         CHECK(their_node_id->arr_len == 33);
15918         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15919         LDKChannelUpdate msg_conv;
15920         msg_conv.inner = untag_ptr(msg);
15921         msg_conv.is_owned = ptr_is_owned(msg);
15922         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15923         msg_conv.is_owned = false;
15924         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15925 }
15926
15927 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
15928         void* this_arg_ptr = untag_ptr(this_arg);
15929         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15930         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15931         LDKPublicKey their_node_id_ref;
15932         CHECK(their_node_id->arr_len == 33);
15933         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15934         LDKErrorMessage msg_conv;
15935         msg_conv.inner = untag_ptr(msg);
15936         msg_conv.is_owned = ptr_is_owned(msg);
15937         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15938         msg_conv.is_owned = false;
15939         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15940 }
15941
15942 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
15943         void* this_arg_ptr = untag_ptr(this_arg);
15944         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15945         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15946         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15947         uint64_t ret_ref = 0;
15948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15950         return ret_ref;
15951 }
15952
15953 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
15954         void* this_arg_ptr = untag_ptr(this_arg);
15955         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15956         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15957         LDKPublicKey their_node_id_ref;
15958         CHECK(their_node_id->arr_len == 33);
15959         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15960         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15961         uint64_t ret_ref = 0;
15962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15964         return ret_ref;
15965 }
15966
15967 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_get_chain_hashes"))) TS_ChannelMessageHandler_get_chain_hashes(uint64_t this_arg) {
15968         void* this_arg_ptr = untag_ptr(this_arg);
15969         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15970         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15971         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15972         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
15973         uint64_t ret_ref = tag_ptr(ret_copy, true);
15974         return ret_ref;
15975 }
15976
15977 typedef struct LDKOffersMessageHandler_JCalls {
15978         atomic_size_t refcnt;
15979         uint32_t instance_ptr;
15980 } LDKOffersMessageHandler_JCalls;
15981 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
15982         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
15983         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15984                 FREE(j_calls);
15985         }
15986 }
15987 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
15988         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
15989         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
15990         *message_copy = message;
15991         uint64_t message_ref = tag_ptr(message_copy, true);
15992         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 116, message_ref, 0, 0, 0, 0, 0);
15993         void* ret_ptr = untag_ptr(ret);
15994         CHECK_ACCESS(ret_ptr);
15995         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
15996         FREE(untag_ptr(ret));
15997         return ret_conv;
15998 }
15999 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
16000         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
16001         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, 0, 0, 0, 0, 0, 0);
16002         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
16003         ret_constr.datalen = ret->arr_len;
16004         if (ret_constr.datalen > 0)
16005                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
16006         else
16007                 ret_constr.data = NULL;
16008         uint64_t* ret_vals = ret->elems;
16009         for (size_t x = 0; x < ret_constr.datalen; x++) {
16010                 uint64_t ret_conv_49 = ret_vals[x];
16011                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
16012                 CHECK_ACCESS(ret_conv_49_ptr);
16013                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
16014                 FREE(untag_ptr(ret_conv_49));
16015                 ret_constr.data[x] = ret_conv_49_conv;
16016         }
16017         FREE(ret);
16018         return ret_constr;
16019 }
16020 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
16021         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
16022         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16023 }
16024 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JSValue o) {
16025         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
16026         atomic_init(&calls->refcnt, 1);
16027         calls->instance_ptr = o;
16028
16029         LDKOffersMessageHandler ret = {
16030                 .this_arg = (void*) calls,
16031                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
16032                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
16033                 .free = LDKOffersMessageHandler_JCalls_free,
16034         };
16035         return ret;
16036 }
16037 uint64_t  __attribute__((export_name("TS_LDKOffersMessageHandler_new"))) TS_LDKOffersMessageHandler_new(JSValue o) {
16038         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
16039         *res_ptr = LDKOffersMessageHandler_init(o);
16040         return tag_ptr(res_ptr, true);
16041 }
16042 uint64_t  __attribute__((export_name("TS_OffersMessageHandler_handle_message"))) TS_OffersMessageHandler_handle_message(uint64_t this_arg, uint64_t message) {
16043         void* this_arg_ptr = untag_ptr(this_arg);
16044         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16045         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
16046         void* message_ptr = untag_ptr(message);
16047         CHECK_ACCESS(message_ptr);
16048         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
16049         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
16050         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
16051         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
16052         uint64_t ret_ref = tag_ptr(ret_copy, true);
16053         return ret_ref;
16054 }
16055
16056 uint64_tArray  __attribute__((export_name("TS_OffersMessageHandler_release_pending_messages"))) TS_OffersMessageHandler_release_pending_messages(uint64_t this_arg) {
16057         void* this_arg_ptr = untag_ptr(this_arg);
16058         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16059         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
16060         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
16061         uint64_tArray ret_arr = NULL;
16062         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
16063         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
16064         for (size_t x = 0; x < ret_var.datalen; x++) {
16065                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
16066                 *ret_conv_49_conv = ret_var.data[x];
16067                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
16068         }
16069         
16070         FREE(ret_var.data);
16071         return ret_arr;
16072 }
16073
16074 typedef struct LDKNodeIdLookUp_JCalls {
16075         atomic_size_t refcnt;
16076         uint32_t instance_ptr;
16077 } LDKNodeIdLookUp_JCalls;
16078 static void LDKNodeIdLookUp_JCalls_free(void* this_arg) {
16079         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
16080         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16081                 FREE(j_calls);
16082         }
16083 }
16084 LDKPublicKey next_node_id_LDKNodeIdLookUp_jcall(const void* this_arg, uint64_t short_channel_id) {
16085         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
16086         int64_t short_channel_id_conv = short_channel_id;
16087         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 118, short_channel_id_conv, 0, 0, 0, 0, 0);
16088         LDKPublicKey ret_ref;
16089         CHECK(ret->arr_len == 33);
16090         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
16091         return ret_ref;
16092 }
16093 static void LDKNodeIdLookUp_JCalls_cloned(LDKNodeIdLookUp* new_obj) {
16094         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) new_obj->this_arg;
16095         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16096 }
16097 static inline LDKNodeIdLookUp LDKNodeIdLookUp_init (JSValue o) {
16098         LDKNodeIdLookUp_JCalls *calls = MALLOC(sizeof(LDKNodeIdLookUp_JCalls), "LDKNodeIdLookUp_JCalls");
16099         atomic_init(&calls->refcnt, 1);
16100         calls->instance_ptr = o;
16101
16102         LDKNodeIdLookUp ret = {
16103                 .this_arg = (void*) calls,
16104                 .next_node_id = next_node_id_LDKNodeIdLookUp_jcall,
16105                 .free = LDKNodeIdLookUp_JCalls_free,
16106         };
16107         return ret;
16108 }
16109 uint64_t  __attribute__((export_name("TS_LDKNodeIdLookUp_new"))) TS_LDKNodeIdLookUp_new(JSValue o) {
16110         LDKNodeIdLookUp *res_ptr = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
16111         *res_ptr = LDKNodeIdLookUp_init(o);
16112         return tag_ptr(res_ptr, true);
16113 }
16114 int8_tArray  __attribute__((export_name("TS_NodeIdLookUp_next_node_id"))) TS_NodeIdLookUp_next_node_id(uint64_t this_arg, int64_t short_channel_id) {
16115         void* this_arg_ptr = untag_ptr(this_arg);
16116         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16117         LDKNodeIdLookUp* this_arg_conv = (LDKNodeIdLookUp*)this_arg_ptr;
16118         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
16119         memcpy(ret_arr->elems, (this_arg_conv->next_node_id)(this_arg_conv->this_arg, short_channel_id).compressed_form, 33);
16120         return ret_arr;
16121 }
16122
16123 typedef struct LDKRoutingMessageHandler_JCalls {
16124         atomic_size_t refcnt;
16125         uint32_t instance_ptr;
16126         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
16127 } LDKRoutingMessageHandler_JCalls;
16128 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
16129         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16130         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16131                 FREE(j_calls);
16132         }
16133 }
16134 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
16135         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16136         LDKNodeAnnouncement msg_var = *msg;
16137         uint64_t msg_ref = 0;
16138         msg_var = NodeAnnouncement_clone(&msg_var);
16139         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16140         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16141         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 119, msg_ref, 0, 0, 0, 0, 0);
16142         void* ret_ptr = untag_ptr(ret);
16143         CHECK_ACCESS(ret_ptr);
16144         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16145         FREE(untag_ptr(ret));
16146         return ret_conv;
16147 }
16148 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
16149         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16150         LDKChannelAnnouncement msg_var = *msg;
16151         uint64_t msg_ref = 0;
16152         msg_var = ChannelAnnouncement_clone(&msg_var);
16153         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16154         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16155         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 120, msg_ref, 0, 0, 0, 0, 0);
16156         void* ret_ptr = untag_ptr(ret);
16157         CHECK_ACCESS(ret_ptr);
16158         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16159         FREE(untag_ptr(ret));
16160         return ret_conv;
16161 }
16162 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
16163         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16164         LDKChannelUpdate msg_var = *msg;
16165         uint64_t msg_ref = 0;
16166         msg_var = ChannelUpdate_clone(&msg_var);
16167         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16168         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16169         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 121, msg_ref, 0, 0, 0, 0, 0);
16170         void* ret_ptr = untag_ptr(ret);
16171         CHECK_ACCESS(ret_ptr);
16172         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16173         FREE(untag_ptr(ret));
16174         return ret_conv;
16175 }
16176 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
16177         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16178         int64_t starting_point_conv = starting_point;
16179         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 122, starting_point_conv, 0, 0, 0, 0, 0);
16180         void* ret_ptr = untag_ptr(ret);
16181         CHECK_ACCESS(ret_ptr);
16182         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
16183         FREE(untag_ptr(ret));
16184         return ret_conv;
16185 }
16186 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
16187         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16188         LDKNodeId starting_point_var = starting_point;
16189         uint64_t starting_point_ref = 0;
16190         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
16191         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
16192         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 123, starting_point_ref, 0, 0, 0, 0, 0);
16193         LDKNodeAnnouncement ret_conv;
16194         ret_conv.inner = untag_ptr(ret);
16195         ret_conv.is_owned = ptr_is_owned(ret);
16196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16197         return ret_conv;
16198 }
16199 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
16200         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16201         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16202         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16203         LDKInit init_var = *init;
16204         uint64_t init_ref = 0;
16205         init_var = Init_clone(&init_var);
16206         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
16207         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
16208         jboolean inbound_conv = inbound;
16209         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);
16210         void* ret_ptr = untag_ptr(ret);
16211         CHECK_ACCESS(ret_ptr);
16212         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16213         FREE(untag_ptr(ret));
16214         return ret_conv;
16215 }
16216 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
16217         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16218         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16219         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16220         LDKReplyChannelRange msg_var = msg;
16221         uint64_t msg_ref = 0;
16222         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16223         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16224         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 125, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
16225         void* ret_ptr = untag_ptr(ret);
16226         CHECK_ACCESS(ret_ptr);
16227         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16228         FREE(untag_ptr(ret));
16229         return ret_conv;
16230 }
16231 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
16232         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16233         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16234         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16235         LDKReplyShortChannelIdsEnd msg_var = msg;
16236         uint64_t msg_ref = 0;
16237         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16238         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16239         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 126, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
16240         void* ret_ptr = untag_ptr(ret);
16241         CHECK_ACCESS(ret_ptr);
16242         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16243         FREE(untag_ptr(ret));
16244         return ret_conv;
16245 }
16246 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
16247         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16248         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16249         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16250         LDKQueryChannelRange msg_var = msg;
16251         uint64_t msg_ref = 0;
16252         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16253         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16254         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 127, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
16255         void* ret_ptr = untag_ptr(ret);
16256         CHECK_ACCESS(ret_ptr);
16257         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16258         FREE(untag_ptr(ret));
16259         return ret_conv;
16260 }
16261 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
16262         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16263         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16264         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16265         LDKQueryShortChannelIds msg_var = msg;
16266         uint64_t msg_ref = 0;
16267         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16268         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16269         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 128, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
16270         void* ret_ptr = untag_ptr(ret);
16271         CHECK_ACCESS(ret_ptr);
16272         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16273         FREE(untag_ptr(ret));
16274         return ret_conv;
16275 }
16276 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
16277         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16278         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 129, 0, 0, 0, 0, 0, 0);
16279 }
16280 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
16281         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16282         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 130, 0, 0, 0, 0, 0, 0);
16283         LDKNodeFeatures ret_conv;
16284         ret_conv.inner = untag_ptr(ret);
16285         ret_conv.is_owned = ptr_is_owned(ret);
16286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16287         return ret_conv;
16288 }
16289 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16290         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16291         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16292         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16293         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 131, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
16294         LDKInitFeatures ret_conv;
16295         ret_conv.inner = untag_ptr(ret);
16296         ret_conv.is_owned = ptr_is_owned(ret);
16297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16298         return ret_conv;
16299 }
16300 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
16301         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
16302         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16303         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
16304 }
16305 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
16306         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
16307         atomic_init(&calls->refcnt, 1);
16308         calls->instance_ptr = o;
16309
16310         LDKRoutingMessageHandler ret = {
16311                 .this_arg = (void*) calls,
16312                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
16313                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
16314                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
16315                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
16316                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
16317                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
16318                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
16319                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
16320                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
16321                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
16322                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
16323                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
16324                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
16325                 .free = LDKRoutingMessageHandler_JCalls_free,
16326                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
16327         };
16328         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
16329         return ret;
16330 }
16331 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
16332         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16333         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
16334         return tag_ptr(res_ptr, true);
16335 }
16336 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
16337         void* this_arg_ptr = untag_ptr(this_arg);
16338         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16339         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16340         LDKNodeAnnouncement msg_conv;
16341         msg_conv.inner = untag_ptr(msg);
16342         msg_conv.is_owned = ptr_is_owned(msg);
16343         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16344         msg_conv.is_owned = false;
16345         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16346         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
16347         return tag_ptr(ret_conv, true);
16348 }
16349
16350 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
16351         void* this_arg_ptr = untag_ptr(this_arg);
16352         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16353         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16354         LDKChannelAnnouncement msg_conv;
16355         msg_conv.inner = untag_ptr(msg);
16356         msg_conv.is_owned = ptr_is_owned(msg);
16357         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16358         msg_conv.is_owned = false;
16359         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16360         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
16361         return tag_ptr(ret_conv, true);
16362 }
16363
16364 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
16365         void* this_arg_ptr = untag_ptr(this_arg);
16366         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16367         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16368         LDKChannelUpdate msg_conv;
16369         msg_conv.inner = untag_ptr(msg);
16370         msg_conv.is_owned = ptr_is_owned(msg);
16371         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16372         msg_conv.is_owned = false;
16373         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16374         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
16375         return tag_ptr(ret_conv, true);
16376 }
16377
16378 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) {
16379         void* this_arg_ptr = untag_ptr(this_arg);
16380         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16381         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16382         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
16383         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
16384         uint64_t ret_ref = tag_ptr(ret_copy, true);
16385         return ret_ref;
16386 }
16387
16388 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) {
16389         void* this_arg_ptr = untag_ptr(this_arg);
16390         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16391         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16392         LDKNodeId starting_point_conv;
16393         starting_point_conv.inner = untag_ptr(starting_point);
16394         starting_point_conv.is_owned = ptr_is_owned(starting_point);
16395         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
16396         starting_point_conv = NodeId_clone(&starting_point_conv);
16397         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
16398         uint64_t ret_ref = 0;
16399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16401         return ret_ref;
16402 }
16403
16404 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) {
16405         void* this_arg_ptr = untag_ptr(this_arg);
16406         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16407         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16408         LDKPublicKey their_node_id_ref;
16409         CHECK(their_node_id->arr_len == 33);
16410         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16411         LDKInit init_conv;
16412         init_conv.inner = untag_ptr(init);
16413         init_conv.is_owned = ptr_is_owned(init);
16414         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
16415         init_conv.is_owned = false;
16416         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16417         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
16418         return tag_ptr(ret_conv, true);
16419 }
16420
16421 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) {
16422         void* this_arg_ptr = untag_ptr(this_arg);
16423         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16424         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16425         LDKPublicKey their_node_id_ref;
16426         CHECK(their_node_id->arr_len == 33);
16427         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16428         LDKReplyChannelRange msg_conv;
16429         msg_conv.inner = untag_ptr(msg);
16430         msg_conv.is_owned = ptr_is_owned(msg);
16431         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16432         msg_conv = ReplyChannelRange_clone(&msg_conv);
16433         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16434         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16435         return tag_ptr(ret_conv, true);
16436 }
16437
16438 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) {
16439         void* this_arg_ptr = untag_ptr(this_arg);
16440         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16441         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16442         LDKPublicKey their_node_id_ref;
16443         CHECK(their_node_id->arr_len == 33);
16444         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16445         LDKReplyShortChannelIdsEnd msg_conv;
16446         msg_conv.inner = untag_ptr(msg);
16447         msg_conv.is_owned = ptr_is_owned(msg);
16448         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16449         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
16450         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16451         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16452         return tag_ptr(ret_conv, true);
16453 }
16454
16455 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) {
16456         void* this_arg_ptr = untag_ptr(this_arg);
16457         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16458         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16459         LDKPublicKey their_node_id_ref;
16460         CHECK(their_node_id->arr_len == 33);
16461         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16462         LDKQueryChannelRange msg_conv;
16463         msg_conv.inner = untag_ptr(msg);
16464         msg_conv.is_owned = ptr_is_owned(msg);
16465         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16466         msg_conv = QueryChannelRange_clone(&msg_conv);
16467         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16468         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16469         return tag_ptr(ret_conv, true);
16470 }
16471
16472 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) {
16473         void* this_arg_ptr = untag_ptr(this_arg);
16474         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16475         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16476         LDKPublicKey their_node_id_ref;
16477         CHECK(their_node_id->arr_len == 33);
16478         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16479         LDKQueryShortChannelIds msg_conv;
16480         msg_conv.inner = untag_ptr(msg);
16481         msg_conv.is_owned = ptr_is_owned(msg);
16482         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16483         msg_conv = QueryShortChannelIds_clone(&msg_conv);
16484         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16485         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16486         return tag_ptr(ret_conv, true);
16487 }
16488
16489 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
16490         void* this_arg_ptr = untag_ptr(this_arg);
16491         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16492         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16493         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
16494         return ret_conv;
16495 }
16496
16497 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
16498         void* this_arg_ptr = untag_ptr(this_arg);
16499         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16500         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16501         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16502         uint64_t ret_ref = 0;
16503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16505         return ret_ref;
16506 }
16507
16508 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
16509         void* this_arg_ptr = untag_ptr(this_arg);
16510         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16511         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16512         LDKPublicKey their_node_id_ref;
16513         CHECK(their_node_id->arr_len == 33);
16514         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16515         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16516         uint64_t ret_ref = 0;
16517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16519         return ret_ref;
16520 }
16521
16522 typedef struct LDKOnionMessageHandler_JCalls {
16523         atomic_size_t refcnt;
16524         uint32_t instance_ptr;
16525 } LDKOnionMessageHandler_JCalls;
16526 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
16527         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16528         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16529                 FREE(j_calls);
16530         }
16531 }
16532 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
16533         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16534         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 132, 0, 0, 0, 0, 0, 0);
16535         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
16536         ret_constr.datalen = ret->arr_len;
16537         if (ret_constr.datalen > 0)
16538                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
16539         else
16540                 ret_constr.data = NULL;
16541         uint64_t* ret_vals = ret->elems;
16542         for (size_t o = 0; o < ret_constr.datalen; o++) {
16543                 uint64_t ret_conv_40 = ret_vals[o];
16544                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
16545                 CHECK_ACCESS(ret_conv_40_ptr);
16546                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
16547                 FREE(untag_ptr(ret_conv_40));
16548                 ret_constr.data[o] = ret_conv_40_conv;
16549         }
16550         FREE(ret);
16551         return ret_constr;
16552 }
16553 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
16554         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16555         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
16556         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
16557         LDKOnionMessage msg_var = *msg;
16558         uint64_t msg_ref = 0;
16559         msg_var = OnionMessage_clone(&msg_var);
16560         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16561         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16562         js_invoke_function_ubuuuu(j_calls->instance_ptr, 133, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
16563 }
16564 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
16565         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16566         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
16567         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
16568         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 134, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
16569         LDKOnionMessage ret_conv;
16570         ret_conv.inner = untag_ptr(ret);
16571         ret_conv.is_owned = ptr_is_owned(ret);
16572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16573         return ret_conv;
16574 }
16575 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
16576         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16577         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16578         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16579         LDKInit init_var = *init;
16580         uint64_t init_ref = 0;
16581         init_var = Init_clone(&init_var);
16582         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
16583         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
16584         jboolean inbound_conv = inbound;
16585         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);
16586         void* ret_ptr = untag_ptr(ret);
16587         CHECK_ACCESS(ret_ptr);
16588         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16589         FREE(untag_ptr(ret));
16590         return ret_conv;
16591 }
16592 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16593         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16594         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16595         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16596         js_invoke_function_uuuuuu(j_calls->instance_ptr, 136, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
16597 }
16598 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
16599         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16600         js_invoke_function_uuuuuu(j_calls->instance_ptr, 137, 0, 0, 0, 0, 0, 0);
16601 }
16602 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
16603         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16604         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 138, 0, 0, 0, 0, 0, 0);
16605         LDKNodeFeatures ret_conv;
16606         ret_conv.inner = untag_ptr(ret);
16607         ret_conv.is_owned = ptr_is_owned(ret);
16608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16609         return ret_conv;
16610 }
16611 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16612         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16613         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16614         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16615         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 139, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
16616         LDKInitFeatures ret_conv;
16617         ret_conv.inner = untag_ptr(ret);
16618         ret_conv.is_owned = ptr_is_owned(ret);
16619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16620         return ret_conv;
16621 }
16622 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
16623         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
16624         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16625 }
16626 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o) {
16627         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
16628         atomic_init(&calls->refcnt, 1);
16629         calls->instance_ptr = o;
16630
16631         LDKOnionMessageHandler ret = {
16632                 .this_arg = (void*) calls,
16633                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
16634                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
16635                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
16636                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
16637                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
16638                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
16639                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
16640                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
16641                 .free = LDKOnionMessageHandler_JCalls_free,
16642         };
16643         return ret;
16644 }
16645 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o) {
16646         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
16647         *res_ptr = LDKOnionMessageHandler_init(o);
16648         return tag_ptr(res_ptr, true);
16649 }
16650 uint64_tArray  __attribute__((export_name("TS_OnionMessageHandler_get_and_clear_connections_needed"))) TS_OnionMessageHandler_get_and_clear_connections_needed(uint64_t this_arg) {
16651         void* this_arg_ptr = untag_ptr(this_arg);
16652         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16653         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16654         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
16655         uint64_tArray ret_arr = NULL;
16656         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
16657         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
16658         for (size_t o = 0; o < ret_var.datalen; o++) {
16659                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
16660                 *ret_conv_40_conv = ret_var.data[o];
16661                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
16662         }
16663         
16664         FREE(ret_var.data);
16665         return ret_arr;
16666 }
16667
16668 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) {
16669         void* this_arg_ptr = untag_ptr(this_arg);
16670         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16671         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16672         LDKPublicKey peer_node_id_ref;
16673         CHECK(peer_node_id->arr_len == 33);
16674         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
16675         LDKOnionMessage msg_conv;
16676         msg_conv.inner = untag_ptr(msg);
16677         msg_conv.is_owned = ptr_is_owned(msg);
16678         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16679         msg_conv.is_owned = false;
16680         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
16681 }
16682
16683 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) {
16684         void* this_arg_ptr = untag_ptr(this_arg);
16685         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16686         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16687         LDKPublicKey peer_node_id_ref;
16688         CHECK(peer_node_id->arr_len == 33);
16689         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
16690         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
16691         uint64_t ret_ref = 0;
16692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16694         return ret_ref;
16695 }
16696
16697 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) {
16698         void* this_arg_ptr = untag_ptr(this_arg);
16699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16700         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16701         LDKPublicKey their_node_id_ref;
16702         CHECK(their_node_id->arr_len == 33);
16703         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16704         LDKInit init_conv;
16705         init_conv.inner = untag_ptr(init);
16706         init_conv.is_owned = ptr_is_owned(init);
16707         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
16708         init_conv.is_owned = false;
16709         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16710         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
16711         return tag_ptr(ret_conv, true);
16712 }
16713
16714 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
16715         void* this_arg_ptr = untag_ptr(this_arg);
16716         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16717         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16718         LDKPublicKey their_node_id_ref;
16719         CHECK(their_node_id->arr_len == 33);
16720         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16721         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
16722 }
16723
16724 void  __attribute__((export_name("TS_OnionMessageHandler_timer_tick_occurred"))) TS_OnionMessageHandler_timer_tick_occurred(uint64_t this_arg) {
16725         void* this_arg_ptr = untag_ptr(this_arg);
16726         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16727         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16728         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
16729 }
16730
16731 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
16732         void* this_arg_ptr = untag_ptr(this_arg);
16733         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16734         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16735         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16736         uint64_t ret_ref = 0;
16737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16739         return ret_ref;
16740 }
16741
16742 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
16743         void* this_arg_ptr = untag_ptr(this_arg);
16744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16745         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16746         LDKPublicKey their_node_id_ref;
16747         CHECK(their_node_id->arr_len == 33);
16748         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16749         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16750         uint64_t ret_ref = 0;
16751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16753         return ret_ref;
16754 }
16755
16756 typedef struct LDKCustomMessageReader_JCalls {
16757         atomic_size_t refcnt;
16758         uint32_t instance_ptr;
16759 } LDKCustomMessageReader_JCalls;
16760 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
16761         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
16762         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16763                 FREE(j_calls);
16764         }
16765 }
16766 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
16767         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
16768         int16_t message_type_conv = message_type;
16769         LDKu8slice buffer_var = buffer;
16770         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
16771         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
16772         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 140, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
16773         void* ret_ptr = untag_ptr(ret);
16774         CHECK_ACCESS(ret_ptr);
16775         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
16776         FREE(untag_ptr(ret));
16777         return ret_conv;
16778 }
16779 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
16780         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
16781         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16782 }
16783 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
16784         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
16785         atomic_init(&calls->refcnt, 1);
16786         calls->instance_ptr = o;
16787
16788         LDKCustomMessageReader ret = {
16789                 .this_arg = (void*) calls,
16790                 .read = read_LDKCustomMessageReader_jcall,
16791                 .free = LDKCustomMessageReader_JCalls_free,
16792         };
16793         return ret;
16794 }
16795 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
16796         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
16797         *res_ptr = LDKCustomMessageReader_init(o);
16798         return tag_ptr(res_ptr, true);
16799 }
16800 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
16801         void* this_arg_ptr = untag_ptr(this_arg);
16802         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16803         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
16804         LDKu8slice buffer_ref;
16805         buffer_ref.datalen = buffer->arr_len;
16806         buffer_ref.data = buffer->elems;
16807         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16808         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
16809         FREE(buffer);
16810         return tag_ptr(ret_conv, true);
16811 }
16812
16813 typedef struct LDKCustomMessageHandler_JCalls {
16814         atomic_size_t refcnt;
16815         uint32_t instance_ptr;
16816         LDKCustomMessageReader_JCalls* CustomMessageReader;
16817 } LDKCustomMessageHandler_JCalls;
16818 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
16819         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
16820         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16821                 FREE(j_calls);
16822         }
16823 }
16824 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
16825         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
16826         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
16827         *msg_ret = msg;
16828         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
16829         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
16830         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);
16831         void* ret_ptr = untag_ptr(ret);
16832         CHECK_ACCESS(ret_ptr);
16833         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16834         FREE(untag_ptr(ret));
16835         return ret_conv;
16836 }
16837 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
16838         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
16839         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 142, 0, 0, 0, 0, 0, 0);
16840         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
16841         ret_constr.datalen = ret->arr_len;
16842         if (ret_constr.datalen > 0)
16843                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
16844         else
16845                 ret_constr.data = NULL;
16846         uint64_t* ret_vals = ret->elems;
16847         for (size_t z = 0; z < ret_constr.datalen; z++) {
16848                 uint64_t ret_conv_25 = ret_vals[z];
16849                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
16850                 CHECK_ACCESS(ret_conv_25_ptr);
16851                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
16852                 FREE(untag_ptr(ret_conv_25));
16853                 ret_constr.data[z] = ret_conv_25_conv;
16854         }
16855         FREE(ret);
16856         return ret_constr;
16857 }
16858 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
16859         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
16860         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 143, 0, 0, 0, 0, 0, 0);
16861         LDKNodeFeatures ret_conv;
16862         ret_conv.inner = untag_ptr(ret);
16863         ret_conv.is_owned = ptr_is_owned(ret);
16864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16865         return ret_conv;
16866 }
16867 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16868         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
16869         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16870         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16871         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 144, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
16872         LDKInitFeatures ret_conv;
16873         ret_conv.inner = untag_ptr(ret);
16874         ret_conv.is_owned = ptr_is_owned(ret);
16875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16876         return ret_conv;
16877 }
16878 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
16879         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
16880         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16881         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
16882 }
16883 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
16884         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
16885         atomic_init(&calls->refcnt, 1);
16886         calls->instance_ptr = o;
16887
16888         LDKCustomMessageHandler ret = {
16889                 .this_arg = (void*) calls,
16890                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
16891                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
16892                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
16893                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
16894                 .free = LDKCustomMessageHandler_JCalls_free,
16895                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
16896         };
16897         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
16898         return ret;
16899 }
16900 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
16901         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
16902         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
16903         return tag_ptr(res_ptr, true);
16904 }
16905 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) {
16906         void* this_arg_ptr = untag_ptr(this_arg);
16907         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16908         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
16909         void* msg_ptr = untag_ptr(msg);
16910         CHECK_ACCESS(msg_ptr);
16911         LDKType msg_conv = *(LDKType*)(msg_ptr);
16912         if (msg_conv.free == LDKType_JCalls_free) {
16913                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16914                 LDKType_JCalls_cloned(&msg_conv);
16915         }
16916         LDKPublicKey sender_node_id_ref;
16917         CHECK(sender_node_id->arr_len == 33);
16918         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
16919         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16920         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
16921         return tag_ptr(ret_conv, true);
16922 }
16923
16924 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
16925         void* this_arg_ptr = untag_ptr(this_arg);
16926         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16927         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
16928         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
16929         uint64_tArray ret_arr = NULL;
16930         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
16931         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
16932         for (size_t z = 0; z < ret_var.datalen; z++) {
16933                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16934                 *ret_conv_25_conv = ret_var.data[z];
16935                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
16936         }
16937         
16938         FREE(ret_var.data);
16939         return ret_arr;
16940 }
16941
16942 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_node_features"))) TS_CustomMessageHandler_provided_node_features(uint64_t this_arg) {
16943         void* this_arg_ptr = untag_ptr(this_arg);
16944         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16945         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
16946         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16947         uint64_t ret_ref = 0;
16948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16950         return ret_ref;
16951 }
16952
16953 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_init_features"))) TS_CustomMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
16954         void* this_arg_ptr = untag_ptr(this_arg);
16955         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16956         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
16957         LDKPublicKey their_node_id_ref;
16958         CHECK(their_node_id->arr_len == 33);
16959         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16960         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16961         uint64_t ret_ref = 0;
16962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16964         return ret_ref;
16965 }
16966
16967 typedef struct LDKCustomOnionMessageHandler_JCalls {
16968         atomic_size_t refcnt;
16969         uint32_t instance_ptr;
16970 } LDKCustomOnionMessageHandler_JCalls;
16971 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
16972         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
16973         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16974                 FREE(j_calls);
16975         }
16976 }
16977 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
16978         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
16979         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
16980         *msg_ret = msg;
16981         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 145, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
16982         void* ret_ptr = untag_ptr(ret);
16983         CHECK_ACCESS(ret_ptr);
16984         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
16985         FREE(untag_ptr(ret));
16986         return ret_conv;
16987 }
16988 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
16989         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
16990         int64_t message_type_conv = message_type;
16991         LDKu8slice buffer_var = buffer;
16992         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
16993         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
16994         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 146, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
16995         void* ret_ptr = untag_ptr(ret);
16996         CHECK_ACCESS(ret_ptr);
16997         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
16998         FREE(untag_ptr(ret));
16999         return ret_conv;
17000 }
17001 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
17002         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17003         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 147, 0, 0, 0, 0, 0, 0);
17004         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
17005         ret_constr.datalen = ret->arr_len;
17006         if (ret_constr.datalen > 0)
17007                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
17008         else
17009                 ret_constr.data = NULL;
17010         uint64_t* ret_vals = ret->elems;
17011         for (size_t e = 0; e < ret_constr.datalen; e++) {
17012                 uint64_t ret_conv_56 = ret_vals[e];
17013                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
17014                 CHECK_ACCESS(ret_conv_56_ptr);
17015                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
17016                 FREE(untag_ptr(ret_conv_56));
17017                 ret_constr.data[e] = ret_conv_56_conv;
17018         }
17019         FREE(ret);
17020         return ret_constr;
17021 }
17022 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
17023         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
17024         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17025 }
17026 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
17027         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
17028         atomic_init(&calls->refcnt, 1);
17029         calls->instance_ptr = o;
17030
17031         LDKCustomOnionMessageHandler ret = {
17032                 .this_arg = (void*) calls,
17033                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
17034                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
17035                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
17036                 .free = LDKCustomOnionMessageHandler_JCalls_free,
17037         };
17038         return ret;
17039 }
17040 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
17041         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
17042         *res_ptr = LDKCustomOnionMessageHandler_init(o);
17043         return tag_ptr(res_ptr, true);
17044 }
17045 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
17046         void* this_arg_ptr = untag_ptr(this_arg);
17047         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17048         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17049         void* msg_ptr = untag_ptr(msg);
17050         CHECK_ACCESS(msg_ptr);
17051         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
17052         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
17053                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17054                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
17055         }
17056         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
17057         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
17058         uint64_t ret_ref = tag_ptr(ret_copy, true);
17059         return ret_ref;
17060 }
17061
17062 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) {
17063         void* this_arg_ptr = untag_ptr(this_arg);
17064         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17065         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17066         LDKu8slice buffer_ref;
17067         buffer_ref.datalen = buffer->arr_len;
17068         buffer_ref.data = buffer->elems;
17069         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
17070         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
17071         FREE(buffer);
17072         return tag_ptr(ret_conv, true);
17073 }
17074
17075 uint64_tArray  __attribute__((export_name("TS_CustomOnionMessageHandler_release_pending_custom_messages"))) TS_CustomOnionMessageHandler_release_pending_custom_messages(uint64_t this_arg) {
17076         void* this_arg_ptr = untag_ptr(this_arg);
17077         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17078         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17079         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
17080         uint64_tArray ret_arr = NULL;
17081         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
17082         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
17083         for (size_t e = 0; e < ret_var.datalen; e++) {
17084                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
17085                 *ret_conv_56_conv = ret_var.data[e];
17086                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
17087         }
17088         
17089         FREE(ret_var.data);
17090         return ret_arr;
17091 }
17092
17093 typedef struct LDKSocketDescriptor_JCalls {
17094         atomic_size_t refcnt;
17095         uint32_t instance_ptr;
17096 } LDKSocketDescriptor_JCalls;
17097 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
17098         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17099         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17100                 FREE(j_calls);
17101         }
17102 }
17103 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
17104         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17105         LDKu8slice data_var = data;
17106         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
17107         memcpy(data_arr->elems, data_var.data, data_var.datalen);
17108         jboolean resume_read_conv = resume_read;
17109         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 148, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
17110 }
17111 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
17112         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17113         js_invoke_function_uuuuuu(j_calls->instance_ptr, 149, 0, 0, 0, 0, 0, 0);
17114 }
17115 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
17116         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17117         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17118         *other_arg_clone = SocketDescriptor_clone(other_arg);
17119         return js_invoke_function_buuuuu(j_calls->instance_ptr, 150, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
17120 }
17121 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
17122         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17123         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 151, 0, 0, 0, 0, 0, 0);
17124 }
17125 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
17126         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
17127         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17128 }
17129 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
17130         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
17131         atomic_init(&calls->refcnt, 1);
17132         calls->instance_ptr = o;
17133
17134         LDKSocketDescriptor ret = {
17135                 .this_arg = (void*) calls,
17136                 .send_data = send_data_LDKSocketDescriptor_jcall,
17137                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
17138                 .eq = eq_LDKSocketDescriptor_jcall,
17139                 .hash = hash_LDKSocketDescriptor_jcall,
17140                 .cloned = LDKSocketDescriptor_JCalls_cloned,
17141                 .free = LDKSocketDescriptor_JCalls_free,
17142         };
17143         return ret;
17144 }
17145 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
17146         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17147         *res_ptr = LDKSocketDescriptor_init(o);
17148         return tag_ptr(res_ptr, true);
17149 }
17150 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
17151         void* this_arg_ptr = untag_ptr(this_arg);
17152         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17153         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17154         LDKu8slice data_ref;
17155         data_ref.datalen = data->arr_len;
17156         data_ref.data = data->elems;
17157         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
17158         FREE(data);
17159         return ret_conv;
17160 }
17161
17162 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
17163         void* this_arg_ptr = untag_ptr(this_arg);
17164         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17165         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17166         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
17167 }
17168
17169 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
17170         void* this_arg_ptr = untag_ptr(this_arg);
17171         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17172         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17173         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
17174         return ret_conv;
17175 }
17176
17177 typedef struct LDKSignBolt12InvoiceFn_JCalls {
17178         atomic_size_t refcnt;
17179         uint32_t instance_ptr;
17180 } LDKSignBolt12InvoiceFn_JCalls;
17181 static void LDKSignBolt12InvoiceFn_JCalls_free(void* this_arg) {
17182         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
17183         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17184                 FREE(j_calls);
17185         }
17186 }
17187 LDKCResult_SchnorrSignatureNoneZ sign_invoice_LDKSignBolt12InvoiceFn_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * message) {
17188         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
17189         LDKUnsignedBolt12Invoice message_var = *message;
17190         uint64_t message_ref = 0;
17191         message_var = UnsignedBolt12Invoice_clone(&message_var);
17192         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
17193         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
17194         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 152, message_ref, 0, 0, 0, 0, 0);
17195         void* ret_ptr = untag_ptr(ret);
17196         CHECK_ACCESS(ret_ptr);
17197         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
17198         FREE(untag_ptr(ret));
17199         return ret_conv;
17200 }
17201 static void LDKSignBolt12InvoiceFn_JCalls_cloned(LDKSignBolt12InvoiceFn* new_obj) {
17202         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) new_obj->this_arg;
17203         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17204 }
17205 static inline LDKSignBolt12InvoiceFn LDKSignBolt12InvoiceFn_init (JSValue o) {
17206         LDKSignBolt12InvoiceFn_JCalls *calls = MALLOC(sizeof(LDKSignBolt12InvoiceFn_JCalls), "LDKSignBolt12InvoiceFn_JCalls");
17207         atomic_init(&calls->refcnt, 1);
17208         calls->instance_ptr = o;
17209
17210         LDKSignBolt12InvoiceFn ret = {
17211                 .this_arg = (void*) calls,
17212                 .sign_invoice = sign_invoice_LDKSignBolt12InvoiceFn_jcall,
17213                 .free = LDKSignBolt12InvoiceFn_JCalls_free,
17214         };
17215         return ret;
17216 }
17217 uint64_t  __attribute__((export_name("TS_LDKSignBolt12InvoiceFn_new"))) TS_LDKSignBolt12InvoiceFn_new(JSValue o) {
17218         LDKSignBolt12InvoiceFn *res_ptr = MALLOC(sizeof(LDKSignBolt12InvoiceFn), "LDKSignBolt12InvoiceFn");
17219         *res_ptr = LDKSignBolt12InvoiceFn_init(o);
17220         return tag_ptr(res_ptr, true);
17221 }
17222 uint64_t  __attribute__((export_name("TS_SignBolt12InvoiceFn_sign_invoice"))) TS_SignBolt12InvoiceFn_sign_invoice(uint64_t this_arg, uint64_t message) {
17223         void* this_arg_ptr = untag_ptr(this_arg);
17224         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17225         LDKSignBolt12InvoiceFn* this_arg_conv = (LDKSignBolt12InvoiceFn*)this_arg_ptr;
17226         LDKUnsignedBolt12Invoice message_conv;
17227         message_conv.inner = untag_ptr(message);
17228         message_conv.is_owned = ptr_is_owned(message);
17229         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
17230         message_conv.is_owned = false;
17231         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17232         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, &message_conv);
17233         return tag_ptr(ret_conv, true);
17234 }
17235
17236 typedef struct LDKSignInvoiceRequestFn_JCalls {
17237         atomic_size_t refcnt;
17238         uint32_t instance_ptr;
17239 } LDKSignInvoiceRequestFn_JCalls;
17240 static void LDKSignInvoiceRequestFn_JCalls_free(void* this_arg) {
17241         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
17242         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17243                 FREE(j_calls);
17244         }
17245 }
17246 LDKCResult_SchnorrSignatureNoneZ sign_invoice_request_LDKSignInvoiceRequestFn_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * message) {
17247         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
17248         LDKUnsignedInvoiceRequest message_var = *message;
17249         uint64_t message_ref = 0;
17250         message_var = UnsignedInvoiceRequest_clone(&message_var);
17251         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
17252         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
17253         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 153, message_ref, 0, 0, 0, 0, 0);
17254         void* ret_ptr = untag_ptr(ret);
17255         CHECK_ACCESS(ret_ptr);
17256         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
17257         FREE(untag_ptr(ret));
17258         return ret_conv;
17259 }
17260 static void LDKSignInvoiceRequestFn_JCalls_cloned(LDKSignInvoiceRequestFn* new_obj) {
17261         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) new_obj->this_arg;
17262         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17263 }
17264 static inline LDKSignInvoiceRequestFn LDKSignInvoiceRequestFn_init (JSValue o) {
17265         LDKSignInvoiceRequestFn_JCalls *calls = MALLOC(sizeof(LDKSignInvoiceRequestFn_JCalls), "LDKSignInvoiceRequestFn_JCalls");
17266         atomic_init(&calls->refcnt, 1);
17267         calls->instance_ptr = o;
17268
17269         LDKSignInvoiceRequestFn ret = {
17270                 .this_arg = (void*) calls,
17271                 .sign_invoice_request = sign_invoice_request_LDKSignInvoiceRequestFn_jcall,
17272                 .free = LDKSignInvoiceRequestFn_JCalls_free,
17273         };
17274         return ret;
17275 }
17276 uint64_t  __attribute__((export_name("TS_LDKSignInvoiceRequestFn_new"))) TS_LDKSignInvoiceRequestFn_new(JSValue o) {
17277         LDKSignInvoiceRequestFn *res_ptr = MALLOC(sizeof(LDKSignInvoiceRequestFn), "LDKSignInvoiceRequestFn");
17278         *res_ptr = LDKSignInvoiceRequestFn_init(o);
17279         return tag_ptr(res_ptr, true);
17280 }
17281 uint64_t  __attribute__((export_name("TS_SignInvoiceRequestFn_sign_invoice_request"))) TS_SignInvoiceRequestFn_sign_invoice_request(uint64_t this_arg, uint64_t message) {
17282         void* this_arg_ptr = untag_ptr(this_arg);
17283         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17284         LDKSignInvoiceRequestFn* this_arg_conv = (LDKSignInvoiceRequestFn*)this_arg_ptr;
17285         LDKUnsignedInvoiceRequest message_conv;
17286         message_conv.inner = untag_ptr(message);
17287         message_conv.is_owned = ptr_is_owned(message);
17288         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
17289         message_conv.is_owned = false;
17290         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17291         *ret_conv = (this_arg_conv->sign_invoice_request)(this_arg_conv->this_arg, &message_conv);
17292         return tag_ptr(ret_conv, true);
17293 }
17294
17295 uint32_t __attribute__((export_name("TS_LDKSignError_ty_from_ptr"))) TS_LDKSignError_ty_from_ptr(uint64_t ptr) {
17296         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
17297         switch(obj->tag) {
17298                 case LDKSignError_Signing: return 0;
17299                 case LDKSignError_Verification: return 1;
17300                 default: abort();
17301         }
17302 }
17303 uint32_t __attribute__((export_name("TS_LDKSignError_Verification_get_verification"))) TS_LDKSignError_Verification_get_verification(uint64_t ptr) {
17304         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
17305         assert(obj->tag == LDKSignError_Verification);
17306         uint32_t verification_conv = LDKSecp256k1Error_to_js(obj->verification);
17307         return verification_conv;
17308 }
17309 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
17310         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17311         switch(obj->tag) {
17312                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
17313                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
17314                 case LDKEffectiveCapacity_Total: return 2;
17315                 case LDKEffectiveCapacity_Infinite: return 3;
17316                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
17317                 case LDKEffectiveCapacity_Unknown: return 5;
17318                 default: abort();
17319         }
17320 }
17321 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
17322         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17323         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
17324         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
17325         return liquidity_msat_conv;
17326 }
17327 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(uint64_t ptr) {
17328         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17329         assert(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
17330         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
17331         return amount_msat_conv;
17332 }
17333 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
17334         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17335         assert(obj->tag == LDKEffectiveCapacity_Total);
17336         int64_t capacity_msat_conv = obj->total.capacity_msat;
17337         return capacity_msat_conv;
17338 }
17339 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
17340         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17341         assert(obj->tag == LDKEffectiveCapacity_Total);
17342         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
17343         return htlc_maximum_msat_conv;
17344 }
17345 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(uint64_t ptr) {
17346         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17347         assert(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
17348         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
17349         return amount_msat_conv;
17350 }
17351 uint32_t __attribute__((export_name("TS_LDKPayee_ty_from_ptr"))) TS_LDKPayee_ty_from_ptr(uint64_t ptr) {
17352         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17353         switch(obj->tag) {
17354                 case LDKPayee_Blinded: return 0;
17355                 case LDKPayee_Clear: return 1;
17356                 default: abort();
17357         }
17358 }
17359 uint64_tArray __attribute__((export_name("TS_LDKPayee_Blinded_get_route_hints"))) TS_LDKPayee_Blinded_get_route_hints(uint64_t ptr) {
17360         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17361         assert(obj->tag == LDKPayee_Blinded);
17362         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
17363                         uint64_tArray route_hints_arr = NULL;
17364                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
17365                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
17366                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
17367                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17368                                 *route_hints_conv_37_conv = route_hints_var.data[l];
17369                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
17370                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
17371                         }
17372                         
17373         return route_hints_arr;
17374 }
17375 uint64_t __attribute__((export_name("TS_LDKPayee_Blinded_get_features"))) TS_LDKPayee_Blinded_get_features(uint64_t ptr) {
17376         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17377         assert(obj->tag == LDKPayee_Blinded);
17378         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
17379                         uint64_t features_ref = 0;
17380                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
17381                         features_ref = tag_ptr(features_var.inner, false);
17382         return features_ref;
17383 }
17384 int8_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_node_id"))) TS_LDKPayee_Clear_get_node_id(uint64_t ptr) {
17385         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17386         assert(obj->tag == LDKPayee_Clear);
17387         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
17388         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
17389         return node_id_arr;
17390 }
17391 uint64_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_route_hints"))) TS_LDKPayee_Clear_get_route_hints(uint64_t ptr) {
17392         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17393         assert(obj->tag == LDKPayee_Clear);
17394         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
17395                         uint64_tArray route_hints_arr = NULL;
17396                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
17397                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
17398                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
17399                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
17400                                 uint64_t route_hints_conv_11_ref = 0;
17401                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
17402                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
17403                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
17404                         }
17405                         
17406         return route_hints_arr;
17407 }
17408 uint64_t __attribute__((export_name("TS_LDKPayee_Clear_get_features"))) TS_LDKPayee_Clear_get_features(uint64_t ptr) {
17409         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17410         assert(obj->tag == LDKPayee_Clear);
17411         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
17412                         uint64_t features_ref = 0;
17413                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
17414                         features_ref = tag_ptr(features_var.inner, false);
17415         return features_ref;
17416 }
17417 int32_t __attribute__((export_name("TS_LDKPayee_Clear_get_final_cltv_expiry_delta"))) TS_LDKPayee_Clear_get_final_cltv_expiry_delta(uint64_t ptr) {
17418         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17419         assert(obj->tag == LDKPayee_Clear);
17420         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
17421         return final_cltv_expiry_delta_conv;
17422 }
17423 typedef struct LDKScore_JCalls {
17424         atomic_size_t refcnt;
17425         uint32_t instance_ptr;
17426         LDKScoreLookUp_JCalls* ScoreLookUp;
17427         LDKScoreUpdate_JCalls* ScoreUpdate;
17428 } LDKScore_JCalls;
17429 static void LDKScore_JCalls_free(void* this_arg) {
17430         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
17431         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17432                 FREE(j_calls);
17433         }
17434 }
17435 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
17436         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
17437         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 154, 0, 0, 0, 0, 0, 0);
17438         LDKCVec_u8Z ret_ref;
17439         ret_ref.datalen = ret->arr_len;
17440         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
17441         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
17442         return ret_ref;
17443 }
17444 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
17445         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
17446         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17447         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
17448         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
17449 }
17450 static inline LDKScore LDKScore_init (JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
17451         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
17452         atomic_init(&calls->refcnt, 1);
17453         calls->instance_ptr = o;
17454
17455         LDKScore ret = {
17456                 .this_arg = (void*) calls,
17457                 .write = write_LDKScore_jcall,
17458                 .free = LDKScore_JCalls_free,
17459                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
17460                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
17461         };
17462         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
17463         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
17464         return ret;
17465 }
17466 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
17467         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
17468         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
17469         return tag_ptr(res_ptr, true);
17470 }
17471 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
17472         void* this_arg_ptr = untag_ptr(this_arg);
17473         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17474         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
17475         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
17476         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
17477         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17478         CVec_u8Z_free(ret_var);
17479         return ret_arr;
17480 }
17481
17482 uint32_t __attribute__((export_name("TS_LDKIntroductionNode_ty_from_ptr"))) TS_LDKIntroductionNode_ty_from_ptr(uint64_t ptr) {
17483         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17484         switch(obj->tag) {
17485                 case LDKIntroductionNode_NodeId: return 0;
17486                 case LDKIntroductionNode_DirectedShortChannelId: return 1;
17487                 default: abort();
17488         }
17489 }
17490 int8_tArray __attribute__((export_name("TS_LDKIntroductionNode_NodeId_get_node_id"))) TS_LDKIntroductionNode_NodeId_get_node_id(uint64_t ptr) {
17491         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17492         assert(obj->tag == LDKIntroductionNode_NodeId);
17493         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
17494         memcpy(node_id_arr->elems, obj->node_id.compressed_form, 33);
17495         return node_id_arr;
17496 }
17497 uint32_t __attribute__((export_name("TS_LDKIntroductionNode_DirectedShortChannelId_get__0"))) TS_LDKIntroductionNode_DirectedShortChannelId_get__0(uint64_t ptr) {
17498         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17499         assert(obj->tag == LDKIntroductionNode_DirectedShortChannelId);
17500         uint32_t _0_conv = LDKDirection_to_js(obj->directed_short_channel_id._0);
17501         return _0_conv;
17502 }
17503 int64_t __attribute__((export_name("TS_LDKIntroductionNode_DirectedShortChannelId_get__1"))) TS_LDKIntroductionNode_DirectedShortChannelId_get__1(uint64_t ptr) {
17504         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17505         assert(obj->tag == LDKIntroductionNode_DirectedShortChannelId);
17506         int64_t _1_conv = obj->directed_short_channel_id._1;
17507         return _1_conv;
17508 }
17509 typedef struct LDKCoinSelectionSource_JCalls {
17510         atomic_size_t refcnt;
17511         uint32_t instance_ptr;
17512 } LDKCoinSelectionSource_JCalls;
17513 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
17514         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17515         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17516                 FREE(j_calls);
17517         }
17518 }
17519 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) {
17520         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17521         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
17522         memcpy(claim_id_arr->elems, claim_id.data, 32);
17523         LDKCVec_InputZ must_spend_var = must_spend;
17524         uint64_tArray must_spend_arr = NULL;
17525         must_spend_arr = init_uint64_tArray(must_spend_var.datalen, __LINE__);
17526         uint64_t *must_spend_arr_ptr = (uint64_t*)(((uint8_t*)must_spend_arr) + 8);
17527         for (size_t h = 0; h < must_spend_var.datalen; h++) {
17528                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
17529                 uint64_t must_spend_conv_7_ref = 0;
17530                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
17531                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
17532                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
17533         }
17534         
17535         FREE(must_spend_var.data);
17536         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
17537         uint64_tArray must_pay_to_arr = NULL;
17538         must_pay_to_arr = init_uint64_tArray(must_pay_to_var.datalen, __LINE__);
17539         uint64_t *must_pay_to_arr_ptr = (uint64_t*)(((uint8_t*)must_pay_to_arr) + 8);
17540         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
17541                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
17542                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
17543                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
17544         }
17545         
17546         FREE(must_pay_to_var.data);
17547         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
17548         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);
17549         void* ret_ptr = untag_ptr(ret);
17550         CHECK_ACCESS(ret_ptr);
17551         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
17552         FREE(untag_ptr(ret));
17553         return ret_conv;
17554 }
17555 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
17556         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17557         LDKCVec_u8Z psbt_var = psbt;
17558         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
17559         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
17560         CVec_u8Z_free(psbt_var);
17561         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 156, (uint32_t)psbt_arr, 0, 0, 0, 0, 0);
17562         void* ret_ptr = untag_ptr(ret);
17563         CHECK_ACCESS(ret_ptr);
17564         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
17565         FREE(untag_ptr(ret));
17566         return ret_conv;
17567 }
17568 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
17569         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
17570         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17571 }
17572 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JSValue o) {
17573         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
17574         atomic_init(&calls->refcnt, 1);
17575         calls->instance_ptr = o;
17576
17577         LDKCoinSelectionSource ret = {
17578                 .this_arg = (void*) calls,
17579                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
17580                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
17581                 .free = LDKCoinSelectionSource_JCalls_free,
17582         };
17583         return ret;
17584 }
17585 uint64_t  __attribute__((export_name("TS_LDKCoinSelectionSource_new"))) TS_LDKCoinSelectionSource_new(JSValue o) {
17586         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
17587         *res_ptr = LDKCoinSelectionSource_init(o);
17588         return tag_ptr(res_ptr, true);
17589 }
17590 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) {
17591         void* this_arg_ptr = untag_ptr(this_arg);
17592         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17593         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
17594         LDKThirtyTwoBytes claim_id_ref;
17595         CHECK(claim_id->arr_len == 32);
17596         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
17597         LDKCVec_InputZ must_spend_constr;
17598         must_spend_constr.datalen = must_spend->arr_len;
17599         if (must_spend_constr.datalen > 0)
17600                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
17601         else
17602                 must_spend_constr.data = NULL;
17603         uint64_t* must_spend_vals = must_spend->elems;
17604         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
17605                 uint64_t must_spend_conv_7 = must_spend_vals[h];
17606                 LDKInput must_spend_conv_7_conv;
17607                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
17608                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
17609                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
17610                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
17611                 must_spend_constr.data[h] = must_spend_conv_7_conv;
17612         }
17613         FREE(must_spend);
17614         LDKCVec_TxOutZ must_pay_to_constr;
17615         must_pay_to_constr.datalen = must_pay_to->arr_len;
17616         if (must_pay_to_constr.datalen > 0)
17617                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17618         else
17619                 must_pay_to_constr.data = NULL;
17620         uint64_t* must_pay_to_vals = must_pay_to->elems;
17621         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
17622                 uint64_t must_pay_to_conv_7 = must_pay_to_vals[h];
17623                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
17624                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
17625                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
17626                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
17627                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
17628         }
17629         FREE(must_pay_to);
17630         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
17631         *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);
17632         return tag_ptr(ret_conv, true);
17633 }
17634
17635 uint64_t  __attribute__((export_name("TS_CoinSelectionSource_sign_psbt"))) TS_CoinSelectionSource_sign_psbt(uint64_t this_arg, int8_tArray psbt) {
17636         void* this_arg_ptr = untag_ptr(this_arg);
17637         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17638         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
17639         LDKCVec_u8Z psbt_ref;
17640         psbt_ref.datalen = psbt->arr_len;
17641         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
17642         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
17643         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17644         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
17645         return tag_ptr(ret_conv, true);
17646 }
17647
17648 typedef struct LDKWalletSource_JCalls {
17649         atomic_size_t refcnt;
17650         uint32_t instance_ptr;
17651 } LDKWalletSource_JCalls;
17652 static void LDKWalletSource_JCalls_free(void* this_arg) {
17653         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17654         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17655                 FREE(j_calls);
17656         }
17657 }
17658 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
17659         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17660         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 157, 0, 0, 0, 0, 0, 0);
17661         void* ret_ptr = untag_ptr(ret);
17662         CHECK_ACCESS(ret_ptr);
17663         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
17664         FREE(untag_ptr(ret));
17665         return ret_conv;
17666 }
17667 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
17668         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17669         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 158, 0, 0, 0, 0, 0, 0);
17670         void* ret_ptr = untag_ptr(ret);
17671         CHECK_ACCESS(ret_ptr);
17672         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
17673         FREE(untag_ptr(ret));
17674         return ret_conv;
17675 }
17676 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
17677         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17678         LDKCVec_u8Z psbt_var = psbt;
17679         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
17680         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
17681         CVec_u8Z_free(psbt_var);
17682         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 159, (uint32_t)psbt_arr, 0, 0, 0, 0, 0);
17683         void* ret_ptr = untag_ptr(ret);
17684         CHECK_ACCESS(ret_ptr);
17685         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
17686         FREE(untag_ptr(ret));
17687         return ret_conv;
17688 }
17689 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
17690         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
17691         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17692 }
17693 static inline LDKWalletSource LDKWalletSource_init (JSValue o) {
17694         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
17695         atomic_init(&calls->refcnt, 1);
17696         calls->instance_ptr = o;
17697
17698         LDKWalletSource ret = {
17699                 .this_arg = (void*) calls,
17700                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
17701                 .get_change_script = get_change_script_LDKWalletSource_jcall,
17702                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
17703                 .free = LDKWalletSource_JCalls_free,
17704         };
17705         return ret;
17706 }
17707 uint64_t  __attribute__((export_name("TS_LDKWalletSource_new"))) TS_LDKWalletSource_new(JSValue o) {
17708         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
17709         *res_ptr = LDKWalletSource_init(o);
17710         return tag_ptr(res_ptr, true);
17711 }
17712 uint64_t  __attribute__((export_name("TS_WalletSource_list_confirmed_utxos"))) TS_WalletSource_list_confirmed_utxos(uint64_t this_arg) {
17713         void* this_arg_ptr = untag_ptr(this_arg);
17714         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17715         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
17716         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
17717         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
17718         return tag_ptr(ret_conv, true);
17719 }
17720
17721 uint64_t  __attribute__((export_name("TS_WalletSource_get_change_script"))) TS_WalletSource_get_change_script(uint64_t this_arg) {
17722         void* this_arg_ptr = untag_ptr(this_arg);
17723         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17724         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
17725         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17726         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
17727         return tag_ptr(ret_conv, true);
17728 }
17729
17730 uint64_t  __attribute__((export_name("TS_WalletSource_sign_psbt"))) TS_WalletSource_sign_psbt(uint64_t this_arg, int8_tArray psbt) {
17731         void* this_arg_ptr = untag_ptr(this_arg);
17732         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17733         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
17734         LDKCVec_u8Z psbt_ref;
17735         psbt_ref.datalen = psbt->arr_len;
17736         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
17737         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
17738         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17739         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
17740         return tag_ptr(ret_conv, true);
17741 }
17742
17743 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
17744         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
17745         switch(obj->tag) {
17746                 case LDKGossipSync_P2P: return 0;
17747                 case LDKGossipSync_Rapid: return 1;
17748                 case LDKGossipSync_None: return 2;
17749                 default: abort();
17750         }
17751 }
17752 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
17753         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
17754         assert(obj->tag == LDKGossipSync_P2P);
17755         LDKP2PGossipSync p2p_var = obj->p2p;
17756                         uint64_t p2p_ref = 0;
17757                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
17758                         p2p_ref = tag_ptr(p2p_var.inner, false);
17759         return p2p_ref;
17760 }
17761 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
17762         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
17763         assert(obj->tag == LDKGossipSync_Rapid);
17764         LDKRapidGossipSync rapid_var = obj->rapid;
17765                         uint64_t rapid_ref = 0;
17766                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
17767                         rapid_ref = tag_ptr(rapid_var.inner, false);
17768         return rapid_ref;
17769 }
17770 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
17771         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17772         switch(obj->tag) {
17773                 case LDKFallback_SegWitProgram: return 0;
17774                 case LDKFallback_PubKeyHash: return 1;
17775                 case LDKFallback_ScriptHash: return 2;
17776                 default: abort();
17777         }
17778 }
17779 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
17780         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17781         assert(obj->tag == LDKFallback_SegWitProgram);
17782         uint8_t version_val = obj->seg_wit_program.version._0;
17783         return version_val;
17784 }
17785 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
17786         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17787         assert(obj->tag == LDKFallback_SegWitProgram);
17788         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
17789                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
17790                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
17791         return program_arr;
17792 }
17793 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
17794         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17795         assert(obj->tag == LDKFallback_PubKeyHash);
17796         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
17797         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
17798         return pub_key_hash_arr;
17799 }
17800 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
17801         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17802         assert(obj->tag == LDKFallback_ScriptHash);
17803         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
17804         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
17805         return script_hash_arr;
17806 }
17807 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
17808         LDKStr ret_str = _ldk_get_compiled_version();
17809         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17810         Str_free(ret_str);
17811         return ret_conv;
17812 }
17813
17814 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
17815         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
17816         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17817         Str_free(ret_str);
17818         return ret_conv;
17819 }
17820
17821 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
17822         LDKU128 val_ref;
17823         CHECK(val->arr_len == 16);
17824         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
17825         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
17826         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
17827         return ret_arr;
17828 }
17829
17830 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
17831         LDKSixteenBytes le_bytes_ref;
17832         CHECK(le_bytes->arr_len == 16);
17833         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
17834         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
17835         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
17836         return ret_arr;
17837 }
17838
17839 uint64_t  __attribute__((export_name("TS_WitnessProgram_new"))) TS_WitnessProgram_new(int8_t version, int8_tArray program) {
17840         
17841         LDKCVec_u8Z program_ref;
17842         program_ref.datalen = program->arr_len;
17843         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
17844         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
17845         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
17846         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
17847         return tag_ptr(ret_ref, true);
17848 }
17849
17850 int8_t  __attribute__((export_name("TS_WitnessProgram_get_version"))) TS_WitnessProgram_get_version(uint64_t prog) {
17851         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
17852         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
17853         return ret_val;
17854 }
17855
17856 int8_tArray  __attribute__((export_name("TS_WitnessProgram_get_program"))) TS_WitnessProgram_get_program(uint64_t prog) {
17857         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
17858         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
17859         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
17860         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17861         return ret_arr;
17862 }
17863
17864 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
17865         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
17866         *ret_ref = WitnessProgram_clone(arg);
17867         return tag_ptr(ret_ref, true);
17868 }
17869 int64_t  __attribute__((export_name("TS_WitnessProgram_clone_ptr"))) TS_WitnessProgram_clone_ptr(uint64_t arg) {
17870         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
17871         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
17872         return ret_conv;
17873 }
17874
17875 uint64_t  __attribute__((export_name("TS_WitnessProgram_clone"))) TS_WitnessProgram_clone(uint64_t orig) {
17876         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
17877         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
17878         *ret_ref = WitnessProgram_clone(orig_conv);
17879         return tag_ptr(ret_ref, true);
17880 }
17881
17882 void  __attribute__((export_name("TS_WitnessProgram_free"))) TS_WitnessProgram_free(uint64_t o) {
17883         if (!ptr_is_owned(o)) return;
17884         void* o_ptr = untag_ptr(o);
17885         CHECK_ACCESS(o_ptr);
17886         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
17887         FREE(untag_ptr(o));
17888         WitnessProgram_free(o_conv);
17889 }
17890
17891 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
17892         LDKThirtyTwoBytes big_endian_bytes_ref;
17893         CHECK(big_endian_bytes->arr_len == 32);
17894         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
17895         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
17896         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
17897         return tag_ptr(ret_ref, true);
17898 }
17899
17900 static inline uint64_t BigEndianScalar_clone_ptr(LDKBigEndianScalar *NONNULL_PTR arg) {
17901         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
17902         *ret_ref = BigEndianScalar_clone(arg);
17903         return tag_ptr(ret_ref, true);
17904 }
17905 int64_t  __attribute__((export_name("TS_BigEndianScalar_clone_ptr"))) TS_BigEndianScalar_clone_ptr(uint64_t arg) {
17906         LDKBigEndianScalar* arg_conv = (LDKBigEndianScalar*)untag_ptr(arg);
17907         int64_t ret_conv = BigEndianScalar_clone_ptr(arg_conv);
17908         return ret_conv;
17909 }
17910
17911 uint64_t  __attribute__((export_name("TS_BigEndianScalar_clone"))) TS_BigEndianScalar_clone(uint64_t orig) {
17912         LDKBigEndianScalar* orig_conv = (LDKBigEndianScalar*)untag_ptr(orig);
17913         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
17914         *ret_ref = BigEndianScalar_clone(orig_conv);
17915         return tag_ptr(ret_ref, true);
17916 }
17917
17918 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
17919         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
17920         *ret_copy = Bech32Error_clone(arg);
17921         uint64_t ret_ref = tag_ptr(ret_copy, true);
17922         return ret_ref;
17923 }
17924 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
17925         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
17926         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
17927         return ret_conv;
17928 }
17929
17930 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
17931         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
17932         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
17933         *ret_copy = Bech32Error_clone(orig_conv);
17934         uint64_t ret_ref = tag_ptr(ret_copy, true);
17935         return ret_ref;
17936 }
17937
17938 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
17939         if (!ptr_is_owned(o)) return;
17940         void* o_ptr = untag_ptr(o);
17941         CHECK_ACCESS(o_ptr);
17942         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
17943         FREE(untag_ptr(o));
17944         Bech32Error_free(o_conv);
17945 }
17946
17947 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
17948         LDKTransaction _res_ref;
17949         _res_ref.datalen = _res->arr_len;
17950         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
17951         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
17952         _res_ref.data_is_owned = true;
17953         Transaction_free(_res_ref);
17954 }
17955
17956 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
17957         LDKWitness _res_ref;
17958         _res_ref.datalen = _res->arr_len;
17959         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
17960         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
17961         _res_ref.data_is_owned = true;
17962         Witness_free(_res_ref);
17963 }
17964
17965 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) {
17966         LDKWitness witness_ref;
17967         witness_ref.datalen = witness->arr_len;
17968         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
17969         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
17970         witness_ref.data_is_owned = true;
17971         LDKCVec_u8Z script_sig_ref;
17972         script_sig_ref.datalen = script_sig->arr_len;
17973         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
17974         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
17975         LDKThirtyTwoBytes previous_txid_ref;
17976         CHECK(previous_txid->arr_len == 32);
17977         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
17978         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
17979         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
17980         return tag_ptr(ret_ref, true);
17981 }
17982
17983 int8_tArray  __attribute__((export_name("TS_TxIn_get_witness"))) TS_TxIn_get_witness(uint64_t txin) {
17984         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
17985         LDKWitness ret_var = TxIn_get_witness(txin_conv);
17986         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
17987         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17988         Witness_free(ret_var);
17989         return ret_arr;
17990 }
17991
17992 int8_tArray  __attribute__((export_name("TS_TxIn_get_script_sig"))) TS_TxIn_get_script_sig(uint64_t txin) {
17993         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
17994         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
17995         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
17996         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17997         return ret_arr;
17998 }
17999
18000 int32_t  __attribute__((export_name("TS_TxIn_get_sequence"))) TS_TxIn_get_sequence(uint64_t txin) {
18001         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18002         int32_t ret_conv = TxIn_get_sequence(txin_conv);
18003         return ret_conv;
18004 }
18005
18006 int8_tArray  __attribute__((export_name("TS_TxIn_get_previous_txid"))) TS_TxIn_get_previous_txid(uint64_t txin) {
18007         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18008         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
18009         memcpy(ret_arr->elems, TxIn_get_previous_txid(txin_conv).data, 32);
18010         return ret_arr;
18011 }
18012
18013 int32_t  __attribute__((export_name("TS_TxIn_get_previous_vout"))) TS_TxIn_get_previous_vout(uint64_t txin) {
18014         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18015         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
18016         return ret_conv;
18017 }
18018
18019 void  __attribute__((export_name("TS_TxIn_free"))) TS_TxIn_free(uint64_t _res) {
18020         if (!ptr_is_owned(_res)) return;
18021         void* _res_ptr = untag_ptr(_res);
18022         CHECK_ACCESS(_res_ptr);
18023         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
18024         FREE(untag_ptr(_res));
18025         TxIn_free(_res_conv);
18026 }
18027
18028 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
18029         LDKCVec_u8Z script_pubkey_ref;
18030         script_pubkey_ref.datalen = script_pubkey->arr_len;
18031         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
18032         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
18033         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18034         *ret_ref = TxOut_new(script_pubkey_ref, value);
18035         return tag_ptr(ret_ref, true);
18036 }
18037
18038 int8_tArray  __attribute__((export_name("TS_TxOut_get_script_pubkey"))) TS_TxOut_get_script_pubkey(uint64_t txout) {
18039         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
18040         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
18041         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18042         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18043         return ret_arr;
18044 }
18045
18046 int64_t  __attribute__((export_name("TS_TxOut_get_value"))) TS_TxOut_get_value(uint64_t txout) {
18047         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
18048         int64_t ret_conv = TxOut_get_value(txout_conv);
18049         return ret_conv;
18050 }
18051
18052 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
18053         if (!ptr_is_owned(_res)) return;
18054         void* _res_ptr = untag_ptr(_res);
18055         CHECK_ACCESS(_res_ptr);
18056         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
18057         FREE(untag_ptr(_res));
18058         TxOut_free(_res_conv);
18059 }
18060
18061 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
18062         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18063         *ret_ref = TxOut_clone(arg);
18064         return tag_ptr(ret_ref, true);
18065 }
18066 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
18067         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
18068         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
18069         return ret_conv;
18070 }
18071
18072 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
18073         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
18074         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18075         *ret_ref = TxOut_clone(orig_conv);
18076         return tag_ptr(ret_ref, true);
18077 }
18078
18079 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
18080         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
18081         Str_free(dummy);
18082 }
18083
18084 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
18085         LDKCVec_u8Z _res_ref;
18086         _res_ref.datalen = _res->arr_len;
18087         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
18088         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
18089         CVec_u8Z_free(_res_ref);
18090 }
18091
18092 uint64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
18093         LDKRefundMaybeWithDerivedMetadataBuilder o_conv;
18094         o_conv.inner = untag_ptr(o);
18095         o_conv.is_owned = ptr_is_owned(o);
18096         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18097         o_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&o_conv);
18098         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18099         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
18100         return tag_ptr(ret_conv, true);
18101 }
18102
18103 uint64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(uint32_t e) {
18104         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
18105         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18106         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
18107         return tag_ptr(ret_conv, true);
18108 }
18109
18110 jboolean  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
18111         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
18112         jboolean ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
18113         return ret_conv;
18114 }
18115
18116 void  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
18117         if (!ptr_is_owned(_res)) return;
18118         void* _res_ptr = untag_ptr(_res);
18119         CHECK_ACCESS(_res_ptr);
18120         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
18121         FREE(untag_ptr(_res));
18122         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
18123 }
18124
18125 static inline uint64_t CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
18126         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18127         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
18128         return tag_ptr(ret_conv, true);
18129 }
18130 int64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
18131         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
18132         int64_t ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
18133         return ret_conv;
18134 }
18135
18136 uint64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(uint64_t orig) {
18137         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
18138         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18139         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
18140         return tag_ptr(ret_conv, true);
18141 }
18142
18143 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_ok"))) TS_CResult_RefundBolt12SemanticErrorZ_ok(uint64_t o) {
18144         LDKRefund o_conv;
18145         o_conv.inner = untag_ptr(o);
18146         o_conv.is_owned = ptr_is_owned(o);
18147         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18148         o_conv = Refund_clone(&o_conv);
18149         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18150         *ret_conv = CResult_RefundBolt12SemanticErrorZ_ok(o_conv);
18151         return tag_ptr(ret_conv, true);
18152 }
18153
18154 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_err"))) TS_CResult_RefundBolt12SemanticErrorZ_err(uint32_t e) {
18155         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
18156         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18157         *ret_conv = CResult_RefundBolt12SemanticErrorZ_err(e_conv);
18158         return tag_ptr(ret_conv, true);
18159 }
18160
18161 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_is_ok"))) TS_CResult_RefundBolt12SemanticErrorZ_is_ok(uint64_t o) {
18162         LDKCResult_RefundBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(o);
18163         jboolean ret_conv = CResult_RefundBolt12SemanticErrorZ_is_ok(o_conv);
18164         return ret_conv;
18165 }
18166
18167 void  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_free"))) TS_CResult_RefundBolt12SemanticErrorZ_free(uint64_t _res) {
18168         if (!ptr_is_owned(_res)) return;
18169         void* _res_ptr = untag_ptr(_res);
18170         CHECK_ACCESS(_res_ptr);
18171         LDKCResult_RefundBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundBolt12SemanticErrorZ*)(_res_ptr);
18172         FREE(untag_ptr(_res));
18173         CResult_RefundBolt12SemanticErrorZ_free(_res_conv);
18174 }
18175
18176 static inline uint64_t CResult_RefundBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR arg) {
18177         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18178         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(arg);
18179         return tag_ptr(ret_conv, true);
18180 }
18181 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_RefundBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
18182         LDKCResult_RefundBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(arg);
18183         int64_t ret_conv = CResult_RefundBolt12SemanticErrorZ_clone_ptr(arg_conv);
18184         return ret_conv;
18185 }
18186
18187 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_clone"))) TS_CResult_RefundBolt12SemanticErrorZ_clone(uint64_t orig) {
18188         LDKCResult_RefundBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(orig);
18189         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18190         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(orig_conv);
18191         return tag_ptr(ret_conv, true);
18192 }
18193
18194 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
18195         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18196         *ret_copy = COption_u64Z_some(o);
18197         uint64_t ret_ref = tag_ptr(ret_copy, true);
18198         return ret_ref;
18199 }
18200
18201 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
18202         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18203         *ret_copy = COption_u64Z_none();
18204         uint64_t ret_ref = tag_ptr(ret_copy, true);
18205         return ret_ref;
18206 }
18207
18208 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
18209         if (!ptr_is_owned(_res)) return;
18210         void* _res_ptr = untag_ptr(_res);
18211         CHECK_ACCESS(_res_ptr);
18212         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
18213         FREE(untag_ptr(_res));
18214         COption_u64Z_free(_res_conv);
18215 }
18216
18217 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
18218         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18219         *ret_copy = COption_u64Z_clone(arg);
18220         uint64_t ret_ref = tag_ptr(ret_copy, true);
18221         return ret_ref;
18222 }
18223 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
18224         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
18225         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
18226         return ret_conv;
18227 }
18228
18229 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
18230         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
18231         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18232         *ret_copy = COption_u64Z_clone(orig_conv);
18233         uint64_t ret_ref = tag_ptr(ret_copy, true);
18234         return ret_ref;
18235 }
18236
18237 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
18238         LDKCVec_BlindedPathZ _res_constr;
18239         _res_constr.datalen = _res->arr_len;
18240         if (_res_constr.datalen > 0)
18241                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
18242         else
18243                 _res_constr.data = NULL;
18244         uint64_t* _res_vals = _res->elems;
18245         for (size_t n = 0; n < _res_constr.datalen; n++) {
18246                 uint64_t _res_conv_13 = _res_vals[n];
18247                 LDKBlindedPath _res_conv_13_conv;
18248                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
18249                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
18250                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
18251                 _res_constr.data[n] = _res_conv_13_conv;
18252         }
18253         FREE(_res);
18254         CVec_BlindedPathZ_free(_res_constr);
18255 }
18256
18257 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_ok"))) TS_CResult_RefundBolt12ParseErrorZ_ok(uint64_t o) {
18258         LDKRefund o_conv;
18259         o_conv.inner = untag_ptr(o);
18260         o_conv.is_owned = ptr_is_owned(o);
18261         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18262         o_conv = Refund_clone(&o_conv);
18263         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18264         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
18265         return tag_ptr(ret_conv, true);
18266 }
18267
18268 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_err"))) TS_CResult_RefundBolt12ParseErrorZ_err(uint64_t e) {
18269         LDKBolt12ParseError e_conv;
18270         e_conv.inner = untag_ptr(e);
18271         e_conv.is_owned = ptr_is_owned(e);
18272         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18273         e_conv = Bolt12ParseError_clone(&e_conv);
18274         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18275         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
18276         return tag_ptr(ret_conv, true);
18277 }
18278
18279 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_is_ok"))) TS_CResult_RefundBolt12ParseErrorZ_is_ok(uint64_t o) {
18280         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
18281         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
18282         return ret_conv;
18283 }
18284
18285 void  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_free"))) TS_CResult_RefundBolt12ParseErrorZ_free(uint64_t _res) {
18286         if (!ptr_is_owned(_res)) return;
18287         void* _res_ptr = untag_ptr(_res);
18288         CHECK_ACCESS(_res_ptr);
18289         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
18290         FREE(untag_ptr(_res));
18291         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
18292 }
18293
18294 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
18295         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18296         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
18297         return tag_ptr(ret_conv, true);
18298 }
18299 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone_ptr"))) TS_CResult_RefundBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
18300         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
18301         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
18302         return ret_conv;
18303 }
18304
18305 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone"))) TS_CResult_RefundBolt12ParseErrorZ_clone(uint64_t orig) {
18306         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
18307         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18308         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
18309         return tag_ptr(ret_conv, true);
18310 }
18311
18312 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_ok"))) TS_CResult_RetryDecodeErrorZ_ok(uint64_t o) {
18313         void* o_ptr = untag_ptr(o);
18314         CHECK_ACCESS(o_ptr);
18315         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
18316         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
18317         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18318         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
18319         return tag_ptr(ret_conv, true);
18320 }
18321
18322 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_err"))) TS_CResult_RetryDecodeErrorZ_err(uint64_t e) {
18323         void* e_ptr = untag_ptr(e);
18324         CHECK_ACCESS(e_ptr);
18325         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18326         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18327         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18328         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
18329         return tag_ptr(ret_conv, true);
18330 }
18331
18332 jboolean  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_is_ok"))) TS_CResult_RetryDecodeErrorZ_is_ok(uint64_t o) {
18333         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
18334         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
18335         return ret_conv;
18336 }
18337
18338 void  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_free"))) TS_CResult_RetryDecodeErrorZ_free(uint64_t _res) {
18339         if (!ptr_is_owned(_res)) return;
18340         void* _res_ptr = untag_ptr(_res);
18341         CHECK_ACCESS(_res_ptr);
18342         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
18343         FREE(untag_ptr(_res));
18344         CResult_RetryDecodeErrorZ_free(_res_conv);
18345 }
18346
18347 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
18348         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18349         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
18350         return tag_ptr(ret_conv, true);
18351 }
18352 int64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone_ptr"))) TS_CResult_RetryDecodeErrorZ_clone_ptr(uint64_t arg) {
18353         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
18354         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
18355         return ret_conv;
18356 }
18357
18358 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone"))) TS_CResult_RetryDecodeErrorZ_clone(uint64_t orig) {
18359         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
18360         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18361         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
18362         return tag_ptr(ret_conv, true);
18363 }
18364
18365 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
18366         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18367         *ret_conv = CResult_NoneAPIErrorZ_ok();
18368         return tag_ptr(ret_conv, true);
18369 }
18370
18371 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
18372         void* e_ptr = untag_ptr(e);
18373         CHECK_ACCESS(e_ptr);
18374         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18375         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18376         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18377         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
18378         return tag_ptr(ret_conv, true);
18379 }
18380
18381 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
18382         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
18383         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
18384         return ret_conv;
18385 }
18386
18387 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
18388         if (!ptr_is_owned(_res)) return;
18389         void* _res_ptr = untag_ptr(_res);
18390         CHECK_ACCESS(_res_ptr);
18391         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
18392         FREE(untag_ptr(_res));
18393         CResult_NoneAPIErrorZ_free(_res_conv);
18394 }
18395
18396 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
18397         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18398         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
18399         return tag_ptr(ret_conv, true);
18400 }
18401 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
18402         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
18403         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
18404         return ret_conv;
18405 }
18406
18407 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
18408         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
18409         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18410         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
18411         return tag_ptr(ret_conv, true);
18412 }
18413
18414 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
18415         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
18416         _res_constr.datalen = _res->arr_len;
18417         if (_res_constr.datalen > 0)
18418                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18419         else
18420                 _res_constr.data = NULL;
18421         uint64_t* _res_vals = _res->elems;
18422         for (size_t w = 0; w < _res_constr.datalen; w++) {
18423                 uint64_t _res_conv_22 = _res_vals[w];
18424                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
18425                 CHECK_ACCESS(_res_conv_22_ptr);
18426                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
18427                 FREE(untag_ptr(_res_conv_22));
18428                 _res_constr.data[w] = _res_conv_22_conv;
18429         }
18430         FREE(_res);
18431         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
18432 }
18433
18434 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
18435         LDKCVec_APIErrorZ _res_constr;
18436         _res_constr.datalen = _res->arr_len;
18437         if (_res_constr.datalen > 0)
18438                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18439         else
18440                 _res_constr.data = NULL;
18441         uint64_t* _res_vals = _res->elems;
18442         for (size_t k = 0; k < _res_constr.datalen; k++) {
18443                 uint64_t _res_conv_10 = _res_vals[k];
18444                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
18445                 CHECK_ACCESS(_res_conv_10_ptr);
18446                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
18447                 FREE(untag_ptr(_res_conv_10));
18448                 _res_constr.data[k] = _res_conv_10_conv;
18449         }
18450         FREE(_res);
18451         CVec_APIErrorZ_free(_res_constr);
18452 }
18453
18454 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_some"))) TS_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
18455         LDKThirtyTwoBytes o_ref;
18456         CHECK(o->arr_len == 32);
18457         memcpy(o_ref.data, o->elems, 32); FREE(o);
18458         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18459         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
18460         uint64_t ret_ref = tag_ptr(ret_copy, true);
18461         return ret_ref;
18462 }
18463
18464 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_none"))) TS_COption_ThirtyTwoBytesZ_none() {
18465         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18466         *ret_copy = COption_ThirtyTwoBytesZ_none();
18467         uint64_t ret_ref = tag_ptr(ret_copy, true);
18468         return ret_ref;
18469 }
18470
18471 void  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_free"))) TS_COption_ThirtyTwoBytesZ_free(uint64_t _res) {
18472         if (!ptr_is_owned(_res)) return;
18473         void* _res_ptr = untag_ptr(_res);
18474         CHECK_ACCESS(_res_ptr);
18475         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
18476         FREE(untag_ptr(_res));
18477         COption_ThirtyTwoBytesZ_free(_res_conv);
18478 }
18479
18480 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
18481         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18482         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
18483         uint64_t ret_ref = tag_ptr(ret_copy, true);
18484         return ret_ref;
18485 }
18486 int64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone_ptr"))) TS_COption_ThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
18487         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
18488         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
18489         return ret_conv;
18490 }
18491
18492 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone"))) TS_COption_ThirtyTwoBytesZ_clone(uint64_t orig) {
18493         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
18494         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18495         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
18496         uint64_t ret_ref = tag_ptr(ret_copy, true);
18497         return ret_ref;
18498 }
18499
18500 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
18501         LDKCVec_u8Z o_ref;
18502         o_ref.datalen = o->arr_len;
18503         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18504         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18505         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18506         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
18507         uint64_t ret_ref = tag_ptr(ret_copy, true);
18508         return ret_ref;
18509 }
18510
18511 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
18512         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18513         *ret_copy = COption_CVec_u8ZZ_none();
18514         uint64_t ret_ref = tag_ptr(ret_copy, true);
18515         return ret_ref;
18516 }
18517
18518 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
18519         if (!ptr_is_owned(_res)) return;
18520         void* _res_ptr = untag_ptr(_res);
18521         CHECK_ACCESS(_res_ptr);
18522         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
18523         FREE(untag_ptr(_res));
18524         COption_CVec_u8ZZ_free(_res_conv);
18525 }
18526
18527 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
18528         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18529         *ret_copy = COption_CVec_u8ZZ_clone(arg);
18530         uint64_t ret_ref = tag_ptr(ret_copy, true);
18531         return ret_ref;
18532 }
18533 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
18534         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
18535         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
18536         return ret_conv;
18537 }
18538
18539 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
18540         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
18541         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18542         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
18543         uint64_t ret_ref = tag_ptr(ret_copy, true);
18544         return ret_ref;
18545 }
18546
18547 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
18548         LDKRecipientOnionFields o_conv;
18549         o_conv.inner = untag_ptr(o);
18550         o_conv.is_owned = ptr_is_owned(o);
18551         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18552         o_conv = RecipientOnionFields_clone(&o_conv);
18553         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18554         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
18555         return tag_ptr(ret_conv, true);
18556 }
18557
18558 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
18559         void* e_ptr = untag_ptr(e);
18560         CHECK_ACCESS(e_ptr);
18561         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18562         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18563         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18564         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
18565         return tag_ptr(ret_conv, true);
18566 }
18567
18568 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
18569         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
18570         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
18571         return ret_conv;
18572 }
18573
18574 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
18575         if (!ptr_is_owned(_res)) return;
18576         void* _res_ptr = untag_ptr(_res);
18577         CHECK_ACCESS(_res_ptr);
18578         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
18579         FREE(untag_ptr(_res));
18580         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
18581 }
18582
18583 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
18584         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18585         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
18586         return tag_ptr(ret_conv, true);
18587 }
18588 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
18589         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
18590         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
18591         return ret_conv;
18592 }
18593
18594 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
18595         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
18596         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18597         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
18598         return tag_ptr(ret_conv, true);
18599 }
18600
18601 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
18602         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
18603         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
18604         return tag_ptr(ret_conv, true);
18605 }
18606 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u64CVec_u8ZZ_clone_ptr(uint64_t arg) {
18607         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
18608         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
18609         return ret_conv;
18610 }
18611
18612 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone"))) TS_C2Tuple_u64CVec_u8ZZ_clone(uint64_t orig) {
18613         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
18614         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
18615         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
18616         return tag_ptr(ret_conv, true);
18617 }
18618
18619 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_new"))) TS_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
18620         LDKCVec_u8Z b_ref;
18621         b_ref.datalen = b->arr_len;
18622         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18623         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18624         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
18625         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
18626         return tag_ptr(ret_conv, true);
18627 }
18628
18629 void  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_free"))) TS_C2Tuple_u64CVec_u8ZZ_free(uint64_t _res) {
18630         if (!ptr_is_owned(_res)) return;
18631         void* _res_ptr = untag_ptr(_res);
18632         CHECK_ACCESS(_res_ptr);
18633         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
18634         FREE(untag_ptr(_res));
18635         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
18636 }
18637
18638 void  __attribute__((export_name("TS_CVec_C2Tuple_u64CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u64CVec_u8ZZZ_free(uint64_tArray _res) {
18639         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
18640         _res_constr.datalen = _res->arr_len;
18641         if (_res_constr.datalen > 0)
18642                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
18643         else
18644                 _res_constr.data = NULL;
18645         uint64_t* _res_vals = _res->elems;
18646         for (size_t x = 0; x < _res_constr.datalen; x++) {
18647                 uint64_t _res_conv_23 = _res_vals[x];
18648                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
18649                 CHECK_ACCESS(_res_conv_23_ptr);
18650                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
18651                 FREE(untag_ptr(_res_conv_23));
18652                 _res_constr.data[x] = _res_conv_23_conv;
18653         }
18654         FREE(_res);
18655         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
18656 }
18657
18658 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_ok(uint64_t o) {
18659         LDKRecipientOnionFields o_conv;
18660         o_conv.inner = untag_ptr(o);
18661         o_conv.is_owned = ptr_is_owned(o);
18662         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18663         o_conv = RecipientOnionFields_clone(&o_conv);
18664         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18665         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
18666         return tag_ptr(ret_conv, true);
18667 }
18668
18669 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_err"))) TS_CResult_RecipientOnionFieldsNoneZ_err() {
18670         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18671         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
18672         return tag_ptr(ret_conv, true);
18673 }
18674
18675 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_is_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_is_ok(uint64_t o) {
18676         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
18677         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
18678         return ret_conv;
18679 }
18680
18681 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_free"))) TS_CResult_RecipientOnionFieldsNoneZ_free(uint64_t _res) {
18682         if (!ptr_is_owned(_res)) return;
18683         void* _res_ptr = untag_ptr(_res);
18684         CHECK_ACCESS(_res_ptr);
18685         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
18686         FREE(untag_ptr(_res));
18687         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
18688 }
18689
18690 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
18691         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18692         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
18693         return tag_ptr(ret_conv, true);
18694 }
18695 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr(uint64_t arg) {
18696         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
18697         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
18698         return ret_conv;
18699 }
18700
18701 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone"))) TS_CResult_RecipientOnionFieldsNoneZ_clone(uint64_t orig) {
18702         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
18703         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18704         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
18705         return tag_ptr(ret_conv, true);
18706 }
18707
18708 uint64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(uint64_t o) {
18709         LDKUnsignedBolt12Invoice o_conv;
18710         o_conv.inner = untag_ptr(o);
18711         o_conv.is_owned = ptr_is_owned(o);
18712         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18713         o_conv = UnsignedBolt12Invoice_clone(&o_conv);
18714         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18715         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
18716         return tag_ptr(ret_conv, true);
18717 }
18718
18719 uint64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(uint32_t e) {
18720         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
18721         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18722         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
18723         return tag_ptr(ret_conv, true);
18724 }
18725
18726 jboolean  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(uint64_t o) {
18727         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
18728         jboolean ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
18729         return ret_conv;
18730 }
18731
18732 void  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(uint64_t _res) {
18733         if (!ptr_is_owned(_res)) return;
18734         void* _res_ptr = untag_ptr(_res);
18735         CHECK_ACCESS(_res_ptr);
18736         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
18737         FREE(untag_ptr(_res));
18738         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
18739 }
18740
18741 static inline uint64_t CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
18742         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18743         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(arg);
18744         return tag_ptr(ret_conv, true);
18745 }
18746 int64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
18747         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
18748         int64_t ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
18749         return ret_conv;
18750 }
18751
18752 uint64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(uint64_t orig) {
18753         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
18754         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18755         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
18756         return tag_ptr(ret_conv, true);
18757 }
18758
18759 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(uint64_t o) {
18760         LDKBolt12Invoice o_conv;
18761         o_conv.inner = untag_ptr(o);
18762         o_conv.is_owned = ptr_is_owned(o);
18763         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18764         o_conv = Bolt12Invoice_clone(&o_conv);
18765         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
18766         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
18767         return tag_ptr(ret_conv, true);
18768 }
18769
18770 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_err"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(uint32_t e) {
18771         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
18772         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
18773         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
18774         return tag_ptr(ret_conv, true);
18775 }
18776
18777 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(uint64_t o) {
18778         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
18779         jboolean ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
18780         return ret_conv;
18781 }
18782
18783 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_free"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(uint64_t _res) {
18784         if (!ptr_is_owned(_res)) return;
18785         void* _res_ptr = untag_ptr(_res);
18786         CHECK_ACCESS(_res_ptr);
18787         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
18788         FREE(untag_ptr(_res));
18789         CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
18790 }
18791
18792 static inline uint64_t CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
18793         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
18794         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(arg);
18795         return tag_ptr(ret_conv, true);
18796 }
18797 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
18798         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
18799         int64_t ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
18800         return ret_conv;
18801 }
18802
18803 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(uint64_t orig) {
18804         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
18805         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
18806         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
18807         return tag_ptr(ret_conv, true);
18808 }
18809
18810 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_ok"))) TS_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
18811         LDKSchnorrSignature o_ref;
18812         CHECK(o->arr_len == 64);
18813         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
18814         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18815         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
18816         return tag_ptr(ret_conv, true);
18817 }
18818
18819 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_err"))) TS_CResult_SchnorrSignatureNoneZ_err() {
18820         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18821         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
18822         return tag_ptr(ret_conv, true);
18823 }
18824
18825 jboolean  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_is_ok"))) TS_CResult_SchnorrSignatureNoneZ_is_ok(uint64_t o) {
18826         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
18827         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
18828         return ret_conv;
18829 }
18830
18831 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_free"))) TS_CResult_SchnorrSignatureNoneZ_free(uint64_t _res) {
18832         if (!ptr_is_owned(_res)) return;
18833         void* _res_ptr = untag_ptr(_res);
18834         CHECK_ACCESS(_res_ptr);
18835         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
18836         FREE(untag_ptr(_res));
18837         CResult_SchnorrSignatureNoneZ_free(_res_conv);
18838 }
18839
18840 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
18841         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18842         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
18843         return tag_ptr(ret_conv, true);
18844 }
18845 int64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone_ptr"))) TS_CResult_SchnorrSignatureNoneZ_clone_ptr(uint64_t arg) {
18846         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
18847         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
18848         return ret_conv;
18849 }
18850
18851 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone"))) TS_CResult_SchnorrSignatureNoneZ_clone(uint64_t orig) {
18852         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
18853         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18854         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
18855         return tag_ptr(ret_conv, true);
18856 }
18857
18858 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
18859         LDKCVec_ThirtyTwoBytesZ _res_constr;
18860         _res_constr.datalen = _res->arr_len;
18861         if (_res_constr.datalen > 0)
18862                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
18863         else
18864                 _res_constr.data = NULL;
18865         int8_tArray* _res_vals = (void*) _res->elems;
18866         for (size_t m = 0; m < _res_constr.datalen; m++) {
18867                 int8_tArray _res_conv_12 = _res_vals[m];
18868                 LDKThirtyTwoBytes _res_conv_12_ref;
18869                 CHECK(_res_conv_12->arr_len == 32);
18870                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
18871                 _res_constr.data[m] = _res_conv_12_ref;
18872         }
18873         FREE(_res);
18874         CVec_ThirtyTwoBytesZ_free(_res_constr);
18875 }
18876
18877 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_some"))) TS_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
18878         LDKCVec_ThirtyTwoBytesZ o_constr;
18879         o_constr.datalen = o->arr_len;
18880         if (o_constr.datalen > 0)
18881                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
18882         else
18883                 o_constr.data = NULL;
18884         int8_tArray* o_vals = (void*) o->elems;
18885         for (size_t m = 0; m < o_constr.datalen; m++) {
18886                 int8_tArray o_conv_12 = o_vals[m];
18887                 LDKThirtyTwoBytes o_conv_12_ref;
18888                 CHECK(o_conv_12->arr_len == 32);
18889                 memcpy(o_conv_12_ref.data, o_conv_12->elems, 32); FREE(o_conv_12);
18890                 o_constr.data[m] = o_conv_12_ref;
18891         }
18892         FREE(o);
18893         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
18894         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
18895         uint64_t ret_ref = tag_ptr(ret_copy, true);
18896         return ret_ref;
18897 }
18898
18899 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_none"))) TS_COption_CVec_ThirtyTwoBytesZZ_none() {
18900         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
18901         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
18902         uint64_t ret_ref = tag_ptr(ret_copy, true);
18903         return ret_ref;
18904 }
18905
18906 void  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_free"))) TS_COption_CVec_ThirtyTwoBytesZZ_free(uint64_t _res) {
18907         if (!ptr_is_owned(_res)) return;
18908         void* _res_ptr = untag_ptr(_res);
18909         CHECK_ACCESS(_res_ptr);
18910         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
18911         FREE(untag_ptr(_res));
18912         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
18913 }
18914
18915 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
18916         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
18917         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
18918         uint64_t ret_ref = tag_ptr(ret_copy, true);
18919         return ret_ref;
18920 }
18921 int64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
18922         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
18923         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
18924         return ret_conv;
18925 }
18926
18927 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone(uint64_t orig) {
18928         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
18929         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
18930         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
18931         uint64_t ret_ref = tag_ptr(ret_copy, true);
18932         return ret_ref;
18933 }
18934
18935 uint64_t  __attribute__((export_name("TS_COption_AmountZ_some"))) TS_COption_AmountZ_some(uint64_t o) {
18936         void* o_ptr = untag_ptr(o);
18937         CHECK_ACCESS(o_ptr);
18938         LDKAmount o_conv = *(LDKAmount*)(o_ptr);
18939         o_conv = Amount_clone((LDKAmount*)untag_ptr(o));
18940         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
18941         *ret_copy = COption_AmountZ_some(o_conv);
18942         uint64_t ret_ref = tag_ptr(ret_copy, true);
18943         return ret_ref;
18944 }
18945
18946 uint64_t  __attribute__((export_name("TS_COption_AmountZ_none"))) TS_COption_AmountZ_none() {
18947         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
18948         *ret_copy = COption_AmountZ_none();
18949         uint64_t ret_ref = tag_ptr(ret_copy, true);
18950         return ret_ref;
18951 }
18952
18953 void  __attribute__((export_name("TS_COption_AmountZ_free"))) TS_COption_AmountZ_free(uint64_t _res) {
18954         if (!ptr_is_owned(_res)) return;
18955         void* _res_ptr = untag_ptr(_res);
18956         CHECK_ACCESS(_res_ptr);
18957         LDKCOption_AmountZ _res_conv = *(LDKCOption_AmountZ*)(_res_ptr);
18958         FREE(untag_ptr(_res));
18959         COption_AmountZ_free(_res_conv);
18960 }
18961
18962 static inline uint64_t COption_AmountZ_clone_ptr(LDKCOption_AmountZ *NONNULL_PTR arg) {
18963         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
18964         *ret_copy = COption_AmountZ_clone(arg);
18965         uint64_t ret_ref = tag_ptr(ret_copy, true);
18966         return ret_ref;
18967 }
18968 int64_t  __attribute__((export_name("TS_COption_AmountZ_clone_ptr"))) TS_COption_AmountZ_clone_ptr(uint64_t arg) {
18969         LDKCOption_AmountZ* arg_conv = (LDKCOption_AmountZ*)untag_ptr(arg);
18970         int64_t ret_conv = COption_AmountZ_clone_ptr(arg_conv);
18971         return ret_conv;
18972 }
18973
18974 uint64_t  __attribute__((export_name("TS_COption_AmountZ_clone"))) TS_COption_AmountZ_clone(uint64_t orig) {
18975         LDKCOption_AmountZ* orig_conv = (LDKCOption_AmountZ*)untag_ptr(orig);
18976         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
18977         *ret_copy = COption_AmountZ_clone(orig_conv);
18978         uint64_t ret_ref = tag_ptr(ret_copy, true);
18979         return ret_ref;
18980 }
18981
18982 uint64_t  __attribute__((export_name("TS_COption_QuantityZ_some"))) TS_COption_QuantityZ_some(uint64_t o) {
18983         void* o_ptr = untag_ptr(o);
18984         CHECK_ACCESS(o_ptr);
18985         LDKQuantity o_conv = *(LDKQuantity*)(o_ptr);
18986         o_conv = Quantity_clone((LDKQuantity*)untag_ptr(o));
18987         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
18988         *ret_copy = COption_QuantityZ_some(o_conv);
18989         uint64_t ret_ref = tag_ptr(ret_copy, true);
18990         return ret_ref;
18991 }
18992
18993 uint64_t  __attribute__((export_name("TS_COption_QuantityZ_none"))) TS_COption_QuantityZ_none() {
18994         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
18995         *ret_copy = COption_QuantityZ_none();
18996         uint64_t ret_ref = tag_ptr(ret_copy, true);
18997         return ret_ref;
18998 }
18999
19000 void  __attribute__((export_name("TS_COption_QuantityZ_free"))) TS_COption_QuantityZ_free(uint64_t _res) {
19001         if (!ptr_is_owned(_res)) return;
19002         void* _res_ptr = untag_ptr(_res);
19003         CHECK_ACCESS(_res_ptr);
19004         LDKCOption_QuantityZ _res_conv = *(LDKCOption_QuantityZ*)(_res_ptr);
19005         FREE(untag_ptr(_res));
19006         COption_QuantityZ_free(_res_conv);
19007 }
19008
19009 static inline uint64_t COption_QuantityZ_clone_ptr(LDKCOption_QuantityZ *NONNULL_PTR arg) {
19010         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19011         *ret_copy = COption_QuantityZ_clone(arg);
19012         uint64_t ret_ref = tag_ptr(ret_copy, true);
19013         return ret_ref;
19014 }
19015 int64_t  __attribute__((export_name("TS_COption_QuantityZ_clone_ptr"))) TS_COption_QuantityZ_clone_ptr(uint64_t arg) {
19016         LDKCOption_QuantityZ* arg_conv = (LDKCOption_QuantityZ*)untag_ptr(arg);
19017         int64_t ret_conv = COption_QuantityZ_clone_ptr(arg_conv);
19018         return ret_conv;
19019 }
19020
19021 uint64_t  __attribute__((export_name("TS_COption_QuantityZ_clone"))) TS_COption_QuantityZ_clone(uint64_t orig) {
19022         LDKCOption_QuantityZ* orig_conv = (LDKCOption_QuantityZ*)untag_ptr(orig);
19023         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19024         *ret_copy = COption_QuantityZ_clone(orig_conv);
19025         uint64_t ret_ref = tag_ptr(ret_copy, true);
19026         return ret_ref;
19027 }
19028
19029 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
19030         LDKThirtyTwoBytes o_ref;
19031         CHECK(o->arr_len == 32);
19032         memcpy(o_ref.data, o->elems, 32); FREE(o);
19033         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19034         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
19035         return tag_ptr(ret_conv, true);
19036 }
19037
19038 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_err"))) TS_CResult_ThirtyTwoBytesNoneZ_err() {
19039         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19040         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
19041         return tag_ptr(ret_conv, true);
19042 }
19043
19044 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_is_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_is_ok(uint64_t o) {
19045         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
19046         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
19047         return ret_conv;
19048 }
19049
19050 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_free"))) TS_CResult_ThirtyTwoBytesNoneZ_free(uint64_t _res) {
19051         if (!ptr_is_owned(_res)) return;
19052         void* _res_ptr = untag_ptr(_res);
19053         CHECK_ACCESS(_res_ptr);
19054         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
19055         FREE(untag_ptr(_res));
19056         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
19057 }
19058
19059 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
19060         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19061         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
19062         return tag_ptr(ret_conv, true);
19063 }
19064 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr(uint64_t arg) {
19065         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
19066         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
19067         return ret_conv;
19068 }
19069
19070 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone"))) TS_CResult_ThirtyTwoBytesNoneZ_clone(uint64_t orig) {
19071         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
19072         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19073         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
19074         return tag_ptr(ret_conv, true);
19075 }
19076
19077 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
19078         LDKBlindedPayInfo o_conv;
19079         o_conv.inner = untag_ptr(o);
19080         o_conv.is_owned = ptr_is_owned(o);
19081         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19082         o_conv = BlindedPayInfo_clone(&o_conv);
19083         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19084         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
19085         return tag_ptr(ret_conv, true);
19086 }
19087
19088 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
19089         void* e_ptr = untag_ptr(e);
19090         CHECK_ACCESS(e_ptr);
19091         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19092         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19093         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19094         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
19095         return tag_ptr(ret_conv, true);
19096 }
19097
19098 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
19099         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
19100         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
19101         return ret_conv;
19102 }
19103
19104 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
19105         if (!ptr_is_owned(_res)) return;
19106         void* _res_ptr = untag_ptr(_res);
19107         CHECK_ACCESS(_res_ptr);
19108         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
19109         FREE(untag_ptr(_res));
19110         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
19111 }
19112
19113 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
19114         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19115         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
19116         return tag_ptr(ret_conv, true);
19117 }
19118 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19119         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
19120         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
19121         return ret_conv;
19122 }
19123
19124 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
19125         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
19126         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19127         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
19128         return tag_ptr(ret_conv, true);
19129 }
19130
19131 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
19132         LDKDelayedPaymentOutputDescriptor o_conv;
19133         o_conv.inner = untag_ptr(o);
19134         o_conv.is_owned = ptr_is_owned(o);
19135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19136         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
19137         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19138         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19139         return tag_ptr(ret_conv, true);
19140 }
19141
19142 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
19143         void* e_ptr = untag_ptr(e);
19144         CHECK_ACCESS(e_ptr);
19145         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19146         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19147         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19148         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19149         return tag_ptr(ret_conv, true);
19150 }
19151
19152 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19153         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19154         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19155         return ret_conv;
19156 }
19157
19158 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
19159         if (!ptr_is_owned(_res)) return;
19160         void* _res_ptr = untag_ptr(_res);
19161         CHECK_ACCESS(_res_ptr);
19162         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19163         FREE(untag_ptr(_res));
19164         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19165 }
19166
19167 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19168         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19169         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19170         return tag_ptr(ret_conv, true);
19171 }
19172 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19173         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19174         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19175         return ret_conv;
19176 }
19177
19178 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
19179         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19180         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19181         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19182         return tag_ptr(ret_conv, true);
19183 }
19184
19185 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
19186         LDKStaticPaymentOutputDescriptor o_conv;
19187         o_conv.inner = untag_ptr(o);
19188         o_conv.is_owned = ptr_is_owned(o);
19189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19190         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
19191         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19192         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19193         return tag_ptr(ret_conv, true);
19194 }
19195
19196 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
19197         void* e_ptr = untag_ptr(e);
19198         CHECK_ACCESS(e_ptr);
19199         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19200         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19201         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19202         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19203         return tag_ptr(ret_conv, true);
19204 }
19205
19206 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19207         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19208         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19209         return ret_conv;
19210 }
19211
19212 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
19213         if (!ptr_is_owned(_res)) return;
19214         void* _res_ptr = untag_ptr(_res);
19215         CHECK_ACCESS(_res_ptr);
19216         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19217         FREE(untag_ptr(_res));
19218         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19219 }
19220
19221 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19222         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19223         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19224         return tag_ptr(ret_conv, true);
19225 }
19226 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19227         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19228         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19229         return ret_conv;
19230 }
19231
19232 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
19233         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19234         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19235         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19236         return tag_ptr(ret_conv, true);
19237 }
19238
19239 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
19240         void* o_ptr = untag_ptr(o);
19241         CHECK_ACCESS(o_ptr);
19242         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
19243         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
19244         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19245         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
19246         return tag_ptr(ret_conv, true);
19247 }
19248
19249 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
19250         void* e_ptr = untag_ptr(e);
19251         CHECK_ACCESS(e_ptr);
19252         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19253         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19254         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19255         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
19256         return tag_ptr(ret_conv, true);
19257 }
19258
19259 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19260         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19261         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19262         return ret_conv;
19263 }
19264
19265 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
19266         if (!ptr_is_owned(_res)) return;
19267         void* _res_ptr = untag_ptr(_res);
19268         CHECK_ACCESS(_res_ptr);
19269         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
19270         FREE(untag_ptr(_res));
19271         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
19272 }
19273
19274 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19275         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19276         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
19277         return tag_ptr(ret_conv, true);
19278 }
19279 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19280         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19281         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19282         return ret_conv;
19283 }
19284
19285 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
19286         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19287         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19288         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
19289         return tag_ptr(ret_conv, true);
19290 }
19291
19292 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
19293         LDKCVec_SpendableOutputDescriptorZ _res_constr;
19294         _res_constr.datalen = _res->arr_len;
19295         if (_res_constr.datalen > 0)
19296                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
19297         else
19298                 _res_constr.data = NULL;
19299         uint64_t* _res_vals = _res->elems;
19300         for (size_t b = 0; b < _res_constr.datalen; b++) {
19301                 uint64_t _res_conv_27 = _res_vals[b];
19302                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
19303                 CHECK_ACCESS(_res_conv_27_ptr);
19304                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
19305                 FREE(untag_ptr(_res_conv_27));
19306                 _res_constr.data[b] = _res_conv_27_conv;
19307         }
19308         FREE(_res);
19309         CVec_SpendableOutputDescriptorZ_free(_res_constr);
19310 }
19311
19312 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
19313         LDKCVec_TxOutZ _res_constr;
19314         _res_constr.datalen = _res->arr_len;
19315         if (_res_constr.datalen > 0)
19316                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19317         else
19318                 _res_constr.data = NULL;
19319         uint64_t* _res_vals = _res->elems;
19320         for (size_t h = 0; h < _res_constr.datalen; h++) {
19321                 uint64_t _res_conv_7 = _res_vals[h];
19322                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
19323                 CHECK_ACCESS(_res_conv_7_ptr);
19324                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
19325                 FREE(untag_ptr(_res_conv_7));
19326                 _res_constr.data[h] = _res_conv_7_conv;
19327         }
19328         FREE(_res);
19329         CVec_TxOutZ_free(_res_constr);
19330 }
19331
19332 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
19333         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19334         *ret_copy = COption_u32Z_some(o);
19335         uint64_t ret_ref = tag_ptr(ret_copy, true);
19336         return ret_ref;
19337 }
19338
19339 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
19340         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19341         *ret_copy = COption_u32Z_none();
19342         uint64_t ret_ref = tag_ptr(ret_copy, true);
19343         return ret_ref;
19344 }
19345
19346 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
19347         if (!ptr_is_owned(_res)) return;
19348         void* _res_ptr = untag_ptr(_res);
19349         CHECK_ACCESS(_res_ptr);
19350         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
19351         FREE(untag_ptr(_res));
19352         COption_u32Z_free(_res_conv);
19353 }
19354
19355 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
19356         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19357         *ret_copy = COption_u32Z_clone(arg);
19358         uint64_t ret_ref = tag_ptr(ret_copy, true);
19359         return ret_ref;
19360 }
19361 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
19362         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
19363         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
19364         return ret_conv;
19365 }
19366
19367 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
19368         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
19369         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19370         *ret_copy = COption_u32Z_clone(orig_conv);
19371         uint64_t ret_ref = tag_ptr(ret_copy, true);
19372         return ret_ref;
19373 }
19374
19375 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
19376         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19377         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
19378         return tag_ptr(ret_conv, true);
19379 }
19380 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_clone_ptr"))) TS_C2Tuple_CVec_u8Zu64Z_clone_ptr(uint64_t arg) {
19381         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
19382         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
19383         return ret_conv;
19384 }
19385
19386 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_clone"))) TS_C2Tuple_CVec_u8Zu64Z_clone(uint64_t orig) {
19387         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
19388         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19389         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
19390         return tag_ptr(ret_conv, true);
19391 }
19392
19393 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_new"))) TS_C2Tuple_CVec_u8Zu64Z_new(int8_tArray a, int64_t b) {
19394         LDKCVec_u8Z a_ref;
19395         a_ref.datalen = a->arr_len;
19396         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
19397         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
19398         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19399         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
19400         return tag_ptr(ret_conv, true);
19401 }
19402
19403 void  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_free"))) TS_C2Tuple_CVec_u8Zu64Z_free(uint64_t _res) {
19404         if (!ptr_is_owned(_res)) return;
19405         void* _res_ptr = untag_ptr(_res);
19406         CHECK_ACCESS(_res_ptr);
19407         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
19408         FREE(untag_ptr(_res));
19409         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
19410 }
19411
19412 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(uint64_t o) {
19413         void* o_ptr = untag_ptr(o);
19414         CHECK_ACCESS(o_ptr);
19415         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
19416         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
19417         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19418         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
19419         return tag_ptr(ret_conv, true);
19420 }
19421
19422 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() {
19423         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19424         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
19425         return tag_ptr(ret_conv, true);
19426 }
19427
19428 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(uint64_t o) {
19429         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
19430         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
19431         return ret_conv;
19432 }
19433
19434 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(uint64_t _res) {
19435         if (!ptr_is_owned(_res)) return;
19436         void* _res_ptr = untag_ptr(_res);
19437         CHECK_ACCESS(_res_ptr);
19438         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
19439         FREE(untag_ptr(_res));
19440         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
19441 }
19442
19443 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
19444         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19445         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
19446         return tag_ptr(ret_conv, true);
19447 }
19448 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(uint64_t arg) {
19449         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
19450         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
19451         return ret_conv;
19452 }
19453
19454 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(uint64_t orig) {
19455         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
19456         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19457         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
19458         return tag_ptr(ret_conv, true);
19459 }
19460
19461 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok(uint64_t o) {
19462         LDKChannelDerivationParameters o_conv;
19463         o_conv.inner = untag_ptr(o);
19464         o_conv.is_owned = ptr_is_owned(o);
19465         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19466         o_conv = ChannelDerivationParameters_clone(&o_conv);
19467         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19468         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
19469         return tag_ptr(ret_conv, true);
19470 }
19471
19472 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_err(uint64_t e) {
19473         void* e_ptr = untag_ptr(e);
19474         CHECK_ACCESS(e_ptr);
19475         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19476         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19477         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19478         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
19479         return tag_ptr(ret_conv, true);
19480 }
19481
19482 jboolean  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(uint64_t o) {
19483         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
19484         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
19485         return ret_conv;
19486 }
19487
19488 void  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_free"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_free(uint64_t _res) {
19489         if (!ptr_is_owned(_res)) return;
19490         void* _res_ptr = untag_ptr(_res);
19491         CHECK_ACCESS(_res_ptr);
19492         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
19493         FREE(untag_ptr(_res));
19494         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
19495 }
19496
19497 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
19498         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19499         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
19500         return tag_ptr(ret_conv, true);
19501 }
19502 int64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
19503         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
19504         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
19505         return ret_conv;
19506 }
19507
19508 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone(uint64_t orig) {
19509         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
19510         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19511         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
19512         return tag_ptr(ret_conv, true);
19513 }
19514
19515 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_ok(uint64_t o) {
19516         LDKHTLCDescriptor o_conv;
19517         o_conv.inner = untag_ptr(o);
19518         o_conv.is_owned = ptr_is_owned(o);
19519         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19520         o_conv = HTLCDescriptor_clone(&o_conv);
19521         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19522         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
19523         return tag_ptr(ret_conv, true);
19524 }
19525
19526 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_err(uint64_t e) {
19527         void* e_ptr = untag_ptr(e);
19528         CHECK_ACCESS(e_ptr);
19529         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19530         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19531         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19532         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
19533         return tag_ptr(ret_conv, true);
19534 }
19535
19536 jboolean  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19537         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
19538         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
19539         return ret_conv;
19540 }
19541
19542 void  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_free"))) TS_CResult_HTLCDescriptorDecodeErrorZ_free(uint64_t _res) {
19543         if (!ptr_is_owned(_res)) return;
19544         void* _res_ptr = untag_ptr(_res);
19545         CHECK_ACCESS(_res_ptr);
19546         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
19547         FREE(untag_ptr(_res));
19548         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
19549 }
19550
19551 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19552         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19553         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
19554         return tag_ptr(ret_conv, true);
19555 }
19556 int64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19557         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
19558         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19559         return ret_conv;
19560 }
19561
19562 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone(uint64_t orig) {
19563         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
19564         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19565         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
19566         return tag_ptr(ret_conv, true);
19567 }
19568
19569 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
19570         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19571         *ret_conv = CResult_NoneNoneZ_ok();
19572         return tag_ptr(ret_conv, true);
19573 }
19574
19575 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
19576         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19577         *ret_conv = CResult_NoneNoneZ_err();
19578         return tag_ptr(ret_conv, true);
19579 }
19580
19581 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
19582         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
19583         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
19584         return ret_conv;
19585 }
19586
19587 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
19588         if (!ptr_is_owned(_res)) return;
19589         void* _res_ptr = untag_ptr(_res);
19590         CHECK_ACCESS(_res_ptr);
19591         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
19592         FREE(untag_ptr(_res));
19593         CResult_NoneNoneZ_free(_res_conv);
19594 }
19595
19596 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
19597         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19598         *ret_conv = CResult_NoneNoneZ_clone(arg);
19599         return tag_ptr(ret_conv, true);
19600 }
19601 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
19602         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
19603         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
19604         return ret_conv;
19605 }
19606
19607 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
19608         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
19609         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19610         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
19611         return tag_ptr(ret_conv, true);
19612 }
19613
19614 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
19615         LDKPublicKey o_ref;
19616         CHECK(o->arr_len == 33);
19617         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
19618         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19619         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
19620         return tag_ptr(ret_conv, true);
19621 }
19622
19623 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
19624         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19625         *ret_conv = CResult_PublicKeyNoneZ_err();
19626         return tag_ptr(ret_conv, true);
19627 }
19628
19629 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
19630         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
19631         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
19632         return ret_conv;
19633 }
19634
19635 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
19636         if (!ptr_is_owned(_res)) return;
19637         void* _res_ptr = untag_ptr(_res);
19638         CHECK_ACCESS(_res_ptr);
19639         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
19640         FREE(untag_ptr(_res));
19641         CResult_PublicKeyNoneZ_free(_res_conv);
19642 }
19643
19644 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
19645         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19646         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
19647         return tag_ptr(ret_conv, true);
19648 }
19649 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
19650         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
19651         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
19652         return ret_conv;
19653 }
19654
19655 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
19656         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
19657         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19658         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
19659         return tag_ptr(ret_conv, true);
19660 }
19661
19662 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_some"))) TS_COption_BigEndianScalarZ_some(uint64_t o) {
19663         void* o_ptr = untag_ptr(o);
19664         CHECK_ACCESS(o_ptr);
19665         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
19666         o_conv = BigEndianScalar_clone((LDKBigEndianScalar*)untag_ptr(o));
19667         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19668         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
19669         uint64_t ret_ref = tag_ptr(ret_copy, true);
19670         return ret_ref;
19671 }
19672
19673 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_none"))) TS_COption_BigEndianScalarZ_none() {
19674         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19675         *ret_copy = COption_BigEndianScalarZ_none();
19676         uint64_t ret_ref = tag_ptr(ret_copy, true);
19677         return ret_ref;
19678 }
19679
19680 void  __attribute__((export_name("TS_COption_BigEndianScalarZ_free"))) TS_COption_BigEndianScalarZ_free(uint64_t _res) {
19681         if (!ptr_is_owned(_res)) return;
19682         void* _res_ptr = untag_ptr(_res);
19683         CHECK_ACCESS(_res_ptr);
19684         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
19685         FREE(untag_ptr(_res));
19686         COption_BigEndianScalarZ_free(_res_conv);
19687 }
19688
19689 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
19690         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19691         *ret_copy = COption_BigEndianScalarZ_clone(arg);
19692         uint64_t ret_ref = tag_ptr(ret_copy, true);
19693         return ret_ref;
19694 }
19695 int64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone_ptr"))) TS_COption_BigEndianScalarZ_clone_ptr(uint64_t arg) {
19696         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
19697         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
19698         return ret_conv;
19699 }
19700
19701 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone"))) TS_COption_BigEndianScalarZ_clone(uint64_t orig) {
19702         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
19703         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19704         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
19705         uint64_t ret_ref = tag_ptr(ret_copy, true);
19706         return ret_ref;
19707 }
19708
19709 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
19710         LDKCVec_U5Z _res_constr;
19711         _res_constr.datalen = _res->arr_len;
19712         if (_res_constr.datalen > 0)
19713                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
19714         else
19715                 _res_constr.data = NULL;
19716         int8_t* _res_vals = (void*) _res->elems;
19717         for (size_t h = 0; h < _res_constr.datalen; h++) {
19718                 int8_t _res_conv_7 = _res_vals[h];
19719                 
19720                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
19721         }
19722         FREE(_res);
19723         CVec_U5Z_free(_res_constr);
19724 }
19725
19726 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
19727         LDKRecoverableSignature o_ref;
19728         CHECK(o->arr_len == 68);
19729         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
19730         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19731         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
19732         return tag_ptr(ret_conv, true);
19733 }
19734
19735 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
19736         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19737         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
19738         return tag_ptr(ret_conv, true);
19739 }
19740
19741 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
19742         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
19743         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
19744         return ret_conv;
19745 }
19746
19747 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
19748         if (!ptr_is_owned(_res)) return;
19749         void* _res_ptr = untag_ptr(_res);
19750         CHECK_ACCESS(_res_ptr);
19751         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
19752         FREE(untag_ptr(_res));
19753         CResult_RecoverableSignatureNoneZ_free(_res_conv);
19754 }
19755
19756 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
19757         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19758         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
19759         return tag_ptr(ret_conv, true);
19760 }
19761 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
19762         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
19763         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
19764         return ret_conv;
19765 }
19766
19767 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
19768         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
19769         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19770         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
19771         return tag_ptr(ret_conv, true);
19772 }
19773
19774 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_ok"))) TS_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
19775         LDKECDSASignature o_ref;
19776         CHECK(o->arr_len == 64);
19777         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
19778         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
19779         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
19780         return tag_ptr(ret_conv, true);
19781 }
19782
19783 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_err"))) TS_CResult_ECDSASignatureNoneZ_err() {
19784         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
19785         *ret_conv = CResult_ECDSASignatureNoneZ_err();
19786         return tag_ptr(ret_conv, true);
19787 }
19788
19789 jboolean  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_is_ok"))) TS_CResult_ECDSASignatureNoneZ_is_ok(uint64_t o) {
19790         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
19791         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
19792         return ret_conv;
19793 }
19794
19795 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_free"))) TS_CResult_ECDSASignatureNoneZ_free(uint64_t _res) {
19796         if (!ptr_is_owned(_res)) return;
19797         void* _res_ptr = untag_ptr(_res);
19798         CHECK_ACCESS(_res_ptr);
19799         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
19800         FREE(untag_ptr(_res));
19801         CResult_ECDSASignatureNoneZ_free(_res_conv);
19802 }
19803
19804 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
19805         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
19806         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
19807         return tag_ptr(ret_conv, true);
19808 }
19809 int64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone_ptr"))) TS_CResult_ECDSASignatureNoneZ_clone_ptr(uint64_t arg) {
19810         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
19811         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
19812         return ret_conv;
19813 }
19814
19815 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone"))) TS_CResult_ECDSASignatureNoneZ_clone(uint64_t orig) {
19816         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
19817         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
19818         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
19819         return tag_ptr(ret_conv, true);
19820 }
19821
19822 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
19823         LDKTransaction o_ref;
19824         o_ref.datalen = o->arr_len;
19825         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
19826         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
19827         o_ref.data_is_owned = true;
19828         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19829         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
19830         return tag_ptr(ret_conv, true);
19831 }
19832
19833 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
19834         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19835         *ret_conv = CResult_TransactionNoneZ_err();
19836         return tag_ptr(ret_conv, true);
19837 }
19838
19839 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
19840         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
19841         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
19842         return ret_conv;
19843 }
19844
19845 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
19846         if (!ptr_is_owned(_res)) return;
19847         void* _res_ptr = untag_ptr(_res);
19848         CHECK_ACCESS(_res_ptr);
19849         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
19850         FREE(untag_ptr(_res));
19851         CResult_TransactionNoneZ_free(_res_conv);
19852 }
19853
19854 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
19855         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19856         *ret_conv = CResult_TransactionNoneZ_clone(arg);
19857         return tag_ptr(ret_conv, true);
19858 }
19859 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
19860         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
19861         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
19862         return ret_conv;
19863 }
19864
19865 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
19866         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
19867         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19868         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
19869         return tag_ptr(ret_conv, true);
19870 }
19871
19872 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
19873         void* o_ptr = untag_ptr(o);
19874         CHECK_ACCESS(o_ptr);
19875         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
19876         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
19877                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19878                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
19879         }
19880         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
19881         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
19882         return tag_ptr(ret_conv, true);
19883 }
19884
19885 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
19886         void* e_ptr = untag_ptr(e);
19887         CHECK_ACCESS(e_ptr);
19888         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19889         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19890         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
19891         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
19892         return tag_ptr(ret_conv, true);
19893 }
19894
19895 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
19896         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
19897         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
19898         return ret_conv;
19899 }
19900
19901 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
19902         if (!ptr_is_owned(_res)) return;
19903         void* _res_ptr = untag_ptr(_res);
19904         CHECK_ACCESS(_res_ptr);
19905         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
19906         FREE(untag_ptr(_res));
19907         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
19908 }
19909
19910 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
19911         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
19912         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
19913         return tag_ptr(ret_conv, true);
19914 }
19915 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
19916         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
19917         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
19918         return ret_conv;
19919 }
19920
19921 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
19922         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
19923         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
19924         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
19925         return tag_ptr(ret_conv, true);
19926 }
19927
19928 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_ok"))) TS_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
19929         LDKCVec_u8Z o_ref;
19930         o_ref.datalen = o->arr_len;
19931         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
19932         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
19933         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
19934         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
19935         return tag_ptr(ret_conv, true);
19936 }
19937
19938 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_err"))) TS_CResult_CVec_u8ZNoneZ_err() {
19939         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
19940         *ret_conv = CResult_CVec_u8ZNoneZ_err();
19941         return tag_ptr(ret_conv, true);
19942 }
19943
19944 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_is_ok"))) TS_CResult_CVec_u8ZNoneZ_is_ok(uint64_t o) {
19945         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
19946         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
19947         return ret_conv;
19948 }
19949
19950 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_free"))) TS_CResult_CVec_u8ZNoneZ_free(uint64_t _res) {
19951         if (!ptr_is_owned(_res)) return;
19952         void* _res_ptr = untag_ptr(_res);
19953         CHECK_ACCESS(_res_ptr);
19954         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
19955         FREE(untag_ptr(_res));
19956         CResult_CVec_u8ZNoneZ_free(_res_conv);
19957 }
19958
19959 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
19960         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
19961         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
19962         return tag_ptr(ret_conv, true);
19963 }
19964 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone_ptr"))) TS_CResult_CVec_u8ZNoneZ_clone_ptr(uint64_t arg) {
19965         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
19966         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
19967         return ret_conv;
19968 }
19969
19970 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone"))) TS_CResult_CVec_u8ZNoneZ_clone(uint64_t orig) {
19971         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
19972         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
19973         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
19974         return tag_ptr(ret_conv, true);
19975 }
19976
19977 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_ok"))) TS_CResult_ShutdownScriptNoneZ_ok(uint64_t o) {
19978         LDKShutdownScript o_conv;
19979         o_conv.inner = untag_ptr(o);
19980         o_conv.is_owned = ptr_is_owned(o);
19981         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19982         o_conv = ShutdownScript_clone(&o_conv);
19983         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
19984         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
19985         return tag_ptr(ret_conv, true);
19986 }
19987
19988 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_err"))) TS_CResult_ShutdownScriptNoneZ_err() {
19989         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
19990         *ret_conv = CResult_ShutdownScriptNoneZ_err();
19991         return tag_ptr(ret_conv, true);
19992 }
19993
19994 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_is_ok"))) TS_CResult_ShutdownScriptNoneZ_is_ok(uint64_t o) {
19995         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
19996         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
19997         return ret_conv;
19998 }
19999
20000 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_free"))) TS_CResult_ShutdownScriptNoneZ_free(uint64_t _res) {
20001         if (!ptr_is_owned(_res)) return;
20002         void* _res_ptr = untag_ptr(_res);
20003         CHECK_ACCESS(_res_ptr);
20004         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
20005         FREE(untag_ptr(_res));
20006         CResult_ShutdownScriptNoneZ_free(_res_conv);
20007 }
20008
20009 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
20010         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20011         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
20012         return tag_ptr(ret_conv, true);
20013 }
20014 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone_ptr"))) TS_CResult_ShutdownScriptNoneZ_clone_ptr(uint64_t arg) {
20015         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
20016         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
20017         return ret_conv;
20018 }
20019
20020 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone"))) TS_CResult_ShutdownScriptNoneZ_clone(uint64_t orig) {
20021         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
20022         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20023         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
20024         return tag_ptr(ret_conv, true);
20025 }
20026
20027 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
20028         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20029         *ret_copy = COption_u16Z_some(o);
20030         uint64_t ret_ref = tag_ptr(ret_copy, true);
20031         return ret_ref;
20032 }
20033
20034 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
20035         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20036         *ret_copy = COption_u16Z_none();
20037         uint64_t ret_ref = tag_ptr(ret_copy, true);
20038         return ret_ref;
20039 }
20040
20041 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
20042         if (!ptr_is_owned(_res)) return;
20043         void* _res_ptr = untag_ptr(_res);
20044         CHECK_ACCESS(_res_ptr);
20045         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
20046         FREE(untag_ptr(_res));
20047         COption_u16Z_free(_res_conv);
20048 }
20049
20050 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
20051         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20052         *ret_copy = COption_u16Z_clone(arg);
20053         uint64_t ret_ref = tag_ptr(ret_copy, true);
20054         return ret_ref;
20055 }
20056 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
20057         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
20058         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
20059         return ret_conv;
20060 }
20061
20062 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
20063         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
20064         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20065         *ret_copy = COption_u16Z_clone(orig_conv);
20066         uint64_t ret_ref = tag_ptr(ret_copy, true);
20067         return ret_ref;
20068 }
20069
20070 uint64_t  __attribute__((export_name("TS_COption_boolZ_some"))) TS_COption_boolZ_some(jboolean o) {
20071         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20072         *ret_copy = COption_boolZ_some(o);
20073         uint64_t ret_ref = tag_ptr(ret_copy, true);
20074         return ret_ref;
20075 }
20076
20077 uint64_t  __attribute__((export_name("TS_COption_boolZ_none"))) TS_COption_boolZ_none() {
20078         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20079         *ret_copy = COption_boolZ_none();
20080         uint64_t ret_ref = tag_ptr(ret_copy, true);
20081         return ret_ref;
20082 }
20083
20084 void  __attribute__((export_name("TS_COption_boolZ_free"))) TS_COption_boolZ_free(uint64_t _res) {
20085         if (!ptr_is_owned(_res)) return;
20086         void* _res_ptr = untag_ptr(_res);
20087         CHECK_ACCESS(_res_ptr);
20088         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
20089         FREE(untag_ptr(_res));
20090         COption_boolZ_free(_res_conv);
20091 }
20092
20093 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
20094         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20095         *ret_copy = COption_boolZ_clone(arg);
20096         uint64_t ret_ref = tag_ptr(ret_copy, true);
20097         return ret_ref;
20098 }
20099 int64_t  __attribute__((export_name("TS_COption_boolZ_clone_ptr"))) TS_COption_boolZ_clone_ptr(uint64_t arg) {
20100         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
20101         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
20102         return ret_conv;
20103 }
20104
20105 uint64_t  __attribute__((export_name("TS_COption_boolZ_clone"))) TS_COption_boolZ_clone(uint64_t orig) {
20106         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
20107         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20108         *ret_copy = COption_boolZ_clone(orig_conv);
20109         uint64_t ret_ref = tag_ptr(ret_copy, true);
20110         return ret_ref;
20111 }
20112
20113 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_ok"))) TS_CResult_WitnessNoneZ_ok(int8_tArray o) {
20114         LDKWitness o_ref;
20115         o_ref.datalen = o->arr_len;
20116         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
20117         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
20118         o_ref.data_is_owned = true;
20119         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20120         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
20121         return tag_ptr(ret_conv, true);
20122 }
20123
20124 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_err"))) TS_CResult_WitnessNoneZ_err() {
20125         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20126         *ret_conv = CResult_WitnessNoneZ_err();
20127         return tag_ptr(ret_conv, true);
20128 }
20129
20130 jboolean  __attribute__((export_name("TS_CResult_WitnessNoneZ_is_ok"))) TS_CResult_WitnessNoneZ_is_ok(uint64_t o) {
20131         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
20132         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
20133         return ret_conv;
20134 }
20135
20136 void  __attribute__((export_name("TS_CResult_WitnessNoneZ_free"))) TS_CResult_WitnessNoneZ_free(uint64_t _res) {
20137         if (!ptr_is_owned(_res)) return;
20138         void* _res_ptr = untag_ptr(_res);
20139         CHECK_ACCESS(_res_ptr);
20140         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
20141         FREE(untag_ptr(_res));
20142         CResult_WitnessNoneZ_free(_res_conv);
20143 }
20144
20145 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
20146         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20147         *ret_conv = CResult_WitnessNoneZ_clone(arg);
20148         return tag_ptr(ret_conv, true);
20149 }
20150 int64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_clone_ptr"))) TS_CResult_WitnessNoneZ_clone_ptr(uint64_t arg) {
20151         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
20152         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
20153         return ret_conv;
20154 }
20155
20156 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_clone"))) TS_CResult_WitnessNoneZ_clone(uint64_t orig) {
20157         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
20158         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20159         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
20160         return tag_ptr(ret_conv, true);
20161 }
20162
20163 void  __attribute__((export_name("TS_CVec_ECDSASignatureZ_free"))) TS_CVec_ECDSASignatureZ_free(ptrArray _res) {
20164         LDKCVec_ECDSASignatureZ _res_constr;
20165         _res_constr.datalen = _res->arr_len;
20166         if (_res_constr.datalen > 0)
20167                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
20168         else
20169                 _res_constr.data = NULL;
20170         int8_tArray* _res_vals = (void*) _res->elems;
20171         for (size_t m = 0; m < _res_constr.datalen; m++) {
20172                 int8_tArray _res_conv_12 = _res_vals[m];
20173                 LDKECDSASignature _res_conv_12_ref;
20174                 CHECK(_res_conv_12->arr_len == 64);
20175                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
20176                 _res_constr.data[m] = _res_conv_12_ref;
20177         }
20178         FREE(_res);
20179         CVec_ECDSASignatureZ_free(_res_constr);
20180 }
20181
20182 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
20183         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20184         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
20185         return tag_ptr(ret_conv, true);
20186 }
20187 int64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(uint64_t arg) {
20188         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
20189         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
20190         return ret_conv;
20191 }
20192
20193 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(uint64_t orig) {
20194         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
20195         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20196         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
20197         return tag_ptr(ret_conv, true);
20198 }
20199
20200 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
20201         LDKECDSASignature a_ref;
20202         CHECK(a->arr_len == 64);
20203         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
20204         LDKCVec_ECDSASignatureZ b_constr;
20205         b_constr.datalen = b->arr_len;
20206         if (b_constr.datalen > 0)
20207                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
20208         else
20209                 b_constr.data = NULL;
20210         int8_tArray* b_vals = (void*) b->elems;
20211         for (size_t m = 0; m < b_constr.datalen; m++) {
20212                 int8_tArray b_conv_12 = b_vals[m];
20213                 LDKECDSASignature b_conv_12_ref;
20214                 CHECK(b_conv_12->arr_len == 64);
20215                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
20216                 b_constr.data[m] = b_conv_12_ref;
20217         }
20218         FREE(b);
20219         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20220         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
20221         return tag_ptr(ret_conv, true);
20222 }
20223
20224 void  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(uint64_t _res) {
20225         if (!ptr_is_owned(_res)) return;
20226         void* _res_ptr = untag_ptr(_res);
20227         CHECK_ACCESS(_res_ptr);
20228         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
20229         FREE(untag_ptr(_res));
20230         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
20231 }
20232
20233 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(uint64_t o) {
20234         void* o_ptr = untag_ptr(o);
20235         CHECK_ACCESS(o_ptr);
20236         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
20237         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
20238         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20239         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
20240         return tag_ptr(ret_conv, true);
20241 }
20242
20243 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
20244         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20245         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
20246         return tag_ptr(ret_conv, true);
20247 }
20248
20249 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(uint64_t o) {
20250         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
20251         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
20252         return ret_conv;
20253 }
20254
20255 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(uint64_t _res) {
20256         if (!ptr_is_owned(_res)) return;
20257         void* _res_ptr = untag_ptr(_res);
20258         CHECK_ACCESS(_res_ptr);
20259         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
20260         FREE(untag_ptr(_res));
20261         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
20262 }
20263
20264 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
20265         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20266         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
20267         return tag_ptr(ret_conv, true);
20268 }
20269 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(uint64_t arg) {
20270         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
20271         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
20272         return ret_conv;
20273 }
20274
20275 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(uint64_t orig) {
20276         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
20277         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20278         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
20279         return tag_ptr(ret_conv, true);
20280 }
20281
20282 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
20283         LDKInMemorySigner o_conv;
20284         o_conv.inner = untag_ptr(o);
20285         o_conv.is_owned = ptr_is_owned(o);
20286         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20287         o_conv = InMemorySigner_clone(&o_conv);
20288         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20289         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
20290         return tag_ptr(ret_conv, true);
20291 }
20292
20293 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
20294         void* e_ptr = untag_ptr(e);
20295         CHECK_ACCESS(e_ptr);
20296         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20297         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20298         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20299         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
20300         return tag_ptr(ret_conv, true);
20301 }
20302
20303 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
20304         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
20305         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
20306         return ret_conv;
20307 }
20308
20309 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
20310         if (!ptr_is_owned(_res)) return;
20311         void* _res_ptr = untag_ptr(_res);
20312         CHECK_ACCESS(_res_ptr);
20313         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
20314         FREE(untag_ptr(_res));
20315         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
20316 }
20317
20318 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
20319         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20320         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
20321         return tag_ptr(ret_conv, true);
20322 }
20323 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
20324         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
20325         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
20326         return ret_conv;
20327 }
20328
20329 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
20330         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
20331         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20332         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
20333         return tag_ptr(ret_conv, true);
20334 }
20335
20336 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
20337         LDKCVec_ChannelDetailsZ _res_constr;
20338         _res_constr.datalen = _res->arr_len;
20339         if (_res_constr.datalen > 0)
20340                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
20341         else
20342                 _res_constr.data = NULL;
20343         uint64_t* _res_vals = _res->elems;
20344         for (size_t q = 0; q < _res_constr.datalen; q++) {
20345                 uint64_t _res_conv_16 = _res_vals[q];
20346                 LDKChannelDetails _res_conv_16_conv;
20347                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20348                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20349                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20350                 _res_constr.data[q] = _res_conv_16_conv;
20351         }
20352         FREE(_res);
20353         CVec_ChannelDetailsZ_free(_res_constr);
20354 }
20355
20356 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
20357         LDKRoute o_conv;
20358         o_conv.inner = untag_ptr(o);
20359         o_conv.is_owned = ptr_is_owned(o);
20360         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20361         o_conv = Route_clone(&o_conv);
20362         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20363         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
20364         return tag_ptr(ret_conv, true);
20365 }
20366
20367 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
20368         LDKLightningError e_conv;
20369         e_conv.inner = untag_ptr(e);
20370         e_conv.is_owned = ptr_is_owned(e);
20371         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20372         e_conv = LightningError_clone(&e_conv);
20373         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20374         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
20375         return tag_ptr(ret_conv, true);
20376 }
20377
20378 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
20379         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
20380         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
20381         return ret_conv;
20382 }
20383
20384 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
20385         if (!ptr_is_owned(_res)) return;
20386         void* _res_ptr = untag_ptr(_res);
20387         CHECK_ACCESS(_res_ptr);
20388         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
20389         FREE(untag_ptr(_res));
20390         CResult_RouteLightningErrorZ_free(_res_conv);
20391 }
20392
20393 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
20394         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20395         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
20396         return tag_ptr(ret_conv, true);
20397 }
20398 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
20399         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
20400         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
20401         return ret_conv;
20402 }
20403
20404 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
20405         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
20406         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20407         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
20408         return tag_ptr(ret_conv, true);
20409 }
20410
20411 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
20412         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20413         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
20414         return tag_ptr(ret_conv, true);
20415 }
20416 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
20417         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
20418         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
20419         return ret_conv;
20420 }
20421
20422 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
20423         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
20424         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20425         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
20426         return tag_ptr(ret_conv, true);
20427 }
20428
20429 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
20430         LDKBlindedPayInfo a_conv;
20431         a_conv.inner = untag_ptr(a);
20432         a_conv.is_owned = ptr_is_owned(a);
20433         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20434         a_conv = BlindedPayInfo_clone(&a_conv);
20435         LDKBlindedPath b_conv;
20436         b_conv.inner = untag_ptr(b);
20437         b_conv.is_owned = ptr_is_owned(b);
20438         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20439         b_conv = BlindedPath_clone(&b_conv);
20440         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20441         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
20442         return tag_ptr(ret_conv, true);
20443 }
20444
20445 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
20446         if (!ptr_is_owned(_res)) return;
20447         void* _res_ptr = untag_ptr(_res);
20448         CHECK_ACCESS(_res_ptr);
20449         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
20450         FREE(untag_ptr(_res));
20451         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
20452 }
20453
20454 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
20455         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
20456         _res_constr.datalen = _res->arr_len;
20457         if (_res_constr.datalen > 0)
20458                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
20459         else
20460                 _res_constr.data = NULL;
20461         uint64_t* _res_vals = _res->elems;
20462         for (size_t l = 0; l < _res_constr.datalen; l++) {
20463                 uint64_t _res_conv_37 = _res_vals[l];
20464                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
20465                 CHECK_ACCESS(_res_conv_37_ptr);
20466                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
20467                 FREE(untag_ptr(_res_conv_37));
20468                 _res_constr.data[l] = _res_conv_37_conv;
20469         }
20470         FREE(_res);
20471         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
20472 }
20473
20474 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(uint64_tArray o) {
20475         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
20476         o_constr.datalen = o->arr_len;
20477         if (o_constr.datalen > 0)
20478                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
20479         else
20480                 o_constr.data = NULL;
20481         uint64_t* o_vals = o->elems;
20482         for (size_t l = 0; l < o_constr.datalen; l++) {
20483                 uint64_t o_conv_37 = o_vals[l];
20484                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
20485                 CHECK_ACCESS(o_conv_37_ptr);
20486                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
20487                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
20488                 o_constr.data[l] = o_conv_37_conv;
20489         }
20490         FREE(o);
20491         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20492         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
20493         return tag_ptr(ret_conv, true);
20494 }
20495
20496 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() {
20497         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20498         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
20499         return tag_ptr(ret_conv, true);
20500 }
20501
20502 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(uint64_t o) {
20503         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
20504         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
20505         return ret_conv;
20506 }
20507
20508 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(uint64_t _res) {
20509         if (!ptr_is_owned(_res)) return;
20510         void* _res_ptr = untag_ptr(_res);
20511         CHECK_ACCESS(_res_ptr);
20512         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
20513         FREE(untag_ptr(_res));
20514         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
20515 }
20516
20517 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
20518         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20519         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
20520         return tag_ptr(ret_conv, true);
20521 }
20522 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(uint64_t arg) {
20523         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
20524         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
20525         return ret_conv;
20526 }
20527
20528 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(uint64_t orig) {
20529         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
20530         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20531         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
20532         return tag_ptr(ret_conv, true);
20533 }
20534
20535 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
20536         LDKCVec_PublicKeyZ _res_constr;
20537         _res_constr.datalen = _res->arr_len;
20538         if (_res_constr.datalen > 0)
20539                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
20540         else
20541                 _res_constr.data = NULL;
20542         int8_tArray* _res_vals = (void*) _res->elems;
20543         for (size_t m = 0; m < _res_constr.datalen; m++) {
20544                 int8_tArray _res_conv_12 = _res_vals[m];
20545                 LDKPublicKey _res_conv_12_ref;
20546                 CHECK(_res_conv_12->arr_len == 33);
20547                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
20548                 _res_constr.data[m] = _res_conv_12_ref;
20549         }
20550         FREE(_res);
20551         CVec_PublicKeyZ_free(_res_constr);
20552 }
20553
20554 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_ok"))) TS_CResult_OnionMessagePathNoneZ_ok(uint64_t o) {
20555         LDKOnionMessagePath o_conv;
20556         o_conv.inner = untag_ptr(o);
20557         o_conv.is_owned = ptr_is_owned(o);
20558         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20559         o_conv = OnionMessagePath_clone(&o_conv);
20560         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20561         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
20562         return tag_ptr(ret_conv, true);
20563 }
20564
20565 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_err"))) TS_CResult_OnionMessagePathNoneZ_err() {
20566         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20567         *ret_conv = CResult_OnionMessagePathNoneZ_err();
20568         return tag_ptr(ret_conv, true);
20569 }
20570
20571 jboolean  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_is_ok"))) TS_CResult_OnionMessagePathNoneZ_is_ok(uint64_t o) {
20572         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
20573         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
20574         return ret_conv;
20575 }
20576
20577 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_free"))) TS_CResult_OnionMessagePathNoneZ_free(uint64_t _res) {
20578         if (!ptr_is_owned(_res)) return;
20579         void* _res_ptr = untag_ptr(_res);
20580         CHECK_ACCESS(_res_ptr);
20581         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
20582         FREE(untag_ptr(_res));
20583         CResult_OnionMessagePathNoneZ_free(_res_conv);
20584 }
20585
20586 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
20587         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20588         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
20589         return tag_ptr(ret_conv, true);
20590 }
20591 int64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone_ptr"))) TS_CResult_OnionMessagePathNoneZ_clone_ptr(uint64_t arg) {
20592         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
20593         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
20594         return ret_conv;
20595 }
20596
20597 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone"))) TS_CResult_OnionMessagePathNoneZ_clone(uint64_t orig) {
20598         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
20599         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20600         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
20601         return tag_ptr(ret_conv, true);
20602 }
20603
20604 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_ok(uint64_tArray o) {
20605         LDKCVec_BlindedPathZ o_constr;
20606         o_constr.datalen = o->arr_len;
20607         if (o_constr.datalen > 0)
20608                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
20609         else
20610                 o_constr.data = NULL;
20611         uint64_t* o_vals = o->elems;
20612         for (size_t n = 0; n < o_constr.datalen; n++) {
20613                 uint64_t o_conv_13 = o_vals[n];
20614                 LDKBlindedPath o_conv_13_conv;
20615                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
20616                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
20617                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
20618                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
20619                 o_constr.data[n] = o_conv_13_conv;
20620         }
20621         FREE(o);
20622         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20623         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
20624         return tag_ptr(ret_conv, true);
20625 }
20626
20627 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_err"))) TS_CResult_CVec_BlindedPathZNoneZ_err() {
20628         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20629         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
20630         return tag_ptr(ret_conv, true);
20631 }
20632
20633 jboolean  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_is_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_is_ok(uint64_t o) {
20634         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
20635         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
20636         return ret_conv;
20637 }
20638
20639 void  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_free"))) TS_CResult_CVec_BlindedPathZNoneZ_free(uint64_t _res) {
20640         if (!ptr_is_owned(_res)) return;
20641         void* _res_ptr = untag_ptr(_res);
20642         CHECK_ACCESS(_res_ptr);
20643         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
20644         FREE(untag_ptr(_res));
20645         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
20646 }
20647
20648 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
20649         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20650         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
20651         return tag_ptr(ret_conv, true);
20652 }
20653 int64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_clone_ptr"))) TS_CResult_CVec_BlindedPathZNoneZ_clone_ptr(uint64_t arg) {
20654         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
20655         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
20656         return ret_conv;
20657 }
20658
20659 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_clone"))) TS_CResult_CVec_BlindedPathZNoneZ_clone(uint64_t orig) {
20660         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
20661         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20662         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
20663         return tag_ptr(ret_conv, true);
20664 }
20665
20666 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
20667         LDKInFlightHtlcs o_conv;
20668         o_conv.inner = untag_ptr(o);
20669         o_conv.is_owned = ptr_is_owned(o);
20670         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20671         o_conv = InFlightHtlcs_clone(&o_conv);
20672         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20673         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
20674         return tag_ptr(ret_conv, true);
20675 }
20676
20677 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
20678         void* e_ptr = untag_ptr(e);
20679         CHECK_ACCESS(e_ptr);
20680         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20681         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20682         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20683         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
20684         return tag_ptr(ret_conv, true);
20685 }
20686
20687 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
20688         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
20689         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
20690         return ret_conv;
20691 }
20692
20693 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
20694         if (!ptr_is_owned(_res)) return;
20695         void* _res_ptr = untag_ptr(_res);
20696         CHECK_ACCESS(_res_ptr);
20697         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
20698         FREE(untag_ptr(_res));
20699         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
20700 }
20701
20702 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
20703         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20704         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
20705         return tag_ptr(ret_conv, true);
20706 }
20707 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
20708         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
20709         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
20710         return ret_conv;
20711 }
20712
20713 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
20714         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
20715         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20716         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
20717         return tag_ptr(ret_conv, true);
20718 }
20719
20720 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
20721         LDKRouteHop o_conv;
20722         o_conv.inner = untag_ptr(o);
20723         o_conv.is_owned = ptr_is_owned(o);
20724         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20725         o_conv = RouteHop_clone(&o_conv);
20726         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
20727         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
20728         return tag_ptr(ret_conv, true);
20729 }
20730
20731 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
20732         void* e_ptr = untag_ptr(e);
20733         CHECK_ACCESS(e_ptr);
20734         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20735         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20736         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
20737         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
20738         return tag_ptr(ret_conv, true);
20739 }
20740
20741 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
20742         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
20743         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
20744         return ret_conv;
20745 }
20746
20747 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
20748         if (!ptr_is_owned(_res)) return;
20749         void* _res_ptr = untag_ptr(_res);
20750         CHECK_ACCESS(_res_ptr);
20751         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
20752         FREE(untag_ptr(_res));
20753         CResult_RouteHopDecodeErrorZ_free(_res_conv);
20754 }
20755
20756 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
20757         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
20758         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
20759         return tag_ptr(ret_conv, true);
20760 }
20761 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
20762         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
20763         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
20764         return ret_conv;
20765 }
20766
20767 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
20768         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
20769         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
20770         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
20771         return tag_ptr(ret_conv, true);
20772 }
20773
20774 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
20775         LDKCVec_BlindedHopZ _res_constr;
20776         _res_constr.datalen = _res->arr_len;
20777         if (_res_constr.datalen > 0)
20778                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
20779         else
20780                 _res_constr.data = NULL;
20781         uint64_t* _res_vals = _res->elems;
20782         for (size_t m = 0; m < _res_constr.datalen; m++) {
20783                 uint64_t _res_conv_12 = _res_vals[m];
20784                 LDKBlindedHop _res_conv_12_conv;
20785                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
20786                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
20787                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
20788                 _res_constr.data[m] = _res_conv_12_conv;
20789         }
20790         FREE(_res);
20791         CVec_BlindedHopZ_free(_res_constr);
20792 }
20793
20794 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
20795         LDKBlindedTail o_conv;
20796         o_conv.inner = untag_ptr(o);
20797         o_conv.is_owned = ptr_is_owned(o);
20798         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20799         o_conv = BlindedTail_clone(&o_conv);
20800         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
20801         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
20802         return tag_ptr(ret_conv, true);
20803 }
20804
20805 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
20806         void* e_ptr = untag_ptr(e);
20807         CHECK_ACCESS(e_ptr);
20808         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20809         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20810         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
20811         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
20812         return tag_ptr(ret_conv, true);
20813 }
20814
20815 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
20816         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
20817         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
20818         return ret_conv;
20819 }
20820
20821 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
20822         if (!ptr_is_owned(_res)) return;
20823         void* _res_ptr = untag_ptr(_res);
20824         CHECK_ACCESS(_res_ptr);
20825         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
20826         FREE(untag_ptr(_res));
20827         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
20828 }
20829
20830 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
20831         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
20832         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
20833         return tag_ptr(ret_conv, true);
20834 }
20835 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
20836         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
20837         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
20838         return ret_conv;
20839 }
20840
20841 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
20842         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
20843         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
20844         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
20845         return tag_ptr(ret_conv, true);
20846 }
20847
20848 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
20849         LDKCVec_RouteHopZ _res_constr;
20850         _res_constr.datalen = _res->arr_len;
20851         if (_res_constr.datalen > 0)
20852                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
20853         else
20854                 _res_constr.data = NULL;
20855         uint64_t* _res_vals = _res->elems;
20856         for (size_t k = 0; k < _res_constr.datalen; k++) {
20857                 uint64_t _res_conv_10 = _res_vals[k];
20858                 LDKRouteHop _res_conv_10_conv;
20859                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
20860                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
20861                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
20862                 _res_constr.data[k] = _res_conv_10_conv;
20863         }
20864         FREE(_res);
20865         CVec_RouteHopZ_free(_res_constr);
20866 }
20867
20868 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
20869         LDKCVec_PathZ _res_constr;
20870         _res_constr.datalen = _res->arr_len;
20871         if (_res_constr.datalen > 0)
20872                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
20873         else
20874                 _res_constr.data = NULL;
20875         uint64_t* _res_vals = _res->elems;
20876         for (size_t g = 0; g < _res_constr.datalen; g++) {
20877                 uint64_t _res_conv_6 = _res_vals[g];
20878                 LDKPath _res_conv_6_conv;
20879                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
20880                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
20881                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
20882                 _res_constr.data[g] = _res_conv_6_conv;
20883         }
20884         FREE(_res);
20885         CVec_PathZ_free(_res_constr);
20886 }
20887
20888 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
20889         LDKRoute o_conv;
20890         o_conv.inner = untag_ptr(o);
20891         o_conv.is_owned = ptr_is_owned(o);
20892         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20893         o_conv = Route_clone(&o_conv);
20894         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
20895         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
20896         return tag_ptr(ret_conv, true);
20897 }
20898
20899 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
20900         void* e_ptr = untag_ptr(e);
20901         CHECK_ACCESS(e_ptr);
20902         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20903         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20904         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
20905         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
20906         return tag_ptr(ret_conv, true);
20907 }
20908
20909 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
20910         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
20911         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
20912         return ret_conv;
20913 }
20914
20915 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
20916         if (!ptr_is_owned(_res)) return;
20917         void* _res_ptr = untag_ptr(_res);
20918         CHECK_ACCESS(_res_ptr);
20919         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
20920         FREE(untag_ptr(_res));
20921         CResult_RouteDecodeErrorZ_free(_res_conv);
20922 }
20923
20924 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
20925         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
20926         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
20927         return tag_ptr(ret_conv, true);
20928 }
20929 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
20930         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
20931         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
20932         return ret_conv;
20933 }
20934
20935 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
20936         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
20937         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
20938         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
20939         return tag_ptr(ret_conv, true);
20940 }
20941
20942 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
20943         LDKRouteParameters o_conv;
20944         o_conv.inner = untag_ptr(o);
20945         o_conv.is_owned = ptr_is_owned(o);
20946         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20947         o_conv = RouteParameters_clone(&o_conv);
20948         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
20949         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
20950         return tag_ptr(ret_conv, true);
20951 }
20952
20953 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
20954         void* e_ptr = untag_ptr(e);
20955         CHECK_ACCESS(e_ptr);
20956         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20957         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20958         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
20959         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
20960         return tag_ptr(ret_conv, true);
20961 }
20962
20963 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
20964         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
20965         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
20966         return ret_conv;
20967 }
20968
20969 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
20970         if (!ptr_is_owned(_res)) return;
20971         void* _res_ptr = untag_ptr(_res);
20972         CHECK_ACCESS(_res_ptr);
20973         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
20974         FREE(untag_ptr(_res));
20975         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
20976 }
20977
20978 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
20979         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
20980         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
20981         return tag_ptr(ret_conv, true);
20982 }
20983 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
20984         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
20985         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
20986         return ret_conv;
20987 }
20988
20989 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
20990         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
20991         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
20992         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
20993         return tag_ptr(ret_conv, true);
20994 }
20995
20996 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
20997         LDKCVec_u64Z _res_constr;
20998         _res_constr.datalen = _res->arr_len;
20999         if (_res_constr.datalen > 0)
21000                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
21001         else
21002                 _res_constr.data = NULL;
21003         int64_t* _res_vals = _res->elems;
21004         for (size_t i = 0; i < _res_constr.datalen; i++) {
21005                 int64_t _res_conv_8 = _res_vals[i];
21006                 _res_constr.data[i] = _res_conv_8;
21007         }
21008         FREE(_res);
21009         CVec_u64Z_free(_res_constr);
21010 }
21011
21012 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
21013         LDKPaymentParameters o_conv;
21014         o_conv.inner = untag_ptr(o);
21015         o_conv.is_owned = ptr_is_owned(o);
21016         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21017         o_conv = PaymentParameters_clone(&o_conv);
21018         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21019         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
21020         return tag_ptr(ret_conv, true);
21021 }
21022
21023 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
21024         void* e_ptr = untag_ptr(e);
21025         CHECK_ACCESS(e_ptr);
21026         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21027         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21028         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21029         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
21030         return tag_ptr(ret_conv, true);
21031 }
21032
21033 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
21034         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
21035         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
21036         return ret_conv;
21037 }
21038
21039 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
21040         if (!ptr_is_owned(_res)) return;
21041         void* _res_ptr = untag_ptr(_res);
21042         CHECK_ACCESS(_res_ptr);
21043         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
21044         FREE(untag_ptr(_res));
21045         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
21046 }
21047
21048 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
21049         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21050         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
21051         return tag_ptr(ret_conv, true);
21052 }
21053 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
21054         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
21055         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
21056         return ret_conv;
21057 }
21058
21059 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
21060         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
21061         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21062         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
21063         return tag_ptr(ret_conv, true);
21064 }
21065
21066 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
21067         LDKCVec_RouteHintZ _res_constr;
21068         _res_constr.datalen = _res->arr_len;
21069         if (_res_constr.datalen > 0)
21070                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
21071         else
21072                 _res_constr.data = NULL;
21073         uint64_t* _res_vals = _res->elems;
21074         for (size_t l = 0; l < _res_constr.datalen; l++) {
21075                 uint64_t _res_conv_11 = _res_vals[l];
21076                 LDKRouteHint _res_conv_11_conv;
21077                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
21078                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
21079                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
21080                 _res_constr.data[l] = _res_conv_11_conv;
21081         }
21082         FREE(_res);
21083         CVec_RouteHintZ_free(_res_constr);
21084 }
21085
21086 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
21087         LDKCVec_RouteHintHopZ _res_constr;
21088         _res_constr.datalen = _res->arr_len;
21089         if (_res_constr.datalen > 0)
21090                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
21091         else
21092                 _res_constr.data = NULL;
21093         uint64_t* _res_vals = _res->elems;
21094         for (size_t o = 0; o < _res_constr.datalen; o++) {
21095                 uint64_t _res_conv_14 = _res_vals[o];
21096                 LDKRouteHintHop _res_conv_14_conv;
21097                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
21098                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
21099                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
21100                 _res_constr.data[o] = _res_conv_14_conv;
21101         }
21102         FREE(_res);
21103         CVec_RouteHintHopZ_free(_res_constr);
21104 }
21105
21106 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
21107         LDKRouteHint o_conv;
21108         o_conv.inner = untag_ptr(o);
21109         o_conv.is_owned = ptr_is_owned(o);
21110         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21111         o_conv = RouteHint_clone(&o_conv);
21112         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21113         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
21114         return tag_ptr(ret_conv, true);
21115 }
21116
21117 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
21118         void* e_ptr = untag_ptr(e);
21119         CHECK_ACCESS(e_ptr);
21120         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21121         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21122         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21123         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
21124         return tag_ptr(ret_conv, true);
21125 }
21126
21127 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
21128         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
21129         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
21130         return ret_conv;
21131 }
21132
21133 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
21134         if (!ptr_is_owned(_res)) return;
21135         void* _res_ptr = untag_ptr(_res);
21136         CHECK_ACCESS(_res_ptr);
21137         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
21138         FREE(untag_ptr(_res));
21139         CResult_RouteHintDecodeErrorZ_free(_res_conv);
21140 }
21141
21142 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
21143         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21144         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
21145         return tag_ptr(ret_conv, true);
21146 }
21147 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
21148         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
21149         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
21150         return ret_conv;
21151 }
21152
21153 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
21154         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
21155         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21156         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
21157         return tag_ptr(ret_conv, true);
21158 }
21159
21160 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
21161         LDKRouteHintHop o_conv;
21162         o_conv.inner = untag_ptr(o);
21163         o_conv.is_owned = ptr_is_owned(o);
21164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21165         o_conv = RouteHintHop_clone(&o_conv);
21166         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21167         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
21168         return tag_ptr(ret_conv, true);
21169 }
21170
21171 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
21172         void* e_ptr = untag_ptr(e);
21173         CHECK_ACCESS(e_ptr);
21174         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21175         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21176         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21177         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
21178         return tag_ptr(ret_conv, true);
21179 }
21180
21181 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
21182         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
21183         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
21184         return ret_conv;
21185 }
21186
21187 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
21188         if (!ptr_is_owned(_res)) return;
21189         void* _res_ptr = untag_ptr(_res);
21190         CHECK_ACCESS(_res_ptr);
21191         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
21192         FREE(untag_ptr(_res));
21193         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
21194 }
21195
21196 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
21197         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21198         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
21199         return tag_ptr(ret_conv, true);
21200 }
21201 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
21202         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
21203         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
21204         return ret_conv;
21205 }
21206
21207 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
21208         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
21209         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21210         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
21211         return tag_ptr(ret_conv, true);
21212 }
21213
21214 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
21215         LDKFixedPenaltyScorer o_conv;
21216         o_conv.inner = untag_ptr(o);
21217         o_conv.is_owned = ptr_is_owned(o);
21218         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21219         o_conv = FixedPenaltyScorer_clone(&o_conv);
21220         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21221         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
21222         return tag_ptr(ret_conv, true);
21223 }
21224
21225 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
21226         void* e_ptr = untag_ptr(e);
21227         CHECK_ACCESS(e_ptr);
21228         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21229         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21230         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21231         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
21232         return tag_ptr(ret_conv, true);
21233 }
21234
21235 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
21236         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
21237         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
21238         return ret_conv;
21239 }
21240
21241 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
21242         if (!ptr_is_owned(_res)) return;
21243         void* _res_ptr = untag_ptr(_res);
21244         CHECK_ACCESS(_res_ptr);
21245         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
21246         FREE(untag_ptr(_res));
21247         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
21248 }
21249
21250 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
21251         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21252         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
21253         return tag_ptr(ret_conv, true);
21254 }
21255 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
21256         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
21257         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
21258         return ret_conv;
21259 }
21260
21261 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
21262         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
21263         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21264         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
21265         return tag_ptr(ret_conv, true);
21266 }
21267
21268 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
21269         LDKCVec_NodeIdZ _res_constr;
21270         _res_constr.datalen = _res->arr_len;
21271         if (_res_constr.datalen > 0)
21272                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
21273         else
21274                 _res_constr.data = NULL;
21275         uint64_t* _res_vals = _res->elems;
21276         for (size_t i = 0; i < _res_constr.datalen; i++) {
21277                 uint64_t _res_conv_8 = _res_vals[i];
21278                 LDKNodeId _res_conv_8_conv;
21279                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
21280                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
21281                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
21282                 _res_constr.data[i] = _res_conv_8_conv;
21283         }
21284         FREE(_res);
21285         CVec_NodeIdZ_free(_res_constr);
21286 }
21287
21288 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
21289         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21290         *ret_conv = C2Tuple_u64u64Z_clone(arg);
21291         return tag_ptr(ret_conv, true);
21292 }
21293 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
21294         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
21295         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
21296         return ret_conv;
21297 }
21298
21299 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
21300         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
21301         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21302         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
21303         return tag_ptr(ret_conv, true);
21304 }
21305
21306 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
21307         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21308         *ret_conv = C2Tuple_u64u64Z_new(a, b);
21309         return tag_ptr(ret_conv, true);
21310 }
21311
21312 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
21313         if (!ptr_is_owned(_res)) return;
21314         void* _res_ptr = untag_ptr(_res);
21315         CHECK_ACCESS(_res_ptr);
21316         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
21317         FREE(untag_ptr(_res));
21318         C2Tuple_u64u64Z_free(_res_conv);
21319 }
21320
21321 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
21322         void* o_ptr = untag_ptr(o);
21323         CHECK_ACCESS(o_ptr);
21324         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
21325         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
21326         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21327         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
21328         uint64_t ret_ref = tag_ptr(ret_copy, true);
21329         return ret_ref;
21330 }
21331
21332 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
21333         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21334         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
21335         uint64_t ret_ref = tag_ptr(ret_copy, true);
21336         return ret_ref;
21337 }
21338
21339 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
21340         if (!ptr_is_owned(_res)) return;
21341         void* _res_ptr = untag_ptr(_res);
21342         CHECK_ACCESS(_res_ptr);
21343         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
21344         FREE(untag_ptr(_res));
21345         COption_C2Tuple_u64u64ZZ_free(_res_conv);
21346 }
21347
21348 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
21349         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21350         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
21351         uint64_t ret_ref = tag_ptr(ret_copy, true);
21352         return ret_ref;
21353 }
21354 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
21355         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
21356         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
21357         return ret_conv;
21358 }
21359
21360 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
21361         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
21362         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21363         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
21364         uint64_t ret_ref = tag_ptr(ret_copy, true);
21365         return ret_ref;
21366 }
21367
21368 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
21369         LDKThirtyTwoU16s a_ref;
21370         CHECK(a->arr_len == 32);
21371         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
21372         LDKThirtyTwoU16s b_ref;
21373         CHECK(b->arr_len == 32);
21374         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
21375         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
21376         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
21377         return tag_ptr(ret_conv, true);
21378 }
21379
21380 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
21381         if (!ptr_is_owned(_res)) return;
21382         void* _res_ptr = untag_ptr(_res);
21383         CHECK_ACCESS(_res_ptr);
21384         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
21385         FREE(untag_ptr(_res));
21386         C2Tuple_Z_free(_res_conv);
21387 }
21388
21389 uint64_t  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_new"))) TS_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
21390         LDKThirtyTwoU16s a_ref;
21391         CHECK(a->arr_len == 32);
21392         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
21393         LDKThirtyTwoU16s b_ref;
21394         CHECK(b->arr_len == 32);
21395         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
21396         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
21397         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
21398         return tag_ptr(ret_conv, true);
21399 }
21400
21401 void  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_free"))) TS_C2Tuple__u1632_u1632Z_free(uint64_t _res) {
21402         if (!ptr_is_owned(_res)) return;
21403         void* _res_ptr = untag_ptr(_res);
21404         CHECK_ACCESS(_res_ptr);
21405         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
21406         FREE(untag_ptr(_res));
21407         C2Tuple__u1632_u1632Z_free(_res_conv);
21408 }
21409
21410 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(uint64_t o) {
21411         void* o_ptr = untag_ptr(o);
21412         CHECK_ACCESS(o_ptr);
21413         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
21414         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
21415         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
21416         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
21417         uint64_t ret_ref = tag_ptr(ret_copy, true);
21418         return ret_ref;
21419 }
21420
21421 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
21422         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
21423         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
21424         uint64_t ret_ref = tag_ptr(ret_copy, true);
21425         return ret_ref;
21426 }
21427
21428 void  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(uint64_t _res) {
21429         if (!ptr_is_owned(_res)) return;
21430         void* _res_ptr = untag_ptr(_res);
21431         CHECK_ACCESS(_res_ptr);
21432         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
21433         FREE(untag_ptr(_res));
21434         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
21435 }
21436
21437 uint64_t  __attribute__((export_name("TS_COption_f64Z_some"))) TS_COption_f64Z_some(double o) {
21438         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21439         *ret_copy = COption_f64Z_some(o);
21440         uint64_t ret_ref = tag_ptr(ret_copy, true);
21441         return ret_ref;
21442 }
21443
21444 uint64_t  __attribute__((export_name("TS_COption_f64Z_none"))) TS_COption_f64Z_none() {
21445         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21446         *ret_copy = COption_f64Z_none();
21447         uint64_t ret_ref = tag_ptr(ret_copy, true);
21448         return ret_ref;
21449 }
21450
21451 void  __attribute__((export_name("TS_COption_f64Z_free"))) TS_COption_f64Z_free(uint64_t _res) {
21452         if (!ptr_is_owned(_res)) return;
21453         void* _res_ptr = untag_ptr(_res);
21454         CHECK_ACCESS(_res_ptr);
21455         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
21456         FREE(untag_ptr(_res));
21457         COption_f64Z_free(_res_conv);
21458 }
21459
21460 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
21461         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21462         *ret_copy = COption_f64Z_clone(arg);
21463         uint64_t ret_ref = tag_ptr(ret_copy, true);
21464         return ret_ref;
21465 }
21466 int64_t  __attribute__((export_name("TS_COption_f64Z_clone_ptr"))) TS_COption_f64Z_clone_ptr(uint64_t arg) {
21467         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
21468         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
21469         return ret_conv;
21470 }
21471
21472 uint64_t  __attribute__((export_name("TS_COption_f64Z_clone"))) TS_COption_f64Z_clone(uint64_t orig) {
21473         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
21474         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21475         *ret_copy = COption_f64Z_clone(orig_conv);
21476         uint64_t ret_ref = tag_ptr(ret_copy, true);
21477         return ret_ref;
21478 }
21479
21480 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
21481         LDKProbabilisticScorer o_conv;
21482         o_conv.inner = untag_ptr(o);
21483         o_conv.is_owned = ptr_is_owned(o);
21484         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21485         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
21486         
21487         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
21488         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
21489         return tag_ptr(ret_conv, true);
21490 }
21491
21492 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
21493         void* e_ptr = untag_ptr(e);
21494         CHECK_ACCESS(e_ptr);
21495         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21496         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21497         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
21498         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
21499         return tag_ptr(ret_conv, true);
21500 }
21501
21502 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
21503         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
21504         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
21505         return ret_conv;
21506 }
21507
21508 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
21509         if (!ptr_is_owned(_res)) return;
21510         void* _res_ptr = untag_ptr(_res);
21511         CHECK_ACCESS(_res_ptr);
21512         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
21513         FREE(untag_ptr(_res));
21514         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
21515 }
21516
21517 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_ok"))) TS_CResult_BestBlockDecodeErrorZ_ok(uint64_t o) {
21518         LDKBestBlock o_conv;
21519         o_conv.inner = untag_ptr(o);
21520         o_conv.is_owned = ptr_is_owned(o);
21521         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21522         o_conv = BestBlock_clone(&o_conv);
21523         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21524         *ret_conv = CResult_BestBlockDecodeErrorZ_ok(o_conv);
21525         return tag_ptr(ret_conv, true);
21526 }
21527
21528 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_err"))) TS_CResult_BestBlockDecodeErrorZ_err(uint64_t e) {
21529         void* e_ptr = untag_ptr(e);
21530         CHECK_ACCESS(e_ptr);
21531         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21532         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21533         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21534         *ret_conv = CResult_BestBlockDecodeErrorZ_err(e_conv);
21535         return tag_ptr(ret_conv, true);
21536 }
21537
21538 jboolean  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_is_ok"))) TS_CResult_BestBlockDecodeErrorZ_is_ok(uint64_t o) {
21539         LDKCResult_BestBlockDecodeErrorZ* o_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(o);
21540         jboolean ret_conv = CResult_BestBlockDecodeErrorZ_is_ok(o_conv);
21541         return ret_conv;
21542 }
21543
21544 void  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_free"))) TS_CResult_BestBlockDecodeErrorZ_free(uint64_t _res) {
21545         if (!ptr_is_owned(_res)) return;
21546         void* _res_ptr = untag_ptr(_res);
21547         CHECK_ACCESS(_res_ptr);
21548         LDKCResult_BestBlockDecodeErrorZ _res_conv = *(LDKCResult_BestBlockDecodeErrorZ*)(_res_ptr);
21549         FREE(untag_ptr(_res));
21550         CResult_BestBlockDecodeErrorZ_free(_res_conv);
21551 }
21552
21553 static inline uint64_t CResult_BestBlockDecodeErrorZ_clone_ptr(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR arg) {
21554         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21555         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(arg);
21556         return tag_ptr(ret_conv, true);
21557 }
21558 int64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_clone_ptr"))) TS_CResult_BestBlockDecodeErrorZ_clone_ptr(uint64_t arg) {
21559         LDKCResult_BestBlockDecodeErrorZ* arg_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(arg);
21560         int64_t ret_conv = CResult_BestBlockDecodeErrorZ_clone_ptr(arg_conv);
21561         return ret_conv;
21562 }
21563
21564 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_clone"))) TS_CResult_BestBlockDecodeErrorZ_clone(uint64_t orig) {
21565         LDKCResult_BestBlockDecodeErrorZ* orig_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(orig);
21566         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21567         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(orig_conv);
21568         return tag_ptr(ret_conv, true);
21569 }
21570
21571 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
21572         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
21573         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
21574         return tag_ptr(ret_conv, true);
21575 }
21576 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
21577         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
21578         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
21579         return ret_conv;
21580 }
21581
21582 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
21583         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
21584         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
21585         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
21586         return tag_ptr(ret_conv, true);
21587 }
21588
21589 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
21590         LDKTransaction b_ref;
21591         b_ref.datalen = b->arr_len;
21592         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
21593         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
21594         b_ref.data_is_owned = true;
21595         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
21596         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
21597         return tag_ptr(ret_conv, true);
21598 }
21599
21600 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
21601         if (!ptr_is_owned(_res)) return;
21602         void* _res_ptr = untag_ptr(_res);
21603         CHECK_ACCESS(_res_ptr);
21604         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
21605         FREE(untag_ptr(_res));
21606         C2Tuple_usizeTransactionZ_free(_res_conv);
21607 }
21608
21609 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
21610         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
21611         _res_constr.datalen = _res->arr_len;
21612         if (_res_constr.datalen > 0)
21613                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
21614         else
21615                 _res_constr.data = NULL;
21616         uint64_t* _res_vals = _res->elems;
21617         for (size_t c = 0; c < _res_constr.datalen; c++) {
21618                 uint64_t _res_conv_28 = _res_vals[c];
21619                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
21620                 CHECK_ACCESS(_res_conv_28_ptr);
21621                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
21622                 FREE(untag_ptr(_res_conv_28));
21623                 _res_constr.data[c] = _res_conv_28_conv;
21624         }
21625         FREE(_res);
21626         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
21627 }
21628
21629 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
21630         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
21631         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
21632         return tag_ptr(ret_conv, true);
21633 }
21634 int64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
21635         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
21636         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
21637         return ret_conv;
21638 }
21639
21640 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(uint64_t orig) {
21641         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
21642         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
21643         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
21644         return tag_ptr(ret_conv, true);
21645 }
21646
21647 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(int8_tArray a, int32_t b, uint64_t c) {
21648         LDKThirtyTwoBytes a_ref;
21649         CHECK(a->arr_len == 32);
21650         memcpy(a_ref.data, a->elems, 32); FREE(a);
21651         void* c_ptr = untag_ptr(c);
21652         CHECK_ACCESS(c_ptr);
21653         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
21654         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
21655         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
21656         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
21657         return tag_ptr(ret_conv, true);
21658 }
21659
21660 void  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(uint64_t _res) {
21661         if (!ptr_is_owned(_res)) return;
21662         void* _res_ptr = untag_ptr(_res);
21663         CHECK_ACCESS(_res_ptr);
21664         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
21665         FREE(untag_ptr(_res));
21666         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
21667 }
21668
21669 void  __attribute__((export_name("TS_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free"))) TS_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(uint64_tArray _res) {
21670         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
21671         _res_constr.datalen = _res->arr_len;
21672         if (_res_constr.datalen > 0)
21673                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
21674         else
21675                 _res_constr.data = NULL;
21676         uint64_t* _res_vals = _res->elems;
21677         for (size_t c = 0; c < _res_constr.datalen; c++) {
21678                 uint64_t _res_conv_54 = _res_vals[c];
21679                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
21680                 CHECK_ACCESS(_res_conv_54_ptr);
21681                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
21682                 FREE(untag_ptr(_res_conv_54));
21683                 _res_constr.data[c] = _res_conv_54_conv;
21684         }
21685         FREE(_res);
21686         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
21687 }
21688
21689 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok(uint32_t o) {
21690         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_js(o);
21691         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
21692         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
21693         return tag_ptr(ret_conv, true);
21694 }
21695
21696 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
21697         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
21698         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
21699         return tag_ptr(ret_conv, true);
21700 }
21701
21702 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(uint64_t o) {
21703         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
21704         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
21705         return ret_conv;
21706 }
21707
21708 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_free"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_free(uint64_t _res) {
21709         if (!ptr_is_owned(_res)) return;
21710         void* _res_ptr = untag_ptr(_res);
21711         CHECK_ACCESS(_res_ptr);
21712         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
21713         FREE(untag_ptr(_res));
21714         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
21715 }
21716
21717 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
21718         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
21719         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
21720         return tag_ptr(ret_conv, true);
21721 }
21722 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(uint64_t arg) {
21723         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
21724         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
21725         return ret_conv;
21726 }
21727
21728 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone(uint64_t orig) {
21729         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
21730         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
21731         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
21732         return tag_ptr(ret_conv, true);
21733 }
21734
21735 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
21736         LDKCVec_MonitorEventZ _res_constr;
21737         _res_constr.datalen = _res->arr_len;
21738         if (_res_constr.datalen > 0)
21739                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
21740         else
21741                 _res_constr.data = NULL;
21742         uint64_t* _res_vals = _res->elems;
21743         for (size_t o = 0; o < _res_constr.datalen; o++) {
21744                 uint64_t _res_conv_14 = _res_vals[o];
21745                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
21746                 CHECK_ACCESS(_res_conv_14_ptr);
21747                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
21748                 FREE(untag_ptr(_res_conv_14));
21749                 _res_constr.data[o] = _res_conv_14_conv;
21750         }
21751         FREE(_res);
21752         CVec_MonitorEventZ_free(_res_constr);
21753 }
21754
21755 static inline uint64_t C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
21756         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
21757         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(arg);
21758         return tag_ptr(ret_conv, true);
21759 }
21760 int64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
21761         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
21762         int64_t ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
21763         return ret_conv;
21764 }
21765
21766 uint64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
21767         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
21768         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
21769         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
21770         return tag_ptr(ret_conv, true);
21771 }
21772
21773 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) {
21774         LDKOutPoint a_conv;
21775         a_conv.inner = untag_ptr(a);
21776         a_conv.is_owned = ptr_is_owned(a);
21777         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21778         a_conv = OutPoint_clone(&a_conv);
21779         LDKChannelId b_conv;
21780         b_conv.inner = untag_ptr(b);
21781         b_conv.is_owned = ptr_is_owned(b);
21782         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21783         b_conv = ChannelId_clone(&b_conv);
21784         LDKCVec_MonitorEventZ c_constr;
21785         c_constr.datalen = c->arr_len;
21786         if (c_constr.datalen > 0)
21787                 c_constr.data = MALLOC(c_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
21788         else
21789                 c_constr.data = NULL;
21790         uint64_t* c_vals = c->elems;
21791         for (size_t o = 0; o < c_constr.datalen; o++) {
21792                 uint64_t c_conv_14 = c_vals[o];
21793                 void* c_conv_14_ptr = untag_ptr(c_conv_14);
21794                 CHECK_ACCESS(c_conv_14_ptr);
21795                 LDKMonitorEvent c_conv_14_conv = *(LDKMonitorEvent*)(c_conv_14_ptr);
21796                 c_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(c_conv_14));
21797                 c_constr.data[o] = c_conv_14_conv;
21798         }
21799         FREE(c);
21800         LDKPublicKey d_ref;
21801         CHECK(d->arr_len == 33);
21802         memcpy(d_ref.compressed_form, d->elems, 33); FREE(d);
21803         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
21804         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a_conv, b_conv, c_constr, d_ref);
21805         return tag_ptr(ret_conv, true);
21806 }
21807
21808 void  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
21809         if (!ptr_is_owned(_res)) return;
21810         void* _res_ptr = untag_ptr(_res);
21811         CHECK_ACCESS(_res_ptr);
21812         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
21813         FREE(untag_ptr(_res));
21814         C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res_conv);
21815 }
21816
21817 void  __attribute__((export_name("TS_CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
21818         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _res_constr;
21819         _res_constr.datalen = _res->arr_len;
21820         if (_res_constr.datalen > 0)
21821                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
21822         else
21823                 _res_constr.data = NULL;
21824         uint64_t* _res_vals = _res->elems;
21825         for (size_t f = 0; f < _res_constr.datalen; f++) {
21826                 uint64_t _res_conv_57 = _res_vals[f];
21827                 void* _res_conv_57_ptr = untag_ptr(_res_conv_57);
21828                 CHECK_ACCESS(_res_conv_57_ptr);
21829                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_conv_57_ptr);
21830                 FREE(untag_ptr(_res_conv_57));
21831                 _res_constr.data[f] = _res_conv_57_conv;
21832         }
21833         FREE(_res);
21834         CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
21835 }
21836
21837 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
21838         LDKInitFeatures o_conv;
21839         o_conv.inner = untag_ptr(o);
21840         o_conv.is_owned = ptr_is_owned(o);
21841         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21842         o_conv = InitFeatures_clone(&o_conv);
21843         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
21844         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
21845         return tag_ptr(ret_conv, true);
21846 }
21847
21848 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
21849         void* e_ptr = untag_ptr(e);
21850         CHECK_ACCESS(e_ptr);
21851         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21852         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21853         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
21854         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
21855         return tag_ptr(ret_conv, true);
21856 }
21857
21858 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
21859         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
21860         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
21861         return ret_conv;
21862 }
21863
21864 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
21865         if (!ptr_is_owned(_res)) return;
21866         void* _res_ptr = untag_ptr(_res);
21867         CHECK_ACCESS(_res_ptr);
21868         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
21869         FREE(untag_ptr(_res));
21870         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
21871 }
21872
21873 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
21874         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
21875         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
21876         return tag_ptr(ret_conv, true);
21877 }
21878 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
21879         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
21880         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
21881         return ret_conv;
21882 }
21883
21884 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
21885         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
21886         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
21887         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
21888         return tag_ptr(ret_conv, true);
21889 }
21890
21891 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
21892         LDKChannelFeatures o_conv;
21893         o_conv.inner = untag_ptr(o);
21894         o_conv.is_owned = ptr_is_owned(o);
21895         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21896         o_conv = ChannelFeatures_clone(&o_conv);
21897         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
21898         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
21899         return tag_ptr(ret_conv, true);
21900 }
21901
21902 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
21903         void* e_ptr = untag_ptr(e);
21904         CHECK_ACCESS(e_ptr);
21905         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21906         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21907         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
21908         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
21909         return tag_ptr(ret_conv, true);
21910 }
21911
21912 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
21913         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
21914         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
21915         return ret_conv;
21916 }
21917
21918 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
21919         if (!ptr_is_owned(_res)) return;
21920         void* _res_ptr = untag_ptr(_res);
21921         CHECK_ACCESS(_res_ptr);
21922         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
21923         FREE(untag_ptr(_res));
21924         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
21925 }
21926
21927 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
21928         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
21929         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
21930         return tag_ptr(ret_conv, true);
21931 }
21932 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
21933         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
21934         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
21935         return ret_conv;
21936 }
21937
21938 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
21939         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
21940         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
21941         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
21942         return tag_ptr(ret_conv, true);
21943 }
21944
21945 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
21946         LDKNodeFeatures o_conv;
21947         o_conv.inner = untag_ptr(o);
21948         o_conv.is_owned = ptr_is_owned(o);
21949         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21950         o_conv = NodeFeatures_clone(&o_conv);
21951         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
21952         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
21953         return tag_ptr(ret_conv, true);
21954 }
21955
21956 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
21957         void* e_ptr = untag_ptr(e);
21958         CHECK_ACCESS(e_ptr);
21959         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21960         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21961         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
21962         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
21963         return tag_ptr(ret_conv, true);
21964 }
21965
21966 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
21967         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
21968         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
21969         return ret_conv;
21970 }
21971
21972 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
21973         if (!ptr_is_owned(_res)) return;
21974         void* _res_ptr = untag_ptr(_res);
21975         CHECK_ACCESS(_res_ptr);
21976         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
21977         FREE(untag_ptr(_res));
21978         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
21979 }
21980
21981 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
21982         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
21983         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
21984         return tag_ptr(ret_conv, true);
21985 }
21986 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
21987         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
21988         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
21989         return ret_conv;
21990 }
21991
21992 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
21993         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
21994         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
21995         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
21996         return tag_ptr(ret_conv, true);
21997 }
21998
21999 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
22000         LDKBolt11InvoiceFeatures o_conv;
22001         o_conv.inner = untag_ptr(o);
22002         o_conv.is_owned = ptr_is_owned(o);
22003         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22004         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
22005         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22006         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22007         return tag_ptr(ret_conv, true);
22008 }
22009
22010 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
22011         void* e_ptr = untag_ptr(e);
22012         CHECK_ACCESS(e_ptr);
22013         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22014         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22015         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22016         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
22017         return tag_ptr(ret_conv, true);
22018 }
22019
22020 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22021         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22022         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22023         return ret_conv;
22024 }
22025
22026 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
22027         if (!ptr_is_owned(_res)) return;
22028         void* _res_ptr = untag_ptr(_res);
22029         CHECK_ACCESS(_res_ptr);
22030         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22031         FREE(untag_ptr(_res));
22032         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22033 }
22034
22035 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22036         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22037         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
22038         return tag_ptr(ret_conv, true);
22039 }
22040 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22041         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22042         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22043         return ret_conv;
22044 }
22045
22046 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
22047         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22048         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22049         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22050         return tag_ptr(ret_conv, true);
22051 }
22052
22053 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
22054         LDKBolt12InvoiceFeatures o_conv;
22055         o_conv.inner = untag_ptr(o);
22056         o_conv.is_owned = ptr_is_owned(o);
22057         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22058         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
22059         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22060         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22061         return tag_ptr(ret_conv, true);
22062 }
22063
22064 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
22065         void* e_ptr = untag_ptr(e);
22066         CHECK_ACCESS(e_ptr);
22067         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22068         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22069         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22070         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
22071         return tag_ptr(ret_conv, true);
22072 }
22073
22074 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22075         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22076         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22077         return ret_conv;
22078 }
22079
22080 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
22081         if (!ptr_is_owned(_res)) return;
22082         void* _res_ptr = untag_ptr(_res);
22083         CHECK_ACCESS(_res_ptr);
22084         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22085         FREE(untag_ptr(_res));
22086         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22087 }
22088
22089 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22090         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22091         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
22092         return tag_ptr(ret_conv, true);
22093 }
22094 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22095         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22096         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22097         return ret_conv;
22098 }
22099
22100 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
22101         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22102         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22103         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22104         return tag_ptr(ret_conv, true);
22105 }
22106
22107 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
22108         LDKBlindedHopFeatures o_conv;
22109         o_conv.inner = untag_ptr(o);
22110         o_conv.is_owned = ptr_is_owned(o);
22111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22112         o_conv = BlindedHopFeatures_clone(&o_conv);
22113         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22114         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
22115         return tag_ptr(ret_conv, true);
22116 }
22117
22118 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
22119         void* e_ptr = untag_ptr(e);
22120         CHECK_ACCESS(e_ptr);
22121         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22122         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22123         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22124         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
22125         return tag_ptr(ret_conv, true);
22126 }
22127
22128 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22129         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
22130         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
22131         return ret_conv;
22132 }
22133
22134 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
22135         if (!ptr_is_owned(_res)) return;
22136         void* _res_ptr = untag_ptr(_res);
22137         CHECK_ACCESS(_res_ptr);
22138         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
22139         FREE(untag_ptr(_res));
22140         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
22141 }
22142
22143 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22144         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22145         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
22146         return tag_ptr(ret_conv, true);
22147 }
22148 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22149         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
22150         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22151         return ret_conv;
22152 }
22153
22154 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
22155         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
22156         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22157         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
22158         return tag_ptr(ret_conv, true);
22159 }
22160
22161 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
22162         LDKChannelTypeFeatures o_conv;
22163         o_conv.inner = untag_ptr(o);
22164         o_conv.is_owned = ptr_is_owned(o);
22165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22166         o_conv = ChannelTypeFeatures_clone(&o_conv);
22167         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22168         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
22169         return tag_ptr(ret_conv, true);
22170 }
22171
22172 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
22173         void* e_ptr = untag_ptr(e);
22174         CHECK_ACCESS(e_ptr);
22175         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22176         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22177         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22178         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
22179         return tag_ptr(ret_conv, true);
22180 }
22181
22182 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22183         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
22184         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
22185         return ret_conv;
22186 }
22187
22188 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
22189         if (!ptr_is_owned(_res)) return;
22190         void* _res_ptr = untag_ptr(_res);
22191         CHECK_ACCESS(_res_ptr);
22192         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
22193         FREE(untag_ptr(_res));
22194         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
22195 }
22196
22197 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22198         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22199         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
22200         return tag_ptr(ret_conv, true);
22201 }
22202 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22203         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
22204         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22205         return ret_conv;
22206 }
22207
22208 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
22209         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
22210         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22211         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
22212         return tag_ptr(ret_conv, true);
22213 }
22214
22215 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_ok"))) TS_CResult_OfferIdDecodeErrorZ_ok(uint64_t o) {
22216         LDKOfferId o_conv;
22217         o_conv.inner = untag_ptr(o);
22218         o_conv.is_owned = ptr_is_owned(o);
22219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22220         o_conv = OfferId_clone(&o_conv);
22221         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22222         *ret_conv = CResult_OfferIdDecodeErrorZ_ok(o_conv);
22223         return tag_ptr(ret_conv, true);
22224 }
22225
22226 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_err"))) TS_CResult_OfferIdDecodeErrorZ_err(uint64_t e) {
22227         void* e_ptr = untag_ptr(e);
22228         CHECK_ACCESS(e_ptr);
22229         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22230         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22231         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22232         *ret_conv = CResult_OfferIdDecodeErrorZ_err(e_conv);
22233         return tag_ptr(ret_conv, true);
22234 }
22235
22236 jboolean  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_is_ok"))) TS_CResult_OfferIdDecodeErrorZ_is_ok(uint64_t o) {
22237         LDKCResult_OfferIdDecodeErrorZ* o_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(o);
22238         jboolean ret_conv = CResult_OfferIdDecodeErrorZ_is_ok(o_conv);
22239         return ret_conv;
22240 }
22241
22242 void  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_free"))) TS_CResult_OfferIdDecodeErrorZ_free(uint64_t _res) {
22243         if (!ptr_is_owned(_res)) return;
22244         void* _res_ptr = untag_ptr(_res);
22245         CHECK_ACCESS(_res_ptr);
22246         LDKCResult_OfferIdDecodeErrorZ _res_conv = *(LDKCResult_OfferIdDecodeErrorZ*)(_res_ptr);
22247         FREE(untag_ptr(_res));
22248         CResult_OfferIdDecodeErrorZ_free(_res_conv);
22249 }
22250
22251 static inline uint64_t CResult_OfferIdDecodeErrorZ_clone_ptr(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR arg) {
22252         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22253         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(arg);
22254         return tag_ptr(ret_conv, true);
22255 }
22256 int64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_clone_ptr"))) TS_CResult_OfferIdDecodeErrorZ_clone_ptr(uint64_t arg) {
22257         LDKCResult_OfferIdDecodeErrorZ* arg_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(arg);
22258         int64_t ret_conv = CResult_OfferIdDecodeErrorZ_clone_ptr(arg_conv);
22259         return ret_conv;
22260 }
22261
22262 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_clone"))) TS_CResult_OfferIdDecodeErrorZ_clone(uint64_t orig) {
22263         LDKCResult_OfferIdDecodeErrorZ* orig_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(orig);
22264         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22265         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(orig_conv);
22266         return tag_ptr(ret_conv, true);
22267 }
22268
22269 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_ok() {
22270         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22271         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
22272         return tag_ptr(ret_conv, true);
22273 }
22274
22275 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_err"))) TS_CResult_NoneBolt12SemanticErrorZ_err(uint32_t e) {
22276         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22277         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22278         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
22279         return tag_ptr(ret_conv, true);
22280 }
22281
22282 jboolean  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_is_ok(uint64_t o) {
22283         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
22284         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
22285         return ret_conv;
22286 }
22287
22288 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_free"))) TS_CResult_NoneBolt12SemanticErrorZ_free(uint64_t _res) {
22289         if (!ptr_is_owned(_res)) return;
22290         void* _res_ptr = untag_ptr(_res);
22291         CHECK_ACCESS(_res_ptr);
22292         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
22293         FREE(untag_ptr(_res));
22294         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
22295 }
22296
22297 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
22298         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22299         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
22300         return tag_ptr(ret_conv, true);
22301 }
22302 int64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
22303         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
22304         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
22305         return ret_conv;
22306 }
22307
22308 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone"))) TS_CResult_NoneBolt12SemanticErrorZ_clone(uint64_t orig) {
22309         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
22310         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22311         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
22312         return tag_ptr(ret_conv, true);
22313 }
22314
22315 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_ok"))) TS_CResult_OfferBolt12SemanticErrorZ_ok(uint64_t o) {
22316         LDKOffer o_conv;
22317         o_conv.inner = untag_ptr(o);
22318         o_conv.is_owned = ptr_is_owned(o);
22319         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22320         o_conv = Offer_clone(&o_conv);
22321         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22322         *ret_conv = CResult_OfferBolt12SemanticErrorZ_ok(o_conv);
22323         return tag_ptr(ret_conv, true);
22324 }
22325
22326 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_err"))) TS_CResult_OfferBolt12SemanticErrorZ_err(uint32_t e) {
22327         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22328         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22329         *ret_conv = CResult_OfferBolt12SemanticErrorZ_err(e_conv);
22330         return tag_ptr(ret_conv, true);
22331 }
22332
22333 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_is_ok"))) TS_CResult_OfferBolt12SemanticErrorZ_is_ok(uint64_t o) {
22334         LDKCResult_OfferBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(o);
22335         jboolean ret_conv = CResult_OfferBolt12SemanticErrorZ_is_ok(o_conv);
22336         return ret_conv;
22337 }
22338
22339 void  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_free"))) TS_CResult_OfferBolt12SemanticErrorZ_free(uint64_t _res) {
22340         if (!ptr_is_owned(_res)) return;
22341         void* _res_ptr = untag_ptr(_res);
22342         CHECK_ACCESS(_res_ptr);
22343         LDKCResult_OfferBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferBolt12SemanticErrorZ*)(_res_ptr);
22344         FREE(untag_ptr(_res));
22345         CResult_OfferBolt12SemanticErrorZ_free(_res_conv);
22346 }
22347
22348 static inline uint64_t CResult_OfferBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR arg) {
22349         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22350         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(arg);
22351         return tag_ptr(ret_conv, true);
22352 }
22353 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_OfferBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
22354         LDKCResult_OfferBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(arg);
22355         int64_t ret_conv = CResult_OfferBolt12SemanticErrorZ_clone_ptr(arg_conv);
22356         return ret_conv;
22357 }
22358
22359 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_clone"))) TS_CResult_OfferBolt12SemanticErrorZ_clone(uint64_t orig) {
22360         LDKCResult_OfferBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(orig);
22361         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22362         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(orig_conv);
22363         return tag_ptr(ret_conv, true);
22364 }
22365
22366 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
22367         LDKInvoiceRequestWithDerivedPayerIdBuilder o_conv;
22368         o_conv.inner = untag_ptr(o);
22369         o_conv.is_owned = ptr_is_owned(o);
22370         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22371         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
22372         
22373         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
22374         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
22375         return tag_ptr(ret_conv, true);
22376 }
22377
22378 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(uint32_t e) {
22379         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22380         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
22381         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
22382         return tag_ptr(ret_conv, true);
22383 }
22384
22385 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
22386         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
22387         jboolean ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
22388         return ret_conv;
22389 }
22390
22391 void  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
22392         if (!ptr_is_owned(_res)) return;
22393         void* _res_ptr = untag_ptr(_res);
22394         CHECK_ACCESS(_res_ptr);
22395         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
22396         FREE(untag_ptr(_res));
22397         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
22398 }
22399
22400 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
22401         LDKInvoiceRequestWithExplicitPayerIdBuilder o_conv;
22402         o_conv.inner = untag_ptr(o);
22403         o_conv.is_owned = ptr_is_owned(o);
22404         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22405         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
22406         
22407         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
22408         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
22409         return tag_ptr(ret_conv, true);
22410 }
22411
22412 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(uint32_t e) {
22413         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22414         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
22415         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
22416         return tag_ptr(ret_conv, true);
22417 }
22418
22419 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
22420         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
22421         jboolean ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
22422         return ret_conv;
22423 }
22424
22425 void  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
22426         if (!ptr_is_owned(_res)) return;
22427         void* _res_ptr = untag_ptr(_res);
22428         CHECK_ACCESS(_res_ptr);
22429         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
22430         FREE(untag_ptr(_res));
22431         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
22432 }
22433
22434 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_ok"))) TS_CResult_OfferBolt12ParseErrorZ_ok(uint64_t o) {
22435         LDKOffer o_conv;
22436         o_conv.inner = untag_ptr(o);
22437         o_conv.is_owned = ptr_is_owned(o);
22438         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22439         o_conv = Offer_clone(&o_conv);
22440         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22441         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
22442         return tag_ptr(ret_conv, true);
22443 }
22444
22445 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_err"))) TS_CResult_OfferBolt12ParseErrorZ_err(uint64_t e) {
22446         LDKBolt12ParseError e_conv;
22447         e_conv.inner = untag_ptr(e);
22448         e_conv.is_owned = ptr_is_owned(e);
22449         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22450         e_conv = Bolt12ParseError_clone(&e_conv);
22451         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22452         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
22453         return tag_ptr(ret_conv, true);
22454 }
22455
22456 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_is_ok"))) TS_CResult_OfferBolt12ParseErrorZ_is_ok(uint64_t o) {
22457         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
22458         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
22459         return ret_conv;
22460 }
22461
22462 void  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_free"))) TS_CResult_OfferBolt12ParseErrorZ_free(uint64_t _res) {
22463         if (!ptr_is_owned(_res)) return;
22464         void* _res_ptr = untag_ptr(_res);
22465         CHECK_ACCESS(_res_ptr);
22466         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
22467         FREE(untag_ptr(_res));
22468         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
22469 }
22470
22471 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
22472         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22473         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
22474         return tag_ptr(ret_conv, true);
22475 }
22476 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone_ptr"))) TS_CResult_OfferBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
22477         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
22478         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
22479         return ret_conv;
22480 }
22481
22482 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone"))) TS_CResult_OfferBolt12ParseErrorZ_clone(uint64_t orig) {
22483         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
22484         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22485         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
22486         return tag_ptr(ret_conv, true);
22487 }
22488
22489 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
22490         LDKNodeId o_conv;
22491         o_conv.inner = untag_ptr(o);
22492         o_conv.is_owned = ptr_is_owned(o);
22493         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22494         o_conv = NodeId_clone(&o_conv);
22495         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22496         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
22497         return tag_ptr(ret_conv, true);
22498 }
22499
22500 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
22501         void* e_ptr = untag_ptr(e);
22502         CHECK_ACCESS(e_ptr);
22503         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22504         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22505         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22506         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
22507         return tag_ptr(ret_conv, true);
22508 }
22509
22510 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
22511         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
22512         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
22513         return ret_conv;
22514 }
22515
22516 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
22517         if (!ptr_is_owned(_res)) return;
22518         void* _res_ptr = untag_ptr(_res);
22519         CHECK_ACCESS(_res_ptr);
22520         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
22521         FREE(untag_ptr(_res));
22522         CResult_NodeIdDecodeErrorZ_free(_res_conv);
22523 }
22524
22525 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
22526         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22527         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
22528         return tag_ptr(ret_conv, true);
22529 }
22530 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
22531         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
22532         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
22533         return ret_conv;
22534 }
22535
22536 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
22537         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
22538         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22539         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
22540         return tag_ptr(ret_conv, true);
22541 }
22542
22543 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
22544         LDKPublicKey o_ref;
22545         CHECK(o->arr_len == 33);
22546         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
22547         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22548         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
22549         return tag_ptr(ret_conv, true);
22550 }
22551
22552 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_err(uint32_t e) {
22553         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
22554         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22555         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
22556         return tag_ptr(ret_conv, true);
22557 }
22558
22559 jboolean  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_is_ok(uint64_t o) {
22560         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
22561         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
22562         return ret_conv;
22563 }
22564
22565 void  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_free"))) TS_CResult_PublicKeySecp256k1ErrorZ_free(uint64_t _res) {
22566         if (!ptr_is_owned(_res)) return;
22567         void* _res_ptr = untag_ptr(_res);
22568         CHECK_ACCESS(_res_ptr);
22569         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
22570         FREE(untag_ptr(_res));
22571         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
22572 }
22573
22574 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
22575         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22576         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
22577         return tag_ptr(ret_conv, true);
22578 }
22579 int64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
22580         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
22581         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
22582         return ret_conv;
22583 }
22584
22585 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone(uint64_t orig) {
22586         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
22587         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22588         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
22589         return tag_ptr(ret_conv, true);
22590 }
22591
22592 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
22593         void* o_ptr = untag_ptr(o);
22594         CHECK_ACCESS(o_ptr);
22595         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
22596         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
22597         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22598         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
22599         uint64_t ret_ref = tag_ptr(ret_copy, true);
22600         return ret_ref;
22601 }
22602
22603 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
22604         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22605         *ret_copy = COption_NetworkUpdateZ_none();
22606         uint64_t ret_ref = tag_ptr(ret_copy, true);
22607         return ret_ref;
22608 }
22609
22610 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
22611         if (!ptr_is_owned(_res)) return;
22612         void* _res_ptr = untag_ptr(_res);
22613         CHECK_ACCESS(_res_ptr);
22614         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
22615         FREE(untag_ptr(_res));
22616         COption_NetworkUpdateZ_free(_res_conv);
22617 }
22618
22619 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
22620         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22621         *ret_copy = COption_NetworkUpdateZ_clone(arg);
22622         uint64_t ret_ref = tag_ptr(ret_copy, true);
22623         return ret_ref;
22624 }
22625 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
22626         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
22627         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
22628         return ret_conv;
22629 }
22630
22631 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
22632         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
22633         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22634         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
22635         uint64_t ret_ref = tag_ptr(ret_copy, true);
22636         return ret_ref;
22637 }
22638
22639 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
22640         void* o_ptr = untag_ptr(o);
22641         CHECK_ACCESS(o_ptr);
22642         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
22643         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
22644         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22645         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
22646         return tag_ptr(ret_conv, true);
22647 }
22648
22649 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
22650         void* e_ptr = untag_ptr(e);
22651         CHECK_ACCESS(e_ptr);
22652         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22653         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22654         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22655         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
22656         return tag_ptr(ret_conv, true);
22657 }
22658
22659 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
22660         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
22661         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
22662         return ret_conv;
22663 }
22664
22665 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
22666         if (!ptr_is_owned(_res)) return;
22667         void* _res_ptr = untag_ptr(_res);
22668         CHECK_ACCESS(_res_ptr);
22669         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
22670         FREE(untag_ptr(_res));
22671         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
22672 }
22673
22674 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
22675         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22676         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
22677         return tag_ptr(ret_conv, true);
22678 }
22679 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
22680         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
22681         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
22682         return ret_conv;
22683 }
22684
22685 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
22686         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
22687         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22688         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
22689         return tag_ptr(ret_conv, true);
22690 }
22691
22692 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
22693         void* o_ptr = untag_ptr(o);
22694         CHECK_ACCESS(o_ptr);
22695         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
22696         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
22697                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22698                 LDKUtxoLookup_JCalls_cloned(&o_conv);
22699         }
22700         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
22701         *ret_copy = COption_UtxoLookupZ_some(o_conv);
22702         uint64_t ret_ref = tag_ptr(ret_copy, true);
22703         return ret_ref;
22704 }
22705
22706 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
22707         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
22708         *ret_copy = COption_UtxoLookupZ_none();
22709         uint64_t ret_ref = tag_ptr(ret_copy, true);
22710         return ret_ref;
22711 }
22712
22713 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
22714         if (!ptr_is_owned(_res)) return;
22715         void* _res_ptr = untag_ptr(_res);
22716         CHECK_ACCESS(_res_ptr);
22717         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
22718         FREE(untag_ptr(_res));
22719         COption_UtxoLookupZ_free(_res_conv);
22720 }
22721
22722 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
22723         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22724         *ret_conv = CResult_NoneLightningErrorZ_ok();
22725         return tag_ptr(ret_conv, true);
22726 }
22727
22728 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
22729         LDKLightningError e_conv;
22730         e_conv.inner = untag_ptr(e);
22731         e_conv.is_owned = ptr_is_owned(e);
22732         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22733         e_conv = LightningError_clone(&e_conv);
22734         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22735         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
22736         return tag_ptr(ret_conv, true);
22737 }
22738
22739 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
22740         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
22741         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
22742         return ret_conv;
22743 }
22744
22745 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
22746         if (!ptr_is_owned(_res)) return;
22747         void* _res_ptr = untag_ptr(_res);
22748         CHECK_ACCESS(_res_ptr);
22749         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
22750         FREE(untag_ptr(_res));
22751         CResult_NoneLightningErrorZ_free(_res_conv);
22752 }
22753
22754 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
22755         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22756         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
22757         return tag_ptr(ret_conv, true);
22758 }
22759 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
22760         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
22761         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
22762         return ret_conv;
22763 }
22764
22765 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
22766         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
22767         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22768         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
22769         return tag_ptr(ret_conv, true);
22770 }
22771
22772 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
22773         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
22774         *ret_conv = CResult_boolLightningErrorZ_ok(o);
22775         return tag_ptr(ret_conv, true);
22776 }
22777
22778 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
22779         LDKLightningError e_conv;
22780         e_conv.inner = untag_ptr(e);
22781         e_conv.is_owned = ptr_is_owned(e);
22782         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22783         e_conv = LightningError_clone(&e_conv);
22784         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
22785         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
22786         return tag_ptr(ret_conv, true);
22787 }
22788
22789 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
22790         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
22791         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
22792         return ret_conv;
22793 }
22794
22795 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
22796         if (!ptr_is_owned(_res)) return;
22797         void* _res_ptr = untag_ptr(_res);
22798         CHECK_ACCESS(_res_ptr);
22799         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
22800         FREE(untag_ptr(_res));
22801         CResult_boolLightningErrorZ_free(_res_conv);
22802 }
22803
22804 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
22805         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
22806         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
22807         return tag_ptr(ret_conv, true);
22808 }
22809 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
22810         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
22811         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
22812         return ret_conv;
22813 }
22814
22815 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
22816         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
22817         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
22818         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
22819         return tag_ptr(ret_conv, true);
22820 }
22821
22822 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
22823         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
22824         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
22825         return tag_ptr(ret_conv, true);
22826 }
22827 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
22828         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
22829         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
22830         return ret_conv;
22831 }
22832
22833 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
22834         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
22835         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
22836         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
22837         return tag_ptr(ret_conv, true);
22838 }
22839
22840 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
22841         LDKChannelAnnouncement a_conv;
22842         a_conv.inner = untag_ptr(a);
22843         a_conv.is_owned = ptr_is_owned(a);
22844         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22845         a_conv = ChannelAnnouncement_clone(&a_conv);
22846         LDKChannelUpdate b_conv;
22847         b_conv.inner = untag_ptr(b);
22848         b_conv.is_owned = ptr_is_owned(b);
22849         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22850         b_conv = ChannelUpdate_clone(&b_conv);
22851         LDKChannelUpdate c_conv;
22852         c_conv.inner = untag_ptr(c);
22853         c_conv.is_owned = ptr_is_owned(c);
22854         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
22855         c_conv = ChannelUpdate_clone(&c_conv);
22856         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
22857         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
22858         return tag_ptr(ret_conv, true);
22859 }
22860
22861 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
22862         if (!ptr_is_owned(_res)) return;
22863         void* _res_ptr = untag_ptr(_res);
22864         CHECK_ACCESS(_res_ptr);
22865         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
22866         FREE(untag_ptr(_res));
22867         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
22868 }
22869
22870 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
22871         void* o_ptr = untag_ptr(o);
22872         CHECK_ACCESS(o_ptr);
22873         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
22874         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
22875         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
22876         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
22877         uint64_t ret_ref = tag_ptr(ret_copy, true);
22878         return ret_ref;
22879 }
22880
22881 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
22882         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
22883         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
22884         uint64_t ret_ref = tag_ptr(ret_copy, true);
22885         return ret_ref;
22886 }
22887
22888 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
22889         if (!ptr_is_owned(_res)) return;
22890         void* _res_ptr = untag_ptr(_res);
22891         CHECK_ACCESS(_res_ptr);
22892         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
22893         FREE(untag_ptr(_res));
22894         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
22895 }
22896
22897 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
22898         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
22899         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
22900         uint64_t ret_ref = tag_ptr(ret_copy, true);
22901         return ret_ref;
22902 }
22903 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
22904         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
22905         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
22906         return ret_conv;
22907 }
22908
22909 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
22910         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
22911         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
22912         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
22913         uint64_t ret_ref = tag_ptr(ret_copy, true);
22914         return ret_ref;
22915 }
22916
22917 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
22918         LDKCVec_MessageSendEventZ _res_constr;
22919         _res_constr.datalen = _res->arr_len;
22920         if (_res_constr.datalen > 0)
22921                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
22922         else
22923                 _res_constr.data = NULL;
22924         uint64_t* _res_vals = _res->elems;
22925         for (size_t s = 0; s < _res_constr.datalen; s++) {
22926                 uint64_t _res_conv_18 = _res_vals[s];
22927                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
22928                 CHECK_ACCESS(_res_conv_18_ptr);
22929                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
22930                 FREE(untag_ptr(_res_conv_18));
22931                 _res_constr.data[s] = _res_conv_18_conv;
22932         }
22933         FREE(_res);
22934         CVec_MessageSendEventZ_free(_res_constr);
22935 }
22936
22937 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
22938         LDKChannelUpdateInfo o_conv;
22939         o_conv.inner = untag_ptr(o);
22940         o_conv.is_owned = ptr_is_owned(o);
22941         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22942         o_conv = ChannelUpdateInfo_clone(&o_conv);
22943         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
22944         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
22945         return tag_ptr(ret_conv, true);
22946 }
22947
22948 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
22949         void* e_ptr = untag_ptr(e);
22950         CHECK_ACCESS(e_ptr);
22951         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22952         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22953         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
22954         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
22955         return tag_ptr(ret_conv, true);
22956 }
22957
22958 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
22959         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
22960         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
22961         return ret_conv;
22962 }
22963
22964 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
22965         if (!ptr_is_owned(_res)) return;
22966         void* _res_ptr = untag_ptr(_res);
22967         CHECK_ACCESS(_res_ptr);
22968         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
22969         FREE(untag_ptr(_res));
22970         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
22971 }
22972
22973 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
22974         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
22975         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
22976         return tag_ptr(ret_conv, true);
22977 }
22978 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
22979         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
22980         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
22981         return ret_conv;
22982 }
22983
22984 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
22985         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
22986         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
22987         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
22988         return tag_ptr(ret_conv, true);
22989 }
22990
22991 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
22992         LDKChannelInfo o_conv;
22993         o_conv.inner = untag_ptr(o);
22994         o_conv.is_owned = ptr_is_owned(o);
22995         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22996         o_conv = ChannelInfo_clone(&o_conv);
22997         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
22998         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
22999         return tag_ptr(ret_conv, true);
23000 }
23001
23002 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
23003         void* e_ptr = untag_ptr(e);
23004         CHECK_ACCESS(e_ptr);
23005         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23006         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23007         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23008         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
23009         return tag_ptr(ret_conv, true);
23010 }
23011
23012 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
23013         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
23014         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
23015         return ret_conv;
23016 }
23017
23018 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
23019         if (!ptr_is_owned(_res)) return;
23020         void* _res_ptr = untag_ptr(_res);
23021         CHECK_ACCESS(_res_ptr);
23022         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
23023         FREE(untag_ptr(_res));
23024         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
23025 }
23026
23027 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
23028         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23029         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
23030         return tag_ptr(ret_conv, true);
23031 }
23032 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
23033         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
23034         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
23035         return ret_conv;
23036 }
23037
23038 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
23039         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
23040         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23041         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
23042         return tag_ptr(ret_conv, true);
23043 }
23044
23045 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
23046         LDKRoutingFees o_conv;
23047         o_conv.inner = untag_ptr(o);
23048         o_conv.is_owned = ptr_is_owned(o);
23049         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23050         o_conv = RoutingFees_clone(&o_conv);
23051         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23052         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
23053         return tag_ptr(ret_conv, true);
23054 }
23055
23056 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
23057         void* e_ptr = untag_ptr(e);
23058         CHECK_ACCESS(e_ptr);
23059         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23060         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23061         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23062         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
23063         return tag_ptr(ret_conv, true);
23064 }
23065
23066 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
23067         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
23068         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
23069         return ret_conv;
23070 }
23071
23072 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
23073         if (!ptr_is_owned(_res)) return;
23074         void* _res_ptr = untag_ptr(_res);
23075         CHECK_ACCESS(_res_ptr);
23076         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
23077         FREE(untag_ptr(_res));
23078         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
23079 }
23080
23081 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
23082         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23083         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
23084         return tag_ptr(ret_conv, true);
23085 }
23086 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
23087         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
23088         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
23089         return ret_conv;
23090 }
23091
23092 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
23093         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
23094         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23095         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
23096         return tag_ptr(ret_conv, true);
23097 }
23098
23099 void  __attribute__((export_name("TS_CVec_SocketAddressZ_free"))) TS_CVec_SocketAddressZ_free(uint64_tArray _res) {
23100         LDKCVec_SocketAddressZ _res_constr;
23101         _res_constr.datalen = _res->arr_len;
23102         if (_res_constr.datalen > 0)
23103                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
23104         else
23105                 _res_constr.data = NULL;
23106         uint64_t* _res_vals = _res->elems;
23107         for (size_t p = 0; p < _res_constr.datalen; p++) {
23108                 uint64_t _res_conv_15 = _res_vals[p];
23109                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
23110                 CHECK_ACCESS(_res_conv_15_ptr);
23111                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
23112                 FREE(untag_ptr(_res_conv_15));
23113                 _res_constr.data[p] = _res_conv_15_conv;
23114         }
23115         FREE(_res);
23116         CVec_SocketAddressZ_free(_res_constr);
23117 }
23118
23119 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
23120         LDKNodeAnnouncementInfo o_conv;
23121         o_conv.inner = untag_ptr(o);
23122         o_conv.is_owned = ptr_is_owned(o);
23123         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23124         o_conv = NodeAnnouncementInfo_clone(&o_conv);
23125         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23126         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
23127         return tag_ptr(ret_conv, true);
23128 }
23129
23130 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
23131         void* e_ptr = untag_ptr(e);
23132         CHECK_ACCESS(e_ptr);
23133         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23134         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23135         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23136         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
23137         return tag_ptr(ret_conv, true);
23138 }
23139
23140 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
23141         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
23142         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
23143         return ret_conv;
23144 }
23145
23146 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
23147         if (!ptr_is_owned(_res)) return;
23148         void* _res_ptr = untag_ptr(_res);
23149         CHECK_ACCESS(_res_ptr);
23150         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
23151         FREE(untag_ptr(_res));
23152         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
23153 }
23154
23155 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
23156         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23157         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
23158         return tag_ptr(ret_conv, true);
23159 }
23160 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
23161         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
23162         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
23163         return ret_conv;
23164 }
23165
23166 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
23167         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
23168         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23169         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
23170         return tag_ptr(ret_conv, true);
23171 }
23172
23173 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
23174         LDKNodeAlias o_conv;
23175         o_conv.inner = untag_ptr(o);
23176         o_conv.is_owned = ptr_is_owned(o);
23177         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23178         o_conv = NodeAlias_clone(&o_conv);
23179         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23180         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
23181         return tag_ptr(ret_conv, true);
23182 }
23183
23184 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
23185         void* e_ptr = untag_ptr(e);
23186         CHECK_ACCESS(e_ptr);
23187         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23188         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23189         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23190         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
23191         return tag_ptr(ret_conv, true);
23192 }
23193
23194 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
23195         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
23196         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
23197         return ret_conv;
23198 }
23199
23200 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
23201         if (!ptr_is_owned(_res)) return;
23202         void* _res_ptr = untag_ptr(_res);
23203         CHECK_ACCESS(_res_ptr);
23204         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
23205         FREE(untag_ptr(_res));
23206         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
23207 }
23208
23209 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
23210         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23211         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
23212         return tag_ptr(ret_conv, true);
23213 }
23214 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
23215         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
23216         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
23217         return ret_conv;
23218 }
23219
23220 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
23221         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
23222         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23223         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
23224         return tag_ptr(ret_conv, true);
23225 }
23226
23227 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
23228         LDKNodeInfo o_conv;
23229         o_conv.inner = untag_ptr(o);
23230         o_conv.is_owned = ptr_is_owned(o);
23231         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23232         o_conv = NodeInfo_clone(&o_conv);
23233         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23234         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
23235         return tag_ptr(ret_conv, true);
23236 }
23237
23238 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
23239         void* e_ptr = untag_ptr(e);
23240         CHECK_ACCESS(e_ptr);
23241         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23242         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23243         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23244         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
23245         return tag_ptr(ret_conv, true);
23246 }
23247
23248 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
23249         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
23250         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
23251         return ret_conv;
23252 }
23253
23254 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
23255         if (!ptr_is_owned(_res)) return;
23256         void* _res_ptr = untag_ptr(_res);
23257         CHECK_ACCESS(_res_ptr);
23258         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
23259         FREE(untag_ptr(_res));
23260         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
23261 }
23262
23263 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
23264         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23265         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
23266         return tag_ptr(ret_conv, true);
23267 }
23268 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
23269         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
23270         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
23271         return ret_conv;
23272 }
23273
23274 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
23275         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
23276         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23277         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
23278         return tag_ptr(ret_conv, true);
23279 }
23280
23281 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
23282         LDKNetworkGraph o_conv;
23283         o_conv.inner = untag_ptr(o);
23284         o_conv.is_owned = ptr_is_owned(o);
23285         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23286         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
23287         
23288         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23289         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
23290         return tag_ptr(ret_conv, true);
23291 }
23292
23293 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
23294         void* e_ptr = untag_ptr(e);
23295         CHECK_ACCESS(e_ptr);
23296         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23297         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23298         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23299         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
23300         return tag_ptr(ret_conv, true);
23301 }
23302
23303 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
23304         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
23305         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
23306         return ret_conv;
23307 }
23308
23309 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
23310         if (!ptr_is_owned(_res)) return;
23311         void* _res_ptr = untag_ptr(_res);
23312         CHECK_ACCESS(_res_ptr);
23313         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
23314         FREE(untag_ptr(_res));
23315         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
23316 }
23317
23318 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_some"))) TS_COption_CVec_SocketAddressZZ_some(uint64_tArray o) {
23319         LDKCVec_SocketAddressZ o_constr;
23320         o_constr.datalen = o->arr_len;
23321         if (o_constr.datalen > 0)
23322                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
23323         else
23324                 o_constr.data = NULL;
23325         uint64_t* o_vals = o->elems;
23326         for (size_t p = 0; p < o_constr.datalen; p++) {
23327                 uint64_t o_conv_15 = o_vals[p];
23328                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
23329                 CHECK_ACCESS(o_conv_15_ptr);
23330                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
23331                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
23332                 o_constr.data[p] = o_conv_15_conv;
23333         }
23334         FREE(o);
23335         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23336         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
23337         uint64_t ret_ref = tag_ptr(ret_copy, true);
23338         return ret_ref;
23339 }
23340
23341 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_none"))) TS_COption_CVec_SocketAddressZZ_none() {
23342         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23343         *ret_copy = COption_CVec_SocketAddressZZ_none();
23344         uint64_t ret_ref = tag_ptr(ret_copy, true);
23345         return ret_ref;
23346 }
23347
23348 void  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_free"))) TS_COption_CVec_SocketAddressZZ_free(uint64_t _res) {
23349         if (!ptr_is_owned(_res)) return;
23350         void* _res_ptr = untag_ptr(_res);
23351         CHECK_ACCESS(_res_ptr);
23352         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
23353         FREE(untag_ptr(_res));
23354         COption_CVec_SocketAddressZZ_free(_res_conv);
23355 }
23356
23357 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
23358         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23359         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
23360         uint64_t ret_ref = tag_ptr(ret_copy, true);
23361         return ret_ref;
23362 }
23363 int64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone_ptr"))) TS_COption_CVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
23364         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
23365         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
23366         return ret_conv;
23367 }
23368
23369 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone"))) TS_COption_CVec_SocketAddressZZ_clone(uint64_t orig) {
23370         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
23371         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23372         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
23373         uint64_t ret_ref = tag_ptr(ret_copy, true);
23374         return ret_ref;
23375 }
23376
23377 uint64_t  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_ok"))) TS_CResult_u64ShortChannelIdErrorZ_ok(int64_t o) {
23378         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
23379         *ret_conv = CResult_u64ShortChannelIdErrorZ_ok(o);
23380         return tag_ptr(ret_conv, true);
23381 }
23382
23383 uint64_t  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_err"))) TS_CResult_u64ShortChannelIdErrorZ_err(uint32_t e) {
23384         LDKShortChannelIdError e_conv = LDKShortChannelIdError_from_js(e);
23385         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
23386         *ret_conv = CResult_u64ShortChannelIdErrorZ_err(e_conv);
23387         return tag_ptr(ret_conv, true);
23388 }
23389
23390 jboolean  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_is_ok"))) TS_CResult_u64ShortChannelIdErrorZ_is_ok(uint64_t o) {
23391         LDKCResult_u64ShortChannelIdErrorZ* o_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(o);
23392         jboolean ret_conv = CResult_u64ShortChannelIdErrorZ_is_ok(o_conv);
23393         return ret_conv;
23394 }
23395
23396 void  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_free"))) TS_CResult_u64ShortChannelIdErrorZ_free(uint64_t _res) {
23397         if (!ptr_is_owned(_res)) return;
23398         void* _res_ptr = untag_ptr(_res);
23399         CHECK_ACCESS(_res_ptr);
23400         LDKCResult_u64ShortChannelIdErrorZ _res_conv = *(LDKCResult_u64ShortChannelIdErrorZ*)(_res_ptr);
23401         FREE(untag_ptr(_res));
23402         CResult_u64ShortChannelIdErrorZ_free(_res_conv);
23403 }
23404
23405 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_ok(uint64_t o) {
23406         LDKPendingHTLCInfo o_conv;
23407         o_conv.inner = untag_ptr(o);
23408         o_conv.is_owned = ptr_is_owned(o);
23409         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23410         o_conv = PendingHTLCInfo_clone(&o_conv);
23411         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23412         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
23413         return tag_ptr(ret_conv, true);
23414 }
23415
23416 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_err"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_err(uint64_t e) {
23417         LDKInboundHTLCErr e_conv;
23418         e_conv.inner = untag_ptr(e);
23419         e_conv.is_owned = ptr_is_owned(e);
23420         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23421         e_conv = InboundHTLCErr_clone(&e_conv);
23422         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23423         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
23424         return tag_ptr(ret_conv, true);
23425 }
23426
23427 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(uint64_t o) {
23428         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
23429         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
23430         return ret_conv;
23431 }
23432
23433 void  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_free"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_free(uint64_t _res) {
23434         if (!ptr_is_owned(_res)) return;
23435         void* _res_ptr = untag_ptr(_res);
23436         CHECK_ACCESS(_res_ptr);
23437         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
23438         FREE(untag_ptr(_res));
23439         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
23440 }
23441
23442 static inline uint64_t CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR arg) {
23443         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23444         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(arg);
23445         return tag_ptr(ret_conv, true);
23446 }
23447 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(uint64_t arg) {
23448         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* arg_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(arg);
23449         int64_t ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(arg_conv);
23450         return ret_conv;
23451 }
23452
23453 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_clone"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_clone(uint64_t orig) {
23454         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* orig_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(orig);
23455         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23456         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig_conv);
23457         return tag_ptr(ret_conv, true);
23458 }
23459
23460 void  __attribute__((export_name("TS_CVec_HTLCOutputInCommitmentZ_free"))) TS_CVec_HTLCOutputInCommitmentZ_free(uint64_tArray _res) {
23461         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
23462         _res_constr.datalen = _res->arr_len;
23463         if (_res_constr.datalen > 0)
23464                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
23465         else
23466                 _res_constr.data = NULL;
23467         uint64_t* _res_vals = _res->elems;
23468         for (size_t y = 0; y < _res_constr.datalen; y++) {
23469                 uint64_t _res_conv_24 = _res_vals[y];
23470                 LDKHTLCOutputInCommitment _res_conv_24_conv;
23471                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
23472                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
23473                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
23474                 _res_constr.data[y] = _res_conv_24_conv;
23475         }
23476         FREE(_res);
23477         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
23478 }
23479
23480 void  __attribute__((export_name("TS_CVec_HTLCDescriptorZ_free"))) TS_CVec_HTLCDescriptorZ_free(uint64_tArray _res) {
23481         LDKCVec_HTLCDescriptorZ _res_constr;
23482         _res_constr.datalen = _res->arr_len;
23483         if (_res_constr.datalen > 0)
23484                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
23485         else
23486                 _res_constr.data = NULL;
23487         uint64_t* _res_vals = _res->elems;
23488         for (size_t q = 0; q < _res_constr.datalen; q++) {
23489                 uint64_t _res_conv_16 = _res_vals[q];
23490                 LDKHTLCDescriptor _res_conv_16_conv;
23491                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23492                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23493                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23494                 _res_constr.data[q] = _res_conv_16_conv;
23495         }
23496         FREE(_res);
23497         CVec_HTLCDescriptorZ_free(_res_constr);
23498 }
23499
23500 void  __attribute__((export_name("TS_CVec_UtxoZ_free"))) TS_CVec_UtxoZ_free(uint64_tArray _res) {
23501         LDKCVec_UtxoZ _res_constr;
23502         _res_constr.datalen = _res->arr_len;
23503         if (_res_constr.datalen > 0)
23504                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
23505         else
23506                 _res_constr.data = NULL;
23507         uint64_t* _res_vals = _res->elems;
23508         for (size_t g = 0; g < _res_constr.datalen; g++) {
23509                 uint64_t _res_conv_6 = _res_vals[g];
23510                 LDKUtxo _res_conv_6_conv;
23511                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
23512                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
23513                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
23514                 _res_constr.data[g] = _res_conv_6_conv;
23515         }
23516         FREE(_res);
23517         CVec_UtxoZ_free(_res_constr);
23518 }
23519
23520 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_some"))) TS_COption_TxOutZ_some(uint64_t o) {
23521         void* o_ptr = untag_ptr(o);
23522         CHECK_ACCESS(o_ptr);
23523         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
23524         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
23525         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23526         *ret_copy = COption_TxOutZ_some(o_conv);
23527         uint64_t ret_ref = tag_ptr(ret_copy, true);
23528         return ret_ref;
23529 }
23530
23531 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_none"))) TS_COption_TxOutZ_none() {
23532         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23533         *ret_copy = COption_TxOutZ_none();
23534         uint64_t ret_ref = tag_ptr(ret_copy, true);
23535         return ret_ref;
23536 }
23537
23538 void  __attribute__((export_name("TS_COption_TxOutZ_free"))) TS_COption_TxOutZ_free(uint64_t _res) {
23539         if (!ptr_is_owned(_res)) return;
23540         void* _res_ptr = untag_ptr(_res);
23541         CHECK_ACCESS(_res_ptr);
23542         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
23543         FREE(untag_ptr(_res));
23544         COption_TxOutZ_free(_res_conv);
23545 }
23546
23547 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
23548         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23549         *ret_copy = COption_TxOutZ_clone(arg);
23550         uint64_t ret_ref = tag_ptr(ret_copy, true);
23551         return ret_ref;
23552 }
23553 int64_t  __attribute__((export_name("TS_COption_TxOutZ_clone_ptr"))) TS_COption_TxOutZ_clone_ptr(uint64_t arg) {
23554         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
23555         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
23556         return ret_conv;
23557 }
23558
23559 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_clone"))) TS_COption_TxOutZ_clone(uint64_t orig) {
23560         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
23561         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23562         *ret_copy = COption_TxOutZ_clone(orig_conv);
23563         uint64_t ret_ref = tag_ptr(ret_copy, true);
23564         return ret_ref;
23565 }
23566
23567 void  __attribute__((export_name("TS_CVec_InputZ_free"))) TS_CVec_InputZ_free(uint64_tArray _res) {
23568         LDKCVec_InputZ _res_constr;
23569         _res_constr.datalen = _res->arr_len;
23570         if (_res_constr.datalen > 0)
23571                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
23572         else
23573                 _res_constr.data = NULL;
23574         uint64_t* _res_vals = _res->elems;
23575         for (size_t h = 0; h < _res_constr.datalen; h++) {
23576                 uint64_t _res_conv_7 = _res_vals[h];
23577                 LDKInput _res_conv_7_conv;
23578                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
23579                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
23580                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
23581                 _res_constr.data[h] = _res_conv_7_conv;
23582         }
23583         FREE(_res);
23584         CVec_InputZ_free(_res_constr);
23585 }
23586
23587 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_ok"))) TS_CResult_CoinSelectionNoneZ_ok(uint64_t o) {
23588         LDKCoinSelection o_conv;
23589         o_conv.inner = untag_ptr(o);
23590         o_conv.is_owned = ptr_is_owned(o);
23591         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23592         o_conv = CoinSelection_clone(&o_conv);
23593         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23594         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
23595         return tag_ptr(ret_conv, true);
23596 }
23597
23598 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_err"))) TS_CResult_CoinSelectionNoneZ_err() {
23599         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23600         *ret_conv = CResult_CoinSelectionNoneZ_err();
23601         return tag_ptr(ret_conv, true);
23602 }
23603
23604 jboolean  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_is_ok"))) TS_CResult_CoinSelectionNoneZ_is_ok(uint64_t o) {
23605         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
23606         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
23607         return ret_conv;
23608 }
23609
23610 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_free"))) TS_CResult_CoinSelectionNoneZ_free(uint64_t _res) {
23611         if (!ptr_is_owned(_res)) return;
23612         void* _res_ptr = untag_ptr(_res);
23613         CHECK_ACCESS(_res_ptr);
23614         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
23615         FREE(untag_ptr(_res));
23616         CResult_CoinSelectionNoneZ_free(_res_conv);
23617 }
23618
23619 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
23620         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23621         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
23622         return tag_ptr(ret_conv, true);
23623 }
23624 int64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone_ptr"))) TS_CResult_CoinSelectionNoneZ_clone_ptr(uint64_t arg) {
23625         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
23626         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
23627         return ret_conv;
23628 }
23629
23630 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone"))) TS_CResult_CoinSelectionNoneZ_clone(uint64_t orig) {
23631         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
23632         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23633         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
23634         return tag_ptr(ret_conv, true);
23635 }
23636
23637 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_ok"))) TS_CResult_CVec_UtxoZNoneZ_ok(uint64_tArray o) {
23638         LDKCVec_UtxoZ o_constr;
23639         o_constr.datalen = o->arr_len;
23640         if (o_constr.datalen > 0)
23641                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
23642         else
23643                 o_constr.data = NULL;
23644         uint64_t* o_vals = o->elems;
23645         for (size_t g = 0; g < o_constr.datalen; g++) {
23646                 uint64_t o_conv_6 = o_vals[g];
23647                 LDKUtxo o_conv_6_conv;
23648                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
23649                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
23650                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
23651                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
23652                 o_constr.data[g] = o_conv_6_conv;
23653         }
23654         FREE(o);
23655         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23656         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
23657         return tag_ptr(ret_conv, true);
23658 }
23659
23660 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_err"))) TS_CResult_CVec_UtxoZNoneZ_err() {
23661         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23662         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
23663         return tag_ptr(ret_conv, true);
23664 }
23665
23666 jboolean  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_is_ok"))) TS_CResult_CVec_UtxoZNoneZ_is_ok(uint64_t o) {
23667         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
23668         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
23669         return ret_conv;
23670 }
23671
23672 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_free"))) TS_CResult_CVec_UtxoZNoneZ_free(uint64_t _res) {
23673         if (!ptr_is_owned(_res)) return;
23674         void* _res_ptr = untag_ptr(_res);
23675         CHECK_ACCESS(_res_ptr);
23676         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
23677         FREE(untag_ptr(_res));
23678         CResult_CVec_UtxoZNoneZ_free(_res_conv);
23679 }
23680
23681 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
23682         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23683         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
23684         return tag_ptr(ret_conv, true);
23685 }
23686 int64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone_ptr"))) TS_CResult_CVec_UtxoZNoneZ_clone_ptr(uint64_t arg) {
23687         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
23688         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
23689         return ret_conv;
23690 }
23691
23692 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone"))) TS_CResult_CVec_UtxoZNoneZ_clone(uint64_t orig) {
23693         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
23694         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23695         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
23696         return tag_ptr(ret_conv, true);
23697 }
23698
23699 uint64_t  __attribute__((export_name("TS_COption_PaymentContextZ_some"))) TS_COption_PaymentContextZ_some(uint64_t o) {
23700         void* o_ptr = untag_ptr(o);
23701         CHECK_ACCESS(o_ptr);
23702         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
23703         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
23704         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
23705         *ret_copy = COption_PaymentContextZ_some(o_conv);
23706         uint64_t ret_ref = tag_ptr(ret_copy, true);
23707         return ret_ref;
23708 }
23709
23710 uint64_t  __attribute__((export_name("TS_COption_PaymentContextZ_none"))) TS_COption_PaymentContextZ_none() {
23711         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
23712         *ret_copy = COption_PaymentContextZ_none();
23713         uint64_t ret_ref = tag_ptr(ret_copy, true);
23714         return ret_ref;
23715 }
23716
23717 void  __attribute__((export_name("TS_COption_PaymentContextZ_free"))) TS_COption_PaymentContextZ_free(uint64_t _res) {
23718         if (!ptr_is_owned(_res)) return;
23719         void* _res_ptr = untag_ptr(_res);
23720         CHECK_ACCESS(_res_ptr);
23721         LDKCOption_PaymentContextZ _res_conv = *(LDKCOption_PaymentContextZ*)(_res_ptr);
23722         FREE(untag_ptr(_res));
23723         COption_PaymentContextZ_free(_res_conv);
23724 }
23725
23726 static inline uint64_t COption_PaymentContextZ_clone_ptr(LDKCOption_PaymentContextZ *NONNULL_PTR arg) {
23727         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
23728         *ret_copy = COption_PaymentContextZ_clone(arg);
23729         uint64_t ret_ref = tag_ptr(ret_copy, true);
23730         return ret_ref;
23731 }
23732 int64_t  __attribute__((export_name("TS_COption_PaymentContextZ_clone_ptr"))) TS_COption_PaymentContextZ_clone_ptr(uint64_t arg) {
23733         LDKCOption_PaymentContextZ* arg_conv = (LDKCOption_PaymentContextZ*)untag_ptr(arg);
23734         int64_t ret_conv = COption_PaymentContextZ_clone_ptr(arg_conv);
23735         return ret_conv;
23736 }
23737
23738 uint64_t  __attribute__((export_name("TS_COption_PaymentContextZ_clone"))) TS_COption_PaymentContextZ_clone(uint64_t orig) {
23739         LDKCOption_PaymentContextZ* orig_conv = (LDKCOption_PaymentContextZ*)untag_ptr(orig);
23740         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
23741         *ret_copy = COption_PaymentContextZ_clone(orig_conv);
23742         uint64_t ret_ref = tag_ptr(ret_copy, true);
23743         return ret_ref;
23744 }
23745
23746 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
23747         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
23748         *ret_conv = C2Tuple_u64u16Z_clone(arg);
23749         return tag_ptr(ret_conv, true);
23750 }
23751 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone_ptr"))) TS_C2Tuple_u64u16Z_clone_ptr(uint64_t arg) {
23752         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
23753         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
23754         return ret_conv;
23755 }
23756
23757 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone"))) TS_C2Tuple_u64u16Z_clone(uint64_t orig) {
23758         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
23759         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
23760         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
23761         return tag_ptr(ret_conv, true);
23762 }
23763
23764 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_new"))) TS_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
23765         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
23766         *ret_conv = C2Tuple_u64u16Z_new(a, b);
23767         return tag_ptr(ret_conv, true);
23768 }
23769
23770 void  __attribute__((export_name("TS_C2Tuple_u64u16Z_free"))) TS_C2Tuple_u64u16Z_free(uint64_t _res) {
23771         if (!ptr_is_owned(_res)) return;
23772         void* _res_ptr = untag_ptr(_res);
23773         CHECK_ACCESS(_res_ptr);
23774         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
23775         FREE(untag_ptr(_res));
23776         C2Tuple_u64u16Z_free(_res_conv);
23777 }
23778
23779 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_some"))) TS_COption_C2Tuple_u64u16ZZ_some(uint64_t o) {
23780         void* o_ptr = untag_ptr(o);
23781         CHECK_ACCESS(o_ptr);
23782         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
23783         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
23784         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
23785         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
23786         uint64_t ret_ref = tag_ptr(ret_copy, true);
23787         return ret_ref;
23788 }
23789
23790 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_none"))) TS_COption_C2Tuple_u64u16ZZ_none() {
23791         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
23792         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
23793         uint64_t ret_ref = tag_ptr(ret_copy, true);
23794         return ret_ref;
23795 }
23796
23797 void  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_free"))) TS_COption_C2Tuple_u64u16ZZ_free(uint64_t _res) {
23798         if (!ptr_is_owned(_res)) return;
23799         void* _res_ptr = untag_ptr(_res);
23800         CHECK_ACCESS(_res_ptr);
23801         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
23802         FREE(untag_ptr(_res));
23803         COption_C2Tuple_u64u16ZZ_free(_res_conv);
23804 }
23805
23806 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
23807         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
23808         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
23809         uint64_t ret_ref = tag_ptr(ret_copy, true);
23810         return ret_ref;
23811 }
23812 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u16ZZ_clone_ptr(uint64_t arg) {
23813         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
23814         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
23815         return ret_conv;
23816 }
23817
23818 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone"))) TS_COption_C2Tuple_u64u16ZZ_clone(uint64_t orig) {
23819         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
23820         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
23821         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
23822         uint64_t ret_ref = tag_ptr(ret_copy, true);
23823         return ret_ref;
23824 }
23825
23826 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_some"))) TS_COption_ChannelShutdownStateZ_some(uint32_t o) {
23827         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
23828         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
23829         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
23830         uint64_t ret_ref = tag_ptr(ret_copy, true);
23831         return ret_ref;
23832 }
23833
23834 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_none"))) TS_COption_ChannelShutdownStateZ_none() {
23835         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
23836         *ret_copy = COption_ChannelShutdownStateZ_none();
23837         uint64_t ret_ref = tag_ptr(ret_copy, true);
23838         return ret_ref;
23839 }
23840
23841 void  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_free"))) TS_COption_ChannelShutdownStateZ_free(uint64_t _res) {
23842         if (!ptr_is_owned(_res)) return;
23843         void* _res_ptr = untag_ptr(_res);
23844         CHECK_ACCESS(_res_ptr);
23845         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
23846         FREE(untag_ptr(_res));
23847         COption_ChannelShutdownStateZ_free(_res_conv);
23848 }
23849
23850 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
23851         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
23852         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
23853         uint64_t ret_ref = tag_ptr(ret_copy, true);
23854         return ret_ref;
23855 }
23856 int64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone_ptr"))) TS_COption_ChannelShutdownStateZ_clone_ptr(uint64_t arg) {
23857         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
23858         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
23859         return ret_conv;
23860 }
23861
23862 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone"))) TS_COption_ChannelShutdownStateZ_clone(uint64_t orig) {
23863         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
23864         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
23865         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
23866         uint64_t ret_ref = tag_ptr(ret_copy, true);
23867         return ret_ref;
23868 }
23869
23870 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_ok"))) TS_CResult_ChannelIdAPIErrorZ_ok(uint64_t o) {
23871         LDKChannelId o_conv;
23872         o_conv.inner = untag_ptr(o);
23873         o_conv.is_owned = ptr_is_owned(o);
23874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23875         o_conv = ChannelId_clone(&o_conv);
23876         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
23877         *ret_conv = CResult_ChannelIdAPIErrorZ_ok(o_conv);
23878         return tag_ptr(ret_conv, true);
23879 }
23880
23881 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_err"))) TS_CResult_ChannelIdAPIErrorZ_err(uint64_t e) {
23882         void* e_ptr = untag_ptr(e);
23883         CHECK_ACCESS(e_ptr);
23884         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
23885         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
23886         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
23887         *ret_conv = CResult_ChannelIdAPIErrorZ_err(e_conv);
23888         return tag_ptr(ret_conv, true);
23889 }
23890
23891 jboolean  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_is_ok"))) TS_CResult_ChannelIdAPIErrorZ_is_ok(uint64_t o) {
23892         LDKCResult_ChannelIdAPIErrorZ* o_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(o);
23893         jboolean ret_conv = CResult_ChannelIdAPIErrorZ_is_ok(o_conv);
23894         return ret_conv;
23895 }
23896
23897 void  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_free"))) TS_CResult_ChannelIdAPIErrorZ_free(uint64_t _res) {
23898         if (!ptr_is_owned(_res)) return;
23899         void* _res_ptr = untag_ptr(_res);
23900         CHECK_ACCESS(_res_ptr);
23901         LDKCResult_ChannelIdAPIErrorZ _res_conv = *(LDKCResult_ChannelIdAPIErrorZ*)(_res_ptr);
23902         FREE(untag_ptr(_res));
23903         CResult_ChannelIdAPIErrorZ_free(_res_conv);
23904 }
23905
23906 static inline uint64_t CResult_ChannelIdAPIErrorZ_clone_ptr(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR arg) {
23907         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
23908         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(arg);
23909         return tag_ptr(ret_conv, true);
23910 }
23911 int64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_clone_ptr"))) TS_CResult_ChannelIdAPIErrorZ_clone_ptr(uint64_t arg) {
23912         LDKCResult_ChannelIdAPIErrorZ* arg_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(arg);
23913         int64_t ret_conv = CResult_ChannelIdAPIErrorZ_clone_ptr(arg_conv);
23914         return ret_conv;
23915 }
23916
23917 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_clone"))) TS_CResult_ChannelIdAPIErrorZ_clone(uint64_t orig) {
23918         LDKCResult_ChannelIdAPIErrorZ* orig_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(orig);
23919         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
23920         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(orig_conv);
23921         return tag_ptr(ret_conv, true);
23922 }
23923
23924 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
23925         LDKCVec_RecentPaymentDetailsZ _res_constr;
23926         _res_constr.datalen = _res->arr_len;
23927         if (_res_constr.datalen > 0)
23928                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
23929         else
23930                 _res_constr.data = NULL;
23931         uint64_t* _res_vals = _res->elems;
23932         for (size_t w = 0; w < _res_constr.datalen; w++) {
23933                 uint64_t _res_conv_22 = _res_vals[w];
23934                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
23935                 CHECK_ACCESS(_res_conv_22_ptr);
23936                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
23937                 FREE(untag_ptr(_res_conv_22));
23938                 _res_constr.data[w] = _res_conv_22_conv;
23939         }
23940         FREE(_res);
23941         CVec_RecentPaymentDetailsZ_free(_res_constr);
23942 }
23943
23944 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
23945         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
23946         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
23947         return tag_ptr(ret_conv, true);
23948 }
23949
23950 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
23951         void* e_ptr = untag_ptr(e);
23952         CHECK_ACCESS(e_ptr);
23953         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
23954         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
23955         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
23956         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
23957         return tag_ptr(ret_conv, true);
23958 }
23959
23960 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
23961         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
23962         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
23963         return ret_conv;
23964 }
23965
23966 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
23967         if (!ptr_is_owned(_res)) return;
23968         void* _res_ptr = untag_ptr(_res);
23969         CHECK_ACCESS(_res_ptr);
23970         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
23971         FREE(untag_ptr(_res));
23972         CResult_NonePaymentSendFailureZ_free(_res_conv);
23973 }
23974
23975 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
23976         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
23977         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
23978         return tag_ptr(ret_conv, true);
23979 }
23980 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
23981         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
23982         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
23983         return ret_conv;
23984 }
23985
23986 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
23987         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
23988         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
23989         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
23990         return tag_ptr(ret_conv, true);
23991 }
23992
23993 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
23994         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
23995         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
23996         return tag_ptr(ret_conv, true);
23997 }
23998
23999 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
24000         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
24001         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24002         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
24003         return tag_ptr(ret_conv, true);
24004 }
24005
24006 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
24007         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
24008         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
24009         return ret_conv;
24010 }
24011
24012 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
24013         if (!ptr_is_owned(_res)) return;
24014         void* _res_ptr = untag_ptr(_res);
24015         CHECK_ACCESS(_res_ptr);
24016         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
24017         FREE(untag_ptr(_res));
24018         CResult_NoneRetryableSendFailureZ_free(_res_conv);
24019 }
24020
24021 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
24022         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24023         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
24024         return tag_ptr(ret_conv, true);
24025 }
24026 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
24027         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
24028         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
24029         return ret_conv;
24030 }
24031
24032 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
24033         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
24034         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24035         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
24036         return tag_ptr(ret_conv, true);
24037 }
24038
24039 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
24040         LDKThirtyTwoBytes o_ref;
24041         CHECK(o->arr_len == 32);
24042         memcpy(o_ref.data, o->elems, 32); FREE(o);
24043         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24044         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
24045         return tag_ptr(ret_conv, true);
24046 }
24047
24048 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(uint64_t e) {
24049         void* e_ptr = untag_ptr(e);
24050         CHECK_ACCESS(e_ptr);
24051         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24052         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24053         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24054         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
24055         return tag_ptr(ret_conv, true);
24056 }
24057
24058 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(uint64_t o) {
24059         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
24060         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
24061         return ret_conv;
24062 }
24063
24064 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(uint64_t _res) {
24065         if (!ptr_is_owned(_res)) return;
24066         void* _res_ptr = untag_ptr(_res);
24067         CHECK_ACCESS(_res_ptr);
24068         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
24069         FREE(untag_ptr(_res));
24070         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
24071 }
24072
24073 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
24074         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24075         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
24076         return tag_ptr(ret_conv, true);
24077 }
24078 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(uint64_t arg) {
24079         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
24080         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
24081         return ret_conv;
24082 }
24083
24084 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(uint64_t orig) {
24085         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
24086         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24087         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
24088         return tag_ptr(ret_conv, true);
24089 }
24090
24091 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
24092         LDKThirtyTwoBytes o_ref;
24093         CHECK(o->arr_len == 32);
24094         memcpy(o_ref.data, o->elems, 32); FREE(o);
24095         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24096         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
24097         return tag_ptr(ret_conv, true);
24098 }
24099
24100 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(uint32_t e) {
24101         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
24102         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24103         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
24104         return tag_ptr(ret_conv, true);
24105 }
24106
24107 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(uint64_t o) {
24108         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
24109         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
24110         return ret_conv;
24111 }
24112
24113 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(uint64_t _res) {
24114         if (!ptr_is_owned(_res)) return;
24115         void* _res_ptr = untag_ptr(_res);
24116         CHECK_ACCESS(_res_ptr);
24117         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
24118         FREE(untag_ptr(_res));
24119         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
24120 }
24121
24122 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
24123         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24124         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
24125         return tag_ptr(ret_conv, true);
24126 }
24127 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(uint64_t arg) {
24128         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
24129         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
24130         return ret_conv;
24131 }
24132
24133 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(uint64_t orig) {
24134         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
24135         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24136         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
24137         return tag_ptr(ret_conv, true);
24138 }
24139
24140 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
24141         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24142         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
24143         return tag_ptr(ret_conv, true);
24144 }
24145 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
24146         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
24147         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
24148         return ret_conv;
24149 }
24150
24151 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(uint64_t orig) {
24152         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
24153         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24154         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
24155         return tag_ptr(ret_conv, true);
24156 }
24157
24158 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
24159         LDKThirtyTwoBytes a_ref;
24160         CHECK(a->arr_len == 32);
24161         memcpy(a_ref.data, a->elems, 32); FREE(a);
24162         LDKThirtyTwoBytes b_ref;
24163         CHECK(b->arr_len == 32);
24164         memcpy(b_ref.data, b->elems, 32); FREE(b);
24165         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24166         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
24167         return tag_ptr(ret_conv, true);
24168 }
24169
24170 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(uint64_t _res) {
24171         if (!ptr_is_owned(_res)) return;
24172         void* _res_ptr = untag_ptr(_res);
24173         CHECK_ACCESS(_res_ptr);
24174         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
24175         FREE(untag_ptr(_res));
24176         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
24177 }
24178
24179 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(uint64_t o) {
24180         void* o_ptr = untag_ptr(o);
24181         CHECK_ACCESS(o_ptr);
24182         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
24183         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
24184         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24185         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
24186         return tag_ptr(ret_conv, true);
24187 }
24188
24189 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(uint64_t e) {
24190         void* e_ptr = untag_ptr(e);
24191         CHECK_ACCESS(e_ptr);
24192         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24193         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24194         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24195         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
24196         return tag_ptr(ret_conv, true);
24197 }
24198
24199 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(uint64_t o) {
24200         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
24201         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
24202         return ret_conv;
24203 }
24204
24205 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(uint64_t _res) {
24206         if (!ptr_is_owned(_res)) return;
24207         void* _res_ptr = untag_ptr(_res);
24208         CHECK_ACCESS(_res_ptr);
24209         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
24210         FREE(untag_ptr(_res));
24211         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
24212 }
24213
24214 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
24215         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24216         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
24217         return tag_ptr(ret_conv, true);
24218 }
24219 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
24220         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
24221         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
24222         return ret_conv;
24223 }
24224
24225 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(uint64_t orig) {
24226         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
24227         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24228         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
24229         return tag_ptr(ret_conv, true);
24230 }
24231
24232 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(uint64_tArray _res) {
24233         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
24234         _res_constr.datalen = _res->arr_len;
24235         if (_res_constr.datalen > 0)
24236                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
24237         else
24238                 _res_constr.data = NULL;
24239         uint64_t* _res_vals = _res->elems;
24240         for (size_t o = 0; o < _res_constr.datalen; o++) {
24241                 uint64_t _res_conv_40 = _res_vals[o];
24242                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
24243                 CHECK_ACCESS(_res_conv_40_ptr);
24244                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
24245                 FREE(untag_ptr(_res_conv_40));
24246                 _res_constr.data[o] = _res_conv_40_conv;
24247         }
24248         FREE(_res);
24249         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
24250 }
24251
24252 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(uint64_tArray o) {
24253         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
24254         o_constr.datalen = o->arr_len;
24255         if (o_constr.datalen > 0)
24256                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
24257         else
24258                 o_constr.data = NULL;
24259         uint64_t* o_vals = o->elems;
24260         for (size_t o = 0; o < o_constr.datalen; o++) {
24261                 uint64_t o_conv_40 = o_vals[o];
24262                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
24263                 CHECK_ACCESS(o_conv_40_ptr);
24264                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
24265                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
24266                 o_constr.data[o] = o_conv_40_conv;
24267         }
24268         FREE(o);
24269         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24270         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
24271         return tag_ptr(ret_conv, true);
24272 }
24273
24274 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(uint64_t e) {
24275         void* e_ptr = untag_ptr(e);
24276         CHECK_ACCESS(e_ptr);
24277         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
24278         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
24279         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24280         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
24281         return tag_ptr(ret_conv, true);
24282 }
24283
24284 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(uint64_t o) {
24285         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
24286         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
24287         return ret_conv;
24288 }
24289
24290 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(uint64_t _res) {
24291         if (!ptr_is_owned(_res)) return;
24292         void* _res_ptr = untag_ptr(_res);
24293         CHECK_ACCESS(_res_ptr);
24294         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
24295         FREE(untag_ptr(_res));
24296         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
24297 }
24298
24299 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
24300         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24301         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
24302         return tag_ptr(ret_conv, true);
24303 }
24304 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(uint64_t arg) {
24305         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
24306         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
24307         return ret_conv;
24308 }
24309
24310 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(uint64_t orig) {
24311         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
24312         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24313         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
24314         return tag_ptr(ret_conv, true);
24315 }
24316
24317 static inline uint64_t C2Tuple_ChannelIdPublicKeyZ_clone_ptr(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR arg) {
24318         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24319         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(arg);
24320         return tag_ptr(ret_conv, true);
24321 }
24322 int64_t  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_clone_ptr"))) TS_C2Tuple_ChannelIdPublicKeyZ_clone_ptr(uint64_t arg) {
24323         LDKC2Tuple_ChannelIdPublicKeyZ* arg_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(arg);
24324         int64_t ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone_ptr(arg_conv);
24325         return ret_conv;
24326 }
24327
24328 uint64_t  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_clone"))) TS_C2Tuple_ChannelIdPublicKeyZ_clone(uint64_t orig) {
24329         LDKC2Tuple_ChannelIdPublicKeyZ* orig_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(orig);
24330         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24331         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(orig_conv);
24332         return tag_ptr(ret_conv, true);
24333 }
24334
24335 uint64_t  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_new"))) TS_C2Tuple_ChannelIdPublicKeyZ_new(uint64_t a, int8_tArray b) {
24336         LDKChannelId a_conv;
24337         a_conv.inner = untag_ptr(a);
24338         a_conv.is_owned = ptr_is_owned(a);
24339         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24340         a_conv = ChannelId_clone(&a_conv);
24341         LDKPublicKey b_ref;
24342         CHECK(b->arr_len == 33);
24343         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
24344         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24345         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_new(a_conv, b_ref);
24346         return tag_ptr(ret_conv, true);
24347 }
24348
24349 void  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_free"))) TS_C2Tuple_ChannelIdPublicKeyZ_free(uint64_t _res) {
24350         if (!ptr_is_owned(_res)) return;
24351         void* _res_ptr = untag_ptr(_res);
24352         CHECK_ACCESS(_res_ptr);
24353         LDKC2Tuple_ChannelIdPublicKeyZ _res_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_ptr);
24354         FREE(untag_ptr(_res));
24355         C2Tuple_ChannelIdPublicKeyZ_free(_res_conv);
24356 }
24357
24358 void  __attribute__((export_name("TS_CVec_C2Tuple_ChannelIdPublicKeyZZ_free"))) TS_CVec_C2Tuple_ChannelIdPublicKeyZZ_free(uint64_tArray _res) {
24359         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res_constr;
24360         _res_constr.datalen = _res->arr_len;
24361         if (_res_constr.datalen > 0)
24362                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
24363         else
24364                 _res_constr.data = NULL;
24365         uint64_t* _res_vals = _res->elems;
24366         for (size_t e = 0; e < _res_constr.datalen; e++) {
24367                 uint64_t _res_conv_30 = _res_vals[e];
24368                 void* _res_conv_30_ptr = untag_ptr(_res_conv_30);
24369                 CHECK_ACCESS(_res_conv_30_ptr);
24370                 LDKC2Tuple_ChannelIdPublicKeyZ _res_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_conv_30_ptr);
24371                 FREE(untag_ptr(_res_conv_30));
24372                 _res_constr.data[e] = _res_conv_30_conv;
24373         }
24374         FREE(_res);
24375         CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res_constr);
24376 }
24377
24378 void  __attribute__((export_name("TS_CVec_ChannelIdZ_free"))) TS_CVec_ChannelIdZ_free(uint64_tArray _res) {
24379         LDKCVec_ChannelIdZ _res_constr;
24380         _res_constr.datalen = _res->arr_len;
24381         if (_res_constr.datalen > 0)
24382                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
24383         else
24384                 _res_constr.data = NULL;
24385         uint64_t* _res_vals = _res->elems;
24386         for (size_t l = 0; l < _res_constr.datalen; l++) {
24387                 uint64_t _res_conv_11 = _res_vals[l];
24388                 LDKChannelId _res_conv_11_conv;
24389                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
24390                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
24391                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
24392                 _res_constr.data[l] = _res_conv_11_conv;
24393         }
24394         FREE(_res);
24395         CVec_ChannelIdZ_free(_res_constr);
24396 }
24397
24398 uint64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
24399         LDKOfferWithDerivedMetadataBuilder o_conv;
24400         o_conv.inner = untag_ptr(o);
24401         o_conv.is_owned = ptr_is_owned(o);
24402         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24403         o_conv = OfferWithDerivedMetadataBuilder_clone(&o_conv);
24404         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24405         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
24406         return tag_ptr(ret_conv, true);
24407 }
24408
24409 uint64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(uint32_t e) {
24410         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
24411         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24412         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
24413         return tag_ptr(ret_conv, true);
24414 }
24415
24416 jboolean  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
24417         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
24418         jboolean ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
24419         return ret_conv;
24420 }
24421
24422 void  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
24423         if (!ptr_is_owned(_res)) return;
24424         void* _res_ptr = untag_ptr(_res);
24425         CHECK_ACCESS(_res_ptr);
24426         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
24427         FREE(untag_ptr(_res));
24428         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
24429 }
24430
24431 static inline uint64_t CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
24432         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24433         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
24434         return tag_ptr(ret_conv, true);
24435 }
24436 int64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
24437         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
24438         int64_t ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
24439         return ret_conv;
24440 }
24441
24442 uint64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(uint64_t orig) {
24443         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
24444         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24445         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
24446         return tag_ptr(ret_conv, true);
24447 }
24448
24449 uint64_t  __attribute__((export_name("TS_COption_StrZ_some"))) TS_COption_StrZ_some(jstring o) {
24450         LDKStr o_conv = str_ref_to_owned_c(o);
24451         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24452         *ret_copy = COption_StrZ_some(o_conv);
24453         uint64_t ret_ref = tag_ptr(ret_copy, true);
24454         return ret_ref;
24455 }
24456
24457 uint64_t  __attribute__((export_name("TS_COption_StrZ_none"))) TS_COption_StrZ_none() {
24458         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24459         *ret_copy = COption_StrZ_none();
24460         uint64_t ret_ref = tag_ptr(ret_copy, true);
24461         return ret_ref;
24462 }
24463
24464 void  __attribute__((export_name("TS_COption_StrZ_free"))) TS_COption_StrZ_free(uint64_t _res) {
24465         if (!ptr_is_owned(_res)) return;
24466         void* _res_ptr = untag_ptr(_res);
24467         CHECK_ACCESS(_res_ptr);
24468         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
24469         FREE(untag_ptr(_res));
24470         COption_StrZ_free(_res_conv);
24471 }
24472
24473 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
24474         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24475         *ret_copy = COption_StrZ_clone(arg);
24476         uint64_t ret_ref = tag_ptr(ret_copy, true);
24477         return ret_ref;
24478 }
24479 int64_t  __attribute__((export_name("TS_COption_StrZ_clone_ptr"))) TS_COption_StrZ_clone_ptr(uint64_t arg) {
24480         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
24481         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
24482         return ret_conv;
24483 }
24484
24485 uint64_t  __attribute__((export_name("TS_COption_StrZ_clone"))) TS_COption_StrZ_clone(uint64_t orig) {
24486         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
24487         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24488         *ret_copy = COption_StrZ_clone(orig_conv);
24489         uint64_t ret_ref = tag_ptr(ret_copy, true);
24490         return ret_ref;
24491 }
24492
24493 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(uint64_t o) {
24494         void* o_ptr = untag_ptr(o);
24495         CHECK_ACCESS(o_ptr);
24496         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
24497         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
24498         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24499         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
24500         return tag_ptr(ret_conv, true);
24501 }
24502
24503 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
24504         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24505         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
24506         return tag_ptr(ret_conv, true);
24507 }
24508
24509 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(uint64_t o) {
24510         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
24511         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
24512         return ret_conv;
24513 }
24514
24515 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(uint64_t _res) {
24516         if (!ptr_is_owned(_res)) return;
24517         void* _res_ptr = untag_ptr(_res);
24518         CHECK_ACCESS(_res_ptr);
24519         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
24520         FREE(untag_ptr(_res));
24521         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
24522 }
24523
24524 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
24525         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24526         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
24527         return tag_ptr(ret_conv, true);
24528 }
24529 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(uint64_t arg) {
24530         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
24531         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
24532         return ret_conv;
24533 }
24534
24535 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(uint64_t orig) {
24536         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
24537         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24538         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
24539         return tag_ptr(ret_conv, true);
24540 }
24541
24542 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
24543         LDKThirtyTwoBytes o_ref;
24544         CHECK(o->arr_len == 32);
24545         memcpy(o_ref.data, o->elems, 32); FREE(o);
24546         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24547         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
24548         return tag_ptr(ret_conv, true);
24549 }
24550
24551 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_err(uint64_t e) {
24552         void* e_ptr = untag_ptr(e);
24553         CHECK_ACCESS(e_ptr);
24554         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24555         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24556         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24557         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
24558         return tag_ptr(ret_conv, true);
24559 }
24560
24561 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(uint64_t o) {
24562         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
24563         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
24564         return ret_conv;
24565 }
24566
24567 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_free"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_free(uint64_t _res) {
24568         if (!ptr_is_owned(_res)) return;
24569         void* _res_ptr = untag_ptr(_res);
24570         CHECK_ACCESS(_res_ptr);
24571         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
24572         FREE(untag_ptr(_res));
24573         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
24574 }
24575
24576 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
24577         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24578         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
24579         return tag_ptr(ret_conv, true);
24580 }
24581 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(uint64_t arg) {
24582         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
24583         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
24584         return ret_conv;
24585 }
24586
24587 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone(uint64_t orig) {
24588         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
24589         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24590         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
24591         return tag_ptr(ret_conv, true);
24592 }
24593
24594 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_some"))) TS_COption_OffersMessageZ_some(uint64_t o) {
24595         void* o_ptr = untag_ptr(o);
24596         CHECK_ACCESS(o_ptr);
24597         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
24598         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
24599         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24600         *ret_copy = COption_OffersMessageZ_some(o_conv);
24601         uint64_t ret_ref = tag_ptr(ret_copy, true);
24602         return ret_ref;
24603 }
24604
24605 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_none"))) TS_COption_OffersMessageZ_none() {
24606         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24607         *ret_copy = COption_OffersMessageZ_none();
24608         uint64_t ret_ref = tag_ptr(ret_copy, true);
24609         return ret_ref;
24610 }
24611
24612 void  __attribute__((export_name("TS_COption_OffersMessageZ_free"))) TS_COption_OffersMessageZ_free(uint64_t _res) {
24613         if (!ptr_is_owned(_res)) return;
24614         void* _res_ptr = untag_ptr(_res);
24615         CHECK_ACCESS(_res_ptr);
24616         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
24617         FREE(untag_ptr(_res));
24618         COption_OffersMessageZ_free(_res_conv);
24619 }
24620
24621 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
24622         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24623         *ret_copy = COption_OffersMessageZ_clone(arg);
24624         uint64_t ret_ref = tag_ptr(ret_copy, true);
24625         return ret_ref;
24626 }
24627 int64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone_ptr"))) TS_COption_OffersMessageZ_clone_ptr(uint64_t arg) {
24628         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
24629         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
24630         return ret_conv;
24631 }
24632
24633 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone"))) TS_COption_OffersMessageZ_clone(uint64_t orig) {
24634         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
24635         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24636         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
24637         uint64_t ret_ref = tag_ptr(ret_copy, true);
24638         return ret_ref;
24639 }
24640
24641 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
24642         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
24643         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
24644         return tag_ptr(ret_conv, true);
24645 }
24646 int64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
24647         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
24648         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
24649         return ret_conv;
24650 }
24651
24652 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone(uint64_t orig) {
24653         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
24654         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
24655         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
24656         return tag_ptr(ret_conv, true);
24657 }
24658
24659 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
24660         void* a_ptr = untag_ptr(a);
24661         CHECK_ACCESS(a_ptr);
24662         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
24663         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
24664         void* b_ptr = untag_ptr(b);
24665         CHECK_ACCESS(b_ptr);
24666         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
24667         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
24668         LDKBlindedPath c_conv;
24669         c_conv.inner = untag_ptr(c);
24670         c_conv.is_owned = ptr_is_owned(c);
24671         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
24672         c_conv = BlindedPath_clone(&c_conv);
24673         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
24674         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
24675         return tag_ptr(ret_conv, true);
24676 }
24677
24678 void  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free(uint64_t _res) {
24679         if (!ptr_is_owned(_res)) return;
24680         void* _res_ptr = untag_ptr(_res);
24681         CHECK_ACCESS(_res_ptr);
24682         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
24683         FREE(untag_ptr(_res));
24684         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
24685 }
24686
24687 void  __attribute__((export_name("TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(uint64_tArray _res) {
24688         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
24689         _res_constr.datalen = _res->arr_len;
24690         if (_res_constr.datalen > 0)
24691                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
24692         else
24693                 _res_constr.data = NULL;
24694         uint64_t* _res_vals = _res->elems;
24695         for (size_t x = 0; x < _res_constr.datalen; x++) {
24696                 uint64_t _res_conv_49 = _res_vals[x];
24697                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
24698                 CHECK_ACCESS(_res_conv_49_ptr);
24699                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
24700                 FREE(untag_ptr(_res_conv_49));
24701                 _res_constr.data[x] = _res_conv_49_conv;
24702         }
24703         FREE(_res);
24704         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
24705 }
24706
24707 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
24708         LDKCounterpartyForwardingInfo o_conv;
24709         o_conv.inner = untag_ptr(o);
24710         o_conv.is_owned = ptr_is_owned(o);
24711         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24712         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
24713         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24714         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
24715         return tag_ptr(ret_conv, true);
24716 }
24717
24718 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
24719         void* e_ptr = untag_ptr(e);
24720         CHECK_ACCESS(e_ptr);
24721         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24722         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24723         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24724         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
24725         return tag_ptr(ret_conv, true);
24726 }
24727
24728 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
24729         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
24730         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
24731         return ret_conv;
24732 }
24733
24734 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
24735         if (!ptr_is_owned(_res)) return;
24736         void* _res_ptr = untag_ptr(_res);
24737         CHECK_ACCESS(_res_ptr);
24738         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
24739         FREE(untag_ptr(_res));
24740         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
24741 }
24742
24743 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
24744         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24745         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
24746         return tag_ptr(ret_conv, true);
24747 }
24748 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
24749         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
24750         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
24751         return ret_conv;
24752 }
24753
24754 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
24755         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
24756         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24757         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
24758         return tag_ptr(ret_conv, true);
24759 }
24760
24761 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
24762         LDKChannelCounterparty o_conv;
24763         o_conv.inner = untag_ptr(o);
24764         o_conv.is_owned = ptr_is_owned(o);
24765         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24766         o_conv = ChannelCounterparty_clone(&o_conv);
24767         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24768         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
24769         return tag_ptr(ret_conv, true);
24770 }
24771
24772 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
24773         void* e_ptr = untag_ptr(e);
24774         CHECK_ACCESS(e_ptr);
24775         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24776         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24777         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24778         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
24779         return tag_ptr(ret_conv, true);
24780 }
24781
24782 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
24783         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
24784         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
24785         return ret_conv;
24786 }
24787
24788 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
24789         if (!ptr_is_owned(_res)) return;
24790         void* _res_ptr = untag_ptr(_res);
24791         CHECK_ACCESS(_res_ptr);
24792         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
24793         FREE(untag_ptr(_res));
24794         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
24795 }
24796
24797 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
24798         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24799         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
24800         return tag_ptr(ret_conv, true);
24801 }
24802 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
24803         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
24804         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
24805         return ret_conv;
24806 }
24807
24808 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
24809         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
24810         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24811         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
24812         return tag_ptr(ret_conv, true);
24813 }
24814
24815 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
24816         LDKChannelDetails o_conv;
24817         o_conv.inner = untag_ptr(o);
24818         o_conv.is_owned = ptr_is_owned(o);
24819         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24820         o_conv = ChannelDetails_clone(&o_conv);
24821         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24822         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
24823         return tag_ptr(ret_conv, true);
24824 }
24825
24826 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
24827         void* e_ptr = untag_ptr(e);
24828         CHECK_ACCESS(e_ptr);
24829         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24830         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24831         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24832         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
24833         return tag_ptr(ret_conv, true);
24834 }
24835
24836 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
24837         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
24838         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
24839         return ret_conv;
24840 }
24841
24842 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
24843         if (!ptr_is_owned(_res)) return;
24844         void* _res_ptr = untag_ptr(_res);
24845         CHECK_ACCESS(_res_ptr);
24846         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
24847         FREE(untag_ptr(_res));
24848         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
24849 }
24850
24851 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
24852         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24853         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
24854         return tag_ptr(ret_conv, true);
24855 }
24856 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
24857         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
24858         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
24859         return ret_conv;
24860 }
24861
24862 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
24863         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
24864         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24865         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
24866         return tag_ptr(ret_conv, true);
24867 }
24868
24869 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
24870         LDKPhantomRouteHints o_conv;
24871         o_conv.inner = untag_ptr(o);
24872         o_conv.is_owned = ptr_is_owned(o);
24873         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24874         o_conv = PhantomRouteHints_clone(&o_conv);
24875         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24876         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
24877         return tag_ptr(ret_conv, true);
24878 }
24879
24880 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
24881         void* e_ptr = untag_ptr(e);
24882         CHECK_ACCESS(e_ptr);
24883         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24884         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24885         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24886         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
24887         return tag_ptr(ret_conv, true);
24888 }
24889
24890 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
24891         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
24892         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
24893         return ret_conv;
24894 }
24895
24896 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
24897         if (!ptr_is_owned(_res)) return;
24898         void* _res_ptr = untag_ptr(_res);
24899         CHECK_ACCESS(_res_ptr);
24900         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
24901         FREE(untag_ptr(_res));
24902         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
24903 }
24904
24905 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
24906         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24907         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
24908         return tag_ptr(ret_conv, true);
24909 }
24910 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
24911         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
24912         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
24913         return ret_conv;
24914 }
24915
24916 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
24917         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
24918         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24919         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
24920         return tag_ptr(ret_conv, true);
24921 }
24922
24923 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_ok(uint64_t o) {
24924         LDKBlindedForward o_conv;
24925         o_conv.inner = untag_ptr(o);
24926         o_conv.is_owned = ptr_is_owned(o);
24927         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24928         o_conv = BlindedForward_clone(&o_conv);
24929         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
24930         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
24931         return tag_ptr(ret_conv, true);
24932 }
24933
24934 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_err"))) TS_CResult_BlindedForwardDecodeErrorZ_err(uint64_t e) {
24935         void* e_ptr = untag_ptr(e);
24936         CHECK_ACCESS(e_ptr);
24937         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24938         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24939         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
24940         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
24941         return tag_ptr(ret_conv, true);
24942 }
24943
24944 jboolean  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_is_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_is_ok(uint64_t o) {
24945         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
24946         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
24947         return ret_conv;
24948 }
24949
24950 void  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_free"))) TS_CResult_BlindedForwardDecodeErrorZ_free(uint64_t _res) {
24951         if (!ptr_is_owned(_res)) return;
24952         void* _res_ptr = untag_ptr(_res);
24953         CHECK_ACCESS(_res_ptr);
24954         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
24955         FREE(untag_ptr(_res));
24956         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
24957 }
24958
24959 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
24960         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
24961         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
24962         return tag_ptr(ret_conv, true);
24963 }
24964 int64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedForwardDecodeErrorZ_clone_ptr(uint64_t arg) {
24965         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
24966         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
24967         return ret_conv;
24968 }
24969
24970 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_clone"))) TS_CResult_BlindedForwardDecodeErrorZ_clone(uint64_t orig) {
24971         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
24972         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
24973         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
24974         return tag_ptr(ret_conv, true);
24975 }
24976
24977 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_ok(uint64_t o) {
24978         void* o_ptr = untag_ptr(o);
24979         CHECK_ACCESS(o_ptr);
24980         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
24981         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
24982         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
24983         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
24984         return tag_ptr(ret_conv, true);
24985 }
24986
24987 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_err"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_err(uint64_t e) {
24988         void* e_ptr = untag_ptr(e);
24989         CHECK_ACCESS(e_ptr);
24990         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24991         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24992         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
24993         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
24994         return tag_ptr(ret_conv, true);
24995 }
24996
24997 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(uint64_t o) {
24998         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
24999         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
25000         return ret_conv;
25001 }
25002
25003 void  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_free"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_free(uint64_t _res) {
25004         if (!ptr_is_owned(_res)) return;
25005         void* _res_ptr = untag_ptr(_res);
25006         CHECK_ACCESS(_res_ptr);
25007         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
25008         FREE(untag_ptr(_res));
25009         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
25010 }
25011
25012 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
25013         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
25014         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
25015         return tag_ptr(ret_conv, true);
25016 }
25017 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(uint64_t arg) {
25018         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
25019         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
25020         return ret_conv;
25021 }
25022
25023 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone(uint64_t orig) {
25024         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
25025         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
25026         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
25027         return tag_ptr(ret_conv, true);
25028 }
25029
25030 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_ok(uint64_t o) {
25031         LDKPendingHTLCInfo o_conv;
25032         o_conv.inner = untag_ptr(o);
25033         o_conv.is_owned = ptr_is_owned(o);
25034         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25035         o_conv = PendingHTLCInfo_clone(&o_conv);
25036         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25037         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
25038         return tag_ptr(ret_conv, true);
25039 }
25040
25041 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_err"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_err(uint64_t e) {
25042         void* e_ptr = untag_ptr(e);
25043         CHECK_ACCESS(e_ptr);
25044         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25045         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25046         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25047         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
25048         return tag_ptr(ret_conv, true);
25049 }
25050
25051 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_is_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_is_ok(uint64_t o) {
25052         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
25053         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
25054         return ret_conv;
25055 }
25056
25057 void  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_free"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_free(uint64_t _res) {
25058         if (!ptr_is_owned(_res)) return;
25059         void* _res_ptr = untag_ptr(_res);
25060         CHECK_ACCESS(_res_ptr);
25061         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
25062         FREE(untag_ptr(_res));
25063         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
25064 }
25065
25066 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
25067         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25068         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
25069         return tag_ptr(ret_conv, true);
25070 }
25071 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
25072         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
25073         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
25074         return ret_conv;
25075 }
25076
25077 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_clone"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_clone(uint64_t orig) {
25078         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
25079         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25080         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
25081         return tag_ptr(ret_conv, true);
25082 }
25083
25084 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_ok(uint32_t o) {
25085         LDKBlindedFailure o_conv = LDKBlindedFailure_from_js(o);
25086         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25087         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
25088         return tag_ptr(ret_conv, true);
25089 }
25090
25091 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_err"))) TS_CResult_BlindedFailureDecodeErrorZ_err(uint64_t e) {
25092         void* e_ptr = untag_ptr(e);
25093         CHECK_ACCESS(e_ptr);
25094         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25095         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25096         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25097         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
25098         return tag_ptr(ret_conv, true);
25099 }
25100
25101 jboolean  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_is_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_is_ok(uint64_t o) {
25102         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
25103         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
25104         return ret_conv;
25105 }
25106
25107 void  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_free"))) TS_CResult_BlindedFailureDecodeErrorZ_free(uint64_t _res) {
25108         if (!ptr_is_owned(_res)) return;
25109         void* _res_ptr = untag_ptr(_res);
25110         CHECK_ACCESS(_res_ptr);
25111         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
25112         FREE(untag_ptr(_res));
25113         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
25114 }
25115
25116 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
25117         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25118         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
25119         return tag_ptr(ret_conv, true);
25120 }
25121 int64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedFailureDecodeErrorZ_clone_ptr(uint64_t arg) {
25122         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
25123         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
25124         return ret_conv;
25125 }
25126
25127 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_clone"))) TS_CResult_BlindedFailureDecodeErrorZ_clone(uint64_t orig) {
25128         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
25129         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25130         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
25131         return tag_ptr(ret_conv, true);
25132 }
25133
25134 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_ok(uint32_t o) {
25135         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
25136         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
25137         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
25138         return tag_ptr(ret_conv, true);
25139 }
25140
25141 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_err(uint64_t e) {
25142         void* e_ptr = untag_ptr(e);
25143         CHECK_ACCESS(e_ptr);
25144         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25145         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25146         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
25147         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
25148         return tag_ptr(ret_conv, true);
25149 }
25150
25151 jboolean  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(uint64_t o) {
25152         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
25153         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
25154         return ret_conv;
25155 }
25156
25157 void  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_free"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_free(uint64_t _res) {
25158         if (!ptr_is_owned(_res)) return;
25159         void* _res_ptr = untag_ptr(_res);
25160         CHECK_ACCESS(_res_ptr);
25161         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
25162         FREE(untag_ptr(_res));
25163         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
25164 }
25165
25166 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
25167         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
25168         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
25169         return tag_ptr(ret_conv, true);
25170 }
25171 int64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(uint64_t arg) {
25172         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
25173         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
25174         return ret_conv;
25175 }
25176
25177 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone(uint64_t orig) {
25178         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
25179         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
25180         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
25181         return tag_ptr(ret_conv, true);
25182 }
25183
25184 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
25185         LDKCVec_ChannelMonitorZ _res_constr;
25186         _res_constr.datalen = _res->arr_len;
25187         if (_res_constr.datalen > 0)
25188                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
25189         else
25190                 _res_constr.data = NULL;
25191         uint64_t* _res_vals = _res->elems;
25192         for (size_t q = 0; q < _res_constr.datalen; q++) {
25193                 uint64_t _res_conv_16 = _res_vals[q];
25194                 LDKChannelMonitor _res_conv_16_conv;
25195                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25196                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25197                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25198                 _res_constr.data[q] = _res_conv_16_conv;
25199         }
25200         FREE(_res);
25201         CVec_ChannelMonitorZ_free(_res_constr);
25202 }
25203
25204 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, uint64_t b) {
25205         LDKThirtyTwoBytes a_ref;
25206         CHECK(a->arr_len == 32);
25207         memcpy(a_ref.data, a->elems, 32); FREE(a);
25208         LDKChannelManager b_conv;
25209         b_conv.inner = untag_ptr(b);
25210         b_conv.is_owned = ptr_is_owned(b);
25211         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25212         // WARNING: we need a move here but no clone is available for LDKChannelManager
25213         
25214         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
25215         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
25216         return tag_ptr(ret_conv, true);
25217 }
25218
25219 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(uint64_t _res) {
25220         if (!ptr_is_owned(_res)) return;
25221         void* _res_ptr = untag_ptr(_res);
25222         CHECK_ACCESS(_res_ptr);
25223         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
25224         FREE(untag_ptr(_res));
25225         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
25226 }
25227
25228 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(uint64_t o) {
25229         void* o_ptr = untag_ptr(o);
25230         CHECK_ACCESS(o_ptr);
25231         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
25232         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
25233         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
25234         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
25235         return tag_ptr(ret_conv, true);
25236 }
25237
25238 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(uint64_t e) {
25239         void* e_ptr = untag_ptr(e);
25240         CHECK_ACCESS(e_ptr);
25241         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25242         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25243         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
25244         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
25245         return tag_ptr(ret_conv, true);
25246 }
25247
25248 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
25249         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
25250         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
25251         return ret_conv;
25252 }
25253
25254 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(uint64_t _res) {
25255         if (!ptr_is_owned(_res)) return;
25256         void* _res_ptr = untag_ptr(_res);
25257         CHECK_ACCESS(_res_ptr);
25258         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
25259         FREE(untag_ptr(_res));
25260         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
25261 }
25262
25263 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(uint64_t o) {
25264         void* o_ptr = untag_ptr(o);
25265         CHECK_ACCESS(o_ptr);
25266         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25267         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25268         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25269         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
25270         return tag_ptr(ret_conv, true);
25271 }
25272
25273 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err(uint64_t e) {
25274         void* e_ptr = untag_ptr(e);
25275         CHECK_ACCESS(e_ptr);
25276         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25277         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25278         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25279         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
25280         return tag_ptr(ret_conv, true);
25281 }
25282
25283 jboolean  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(uint64_t o) {
25284         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
25285         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
25286         return ret_conv;
25287 }
25288
25289 void  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free(uint64_t _res) {
25290         if (!ptr_is_owned(_res)) return;
25291         void* _res_ptr = untag_ptr(_res);
25292         CHECK_ACCESS(_res_ptr);
25293         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
25294         FREE(untag_ptr(_res));
25295         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
25296 }
25297
25298 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
25299         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25300         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
25301         return tag_ptr(ret_conv, true);
25302 }
25303 int64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(uint64_t arg) {
25304         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
25305         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
25306         return ret_conv;
25307 }
25308
25309 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(uint64_t orig) {
25310         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
25311         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25312         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
25313         return tag_ptr(ret_conv, true);
25314 }
25315
25316 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
25317         LDKChannelConfig o_conv;
25318         o_conv.inner = untag_ptr(o);
25319         o_conv.is_owned = ptr_is_owned(o);
25320         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25321         o_conv = ChannelConfig_clone(&o_conv);
25322         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25323         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
25324         return tag_ptr(ret_conv, true);
25325 }
25326
25327 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
25328         void* e_ptr = untag_ptr(e);
25329         CHECK_ACCESS(e_ptr);
25330         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25331         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25332         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25333         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
25334         return tag_ptr(ret_conv, true);
25335 }
25336
25337 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
25338         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
25339         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
25340         return ret_conv;
25341 }
25342
25343 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
25344         if (!ptr_is_owned(_res)) return;
25345         void* _res_ptr = untag_ptr(_res);
25346         CHECK_ACCESS(_res_ptr);
25347         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
25348         FREE(untag_ptr(_res));
25349         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
25350 }
25351
25352 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
25353         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25354         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
25355         return tag_ptr(ret_conv, true);
25356 }
25357 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
25358         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
25359         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
25360         return ret_conv;
25361 }
25362
25363 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
25364         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
25365         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25366         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
25367         return tag_ptr(ret_conv, true);
25368 }
25369
25370 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_some"))) TS_COption_MaxDustHTLCExposureZ_some(uint64_t o) {
25371         void* o_ptr = untag_ptr(o);
25372         CHECK_ACCESS(o_ptr);
25373         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25374         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25375         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25376         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
25377         uint64_t ret_ref = tag_ptr(ret_copy, true);
25378         return ret_ref;
25379 }
25380
25381 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_none"))) TS_COption_MaxDustHTLCExposureZ_none() {
25382         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25383         *ret_copy = COption_MaxDustHTLCExposureZ_none();
25384         uint64_t ret_ref = tag_ptr(ret_copy, true);
25385         return ret_ref;
25386 }
25387
25388 void  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_free"))) TS_COption_MaxDustHTLCExposureZ_free(uint64_t _res) {
25389         if (!ptr_is_owned(_res)) return;
25390         void* _res_ptr = untag_ptr(_res);
25391         CHECK_ACCESS(_res_ptr);
25392         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
25393         FREE(untag_ptr(_res));
25394         COption_MaxDustHTLCExposureZ_free(_res_conv);
25395 }
25396
25397 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
25398         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25399         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
25400         uint64_t ret_ref = tag_ptr(ret_copy, true);
25401         return ret_ref;
25402 }
25403 int64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone_ptr"))) TS_COption_MaxDustHTLCExposureZ_clone_ptr(uint64_t arg) {
25404         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
25405         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
25406         return ret_conv;
25407 }
25408
25409 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone"))) TS_COption_MaxDustHTLCExposureZ_clone(uint64_t orig) {
25410         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
25411         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25412         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
25413         uint64_t ret_ref = tag_ptr(ret_copy, true);
25414         return ret_ref;
25415 }
25416
25417 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
25418         void* o_ptr = untag_ptr(o);
25419         CHECK_ACCESS(o_ptr);
25420         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
25421         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
25422         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25423         *ret_copy = COption_APIErrorZ_some(o_conv);
25424         uint64_t ret_ref = tag_ptr(ret_copy, true);
25425         return ret_ref;
25426 }
25427
25428 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
25429         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25430         *ret_copy = COption_APIErrorZ_none();
25431         uint64_t ret_ref = tag_ptr(ret_copy, true);
25432         return ret_ref;
25433 }
25434
25435 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
25436         if (!ptr_is_owned(_res)) return;
25437         void* _res_ptr = untag_ptr(_res);
25438         CHECK_ACCESS(_res_ptr);
25439         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
25440         FREE(untag_ptr(_res));
25441         COption_APIErrorZ_free(_res_conv);
25442 }
25443
25444 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
25445         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25446         *ret_copy = COption_APIErrorZ_clone(arg);
25447         uint64_t ret_ref = tag_ptr(ret_copy, true);
25448         return ret_ref;
25449 }
25450 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
25451         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
25452         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
25453         return ret_conv;
25454 }
25455
25456 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
25457         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
25458         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25459         *ret_copy = COption_APIErrorZ_clone(orig_conv);
25460         uint64_t ret_ref = tag_ptr(ret_copy, true);
25461         return ret_ref;
25462 }
25463
25464 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
25465         void* o_ptr = untag_ptr(o);
25466         CHECK_ACCESS(o_ptr);
25467         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
25468         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
25469         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25470         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
25471         return tag_ptr(ret_conv, true);
25472 }
25473
25474 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
25475         void* e_ptr = untag_ptr(e);
25476         CHECK_ACCESS(e_ptr);
25477         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25478         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25479         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25480         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
25481         return tag_ptr(ret_conv, true);
25482 }
25483
25484 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
25485         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
25486         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
25487         return ret_conv;
25488 }
25489
25490 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
25491         if (!ptr_is_owned(_res)) return;
25492         void* _res_ptr = untag_ptr(_res);
25493         CHECK_ACCESS(_res_ptr);
25494         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
25495         FREE(untag_ptr(_res));
25496         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
25497 }
25498
25499 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
25500         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25501         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
25502         return tag_ptr(ret_conv, true);
25503 }
25504 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
25505         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
25506         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
25507         return ret_conv;
25508 }
25509
25510 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
25511         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
25512         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25513         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
25514         return tag_ptr(ret_conv, true);
25515 }
25516
25517 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
25518         LDKChannelMonitorUpdate o_conv;
25519         o_conv.inner = untag_ptr(o);
25520         o_conv.is_owned = ptr_is_owned(o);
25521         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25522         o_conv = ChannelMonitorUpdate_clone(&o_conv);
25523         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25524         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
25525         return tag_ptr(ret_conv, true);
25526 }
25527
25528 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
25529         void* e_ptr = untag_ptr(e);
25530         CHECK_ACCESS(e_ptr);
25531         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25532         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25533         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25534         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
25535         return tag_ptr(ret_conv, true);
25536 }
25537
25538 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
25539         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
25540         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
25541         return ret_conv;
25542 }
25543
25544 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
25545         if (!ptr_is_owned(_res)) return;
25546         void* _res_ptr = untag_ptr(_res);
25547         CHECK_ACCESS(_res_ptr);
25548         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
25549         FREE(untag_ptr(_res));
25550         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
25551 }
25552
25553 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
25554         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25555         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
25556         return tag_ptr(ret_conv, true);
25557 }
25558 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25559         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
25560         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
25561         return ret_conv;
25562 }
25563
25564 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
25565         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
25566         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25567         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
25568         return tag_ptr(ret_conv, true);
25569 }
25570
25571 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
25572         void* o_ptr = untag_ptr(o);
25573         CHECK_ACCESS(o_ptr);
25574         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
25575         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
25576         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25577         *ret_copy = COption_MonitorEventZ_some(o_conv);
25578         uint64_t ret_ref = tag_ptr(ret_copy, true);
25579         return ret_ref;
25580 }
25581
25582 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
25583         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25584         *ret_copy = COption_MonitorEventZ_none();
25585         uint64_t ret_ref = tag_ptr(ret_copy, true);
25586         return ret_ref;
25587 }
25588
25589 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
25590         if (!ptr_is_owned(_res)) return;
25591         void* _res_ptr = untag_ptr(_res);
25592         CHECK_ACCESS(_res_ptr);
25593         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
25594         FREE(untag_ptr(_res));
25595         COption_MonitorEventZ_free(_res_conv);
25596 }
25597
25598 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
25599         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25600         *ret_copy = COption_MonitorEventZ_clone(arg);
25601         uint64_t ret_ref = tag_ptr(ret_copy, true);
25602         return ret_ref;
25603 }
25604 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
25605         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
25606         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
25607         return ret_conv;
25608 }
25609
25610 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
25611         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
25612         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25613         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
25614         uint64_t ret_ref = tag_ptr(ret_copy, true);
25615         return ret_ref;
25616 }
25617
25618 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
25619         void* o_ptr = untag_ptr(o);
25620         CHECK_ACCESS(o_ptr);
25621         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
25622         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
25623         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25624         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
25625         return tag_ptr(ret_conv, true);
25626 }
25627
25628 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
25629         void* e_ptr = untag_ptr(e);
25630         CHECK_ACCESS(e_ptr);
25631         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25632         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25633         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25634         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
25635         return tag_ptr(ret_conv, true);
25636 }
25637
25638 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
25639         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
25640         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
25641         return ret_conv;
25642 }
25643
25644 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
25645         if (!ptr_is_owned(_res)) return;
25646         void* _res_ptr = untag_ptr(_res);
25647         CHECK_ACCESS(_res_ptr);
25648         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
25649         FREE(untag_ptr(_res));
25650         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
25651 }
25652
25653 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
25654         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25655         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
25656         return tag_ptr(ret_conv, true);
25657 }
25658 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
25659         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
25660         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
25661         return ret_conv;
25662 }
25663
25664 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
25665         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
25666         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25667         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
25668         return tag_ptr(ret_conv, true);
25669 }
25670
25671 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
25672         LDKHTLCUpdate o_conv;
25673         o_conv.inner = untag_ptr(o);
25674         o_conv.is_owned = ptr_is_owned(o);
25675         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25676         o_conv = HTLCUpdate_clone(&o_conv);
25677         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25678         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
25679         return tag_ptr(ret_conv, true);
25680 }
25681
25682 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
25683         void* e_ptr = untag_ptr(e);
25684         CHECK_ACCESS(e_ptr);
25685         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25686         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25687         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25688         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
25689         return tag_ptr(ret_conv, true);
25690 }
25691
25692 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
25693         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
25694         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
25695         return ret_conv;
25696 }
25697
25698 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
25699         if (!ptr_is_owned(_res)) return;
25700         void* _res_ptr = untag_ptr(_res);
25701         CHECK_ACCESS(_res_ptr);
25702         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
25703         FREE(untag_ptr(_res));
25704         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
25705 }
25706
25707 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
25708         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25709         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
25710         return tag_ptr(ret_conv, true);
25711 }
25712 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25713         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
25714         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
25715         return ret_conv;
25716 }
25717
25718 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
25719         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
25720         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25721         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
25722         return tag_ptr(ret_conv, true);
25723 }
25724
25725 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
25726         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
25727         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
25728         return tag_ptr(ret_conv, true);
25729 }
25730 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(uint64_t arg) {
25731         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
25732         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
25733         return ret_conv;
25734 }
25735
25736 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone(uint64_t orig) {
25737         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
25738         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
25739         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
25740         return tag_ptr(ret_conv, true);
25741 }
25742
25743 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_new"))) TS_C2Tuple_OutPointCVec_u8ZZ_new(uint64_t a, int8_tArray b) {
25744         LDKOutPoint a_conv;
25745         a_conv.inner = untag_ptr(a);
25746         a_conv.is_owned = ptr_is_owned(a);
25747         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25748         a_conv = OutPoint_clone(&a_conv);
25749         LDKCVec_u8Z b_ref;
25750         b_ref.datalen = b->arr_len;
25751         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
25752         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
25753         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
25754         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
25755         return tag_ptr(ret_conv, true);
25756 }
25757
25758 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_free"))) TS_C2Tuple_OutPointCVec_u8ZZ_free(uint64_t _res) {
25759         if (!ptr_is_owned(_res)) return;
25760         void* _res_ptr = untag_ptr(_res);
25761         CHECK_ACCESS(_res_ptr);
25762         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
25763         FREE(untag_ptr(_res));
25764         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
25765 }
25766
25767 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
25768         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
25769         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
25770         return tag_ptr(ret_conv, true);
25771 }
25772 int64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u32CVec_u8ZZ_clone_ptr(uint64_t arg) {
25773         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
25774         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
25775         return ret_conv;
25776 }
25777
25778 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone"))) TS_C2Tuple_u32CVec_u8ZZ_clone(uint64_t orig) {
25779         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
25780         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
25781         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
25782         return tag_ptr(ret_conv, true);
25783 }
25784
25785 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_new"))) TS_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
25786         LDKCVec_u8Z b_ref;
25787         b_ref.datalen = b->arr_len;
25788         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
25789         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
25790         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
25791         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
25792         return tag_ptr(ret_conv, true);
25793 }
25794
25795 void  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_free"))) TS_C2Tuple_u32CVec_u8ZZ_free(uint64_t _res) {
25796         if (!ptr_is_owned(_res)) return;
25797         void* _res_ptr = untag_ptr(_res);
25798         CHECK_ACCESS(_res_ptr);
25799         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
25800         FREE(untag_ptr(_res));
25801         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
25802 }
25803
25804 void  __attribute__((export_name("TS_CVec_C2Tuple_u32CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u32CVec_u8ZZZ_free(uint64_tArray _res) {
25805         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
25806         _res_constr.datalen = _res->arr_len;
25807         if (_res_constr.datalen > 0)
25808                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
25809         else
25810                 _res_constr.data = NULL;
25811         uint64_t* _res_vals = _res->elems;
25812         for (size_t x = 0; x < _res_constr.datalen; x++) {
25813                 uint64_t _res_conv_23 = _res_vals[x];
25814                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
25815                 CHECK_ACCESS(_res_conv_23_ptr);
25816                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
25817                 FREE(untag_ptr(_res_conv_23));
25818                 _res_constr.data[x] = _res_conv_23_conv;
25819         }
25820         FREE(_res);
25821         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
25822 }
25823
25824 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
25825         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
25826         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
25827         return tag_ptr(ret_conv, true);
25828 }
25829 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(uint64_t arg) {
25830         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
25831         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
25832         return ret_conv;
25833 }
25834
25835 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(uint64_t orig) {
25836         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
25837         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
25838         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
25839         return tag_ptr(ret_conv, true);
25840 }
25841
25842 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) {
25843         LDKThirtyTwoBytes a_ref;
25844         CHECK(a->arr_len == 32);
25845         memcpy(a_ref.data, a->elems, 32); FREE(a);
25846         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
25847         b_constr.datalen = b->arr_len;
25848         if (b_constr.datalen > 0)
25849                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
25850         else
25851                 b_constr.data = NULL;
25852         uint64_t* b_vals = b->elems;
25853         for (size_t x = 0; x < b_constr.datalen; x++) {
25854                 uint64_t b_conv_23 = b_vals[x];
25855                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
25856                 CHECK_ACCESS(b_conv_23_ptr);
25857                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
25858                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
25859                 b_constr.data[x] = b_conv_23_conv;
25860         }
25861         FREE(b);
25862         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
25863         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
25864         return tag_ptr(ret_conv, true);
25865 }
25866
25867 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(uint64_t _res) {
25868         if (!ptr_is_owned(_res)) return;
25869         void* _res_ptr = untag_ptr(_res);
25870         CHECK_ACCESS(_res_ptr);
25871         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
25872         FREE(untag_ptr(_res));
25873         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
25874 }
25875
25876 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(uint64_tArray _res) {
25877         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
25878         _res_constr.datalen = _res->arr_len;
25879         if (_res_constr.datalen > 0)
25880                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
25881         else
25882                 _res_constr.data = NULL;
25883         uint64_t* _res_vals = _res->elems;
25884         for (size_t a = 0; a < _res_constr.datalen; a++) {
25885                 uint64_t _res_conv_52 = _res_vals[a];
25886                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
25887                 CHECK_ACCESS(_res_conv_52_ptr);
25888                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
25889                 FREE(untag_ptr(_res_conv_52));
25890                 _res_constr.data[a] = _res_conv_52_conv;
25891         }
25892         FREE(_res);
25893         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
25894 }
25895
25896 void  __attribute__((export_name("TS_CVec_CommitmentTransactionZ_free"))) TS_CVec_CommitmentTransactionZ_free(uint64_tArray _res) {
25897         LDKCVec_CommitmentTransactionZ _res_constr;
25898         _res_constr.datalen = _res->arr_len;
25899         if (_res_constr.datalen > 0)
25900                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
25901         else
25902                 _res_constr.data = NULL;
25903         uint64_t* _res_vals = _res->elems;
25904         for (size_t x = 0; x < _res_constr.datalen; x++) {
25905                 uint64_t _res_conv_23 = _res_vals[x];
25906                 LDKCommitmentTransaction _res_conv_23_conv;
25907                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
25908                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
25909                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
25910                 _res_constr.data[x] = _res_conv_23_conv;
25911         }
25912         FREE(_res);
25913         CVec_CommitmentTransactionZ_free(_res_constr);
25914 }
25915
25916 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
25917         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25918         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
25919         return tag_ptr(ret_conv, true);
25920 }
25921 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
25922         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
25923         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
25924         return ret_conv;
25925 }
25926
25927 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
25928         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
25929         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25930         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
25931         return tag_ptr(ret_conv, true);
25932 }
25933
25934 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
25935         void* b_ptr = untag_ptr(b);
25936         CHECK_ACCESS(b_ptr);
25937         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
25938         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
25939         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25940         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
25941         return tag_ptr(ret_conv, true);
25942 }
25943
25944 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
25945         if (!ptr_is_owned(_res)) return;
25946         void* _res_ptr = untag_ptr(_res);
25947         CHECK_ACCESS(_res_ptr);
25948         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
25949         FREE(untag_ptr(_res));
25950         C2Tuple_u32TxOutZ_free(_res_conv);
25951 }
25952
25953 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
25954         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
25955         _res_constr.datalen = _res->arr_len;
25956         if (_res_constr.datalen > 0)
25957                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
25958         else
25959                 _res_constr.data = NULL;
25960         uint64_t* _res_vals = _res->elems;
25961         for (size_t u = 0; u < _res_constr.datalen; u++) {
25962                 uint64_t _res_conv_20 = _res_vals[u];
25963                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
25964                 CHECK_ACCESS(_res_conv_20_ptr);
25965                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
25966                 FREE(untag_ptr(_res_conv_20));
25967                 _res_constr.data[u] = _res_conv_20_conv;
25968         }
25969         FREE(_res);
25970         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
25971 }
25972
25973 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
25974         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
25975         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
25976         return tag_ptr(ret_conv, true);
25977 }
25978 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
25979         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
25980         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
25981         return ret_conv;
25982 }
25983
25984 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
25985         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
25986         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
25987         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
25988         return tag_ptr(ret_conv, true);
25989 }
25990
25991 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
25992         LDKThirtyTwoBytes a_ref;
25993         CHECK(a->arr_len == 32);
25994         memcpy(a_ref.data, a->elems, 32); FREE(a);
25995         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
25996         b_constr.datalen = b->arr_len;
25997         if (b_constr.datalen > 0)
25998                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
25999         else
26000                 b_constr.data = NULL;
26001         uint64_t* b_vals = b->elems;
26002         for (size_t u = 0; u < b_constr.datalen; u++) {
26003                 uint64_t b_conv_20 = b_vals[u];
26004                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
26005                 CHECK_ACCESS(b_conv_20_ptr);
26006                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
26007                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
26008                 b_constr.data[u] = b_conv_20_conv;
26009         }
26010         FREE(b);
26011         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
26012         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
26013         return tag_ptr(ret_conv, true);
26014 }
26015
26016 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
26017         if (!ptr_is_owned(_res)) return;
26018         void* _res_ptr = untag_ptr(_res);
26019         CHECK_ACCESS(_res_ptr);
26020         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
26021         FREE(untag_ptr(_res));
26022         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
26023 }
26024
26025 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
26026         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
26027         _res_constr.datalen = _res->arr_len;
26028         if (_res_constr.datalen > 0)
26029                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
26030         else
26031                 _res_constr.data = NULL;
26032         uint64_t* _res_vals = _res->elems;
26033         for (size_t x = 0; x < _res_constr.datalen; x++) {
26034                 uint64_t _res_conv_49 = _res_vals[x];
26035                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
26036                 CHECK_ACCESS(_res_conv_49_ptr);
26037                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
26038                 FREE(untag_ptr(_res_conv_49));
26039                 _res_constr.data[x] = _res_conv_49_conv;
26040         }
26041         FREE(_res);
26042         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
26043 }
26044
26045 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
26046         LDKCVec_BalanceZ _res_constr;
26047         _res_constr.datalen = _res->arr_len;
26048         if (_res_constr.datalen > 0)
26049                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
26050         else
26051                 _res_constr.data = NULL;
26052         uint64_t* _res_vals = _res->elems;
26053         for (size_t j = 0; j < _res_constr.datalen; j++) {
26054                 uint64_t _res_conv_9 = _res_vals[j];
26055                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
26056                 CHECK_ACCESS(_res_conv_9_ptr);
26057                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
26058                 FREE(untag_ptr(_res_conv_9));
26059                 _res_constr.data[j] = _res_conv_9_conv;
26060         }
26061         FREE(_res);
26062         CVec_BalanceZ_free(_res_constr);
26063 }
26064
26065 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
26066         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26067         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
26068         return tag_ptr(ret_conv, true);
26069 }
26070 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(uint64_t arg) {
26071         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
26072         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
26073         return ret_conv;
26074 }
26075
26076 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(uint64_t orig) {
26077         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
26078         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26079         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
26080         return tag_ptr(ret_conv, true);
26081 }
26082
26083 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, uint64_t b) {
26084         LDKThirtyTwoBytes a_ref;
26085         CHECK(a->arr_len == 32);
26086         memcpy(a_ref.data, a->elems, 32); FREE(a);
26087         LDKChannelMonitor b_conv;
26088         b_conv.inner = untag_ptr(b);
26089         b_conv.is_owned = ptr_is_owned(b);
26090         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26091         b_conv = ChannelMonitor_clone(&b_conv);
26092         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26093         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
26094         return tag_ptr(ret_conv, true);
26095 }
26096
26097 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(uint64_t _res) {
26098         if (!ptr_is_owned(_res)) return;
26099         void* _res_ptr = untag_ptr(_res);
26100         CHECK_ACCESS(_res_ptr);
26101         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
26102         FREE(untag_ptr(_res));
26103         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
26104 }
26105
26106 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
26107         void* o_ptr = untag_ptr(o);
26108         CHECK_ACCESS(o_ptr);
26109         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
26110         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
26111         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26112         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
26113         return tag_ptr(ret_conv, true);
26114 }
26115
26116 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(uint64_t e) {
26117         void* e_ptr = untag_ptr(e);
26118         CHECK_ACCESS(e_ptr);
26119         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26120         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26121         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26122         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
26123         return tag_ptr(ret_conv, true);
26124 }
26125
26126 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
26127         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
26128         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
26129         return ret_conv;
26130 }
26131
26132 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
26133         if (!ptr_is_owned(_res)) return;
26134         void* _res_ptr = untag_ptr(_res);
26135         CHECK_ACCESS(_res_ptr);
26136         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
26137         FREE(untag_ptr(_res));
26138         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
26139 }
26140
26141 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
26142         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26143         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
26144         return tag_ptr(ret_conv, true);
26145 }
26146 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
26147         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
26148         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
26149         return ret_conv;
26150 }
26151
26152 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
26153         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
26154         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26155         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
26156         return tag_ptr(ret_conv, true);
26157 }
26158
26159 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
26160         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26161         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
26162         return tag_ptr(ret_conv, true);
26163 }
26164 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
26165         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
26166         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
26167         return ret_conv;
26168 }
26169
26170 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
26171         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
26172         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26173         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
26174         return tag_ptr(ret_conv, true);
26175 }
26176
26177 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
26178         LDKPublicKey a_ref;
26179         CHECK(a->arr_len == 33);
26180         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
26181         void* b_ptr = untag_ptr(b);
26182         CHECK_ACCESS(b_ptr);
26183         LDKType b_conv = *(LDKType*)(b_ptr);
26184         if (b_conv.free == LDKType_JCalls_free) {
26185                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26186                 LDKType_JCalls_cloned(&b_conv);
26187         }
26188         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26189         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
26190         return tag_ptr(ret_conv, true);
26191 }
26192
26193 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
26194         if (!ptr_is_owned(_res)) return;
26195         void* _res_ptr = untag_ptr(_res);
26196         CHECK_ACCESS(_res_ptr);
26197         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
26198         FREE(untag_ptr(_res));
26199         C2Tuple_PublicKeyTypeZ_free(_res_conv);
26200 }
26201
26202 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
26203         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
26204         _res_constr.datalen = _res->arr_len;
26205         if (_res_constr.datalen > 0)
26206                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
26207         else
26208                 _res_constr.data = NULL;
26209         uint64_t* _res_vals = _res->elems;
26210         for (size_t z = 0; z < _res_constr.datalen; z++) {
26211                 uint64_t _res_conv_25 = _res_vals[z];
26212                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
26213                 CHECK_ACCESS(_res_conv_25_ptr);
26214                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
26215                 FREE(untag_ptr(_res_conv_25));
26216                 _res_constr.data[z] = _res_conv_25_conv;
26217         }
26218         FREE(_res);
26219         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
26220 }
26221
26222 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
26223         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26224         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
26225         return tag_ptr(ret_conv, true);
26226 }
26227 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
26228         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
26229         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
26230         return ret_conv;
26231 }
26232
26233 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(uint64_t orig) {
26234         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
26235         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26236         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
26237         return tag_ptr(ret_conv, true);
26238 }
26239
26240 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_new"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_new(int8_tArray a, uint64_tArray b) {
26241         LDKPublicKey a_ref;
26242         CHECK(a->arr_len == 33);
26243         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
26244         LDKCVec_SocketAddressZ b_constr;
26245         b_constr.datalen = b->arr_len;
26246         if (b_constr.datalen > 0)
26247                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
26248         else
26249                 b_constr.data = NULL;
26250         uint64_t* b_vals = b->elems;
26251         for (size_t p = 0; p < b_constr.datalen; p++) {
26252                 uint64_t b_conv_15 = b_vals[p];
26253                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
26254                 CHECK_ACCESS(b_conv_15_ptr);
26255                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
26256                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
26257                 b_constr.data[p] = b_conv_15_conv;
26258         }
26259         FREE(b);
26260         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26261         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
26262         return tag_ptr(ret_conv, true);
26263 }
26264
26265 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_free"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_free(uint64_t _res) {
26266         if (!ptr_is_owned(_res)) return;
26267         void* _res_ptr = untag_ptr(_res);
26268         CHECK_ACCESS(_res_ptr);
26269         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
26270         FREE(untag_ptr(_res));
26271         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
26272 }
26273
26274 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(uint64_tArray _res) {
26275         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
26276         _res_constr.datalen = _res->arr_len;
26277         if (_res_constr.datalen > 0)
26278                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
26279         else
26280                 _res_constr.data = NULL;
26281         uint64_t* _res_vals = _res->elems;
26282         for (size_t o = 0; o < _res_constr.datalen; o++) {
26283                 uint64_t _res_conv_40 = _res_vals[o];
26284                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
26285                 CHECK_ACCESS(_res_conv_40_ptr);
26286                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
26287                 FREE(untag_ptr(_res_conv_40));
26288                 _res_constr.data[o] = _res_conv_40_conv;
26289         }
26290         FREE(_res);
26291         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
26292 }
26293
26294 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_some"))) TS_COption_OnionMessageContentsZ_some(uint64_t o) {
26295         void* o_ptr = untag_ptr(o);
26296         CHECK_ACCESS(o_ptr);
26297         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
26298         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
26299                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26300                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
26301         }
26302         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26303         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
26304         uint64_t ret_ref = tag_ptr(ret_copy, true);
26305         return ret_ref;
26306 }
26307
26308 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_none"))) TS_COption_OnionMessageContentsZ_none() {
26309         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26310         *ret_copy = COption_OnionMessageContentsZ_none();
26311         uint64_t ret_ref = tag_ptr(ret_copy, true);
26312         return ret_ref;
26313 }
26314
26315 void  __attribute__((export_name("TS_COption_OnionMessageContentsZ_free"))) TS_COption_OnionMessageContentsZ_free(uint64_t _res) {
26316         if (!ptr_is_owned(_res)) return;
26317         void* _res_ptr = untag_ptr(_res);
26318         CHECK_ACCESS(_res_ptr);
26319         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
26320         FREE(untag_ptr(_res));
26321         COption_OnionMessageContentsZ_free(_res_conv);
26322 }
26323
26324 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
26325         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26326         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
26327         uint64_t ret_ref = tag_ptr(ret_copy, true);
26328         return ret_ref;
26329 }
26330 int64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone_ptr"))) TS_COption_OnionMessageContentsZ_clone_ptr(uint64_t arg) {
26331         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
26332         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
26333         return ret_conv;
26334 }
26335
26336 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone"))) TS_COption_OnionMessageContentsZ_clone(uint64_t orig) {
26337         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
26338         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26339         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
26340         uint64_t ret_ref = tag_ptr(ret_copy, true);
26341         return ret_ref;
26342 }
26343
26344 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
26345         void* o_ptr = untag_ptr(o);
26346         CHECK_ACCESS(o_ptr);
26347         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
26348         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
26349         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26350         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
26351         return tag_ptr(ret_conv, true);
26352 }
26353
26354 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
26355         void* e_ptr = untag_ptr(e);
26356         CHECK_ACCESS(e_ptr);
26357         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26358         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26359         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26360         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
26361         return tag_ptr(ret_conv, true);
26362 }
26363
26364 jboolean  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
26365         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
26366         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
26367         return ret_conv;
26368 }
26369
26370 void  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
26371         if (!ptr_is_owned(_res)) return;
26372         void* _res_ptr = untag_ptr(_res);
26373         CHECK_ACCESS(_res_ptr);
26374         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
26375         FREE(untag_ptr(_res));
26376         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
26377 }
26378
26379 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
26380         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26381         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
26382         return tag_ptr(ret_conv, true);
26383 }
26384 int64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
26385         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
26386         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
26387         return ret_conv;
26388 }
26389
26390 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
26391         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
26392         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26393         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
26394         return tag_ptr(ret_conv, true);
26395 }
26396
26397 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
26398         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26399         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
26400         return tag_ptr(ret_conv, true);
26401 }
26402 int64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
26403         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
26404         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
26405         return ret_conv;
26406 }
26407
26408 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(uint64_t orig) {
26409         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
26410         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26411         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
26412         return tag_ptr(ret_conv, true);
26413 }
26414
26415 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
26416         void* a_ptr = untag_ptr(a);
26417         CHECK_ACCESS(a_ptr);
26418         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
26419         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
26420                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26421                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
26422         }
26423         void* b_ptr = untag_ptr(b);
26424         CHECK_ACCESS(b_ptr);
26425         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
26426         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
26427         LDKBlindedPath c_conv;
26428         c_conv.inner = untag_ptr(c);
26429         c_conv.is_owned = ptr_is_owned(c);
26430         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
26431         c_conv = BlindedPath_clone(&c_conv);
26432         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26433         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
26434         return tag_ptr(ret_conv, true);
26435 }
26436
26437 void  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(uint64_t _res) {
26438         if (!ptr_is_owned(_res)) return;
26439         void* _res_ptr = untag_ptr(_res);
26440         CHECK_ACCESS(_res_ptr);
26441         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
26442         FREE(untag_ptr(_res));
26443         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
26444 }
26445
26446 void  __attribute__((export_name("TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(uint64_tArray _res) {
26447         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
26448         _res_constr.datalen = _res->arr_len;
26449         if (_res_constr.datalen > 0)
26450                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
26451         else
26452                 _res_constr.data = NULL;
26453         uint64_t* _res_vals = _res->elems;
26454         for (size_t e = 0; e < _res_constr.datalen; e++) {
26455                 uint64_t _res_conv_56 = _res_vals[e];
26456                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
26457                 CHECK_ACCESS(_res_conv_56_ptr);
26458                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
26459                 FREE(untag_ptr(_res_conv_56));
26460                 _res_constr.data[e] = _res_conv_56_conv;
26461         }
26462         FREE(_res);
26463         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
26464 }
26465
26466 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
26467         void* o_ptr = untag_ptr(o);
26468         CHECK_ACCESS(o_ptr);
26469         LDKType o_conv = *(LDKType*)(o_ptr);
26470         if (o_conv.free == LDKType_JCalls_free) {
26471                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26472                 LDKType_JCalls_cloned(&o_conv);
26473         }
26474         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26475         *ret_copy = COption_TypeZ_some(o_conv);
26476         uint64_t ret_ref = tag_ptr(ret_copy, true);
26477         return ret_ref;
26478 }
26479
26480 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
26481         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26482         *ret_copy = COption_TypeZ_none();
26483         uint64_t ret_ref = tag_ptr(ret_copy, true);
26484         return ret_ref;
26485 }
26486
26487 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
26488         if (!ptr_is_owned(_res)) return;
26489         void* _res_ptr = untag_ptr(_res);
26490         CHECK_ACCESS(_res_ptr);
26491         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
26492         FREE(untag_ptr(_res));
26493         COption_TypeZ_free(_res_conv);
26494 }
26495
26496 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
26497         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26498         *ret_copy = COption_TypeZ_clone(arg);
26499         uint64_t ret_ref = tag_ptr(ret_copy, true);
26500         return ret_ref;
26501 }
26502 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
26503         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
26504         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
26505         return ret_conv;
26506 }
26507
26508 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
26509         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
26510         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26511         *ret_copy = COption_TypeZ_clone(orig_conv);
26512         uint64_t ret_ref = tag_ptr(ret_copy, true);
26513         return ret_ref;
26514 }
26515
26516 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
26517         void* o_ptr = untag_ptr(o);
26518         CHECK_ACCESS(o_ptr);
26519         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
26520         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
26521         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26522         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
26523         return tag_ptr(ret_conv, true);
26524 }
26525
26526 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
26527         void* e_ptr = untag_ptr(e);
26528         CHECK_ACCESS(e_ptr);
26529         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26530         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26531         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26532         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
26533         return tag_ptr(ret_conv, true);
26534 }
26535
26536 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
26537         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
26538         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
26539         return ret_conv;
26540 }
26541
26542 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
26543         if (!ptr_is_owned(_res)) return;
26544         void* _res_ptr = untag_ptr(_res);
26545         CHECK_ACCESS(_res_ptr);
26546         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
26547         FREE(untag_ptr(_res));
26548         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
26549 }
26550
26551 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
26552         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26553         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
26554         return tag_ptr(ret_conv, true);
26555 }
26556 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
26557         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
26558         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
26559         return ret_conv;
26560 }
26561
26562 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
26563         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
26564         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26565         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
26566         return tag_ptr(ret_conv, true);
26567 }
26568
26569 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_some"))) TS_COption_SocketAddressZ_some(uint64_t o) {
26570         void* o_ptr = untag_ptr(o);
26571         CHECK_ACCESS(o_ptr);
26572         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
26573         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
26574         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26575         *ret_copy = COption_SocketAddressZ_some(o_conv);
26576         uint64_t ret_ref = tag_ptr(ret_copy, true);
26577         return ret_ref;
26578 }
26579
26580 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_none"))) TS_COption_SocketAddressZ_none() {
26581         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26582         *ret_copy = COption_SocketAddressZ_none();
26583         uint64_t ret_ref = tag_ptr(ret_copy, true);
26584         return ret_ref;
26585 }
26586
26587 void  __attribute__((export_name("TS_COption_SocketAddressZ_free"))) TS_COption_SocketAddressZ_free(uint64_t _res) {
26588         if (!ptr_is_owned(_res)) return;
26589         void* _res_ptr = untag_ptr(_res);
26590         CHECK_ACCESS(_res_ptr);
26591         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
26592         FREE(untag_ptr(_res));
26593         COption_SocketAddressZ_free(_res_conv);
26594 }
26595
26596 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
26597         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26598         *ret_copy = COption_SocketAddressZ_clone(arg);
26599         uint64_t ret_ref = tag_ptr(ret_copy, true);
26600         return ret_ref;
26601 }
26602 int64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone_ptr"))) TS_COption_SocketAddressZ_clone_ptr(uint64_t arg) {
26603         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
26604         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
26605         return ret_conv;
26606 }
26607
26608 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone"))) TS_COption_SocketAddressZ_clone(uint64_t orig) {
26609         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
26610         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26611         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
26612         uint64_t ret_ref = tag_ptr(ret_copy, true);
26613         return ret_ref;
26614 }
26615
26616 void  __attribute__((export_name("TS_CVec_PeerDetailsZ_free"))) TS_CVec_PeerDetailsZ_free(uint64_tArray _res) {
26617         LDKCVec_PeerDetailsZ _res_constr;
26618         _res_constr.datalen = _res->arr_len;
26619         if (_res_constr.datalen > 0)
26620                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPeerDetails), "LDKCVec_PeerDetailsZ Elements");
26621         else
26622                 _res_constr.data = NULL;
26623         uint64_t* _res_vals = _res->elems;
26624         for (size_t n = 0; n < _res_constr.datalen; n++) {
26625                 uint64_t _res_conv_13 = _res_vals[n];
26626                 LDKPeerDetails _res_conv_13_conv;
26627                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
26628                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
26629                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
26630                 _res_constr.data[n] = _res_conv_13_conv;
26631         }
26632         FREE(_res);
26633         CVec_PeerDetailsZ_free(_res_constr);
26634 }
26635
26636 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
26637         LDKCVec_u8Z o_ref;
26638         o_ref.datalen = o->arr_len;
26639         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
26640         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
26641         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26642         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
26643         return tag_ptr(ret_conv, true);
26644 }
26645
26646 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
26647         LDKPeerHandleError e_conv;
26648         e_conv.inner = untag_ptr(e);
26649         e_conv.is_owned = ptr_is_owned(e);
26650         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26651         e_conv = PeerHandleError_clone(&e_conv);
26652         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26653         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
26654         return tag_ptr(ret_conv, true);
26655 }
26656
26657 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
26658         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
26659         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
26660         return ret_conv;
26661 }
26662
26663 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
26664         if (!ptr_is_owned(_res)) return;
26665         void* _res_ptr = untag_ptr(_res);
26666         CHECK_ACCESS(_res_ptr);
26667         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
26668         FREE(untag_ptr(_res));
26669         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
26670 }
26671
26672 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
26673         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26674         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
26675         return tag_ptr(ret_conv, true);
26676 }
26677 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
26678         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
26679         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
26680         return ret_conv;
26681 }
26682
26683 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
26684         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
26685         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26686         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
26687         return tag_ptr(ret_conv, true);
26688 }
26689
26690 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
26691         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26692         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
26693         return tag_ptr(ret_conv, true);
26694 }
26695
26696 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
26697         LDKPeerHandleError e_conv;
26698         e_conv.inner = untag_ptr(e);
26699         e_conv.is_owned = ptr_is_owned(e);
26700         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26701         e_conv = PeerHandleError_clone(&e_conv);
26702         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26703         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
26704         return tag_ptr(ret_conv, true);
26705 }
26706
26707 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
26708         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
26709         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
26710         return ret_conv;
26711 }
26712
26713 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
26714         if (!ptr_is_owned(_res)) return;
26715         void* _res_ptr = untag_ptr(_res);
26716         CHECK_ACCESS(_res_ptr);
26717         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
26718         FREE(untag_ptr(_res));
26719         CResult_NonePeerHandleErrorZ_free(_res_conv);
26720 }
26721
26722 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
26723         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26724         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
26725         return tag_ptr(ret_conv, true);
26726 }
26727 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
26728         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
26729         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
26730         return ret_conv;
26731 }
26732
26733 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
26734         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
26735         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26736         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
26737         return tag_ptr(ret_conv, true);
26738 }
26739
26740 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
26741         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26742         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
26743         return tag_ptr(ret_conv, true);
26744 }
26745
26746 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
26747         LDKPeerHandleError e_conv;
26748         e_conv.inner = untag_ptr(e);
26749         e_conv.is_owned = ptr_is_owned(e);
26750         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26751         e_conv = PeerHandleError_clone(&e_conv);
26752         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26753         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
26754         return tag_ptr(ret_conv, true);
26755 }
26756
26757 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
26758         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
26759         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
26760         return ret_conv;
26761 }
26762
26763 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
26764         if (!ptr_is_owned(_res)) return;
26765         void* _res_ptr = untag_ptr(_res);
26766         CHECK_ACCESS(_res_ptr);
26767         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
26768         FREE(untag_ptr(_res));
26769         CResult_boolPeerHandleErrorZ_free(_res_conv);
26770 }
26771
26772 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
26773         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26774         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
26775         return tag_ptr(ret_conv, true);
26776 }
26777 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
26778         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
26779         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
26780         return ret_conv;
26781 }
26782
26783 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
26784         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
26785         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26786         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
26787         return tag_ptr(ret_conv, true);
26788 }
26789
26790 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
26791         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
26792         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
26793         return tag_ptr(ret_conv, true);
26794 }
26795
26796 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
26797         void* e_ptr = untag_ptr(e);
26798         CHECK_ACCESS(e_ptr);
26799         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
26800         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
26801         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
26802         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
26803         return tag_ptr(ret_conv, true);
26804 }
26805
26806 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
26807         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
26808         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
26809         return ret_conv;
26810 }
26811
26812 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
26813         if (!ptr_is_owned(_res)) return;
26814         void* _res_ptr = untag_ptr(_res);
26815         CHECK_ACCESS(_res_ptr);
26816         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
26817         FREE(untag_ptr(_res));
26818         CResult_u32GraphSyncErrorZ_free(_res_conv);
26819 }
26820
26821 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_ok"))) TS_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
26822         LDKCVec_u8Z o_ref;
26823         o_ref.datalen = o->arr_len;
26824         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
26825         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
26826         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
26827         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
26828         return tag_ptr(ret_conv, true);
26829 }
26830
26831 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_err"))) TS_CResult_CVec_u8ZIOErrorZ_err(uint32_t e) {
26832         LDKIOError e_conv = LDKIOError_from_js(e);
26833         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
26834         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
26835         return tag_ptr(ret_conv, true);
26836 }
26837
26838 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_is_ok"))) TS_CResult_CVec_u8ZIOErrorZ_is_ok(uint64_t o) {
26839         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
26840         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
26841         return ret_conv;
26842 }
26843
26844 void  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_free"))) TS_CResult_CVec_u8ZIOErrorZ_free(uint64_t _res) {
26845         if (!ptr_is_owned(_res)) return;
26846         void* _res_ptr = untag_ptr(_res);
26847         CHECK_ACCESS(_res_ptr);
26848         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
26849         FREE(untag_ptr(_res));
26850         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
26851 }
26852
26853 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
26854         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
26855         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
26856         return tag_ptr(ret_conv, true);
26857 }
26858 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZIOErrorZ_clone_ptr(uint64_t arg) {
26859         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
26860         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
26861         return ret_conv;
26862 }
26863
26864 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone"))) TS_CResult_CVec_u8ZIOErrorZ_clone(uint64_t orig) {
26865         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
26866         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
26867         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
26868         return tag_ptr(ret_conv, true);
26869 }
26870
26871 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_ok"))) TS_CResult_NoneIOErrorZ_ok() {
26872         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26873         *ret_conv = CResult_NoneIOErrorZ_ok();
26874         return tag_ptr(ret_conv, true);
26875 }
26876
26877 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_err"))) TS_CResult_NoneIOErrorZ_err(uint32_t e) {
26878         LDKIOError e_conv = LDKIOError_from_js(e);
26879         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26880         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
26881         return tag_ptr(ret_conv, true);
26882 }
26883
26884 jboolean  __attribute__((export_name("TS_CResult_NoneIOErrorZ_is_ok"))) TS_CResult_NoneIOErrorZ_is_ok(uint64_t o) {
26885         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
26886         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
26887         return ret_conv;
26888 }
26889
26890 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_free"))) TS_CResult_NoneIOErrorZ_free(uint64_t _res) {
26891         if (!ptr_is_owned(_res)) return;
26892         void* _res_ptr = untag_ptr(_res);
26893         CHECK_ACCESS(_res_ptr);
26894         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
26895         FREE(untag_ptr(_res));
26896         CResult_NoneIOErrorZ_free(_res_conv);
26897 }
26898
26899 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
26900         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26901         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
26902         return tag_ptr(ret_conv, true);
26903 }
26904 int64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone_ptr"))) TS_CResult_NoneIOErrorZ_clone_ptr(uint64_t arg) {
26905         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
26906         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
26907         return ret_conv;
26908 }
26909
26910 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone"))) TS_CResult_NoneIOErrorZ_clone(uint64_t orig) {
26911         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
26912         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26913         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
26914         return tag_ptr(ret_conv, true);
26915 }
26916
26917 void  __attribute__((export_name("TS_CVec_StrZ_free"))) TS_CVec_StrZ_free(ptrArray _res) {
26918         LDKCVec_StrZ _res_constr;
26919         _res_constr.datalen = _res->arr_len;
26920         if (_res_constr.datalen > 0)
26921                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
26922         else
26923                 _res_constr.data = NULL;
26924         jstring* _res_vals = (void*) _res->elems;
26925         for (size_t i = 0; i < _res_constr.datalen; i++) {
26926                 jstring _res_conv_8 = _res_vals[i];
26927                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
26928                 _res_constr.data[i] = dummy;
26929         }
26930         FREE(_res);
26931         CVec_StrZ_free(_res_constr);
26932 }
26933
26934 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_ok"))) TS_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
26935         LDKCVec_StrZ o_constr;
26936         o_constr.datalen = o->arr_len;
26937         if (o_constr.datalen > 0)
26938                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
26939         else
26940                 o_constr.data = NULL;
26941         jstring* o_vals = (void*) o->elems;
26942         for (size_t i = 0; i < o_constr.datalen; i++) {
26943                 jstring o_conv_8 = o_vals[i];
26944                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
26945                 o_constr.data[i] = o_conv_8_conv;
26946         }
26947         FREE(o);
26948         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
26949         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
26950         return tag_ptr(ret_conv, true);
26951 }
26952
26953 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_err"))) TS_CResult_CVec_StrZIOErrorZ_err(uint32_t e) {
26954         LDKIOError e_conv = LDKIOError_from_js(e);
26955         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
26956         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
26957         return tag_ptr(ret_conv, true);
26958 }
26959
26960 jboolean  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_is_ok"))) TS_CResult_CVec_StrZIOErrorZ_is_ok(uint64_t o) {
26961         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
26962         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
26963         return ret_conv;
26964 }
26965
26966 void  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_free"))) TS_CResult_CVec_StrZIOErrorZ_free(uint64_t _res) {
26967         if (!ptr_is_owned(_res)) return;
26968         void* _res_ptr = untag_ptr(_res);
26969         CHECK_ACCESS(_res_ptr);
26970         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
26971         FREE(untag_ptr(_res));
26972         CResult_CVec_StrZIOErrorZ_free(_res_conv);
26973 }
26974
26975 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
26976         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
26977         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
26978         return tag_ptr(ret_conv, true);
26979 }
26980 int64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone_ptr"))) TS_CResult_CVec_StrZIOErrorZ_clone_ptr(uint64_t arg) {
26981         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
26982         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
26983         return ret_conv;
26984 }
26985
26986 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone"))) TS_CResult_CVec_StrZIOErrorZ_clone(uint64_t orig) {
26987         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
26988         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
26989         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
26990         return tag_ptr(ret_conv, true);
26991 }
26992
26993 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(uint64_tArray _res) {
26994         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
26995         _res_constr.datalen = _res->arr_len;
26996         if (_res_constr.datalen > 0)
26997                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
26998         else
26999                 _res_constr.data = NULL;
27000         uint64_t* _res_vals = _res->elems;
27001         for (size_t o = 0; o < _res_constr.datalen; o++) {
27002                 uint64_t _res_conv_40 = _res_vals[o];
27003                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
27004                 CHECK_ACCESS(_res_conv_40_ptr);
27005                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
27006                 FREE(untag_ptr(_res_conv_40));
27007                 _res_constr.data[o] = _res_conv_40_conv;
27008         }
27009         FREE(_res);
27010         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
27011 }
27012
27013 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(uint64_tArray o) {
27014         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
27015         o_constr.datalen = o->arr_len;
27016         if (o_constr.datalen > 0)
27017                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
27018         else
27019                 o_constr.data = NULL;
27020         uint64_t* o_vals = o->elems;
27021         for (size_t o = 0; o < o_constr.datalen; o++) {
27022                 uint64_t o_conv_40 = o_vals[o];
27023                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
27024                 CHECK_ACCESS(o_conv_40_ptr);
27025                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
27026                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
27027                 o_constr.data[o] = o_conv_40_conv;
27028         }
27029         FREE(o);
27030         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27031         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
27032         return tag_ptr(ret_conv, true);
27033 }
27034
27035 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(uint32_t e) {
27036         LDKIOError e_conv = LDKIOError_from_js(e);
27037         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27038         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
27039         return tag_ptr(ret_conv, true);
27040 }
27041
27042 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(uint64_t o) {
27043         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
27044         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
27045         return ret_conv;
27046 }
27047
27048 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(uint64_t _res) {
27049         if (!ptr_is_owned(_res)) return;
27050         void* _res_ptr = untag_ptr(_res);
27051         CHECK_ACCESS(_res_ptr);
27052         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
27053         FREE(untag_ptr(_res));
27054         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
27055 }
27056
27057 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
27058         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27059         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
27060         return tag_ptr(ret_conv, true);
27061 }
27062 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(uint64_t arg) {
27063         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
27064         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
27065         return ret_conv;
27066 }
27067
27068 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(uint64_t orig) {
27069         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
27070         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27071         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
27072         return tag_ptr(ret_conv, true);
27073 }
27074
27075 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(uint64_t o) {
27076         void* o_ptr = untag_ptr(o);
27077         CHECK_ACCESS(o_ptr);
27078         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
27079         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
27080         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27081         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
27082         return tag_ptr(ret_conv, true);
27083 }
27084
27085 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(uint32_t e) {
27086         LDKIOError e_conv = LDKIOError_from_js(e);
27087         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27088         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
27089         return tag_ptr(ret_conv, true);
27090 }
27091
27092 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(uint64_t o) {
27093         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
27094         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
27095         return ret_conv;
27096 }
27097
27098 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(uint64_t _res) {
27099         if (!ptr_is_owned(_res)) return;
27100         void* _res_ptr = untag_ptr(_res);
27101         CHECK_ACCESS(_res_ptr);
27102         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
27103         FREE(untag_ptr(_res));
27104         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
27105 }
27106
27107 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
27108         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27109         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
27110         return tag_ptr(ret_conv, true);
27111 }
27112 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(uint64_t arg) {
27113         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
27114         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
27115         return ret_conv;
27116 }
27117
27118 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(uint64_t orig) {
27119         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
27120         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27121         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
27122         return tag_ptr(ret_conv, true);
27123 }
27124
27125 uint64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(uint64_t o) {
27126         LDKUnsignedInvoiceRequest o_conv;
27127         o_conv.inner = untag_ptr(o);
27128         o_conv.is_owned = ptr_is_owned(o);
27129         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27130         o_conv = UnsignedInvoiceRequest_clone(&o_conv);
27131         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27132         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
27133         return tag_ptr(ret_conv, true);
27134 }
27135
27136 uint64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(uint32_t e) {
27137         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
27138         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27139         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e_conv);
27140         return tag_ptr(ret_conv, true);
27141 }
27142
27143 jboolean  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(uint64_t o) {
27144         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
27145         jboolean ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
27146         return ret_conv;
27147 }
27148
27149 void  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(uint64_t _res) {
27150         if (!ptr_is_owned(_res)) return;
27151         void* _res_ptr = untag_ptr(_res);
27152         CHECK_ACCESS(_res_ptr);
27153         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
27154         FREE(untag_ptr(_res));
27155         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
27156 }
27157
27158 static inline uint64_t CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
27159         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27160         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(arg);
27161         return tag_ptr(ret_conv, true);
27162 }
27163 int64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
27164         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
27165         int64_t ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
27166         return ret_conv;
27167 }
27168
27169 uint64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(uint64_t orig) {
27170         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
27171         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27172         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
27173         return tag_ptr(ret_conv, true);
27174 }
27175
27176 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_ok(uint64_t o) {
27177         LDKInvoiceRequest o_conv;
27178         o_conv.inner = untag_ptr(o);
27179         o_conv.is_owned = ptr_is_owned(o);
27180         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27181         o_conv = InvoiceRequest_clone(&o_conv);
27182         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27183         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
27184         return tag_ptr(ret_conv, true);
27185 }
27186
27187 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_err(uint32_t e) {
27188         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
27189         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27190         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_err(e_conv);
27191         return tag_ptr(ret_conv, true);
27192 }
27193
27194 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(uint64_t o) {
27195         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
27196         jboolean ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
27197         return ret_conv;
27198 }
27199
27200 void  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_free(uint64_t _res) {
27201         if (!ptr_is_owned(_res)) return;
27202         void* _res_ptr = untag_ptr(_res);
27203         CHECK_ACCESS(_res_ptr);
27204         LDKCResult_InvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
27205         FREE(untag_ptr(_res));
27206         CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
27207 }
27208
27209 static inline uint64_t CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
27210         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27211         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(arg);
27212         return tag_ptr(ret_conv, true);
27213 }
27214 int64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
27215         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
27216         int64_t ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
27217         return ret_conv;
27218 }
27219
27220 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_clone"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_clone(uint64_t orig) {
27221         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
27222         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27223         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
27224         return tag_ptr(ret_conv, true);
27225 }
27226
27227 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_some"))) TS_COption_SecretKeyZ_some(int8_tArray o) {
27228         LDKSecretKey o_ref;
27229         CHECK(o->arr_len == 32);
27230         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
27231         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27232         *ret_copy = COption_SecretKeyZ_some(o_ref);
27233         uint64_t ret_ref = tag_ptr(ret_copy, true);
27234         return ret_ref;
27235 }
27236
27237 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_none"))) TS_COption_SecretKeyZ_none() {
27238         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27239         *ret_copy = COption_SecretKeyZ_none();
27240         uint64_t ret_ref = tag_ptr(ret_copy, true);
27241         return ret_ref;
27242 }
27243
27244 void  __attribute__((export_name("TS_COption_SecretKeyZ_free"))) TS_COption_SecretKeyZ_free(uint64_t _res) {
27245         if (!ptr_is_owned(_res)) return;
27246         void* _res_ptr = untag_ptr(_res);
27247         CHECK_ACCESS(_res_ptr);
27248         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
27249         FREE(untag_ptr(_res));
27250         COption_SecretKeyZ_free(_res_conv);
27251 }
27252
27253 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
27254         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27255         *ret_copy = COption_SecretKeyZ_clone(arg);
27256         uint64_t ret_ref = tag_ptr(ret_copy, true);
27257         return ret_ref;
27258 }
27259 int64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone_ptr"))) TS_COption_SecretKeyZ_clone_ptr(uint64_t arg) {
27260         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
27261         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
27262         return ret_conv;
27263 }
27264
27265 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone"))) TS_COption_SecretKeyZ_clone(uint64_t orig) {
27266         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
27267         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27268         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
27269         uint64_t ret_ref = tag_ptr(ret_copy, true);
27270         return ret_ref;
27271 }
27272
27273 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
27274         LDKInvoiceWithExplicitSigningPubkeyBuilder o_conv;
27275         o_conv.inner = untag_ptr(o);
27276         o_conv.is_owned = ptr_is_owned(o);
27277         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27278         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
27279         
27280         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
27281         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
27282         return tag_ptr(ret_conv, true);
27283 }
27284
27285 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(uint32_t e) {
27286         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
27287         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
27288         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
27289         return tag_ptr(ret_conv, true);
27290 }
27291
27292 jboolean  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
27293         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
27294         jboolean ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
27295         return ret_conv;
27296 }
27297
27298 void  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
27299         if (!ptr_is_owned(_res)) return;
27300         void* _res_ptr = untag_ptr(_res);
27301         CHECK_ACCESS(_res_ptr);
27302         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
27303         FREE(untag_ptr(_res));
27304         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
27305 }
27306
27307 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_ok(uint64_t o) {
27308         LDKVerifiedInvoiceRequest o_conv;
27309         o_conv.inner = untag_ptr(o);
27310         o_conv.is_owned = ptr_is_owned(o);
27311         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27312         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
27313         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27314         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
27315         return tag_ptr(ret_conv, true);
27316 }
27317
27318 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_err() {
27319         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27320         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
27321         return tag_ptr(ret_conv, true);
27322 }
27323
27324 jboolean  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok(uint64_t o) {
27325         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
27326         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
27327         return ret_conv;
27328 }
27329
27330 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_free"))) TS_CResult_VerifiedInvoiceRequestNoneZ_free(uint64_t _res) {
27331         if (!ptr_is_owned(_res)) return;
27332         void* _res_ptr = untag_ptr(_res);
27333         CHECK_ACCESS(_res_ptr);
27334         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
27335         FREE(untag_ptr(_res));
27336         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
27337 }
27338
27339 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
27340         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27341         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
27342         return tag_ptr(ret_conv, true);
27343 }
27344 int64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(uint64_t arg) {
27345         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
27346         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
27347         return ret_conv;
27348 }
27349
27350 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone(uint64_t orig) {
27351         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
27352         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27353         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
27354         return tag_ptr(ret_conv, true);
27355 }
27356
27357 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
27358         LDKInvoiceWithDerivedSigningPubkeyBuilder o_conv;
27359         o_conv.inner = untag_ptr(o);
27360         o_conv.is_owned = ptr_is_owned(o);
27361         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27362         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
27363         
27364         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
27365         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
27366         return tag_ptr(ret_conv, true);
27367 }
27368
27369 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(uint32_t e) {
27370         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
27371         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
27372         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
27373         return tag_ptr(ret_conv, true);
27374 }
27375
27376 jboolean  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
27377         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
27378         jboolean ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
27379         return ret_conv;
27380 }
27381
27382 void  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
27383         if (!ptr_is_owned(_res)) return;
27384         void* _res_ptr = untag_ptr(_res);
27385         CHECK_ACCESS(_res_ptr);
27386         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
27387         FREE(untag_ptr(_res));
27388         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
27389 }
27390
27391 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_ok"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_ok(uint64_t o) {
27392         LDKInvoiceRequestFields o_conv;
27393         o_conv.inner = untag_ptr(o);
27394         o_conv.is_owned = ptr_is_owned(o);
27395         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27396         o_conv = InvoiceRequestFields_clone(&o_conv);
27397         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27398         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o_conv);
27399         return tag_ptr(ret_conv, true);
27400 }
27401
27402 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_err"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_err(uint64_t e) {
27403         void* e_ptr = untag_ptr(e);
27404         CHECK_ACCESS(e_ptr);
27405         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27406         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27407         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27408         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_err(e_conv);
27409         return tag_ptr(ret_conv, true);
27410 }
27411
27412 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(uint64_t o) {
27413         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(o);
27414         jboolean ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o_conv);
27415         return ret_conv;
27416 }
27417
27418 void  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_free"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_free(uint64_t _res) {
27419         if (!ptr_is_owned(_res)) return;
27420         void* _res_ptr = untag_ptr(_res);
27421         CHECK_ACCESS(_res_ptr);
27422         LDKCResult_InvoiceRequestFieldsDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)(_res_ptr);
27423         FREE(untag_ptr(_res));
27424         CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res_conv);
27425 }
27426
27427 static inline uint64_t CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR arg) {
27428         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27429         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(arg);
27430         return tag_ptr(ret_conv, true);
27431 }
27432 int64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
27433         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(arg);
27434         int64_t ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(arg_conv);
27435         return ret_conv;
27436 }
27437
27438 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_clone"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_clone(uint64_t orig) {
27439         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(orig);
27440         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27441         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig_conv);
27442         return tag_ptr(ret_conv, true);
27443 }
27444
27445 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
27446         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
27447         return ret_conv;
27448 }
27449
27450 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
27451         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
27452         return ret_conv;
27453 }
27454
27455 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
27456         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
27457         COption_NoneZ_free(_res_conv);
27458 }
27459
27460 void  __attribute__((export_name("TS_CVec_WitnessZ_free"))) TS_CVec_WitnessZ_free(ptrArray _res) {
27461         LDKCVec_WitnessZ _res_constr;
27462         _res_constr.datalen = _res->arr_len;
27463         if (_res_constr.datalen > 0)
27464                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
27465         else
27466                 _res_constr.data = NULL;
27467         int8_tArray* _res_vals = (void*) _res->elems;
27468         for (size_t m = 0; m < _res_constr.datalen; m++) {
27469                 int8_tArray _res_conv_12 = _res_vals[m];
27470                 LDKWitness _res_conv_12_ref;
27471                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
27472                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKWitness Bytes");
27473                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
27474                 _res_conv_12_ref.data_is_owned = true;
27475                 _res_constr.data[m] = _res_conv_12_ref;
27476         }
27477         FREE(_res);
27478         CVec_WitnessZ_free(_res_constr);
27479 }
27480
27481 uint64_t  __attribute__((export_name("TS_COption_ECDSASignatureZ_some"))) TS_COption_ECDSASignatureZ_some(int8_tArray o) {
27482         LDKECDSASignature o_ref;
27483         CHECK(o->arr_len == 64);
27484         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
27485         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27486         *ret_copy = COption_ECDSASignatureZ_some(o_ref);
27487         uint64_t ret_ref = tag_ptr(ret_copy, true);
27488         return ret_ref;
27489 }
27490
27491 uint64_t  __attribute__((export_name("TS_COption_ECDSASignatureZ_none"))) TS_COption_ECDSASignatureZ_none() {
27492         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27493         *ret_copy = COption_ECDSASignatureZ_none();
27494         uint64_t ret_ref = tag_ptr(ret_copy, true);
27495         return ret_ref;
27496 }
27497
27498 void  __attribute__((export_name("TS_COption_ECDSASignatureZ_free"))) TS_COption_ECDSASignatureZ_free(uint64_t _res) {
27499         if (!ptr_is_owned(_res)) return;
27500         void* _res_ptr = untag_ptr(_res);
27501         CHECK_ACCESS(_res_ptr);
27502         LDKCOption_ECDSASignatureZ _res_conv = *(LDKCOption_ECDSASignatureZ*)(_res_ptr);
27503         FREE(untag_ptr(_res));
27504         COption_ECDSASignatureZ_free(_res_conv);
27505 }
27506
27507 static inline uint64_t COption_ECDSASignatureZ_clone_ptr(LDKCOption_ECDSASignatureZ *NONNULL_PTR arg) {
27508         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27509         *ret_copy = COption_ECDSASignatureZ_clone(arg);
27510         uint64_t ret_ref = tag_ptr(ret_copy, true);
27511         return ret_ref;
27512 }
27513 int64_t  __attribute__((export_name("TS_COption_ECDSASignatureZ_clone_ptr"))) TS_COption_ECDSASignatureZ_clone_ptr(uint64_t arg) {
27514         LDKCOption_ECDSASignatureZ* arg_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(arg);
27515         int64_t ret_conv = COption_ECDSASignatureZ_clone_ptr(arg_conv);
27516         return ret_conv;
27517 }
27518
27519 uint64_t  __attribute__((export_name("TS_COption_ECDSASignatureZ_clone"))) TS_COption_ECDSASignatureZ_clone(uint64_t orig) {
27520         LDKCOption_ECDSASignatureZ* orig_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(orig);
27521         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27522         *ret_copy = COption_ECDSASignatureZ_clone(orig_conv);
27523         uint64_t ret_ref = tag_ptr(ret_copy, true);
27524         return ret_ref;
27525 }
27526
27527 uint64_t  __attribute__((export_name("TS_COption_i64Z_some"))) TS_COption_i64Z_some(int64_t o) {
27528         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27529         *ret_copy = COption_i64Z_some(o);
27530         uint64_t ret_ref = tag_ptr(ret_copy, true);
27531         return ret_ref;
27532 }
27533
27534 uint64_t  __attribute__((export_name("TS_COption_i64Z_none"))) TS_COption_i64Z_none() {
27535         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27536         *ret_copy = COption_i64Z_none();
27537         uint64_t ret_ref = tag_ptr(ret_copy, true);
27538         return ret_ref;
27539 }
27540
27541 void  __attribute__((export_name("TS_COption_i64Z_free"))) TS_COption_i64Z_free(uint64_t _res) {
27542         if (!ptr_is_owned(_res)) return;
27543         void* _res_ptr = untag_ptr(_res);
27544         CHECK_ACCESS(_res_ptr);
27545         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
27546         FREE(untag_ptr(_res));
27547         COption_i64Z_free(_res_conv);
27548 }
27549
27550 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
27551         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27552         *ret_copy = COption_i64Z_clone(arg);
27553         uint64_t ret_ref = tag_ptr(ret_copy, true);
27554         return ret_ref;
27555 }
27556 int64_t  __attribute__((export_name("TS_COption_i64Z_clone_ptr"))) TS_COption_i64Z_clone_ptr(uint64_t arg) {
27557         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
27558         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
27559         return ret_conv;
27560 }
27561
27562 uint64_t  __attribute__((export_name("TS_COption_i64Z_clone"))) TS_COption_i64Z_clone(uint64_t orig) {
27563         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
27564         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27565         *ret_copy = COption_i64Z_clone(orig_conv);
27566         uint64_t ret_ref = tag_ptr(ret_copy, true);
27567         return ret_ref;
27568 }
27569
27570 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_ok"))) TS_CResult_SocketAddressDecodeErrorZ_ok(uint64_t o) {
27571         void* o_ptr = untag_ptr(o);
27572         CHECK_ACCESS(o_ptr);
27573         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
27574         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
27575         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27576         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
27577         return tag_ptr(ret_conv, true);
27578 }
27579
27580 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_err"))) TS_CResult_SocketAddressDecodeErrorZ_err(uint64_t e) {
27581         void* e_ptr = untag_ptr(e);
27582         CHECK_ACCESS(e_ptr);
27583         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27584         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27585         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27586         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
27587         return tag_ptr(ret_conv, true);
27588 }
27589
27590 jboolean  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_is_ok"))) TS_CResult_SocketAddressDecodeErrorZ_is_ok(uint64_t o) {
27591         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
27592         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
27593         return ret_conv;
27594 }
27595
27596 void  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_free"))) TS_CResult_SocketAddressDecodeErrorZ_free(uint64_t _res) {
27597         if (!ptr_is_owned(_res)) return;
27598         void* _res_ptr = untag_ptr(_res);
27599         CHECK_ACCESS(_res_ptr);
27600         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
27601         FREE(untag_ptr(_res));
27602         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
27603 }
27604
27605 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
27606         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27607         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
27608         return tag_ptr(ret_conv, true);
27609 }
27610 int64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone_ptr"))) TS_CResult_SocketAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
27611         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
27612         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
27613         return ret_conv;
27614 }
27615
27616 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone"))) TS_CResult_SocketAddressDecodeErrorZ_clone(uint64_t orig) {
27617         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
27618         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27619         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
27620         return tag_ptr(ret_conv, true);
27621 }
27622
27623 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_ok(uint64_t o) {
27624         void* o_ptr = untag_ptr(o);
27625         CHECK_ACCESS(o_ptr);
27626         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
27627         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
27628         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27629         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
27630         return tag_ptr(ret_conv, true);
27631 }
27632
27633 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_err(uint32_t e) {
27634         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_js(e);
27635         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27636         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
27637         return tag_ptr(ret_conv, true);
27638 }
27639
27640 jboolean  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(uint64_t o) {
27641         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
27642         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
27643         return ret_conv;
27644 }
27645
27646 void  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_free"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_free(uint64_t _res) {
27647         if (!ptr_is_owned(_res)) return;
27648         void* _res_ptr = untag_ptr(_res);
27649         CHECK_ACCESS(_res_ptr);
27650         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
27651         FREE(untag_ptr(_res));
27652         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
27653 }
27654
27655 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
27656         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27657         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
27658         return tag_ptr(ret_conv, true);
27659 }
27660 int64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(uint64_t arg) {
27661         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
27662         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
27663         return ret_conv;
27664 }
27665
27666 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone(uint64_t orig) {
27667         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
27668         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27669         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
27670         return tag_ptr(ret_conv, true);
27671 }
27672
27673 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
27674         LDKCVec_UpdateAddHTLCZ _res_constr;
27675         _res_constr.datalen = _res->arr_len;
27676         if (_res_constr.datalen > 0)
27677                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27678         else
27679                 _res_constr.data = NULL;
27680         uint64_t* _res_vals = _res->elems;
27681         for (size_t p = 0; p < _res_constr.datalen; p++) {
27682                 uint64_t _res_conv_15 = _res_vals[p];
27683                 LDKUpdateAddHTLC _res_conv_15_conv;
27684                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
27685                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
27686                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
27687                 _res_constr.data[p] = _res_conv_15_conv;
27688         }
27689         FREE(_res);
27690         CVec_UpdateAddHTLCZ_free(_res_constr);
27691 }
27692
27693 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
27694         LDKCVec_UpdateFulfillHTLCZ _res_constr;
27695         _res_constr.datalen = _res->arr_len;
27696         if (_res_constr.datalen > 0)
27697                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27698         else
27699                 _res_constr.data = NULL;
27700         uint64_t* _res_vals = _res->elems;
27701         for (size_t t = 0; t < _res_constr.datalen; t++) {
27702                 uint64_t _res_conv_19 = _res_vals[t];
27703                 LDKUpdateFulfillHTLC _res_conv_19_conv;
27704                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
27705                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
27706                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
27707                 _res_constr.data[t] = _res_conv_19_conv;
27708         }
27709         FREE(_res);
27710         CVec_UpdateFulfillHTLCZ_free(_res_constr);
27711 }
27712
27713 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
27714         LDKCVec_UpdateFailHTLCZ _res_constr;
27715         _res_constr.datalen = _res->arr_len;
27716         if (_res_constr.datalen > 0)
27717                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27718         else
27719                 _res_constr.data = NULL;
27720         uint64_t* _res_vals = _res->elems;
27721         for (size_t q = 0; q < _res_constr.datalen; q++) {
27722                 uint64_t _res_conv_16 = _res_vals[q];
27723                 LDKUpdateFailHTLC _res_conv_16_conv;
27724                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
27725                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
27726                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
27727                 _res_constr.data[q] = _res_conv_16_conv;
27728         }
27729         FREE(_res);
27730         CVec_UpdateFailHTLCZ_free(_res_constr);
27731 }
27732
27733 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
27734         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
27735         _res_constr.datalen = _res->arr_len;
27736         if (_res_constr.datalen > 0)
27737                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27738         else
27739                 _res_constr.data = NULL;
27740         uint64_t* _res_vals = _res->elems;
27741         for (size_t z = 0; z < _res_constr.datalen; z++) {
27742                 uint64_t _res_conv_25 = _res_vals[z];
27743                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
27744                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
27745                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
27746                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
27747                 _res_constr.data[z] = _res_conv_25_conv;
27748         }
27749         FREE(_res);
27750         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
27751 }
27752
27753 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
27754         LDKAcceptChannel o_conv;
27755         o_conv.inner = untag_ptr(o);
27756         o_conv.is_owned = ptr_is_owned(o);
27757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27758         o_conv = AcceptChannel_clone(&o_conv);
27759         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27760         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
27761         return tag_ptr(ret_conv, true);
27762 }
27763
27764 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
27765         void* e_ptr = untag_ptr(e);
27766         CHECK_ACCESS(e_ptr);
27767         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27768         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27769         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27770         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
27771         return tag_ptr(ret_conv, true);
27772 }
27773
27774 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
27775         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
27776         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
27777         return ret_conv;
27778 }
27779
27780 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
27781         if (!ptr_is_owned(_res)) return;
27782         void* _res_ptr = untag_ptr(_res);
27783         CHECK_ACCESS(_res_ptr);
27784         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
27785         FREE(untag_ptr(_res));
27786         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
27787 }
27788
27789 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
27790         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27791         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
27792         return tag_ptr(ret_conv, true);
27793 }
27794 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
27795         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
27796         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
27797         return ret_conv;
27798 }
27799
27800 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
27801         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
27802         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27803         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
27804         return tag_ptr(ret_conv, true);
27805 }
27806
27807 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_ok(uint64_t o) {
27808         LDKAcceptChannelV2 o_conv;
27809         o_conv.inner = untag_ptr(o);
27810         o_conv.is_owned = ptr_is_owned(o);
27811         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27812         o_conv = AcceptChannelV2_clone(&o_conv);
27813         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27814         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
27815         return tag_ptr(ret_conv, true);
27816 }
27817
27818 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_err(uint64_t e) {
27819         void* e_ptr = untag_ptr(e);
27820         CHECK_ACCESS(e_ptr);
27821         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27822         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27823         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27824         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
27825         return tag_ptr(ret_conv, true);
27826 }
27827
27828 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok(uint64_t o) {
27829         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
27830         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
27831         return ret_conv;
27832 }
27833
27834 void  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_free"))) TS_CResult_AcceptChannelV2DecodeErrorZ_free(uint64_t _res) {
27835         if (!ptr_is_owned(_res)) return;
27836         void* _res_ptr = untag_ptr(_res);
27837         CHECK_ACCESS(_res_ptr);
27838         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
27839         FREE(untag_ptr(_res));
27840         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
27841 }
27842
27843 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
27844         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27845         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
27846         return tag_ptr(ret_conv, true);
27847 }
27848 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
27849         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
27850         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
27851         return ret_conv;
27852 }
27853
27854 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone(uint64_t orig) {
27855         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
27856         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27857         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
27858         return tag_ptr(ret_conv, true);
27859 }
27860
27861 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_ok"))) TS_CResult_StfuDecodeErrorZ_ok(uint64_t o) {
27862         LDKStfu o_conv;
27863         o_conv.inner = untag_ptr(o);
27864         o_conv.is_owned = ptr_is_owned(o);
27865         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27866         o_conv = Stfu_clone(&o_conv);
27867         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
27868         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
27869         return tag_ptr(ret_conv, true);
27870 }
27871
27872 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_err"))) TS_CResult_StfuDecodeErrorZ_err(uint64_t e) {
27873         void* e_ptr = untag_ptr(e);
27874         CHECK_ACCESS(e_ptr);
27875         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27876         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27877         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
27878         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
27879         return tag_ptr(ret_conv, true);
27880 }
27881
27882 jboolean  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_is_ok"))) TS_CResult_StfuDecodeErrorZ_is_ok(uint64_t o) {
27883         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
27884         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
27885         return ret_conv;
27886 }
27887
27888 void  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_free"))) TS_CResult_StfuDecodeErrorZ_free(uint64_t _res) {
27889         if (!ptr_is_owned(_res)) return;
27890         void* _res_ptr = untag_ptr(_res);
27891         CHECK_ACCESS(_res_ptr);
27892         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
27893         FREE(untag_ptr(_res));
27894         CResult_StfuDecodeErrorZ_free(_res_conv);
27895 }
27896
27897 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
27898         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
27899         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
27900         return tag_ptr(ret_conv, true);
27901 }
27902 int64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_clone_ptr"))) TS_CResult_StfuDecodeErrorZ_clone_ptr(uint64_t arg) {
27903         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
27904         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
27905         return ret_conv;
27906 }
27907
27908 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_clone"))) TS_CResult_StfuDecodeErrorZ_clone(uint64_t orig) {
27909         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
27910         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
27911         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
27912         return tag_ptr(ret_conv, true);
27913 }
27914
27915 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_ok"))) TS_CResult_SpliceDecodeErrorZ_ok(uint64_t o) {
27916         LDKSplice o_conv;
27917         o_conv.inner = untag_ptr(o);
27918         o_conv.is_owned = ptr_is_owned(o);
27919         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27920         o_conv = Splice_clone(&o_conv);
27921         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
27922         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
27923         return tag_ptr(ret_conv, true);
27924 }
27925
27926 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_err"))) TS_CResult_SpliceDecodeErrorZ_err(uint64_t e) {
27927         void* e_ptr = untag_ptr(e);
27928         CHECK_ACCESS(e_ptr);
27929         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27930         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27931         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
27932         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
27933         return tag_ptr(ret_conv, true);
27934 }
27935
27936 jboolean  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_is_ok"))) TS_CResult_SpliceDecodeErrorZ_is_ok(uint64_t o) {
27937         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
27938         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
27939         return ret_conv;
27940 }
27941
27942 void  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_free"))) TS_CResult_SpliceDecodeErrorZ_free(uint64_t _res) {
27943         if (!ptr_is_owned(_res)) return;
27944         void* _res_ptr = untag_ptr(_res);
27945         CHECK_ACCESS(_res_ptr);
27946         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
27947         FREE(untag_ptr(_res));
27948         CResult_SpliceDecodeErrorZ_free(_res_conv);
27949 }
27950
27951 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
27952         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
27953         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
27954         return tag_ptr(ret_conv, true);
27955 }
27956 int64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceDecodeErrorZ_clone_ptr(uint64_t arg) {
27957         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
27958         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
27959         return ret_conv;
27960 }
27961
27962 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_clone"))) TS_CResult_SpliceDecodeErrorZ_clone(uint64_t orig) {
27963         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
27964         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
27965         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
27966         return tag_ptr(ret_conv, true);
27967 }
27968
27969 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_ok"))) TS_CResult_SpliceAckDecodeErrorZ_ok(uint64_t o) {
27970         LDKSpliceAck o_conv;
27971         o_conv.inner = untag_ptr(o);
27972         o_conv.is_owned = ptr_is_owned(o);
27973         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27974         o_conv = SpliceAck_clone(&o_conv);
27975         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
27976         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
27977         return tag_ptr(ret_conv, true);
27978 }
27979
27980 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_err"))) TS_CResult_SpliceAckDecodeErrorZ_err(uint64_t e) {
27981         void* e_ptr = untag_ptr(e);
27982         CHECK_ACCESS(e_ptr);
27983         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27984         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27985         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
27986         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
27987         return tag_ptr(ret_conv, true);
27988 }
27989
27990 jboolean  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_is_ok"))) TS_CResult_SpliceAckDecodeErrorZ_is_ok(uint64_t o) {
27991         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
27992         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
27993         return ret_conv;
27994 }
27995
27996 void  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_free"))) TS_CResult_SpliceAckDecodeErrorZ_free(uint64_t _res) {
27997         if (!ptr_is_owned(_res)) return;
27998         void* _res_ptr = untag_ptr(_res);
27999         CHECK_ACCESS(_res_ptr);
28000         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
28001         FREE(untag_ptr(_res));
28002         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
28003 }
28004
28005 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
28006         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
28007         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
28008         return tag_ptr(ret_conv, true);
28009 }
28010 int64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceAckDecodeErrorZ_clone_ptr(uint64_t arg) {
28011         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
28012         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
28013         return ret_conv;
28014 }
28015
28016 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_clone"))) TS_CResult_SpliceAckDecodeErrorZ_clone(uint64_t orig) {
28017         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
28018         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
28019         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
28020         return tag_ptr(ret_conv, true);
28021 }
28022
28023 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_ok(uint64_t o) {
28024         LDKSpliceLocked o_conv;
28025         o_conv.inner = untag_ptr(o);
28026         o_conv.is_owned = ptr_is_owned(o);
28027         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28028         o_conv = SpliceLocked_clone(&o_conv);
28029         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28030         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
28031         return tag_ptr(ret_conv, true);
28032 }
28033
28034 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_err"))) TS_CResult_SpliceLockedDecodeErrorZ_err(uint64_t e) {
28035         void* e_ptr = untag_ptr(e);
28036         CHECK_ACCESS(e_ptr);
28037         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28038         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28039         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28040         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
28041         return tag_ptr(ret_conv, true);
28042 }
28043
28044 jboolean  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_is_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_is_ok(uint64_t o) {
28045         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
28046         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
28047         return ret_conv;
28048 }
28049
28050 void  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_free"))) TS_CResult_SpliceLockedDecodeErrorZ_free(uint64_t _res) {
28051         if (!ptr_is_owned(_res)) return;
28052         void* _res_ptr = untag_ptr(_res);
28053         CHECK_ACCESS(_res_ptr);
28054         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
28055         FREE(untag_ptr(_res));
28056         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
28057 }
28058
28059 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
28060         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28061         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
28062         return tag_ptr(ret_conv, true);
28063 }
28064 int64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceLockedDecodeErrorZ_clone_ptr(uint64_t arg) {
28065         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
28066         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
28067         return ret_conv;
28068 }
28069
28070 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_clone"))) TS_CResult_SpliceLockedDecodeErrorZ_clone(uint64_t orig) {
28071         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
28072         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28073         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
28074         return tag_ptr(ret_conv, true);
28075 }
28076
28077 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_ok"))) TS_CResult_TxAddInputDecodeErrorZ_ok(uint64_t o) {
28078         LDKTxAddInput o_conv;
28079         o_conv.inner = untag_ptr(o);
28080         o_conv.is_owned = ptr_is_owned(o);
28081         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28082         o_conv = TxAddInput_clone(&o_conv);
28083         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28084         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
28085         return tag_ptr(ret_conv, true);
28086 }
28087
28088 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_err"))) TS_CResult_TxAddInputDecodeErrorZ_err(uint64_t e) {
28089         void* e_ptr = untag_ptr(e);
28090         CHECK_ACCESS(e_ptr);
28091         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28092         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28093         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28094         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
28095         return tag_ptr(ret_conv, true);
28096 }
28097
28098 jboolean  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_is_ok"))) TS_CResult_TxAddInputDecodeErrorZ_is_ok(uint64_t o) {
28099         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
28100         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
28101         return ret_conv;
28102 }
28103
28104 void  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_free"))) TS_CResult_TxAddInputDecodeErrorZ_free(uint64_t _res) {
28105         if (!ptr_is_owned(_res)) return;
28106         void* _res_ptr = untag_ptr(_res);
28107         CHECK_ACCESS(_res_ptr);
28108         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
28109         FREE(untag_ptr(_res));
28110         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
28111 }
28112
28113 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
28114         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28115         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
28116         return tag_ptr(ret_conv, true);
28117 }
28118 int64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddInputDecodeErrorZ_clone_ptr(uint64_t arg) {
28119         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
28120         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
28121         return ret_conv;
28122 }
28123
28124 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone"))) TS_CResult_TxAddInputDecodeErrorZ_clone(uint64_t orig) {
28125         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
28126         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28127         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
28128         return tag_ptr(ret_conv, true);
28129 }
28130
28131 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_ok(uint64_t o) {
28132         LDKTxAddOutput o_conv;
28133         o_conv.inner = untag_ptr(o);
28134         o_conv.is_owned = ptr_is_owned(o);
28135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28136         o_conv = TxAddOutput_clone(&o_conv);
28137         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28138         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
28139         return tag_ptr(ret_conv, true);
28140 }
28141
28142 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_err"))) TS_CResult_TxAddOutputDecodeErrorZ_err(uint64_t e) {
28143         void* e_ptr = untag_ptr(e);
28144         CHECK_ACCESS(e_ptr);
28145         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28146         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28147         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28148         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
28149         return tag_ptr(ret_conv, true);
28150 }
28151
28152 jboolean  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_is_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_is_ok(uint64_t o) {
28153         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
28154         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
28155         return ret_conv;
28156 }
28157
28158 void  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_free"))) TS_CResult_TxAddOutputDecodeErrorZ_free(uint64_t _res) {
28159         if (!ptr_is_owned(_res)) return;
28160         void* _res_ptr = untag_ptr(_res);
28161         CHECK_ACCESS(_res_ptr);
28162         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
28163         FREE(untag_ptr(_res));
28164         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
28165 }
28166
28167 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
28168         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28169         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
28170         return tag_ptr(ret_conv, true);
28171 }
28172 int64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
28173         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
28174         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
28175         return ret_conv;
28176 }
28177
28178 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone"))) TS_CResult_TxAddOutputDecodeErrorZ_clone(uint64_t orig) {
28179         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
28180         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28181         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
28182         return tag_ptr(ret_conv, true);
28183 }
28184
28185 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_ok(uint64_t o) {
28186         LDKTxRemoveInput o_conv;
28187         o_conv.inner = untag_ptr(o);
28188         o_conv.is_owned = ptr_is_owned(o);
28189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28190         o_conv = TxRemoveInput_clone(&o_conv);
28191         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28192         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
28193         return tag_ptr(ret_conv, true);
28194 }
28195
28196 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_err(uint64_t e) {
28197         void* e_ptr = untag_ptr(e);
28198         CHECK_ACCESS(e_ptr);
28199         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28200         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28201         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28202         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
28203         return tag_ptr(ret_conv, true);
28204 }
28205
28206 jboolean  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_is_ok(uint64_t o) {
28207         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
28208         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
28209         return ret_conv;
28210 }
28211
28212 void  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_free"))) TS_CResult_TxRemoveInputDecodeErrorZ_free(uint64_t _res) {
28213         if (!ptr_is_owned(_res)) return;
28214         void* _res_ptr = untag_ptr(_res);
28215         CHECK_ACCESS(_res_ptr);
28216         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
28217         FREE(untag_ptr(_res));
28218         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
28219 }
28220
28221 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
28222         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28223         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
28224         return tag_ptr(ret_conv, true);
28225 }
28226 int64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(uint64_t arg) {
28227         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
28228         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
28229         return ret_conv;
28230 }
28231
28232 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone(uint64_t orig) {
28233         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
28234         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28235         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
28236         return tag_ptr(ret_conv, true);
28237 }
28238
28239 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_ok(uint64_t o) {
28240         LDKTxRemoveOutput o_conv;
28241         o_conv.inner = untag_ptr(o);
28242         o_conv.is_owned = ptr_is_owned(o);
28243         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28244         o_conv = TxRemoveOutput_clone(&o_conv);
28245         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28246         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
28247         return tag_ptr(ret_conv, true);
28248 }
28249
28250 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_err(uint64_t e) {
28251         void* e_ptr = untag_ptr(e);
28252         CHECK_ACCESS(e_ptr);
28253         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28254         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28255         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28256         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
28257         return tag_ptr(ret_conv, true);
28258 }
28259
28260 jboolean  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok(uint64_t o) {
28261         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
28262         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
28263         return ret_conv;
28264 }
28265
28266 void  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_free"))) TS_CResult_TxRemoveOutputDecodeErrorZ_free(uint64_t _res) {
28267         if (!ptr_is_owned(_res)) return;
28268         void* _res_ptr = untag_ptr(_res);
28269         CHECK_ACCESS(_res_ptr);
28270         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
28271         FREE(untag_ptr(_res));
28272         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
28273 }
28274
28275 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
28276         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28277         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
28278         return tag_ptr(ret_conv, true);
28279 }
28280 int64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
28281         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
28282         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
28283         return ret_conv;
28284 }
28285
28286 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone(uint64_t orig) {
28287         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
28288         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28289         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
28290         return tag_ptr(ret_conv, true);
28291 }
28292
28293 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_ok"))) TS_CResult_TxCompleteDecodeErrorZ_ok(uint64_t o) {
28294         LDKTxComplete o_conv;
28295         o_conv.inner = untag_ptr(o);
28296         o_conv.is_owned = ptr_is_owned(o);
28297         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28298         o_conv = TxComplete_clone(&o_conv);
28299         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28300         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
28301         return tag_ptr(ret_conv, true);
28302 }
28303
28304 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_err"))) TS_CResult_TxCompleteDecodeErrorZ_err(uint64_t e) {
28305         void* e_ptr = untag_ptr(e);
28306         CHECK_ACCESS(e_ptr);
28307         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28308         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28309         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28310         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
28311         return tag_ptr(ret_conv, true);
28312 }
28313
28314 jboolean  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_is_ok"))) TS_CResult_TxCompleteDecodeErrorZ_is_ok(uint64_t o) {
28315         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
28316         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
28317         return ret_conv;
28318 }
28319
28320 void  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_free"))) TS_CResult_TxCompleteDecodeErrorZ_free(uint64_t _res) {
28321         if (!ptr_is_owned(_res)) return;
28322         void* _res_ptr = untag_ptr(_res);
28323         CHECK_ACCESS(_res_ptr);
28324         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
28325         FREE(untag_ptr(_res));
28326         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
28327 }
28328
28329 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
28330         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28331         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
28332         return tag_ptr(ret_conv, true);
28333 }
28334 int64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone_ptr"))) TS_CResult_TxCompleteDecodeErrorZ_clone_ptr(uint64_t arg) {
28335         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
28336         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
28337         return ret_conv;
28338 }
28339
28340 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone"))) TS_CResult_TxCompleteDecodeErrorZ_clone(uint64_t orig) {
28341         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
28342         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28343         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
28344         return tag_ptr(ret_conv, true);
28345 }
28346
28347 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_ok(uint64_t o) {
28348         LDKTxSignatures o_conv;
28349         o_conv.inner = untag_ptr(o);
28350         o_conv.is_owned = ptr_is_owned(o);
28351         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28352         o_conv = TxSignatures_clone(&o_conv);
28353         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28354         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
28355         return tag_ptr(ret_conv, true);
28356 }
28357
28358 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_err"))) TS_CResult_TxSignaturesDecodeErrorZ_err(uint64_t e) {
28359         void* e_ptr = untag_ptr(e);
28360         CHECK_ACCESS(e_ptr);
28361         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28362         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28363         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28364         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
28365         return tag_ptr(ret_conv, true);
28366 }
28367
28368 jboolean  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_is_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_is_ok(uint64_t o) {
28369         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
28370         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
28371         return ret_conv;
28372 }
28373
28374 void  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_free"))) TS_CResult_TxSignaturesDecodeErrorZ_free(uint64_t _res) {
28375         if (!ptr_is_owned(_res)) return;
28376         void* _res_ptr = untag_ptr(_res);
28377         CHECK_ACCESS(_res_ptr);
28378         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
28379         FREE(untag_ptr(_res));
28380         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
28381 }
28382
28383 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
28384         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28385         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
28386         return tag_ptr(ret_conv, true);
28387 }
28388 int64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
28389         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
28390         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
28391         return ret_conv;
28392 }
28393
28394 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone"))) TS_CResult_TxSignaturesDecodeErrorZ_clone(uint64_t orig) {
28395         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
28396         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28397         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
28398         return tag_ptr(ret_conv, true);
28399 }
28400
28401 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_ok(uint64_t o) {
28402         LDKTxInitRbf o_conv;
28403         o_conv.inner = untag_ptr(o);
28404         o_conv.is_owned = ptr_is_owned(o);
28405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28406         o_conv = TxInitRbf_clone(&o_conv);
28407         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28408         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
28409         return tag_ptr(ret_conv, true);
28410 }
28411
28412 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_err"))) TS_CResult_TxInitRbfDecodeErrorZ_err(uint64_t e) {
28413         void* e_ptr = untag_ptr(e);
28414         CHECK_ACCESS(e_ptr);
28415         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28416         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28417         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28418         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
28419         return tag_ptr(ret_conv, true);
28420 }
28421
28422 jboolean  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_is_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_is_ok(uint64_t o) {
28423         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
28424         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
28425         return ret_conv;
28426 }
28427
28428 void  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_free"))) TS_CResult_TxInitRbfDecodeErrorZ_free(uint64_t _res) {
28429         if (!ptr_is_owned(_res)) return;
28430         void* _res_ptr = untag_ptr(_res);
28431         CHECK_ACCESS(_res_ptr);
28432         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
28433         FREE(untag_ptr(_res));
28434         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
28435 }
28436
28437 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
28438         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28439         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
28440         return tag_ptr(ret_conv, true);
28441 }
28442 int64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
28443         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
28444         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
28445         return ret_conv;
28446 }
28447
28448 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone"))) TS_CResult_TxInitRbfDecodeErrorZ_clone(uint64_t orig) {
28449         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
28450         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28451         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
28452         return tag_ptr(ret_conv, true);
28453 }
28454
28455 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_ok(uint64_t o) {
28456         LDKTxAckRbf o_conv;
28457         o_conv.inner = untag_ptr(o);
28458         o_conv.is_owned = ptr_is_owned(o);
28459         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28460         o_conv = TxAckRbf_clone(&o_conv);
28461         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28462         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
28463         return tag_ptr(ret_conv, true);
28464 }
28465
28466 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_err"))) TS_CResult_TxAckRbfDecodeErrorZ_err(uint64_t e) {
28467         void* e_ptr = untag_ptr(e);
28468         CHECK_ACCESS(e_ptr);
28469         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28470         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28471         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28472         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
28473         return tag_ptr(ret_conv, true);
28474 }
28475
28476 jboolean  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_is_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_is_ok(uint64_t o) {
28477         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
28478         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
28479         return ret_conv;
28480 }
28481
28482 void  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_free"))) TS_CResult_TxAckRbfDecodeErrorZ_free(uint64_t _res) {
28483         if (!ptr_is_owned(_res)) return;
28484         void* _res_ptr = untag_ptr(_res);
28485         CHECK_ACCESS(_res_ptr);
28486         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
28487         FREE(untag_ptr(_res));
28488         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
28489 }
28490
28491 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
28492         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28493         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
28494         return tag_ptr(ret_conv, true);
28495 }
28496 int64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
28497         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
28498         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
28499         return ret_conv;
28500 }
28501
28502 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone"))) TS_CResult_TxAckRbfDecodeErrorZ_clone(uint64_t orig) {
28503         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
28504         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28505         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
28506         return tag_ptr(ret_conv, true);
28507 }
28508
28509 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_ok"))) TS_CResult_TxAbortDecodeErrorZ_ok(uint64_t o) {
28510         LDKTxAbort o_conv;
28511         o_conv.inner = untag_ptr(o);
28512         o_conv.is_owned = ptr_is_owned(o);
28513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28514         o_conv = TxAbort_clone(&o_conv);
28515         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28516         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
28517         return tag_ptr(ret_conv, true);
28518 }
28519
28520 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_err"))) TS_CResult_TxAbortDecodeErrorZ_err(uint64_t e) {
28521         void* e_ptr = untag_ptr(e);
28522         CHECK_ACCESS(e_ptr);
28523         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28524         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28525         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28526         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
28527         return tag_ptr(ret_conv, true);
28528 }
28529
28530 jboolean  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_is_ok"))) TS_CResult_TxAbortDecodeErrorZ_is_ok(uint64_t o) {
28531         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
28532         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
28533         return ret_conv;
28534 }
28535
28536 void  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_free"))) TS_CResult_TxAbortDecodeErrorZ_free(uint64_t _res) {
28537         if (!ptr_is_owned(_res)) return;
28538         void* _res_ptr = untag_ptr(_res);
28539         CHECK_ACCESS(_res_ptr);
28540         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
28541         FREE(untag_ptr(_res));
28542         CResult_TxAbortDecodeErrorZ_free(_res_conv);
28543 }
28544
28545 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
28546         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28547         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
28548         return tag_ptr(ret_conv, true);
28549 }
28550 int64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone_ptr"))) TS_CResult_TxAbortDecodeErrorZ_clone_ptr(uint64_t arg) {
28551         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
28552         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
28553         return ret_conv;
28554 }
28555
28556 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone"))) TS_CResult_TxAbortDecodeErrorZ_clone(uint64_t orig) {
28557         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
28558         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28559         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
28560         return tag_ptr(ret_conv, true);
28561 }
28562
28563 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
28564         LDKAnnouncementSignatures o_conv;
28565         o_conv.inner = untag_ptr(o);
28566         o_conv.is_owned = ptr_is_owned(o);
28567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28568         o_conv = AnnouncementSignatures_clone(&o_conv);
28569         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28570         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
28571         return tag_ptr(ret_conv, true);
28572 }
28573
28574 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
28575         void* e_ptr = untag_ptr(e);
28576         CHECK_ACCESS(e_ptr);
28577         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28578         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28579         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28580         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
28581         return tag_ptr(ret_conv, true);
28582 }
28583
28584 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
28585         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
28586         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
28587         return ret_conv;
28588 }
28589
28590 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
28591         if (!ptr_is_owned(_res)) return;
28592         void* _res_ptr = untag_ptr(_res);
28593         CHECK_ACCESS(_res_ptr);
28594         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
28595         FREE(untag_ptr(_res));
28596         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
28597 }
28598
28599 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
28600         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28601         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
28602         return tag_ptr(ret_conv, true);
28603 }
28604 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
28605         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
28606         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
28607         return ret_conv;
28608 }
28609
28610 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
28611         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
28612         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28613         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
28614         return tag_ptr(ret_conv, true);
28615 }
28616
28617 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
28618         LDKChannelReestablish o_conv;
28619         o_conv.inner = untag_ptr(o);
28620         o_conv.is_owned = ptr_is_owned(o);
28621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28622         o_conv = ChannelReestablish_clone(&o_conv);
28623         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28624         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
28625         return tag_ptr(ret_conv, true);
28626 }
28627
28628 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
28629         void* e_ptr = untag_ptr(e);
28630         CHECK_ACCESS(e_ptr);
28631         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28632         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28633         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28634         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
28635         return tag_ptr(ret_conv, true);
28636 }
28637
28638 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
28639         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
28640         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
28641         return ret_conv;
28642 }
28643
28644 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
28645         if (!ptr_is_owned(_res)) return;
28646         void* _res_ptr = untag_ptr(_res);
28647         CHECK_ACCESS(_res_ptr);
28648         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
28649         FREE(untag_ptr(_res));
28650         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
28651 }
28652
28653 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
28654         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28655         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
28656         return tag_ptr(ret_conv, true);
28657 }
28658 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
28659         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
28660         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
28661         return ret_conv;
28662 }
28663
28664 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
28665         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
28666         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28667         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
28668         return tag_ptr(ret_conv, true);
28669 }
28670
28671 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
28672         LDKClosingSigned o_conv;
28673         o_conv.inner = untag_ptr(o);
28674         o_conv.is_owned = ptr_is_owned(o);
28675         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28676         o_conv = ClosingSigned_clone(&o_conv);
28677         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28678         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
28679         return tag_ptr(ret_conv, true);
28680 }
28681
28682 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
28683         void* e_ptr = untag_ptr(e);
28684         CHECK_ACCESS(e_ptr);
28685         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28686         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28687         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28688         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
28689         return tag_ptr(ret_conv, true);
28690 }
28691
28692 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
28693         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
28694         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
28695         return ret_conv;
28696 }
28697
28698 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
28699         if (!ptr_is_owned(_res)) return;
28700         void* _res_ptr = untag_ptr(_res);
28701         CHECK_ACCESS(_res_ptr);
28702         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
28703         FREE(untag_ptr(_res));
28704         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
28705 }
28706
28707 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
28708         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28709         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
28710         return tag_ptr(ret_conv, true);
28711 }
28712 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
28713         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
28714         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
28715         return ret_conv;
28716 }
28717
28718 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
28719         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
28720         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28721         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
28722         return tag_ptr(ret_conv, true);
28723 }
28724
28725 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
28726         LDKClosingSignedFeeRange o_conv;
28727         o_conv.inner = untag_ptr(o);
28728         o_conv.is_owned = ptr_is_owned(o);
28729         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28730         o_conv = ClosingSignedFeeRange_clone(&o_conv);
28731         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28732         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
28733         return tag_ptr(ret_conv, true);
28734 }
28735
28736 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
28737         void* e_ptr = untag_ptr(e);
28738         CHECK_ACCESS(e_ptr);
28739         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28740         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28741         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28742         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
28743         return tag_ptr(ret_conv, true);
28744 }
28745
28746 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
28747         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
28748         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
28749         return ret_conv;
28750 }
28751
28752 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
28753         if (!ptr_is_owned(_res)) return;
28754         void* _res_ptr = untag_ptr(_res);
28755         CHECK_ACCESS(_res_ptr);
28756         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
28757         FREE(untag_ptr(_res));
28758         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
28759 }
28760
28761 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
28762         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28763         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
28764         return tag_ptr(ret_conv, true);
28765 }
28766 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
28767         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
28768         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
28769         return ret_conv;
28770 }
28771
28772 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
28773         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
28774         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28775         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
28776         return tag_ptr(ret_conv, true);
28777 }
28778
28779 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
28780         LDKCommitmentSigned o_conv;
28781         o_conv.inner = untag_ptr(o);
28782         o_conv.is_owned = ptr_is_owned(o);
28783         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28784         o_conv = CommitmentSigned_clone(&o_conv);
28785         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28786         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
28787         return tag_ptr(ret_conv, true);
28788 }
28789
28790 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
28791         void* e_ptr = untag_ptr(e);
28792         CHECK_ACCESS(e_ptr);
28793         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28794         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28795         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28796         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
28797         return tag_ptr(ret_conv, true);
28798 }
28799
28800 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
28801         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
28802         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
28803         return ret_conv;
28804 }
28805
28806 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
28807         if (!ptr_is_owned(_res)) return;
28808         void* _res_ptr = untag_ptr(_res);
28809         CHECK_ACCESS(_res_ptr);
28810         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
28811         FREE(untag_ptr(_res));
28812         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
28813 }
28814
28815 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
28816         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28817         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
28818         return tag_ptr(ret_conv, true);
28819 }
28820 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
28821         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
28822         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
28823         return ret_conv;
28824 }
28825
28826 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
28827         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
28828         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28829         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
28830         return tag_ptr(ret_conv, true);
28831 }
28832
28833 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
28834         LDKFundingCreated o_conv;
28835         o_conv.inner = untag_ptr(o);
28836         o_conv.is_owned = ptr_is_owned(o);
28837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28838         o_conv = FundingCreated_clone(&o_conv);
28839         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
28840         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
28841         return tag_ptr(ret_conv, true);
28842 }
28843
28844 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
28845         void* e_ptr = untag_ptr(e);
28846         CHECK_ACCESS(e_ptr);
28847         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28848         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28849         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
28850         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
28851         return tag_ptr(ret_conv, true);
28852 }
28853
28854 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
28855         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
28856         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
28857         return ret_conv;
28858 }
28859
28860 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
28861         if (!ptr_is_owned(_res)) return;
28862         void* _res_ptr = untag_ptr(_res);
28863         CHECK_ACCESS(_res_ptr);
28864         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
28865         FREE(untag_ptr(_res));
28866         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
28867 }
28868
28869 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
28870         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
28871         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
28872         return tag_ptr(ret_conv, true);
28873 }
28874 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
28875         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
28876         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
28877         return ret_conv;
28878 }
28879
28880 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
28881         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
28882         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
28883         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
28884         return tag_ptr(ret_conv, true);
28885 }
28886
28887 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
28888         LDKFundingSigned o_conv;
28889         o_conv.inner = untag_ptr(o);
28890         o_conv.is_owned = ptr_is_owned(o);
28891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28892         o_conv = FundingSigned_clone(&o_conv);
28893         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
28894         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
28895         return tag_ptr(ret_conv, true);
28896 }
28897
28898 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
28899         void* e_ptr = untag_ptr(e);
28900         CHECK_ACCESS(e_ptr);
28901         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28902         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28903         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
28904         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
28905         return tag_ptr(ret_conv, true);
28906 }
28907
28908 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
28909         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
28910         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
28911         return ret_conv;
28912 }
28913
28914 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
28915         if (!ptr_is_owned(_res)) return;
28916         void* _res_ptr = untag_ptr(_res);
28917         CHECK_ACCESS(_res_ptr);
28918         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
28919         FREE(untag_ptr(_res));
28920         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
28921 }
28922
28923 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
28924         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
28925         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
28926         return tag_ptr(ret_conv, true);
28927 }
28928 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
28929         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
28930         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
28931         return ret_conv;
28932 }
28933
28934 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
28935         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
28936         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
28937         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
28938         return tag_ptr(ret_conv, true);
28939 }
28940
28941 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
28942         LDKChannelReady o_conv;
28943         o_conv.inner = untag_ptr(o);
28944         o_conv.is_owned = ptr_is_owned(o);
28945         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28946         o_conv = ChannelReady_clone(&o_conv);
28947         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28948         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
28949         return tag_ptr(ret_conv, true);
28950 }
28951
28952 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
28953         void* e_ptr = untag_ptr(e);
28954         CHECK_ACCESS(e_ptr);
28955         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28956         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28957         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28958         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
28959         return tag_ptr(ret_conv, true);
28960 }
28961
28962 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
28963         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
28964         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
28965         return ret_conv;
28966 }
28967
28968 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
28969         if (!ptr_is_owned(_res)) return;
28970         void* _res_ptr = untag_ptr(_res);
28971         CHECK_ACCESS(_res_ptr);
28972         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
28973         FREE(untag_ptr(_res));
28974         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
28975 }
28976
28977 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
28978         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28979         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
28980         return tag_ptr(ret_conv, true);
28981 }
28982 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
28983         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
28984         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
28985         return ret_conv;
28986 }
28987
28988 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
28989         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
28990         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28991         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
28992         return tag_ptr(ret_conv, true);
28993 }
28994
28995 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
28996         LDKInit o_conv;
28997         o_conv.inner = untag_ptr(o);
28998         o_conv.is_owned = ptr_is_owned(o);
28999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29000         o_conv = Init_clone(&o_conv);
29001         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29002         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
29003         return tag_ptr(ret_conv, true);
29004 }
29005
29006 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
29007         void* e_ptr = untag_ptr(e);
29008         CHECK_ACCESS(e_ptr);
29009         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29010         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29011         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29012         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
29013         return tag_ptr(ret_conv, true);
29014 }
29015
29016 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
29017         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
29018         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
29019         return ret_conv;
29020 }
29021
29022 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
29023         if (!ptr_is_owned(_res)) return;
29024         void* _res_ptr = untag_ptr(_res);
29025         CHECK_ACCESS(_res_ptr);
29026         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
29027         FREE(untag_ptr(_res));
29028         CResult_InitDecodeErrorZ_free(_res_conv);
29029 }
29030
29031 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
29032         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29033         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
29034         return tag_ptr(ret_conv, true);
29035 }
29036 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
29037         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
29038         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
29039         return ret_conv;
29040 }
29041
29042 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
29043         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
29044         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29045         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
29046         return tag_ptr(ret_conv, true);
29047 }
29048
29049 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
29050         LDKOpenChannel o_conv;
29051         o_conv.inner = untag_ptr(o);
29052         o_conv.is_owned = ptr_is_owned(o);
29053         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29054         o_conv = OpenChannel_clone(&o_conv);
29055         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29056         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
29057         return tag_ptr(ret_conv, true);
29058 }
29059
29060 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
29061         void* e_ptr = untag_ptr(e);
29062         CHECK_ACCESS(e_ptr);
29063         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29064         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29065         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29066         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
29067         return tag_ptr(ret_conv, true);
29068 }
29069
29070 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
29071         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
29072         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
29073         return ret_conv;
29074 }
29075
29076 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
29077         if (!ptr_is_owned(_res)) return;
29078         void* _res_ptr = untag_ptr(_res);
29079         CHECK_ACCESS(_res_ptr);
29080         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
29081         FREE(untag_ptr(_res));
29082         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
29083 }
29084
29085 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
29086         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29087         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
29088         return tag_ptr(ret_conv, true);
29089 }
29090 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
29091         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
29092         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
29093         return ret_conv;
29094 }
29095
29096 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
29097         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
29098         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29099         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
29100         return tag_ptr(ret_conv, true);
29101 }
29102
29103 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_ok(uint64_t o) {
29104         LDKOpenChannelV2 o_conv;
29105         o_conv.inner = untag_ptr(o);
29106         o_conv.is_owned = ptr_is_owned(o);
29107         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29108         o_conv = OpenChannelV2_clone(&o_conv);
29109         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29110         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
29111         return tag_ptr(ret_conv, true);
29112 }
29113
29114 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_err(uint64_t e) {
29115         void* e_ptr = untag_ptr(e);
29116         CHECK_ACCESS(e_ptr);
29117         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29118         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29119         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29120         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
29121         return tag_ptr(ret_conv, true);
29122 }
29123
29124 jboolean  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_is_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_is_ok(uint64_t o) {
29125         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
29126         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
29127         return ret_conv;
29128 }
29129
29130 void  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_free"))) TS_CResult_OpenChannelV2DecodeErrorZ_free(uint64_t _res) {
29131         if (!ptr_is_owned(_res)) return;
29132         void* _res_ptr = untag_ptr(_res);
29133         CHECK_ACCESS(_res_ptr);
29134         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
29135         FREE(untag_ptr(_res));
29136         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
29137 }
29138
29139 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
29140         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29141         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
29142         return tag_ptr(ret_conv, true);
29143 }
29144 int64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
29145         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
29146         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
29147         return ret_conv;
29148 }
29149
29150 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone(uint64_t orig) {
29151         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
29152         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29153         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
29154         return tag_ptr(ret_conv, true);
29155 }
29156
29157 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
29158         LDKRevokeAndACK o_conv;
29159         o_conv.inner = untag_ptr(o);
29160         o_conv.is_owned = ptr_is_owned(o);
29161         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29162         o_conv = RevokeAndACK_clone(&o_conv);
29163         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29164         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
29165         return tag_ptr(ret_conv, true);
29166 }
29167
29168 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
29169         void* e_ptr = untag_ptr(e);
29170         CHECK_ACCESS(e_ptr);
29171         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29172         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29173         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29174         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
29175         return tag_ptr(ret_conv, true);
29176 }
29177
29178 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
29179         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
29180         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
29181         return ret_conv;
29182 }
29183
29184 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
29185         if (!ptr_is_owned(_res)) return;
29186         void* _res_ptr = untag_ptr(_res);
29187         CHECK_ACCESS(_res_ptr);
29188         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
29189         FREE(untag_ptr(_res));
29190         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
29191 }
29192
29193 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
29194         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29195         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
29196         return tag_ptr(ret_conv, true);
29197 }
29198 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
29199         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
29200         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
29201         return ret_conv;
29202 }
29203
29204 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
29205         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
29206         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29207         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
29208         return tag_ptr(ret_conv, true);
29209 }
29210
29211 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
29212         LDKShutdown o_conv;
29213         o_conv.inner = untag_ptr(o);
29214         o_conv.is_owned = ptr_is_owned(o);
29215         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29216         o_conv = Shutdown_clone(&o_conv);
29217         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29218         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
29219         return tag_ptr(ret_conv, true);
29220 }
29221
29222 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
29223         void* e_ptr = untag_ptr(e);
29224         CHECK_ACCESS(e_ptr);
29225         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29226         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29227         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29228         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
29229         return tag_ptr(ret_conv, true);
29230 }
29231
29232 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
29233         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
29234         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
29235         return ret_conv;
29236 }
29237
29238 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
29239         if (!ptr_is_owned(_res)) return;
29240         void* _res_ptr = untag_ptr(_res);
29241         CHECK_ACCESS(_res_ptr);
29242         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
29243         FREE(untag_ptr(_res));
29244         CResult_ShutdownDecodeErrorZ_free(_res_conv);
29245 }
29246
29247 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
29248         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29249         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
29250         return tag_ptr(ret_conv, true);
29251 }
29252 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
29253         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
29254         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
29255         return ret_conv;
29256 }
29257
29258 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
29259         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
29260         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29261         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
29262         return tag_ptr(ret_conv, true);
29263 }
29264
29265 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
29266         LDKUpdateFailHTLC o_conv;
29267         o_conv.inner = untag_ptr(o);
29268         o_conv.is_owned = ptr_is_owned(o);
29269         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29270         o_conv = UpdateFailHTLC_clone(&o_conv);
29271         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29272         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
29273         return tag_ptr(ret_conv, true);
29274 }
29275
29276 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
29277         void* e_ptr = untag_ptr(e);
29278         CHECK_ACCESS(e_ptr);
29279         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29280         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29281         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29282         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
29283         return tag_ptr(ret_conv, true);
29284 }
29285
29286 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
29287         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
29288         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
29289         return ret_conv;
29290 }
29291
29292 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
29293         if (!ptr_is_owned(_res)) return;
29294         void* _res_ptr = untag_ptr(_res);
29295         CHECK_ACCESS(_res_ptr);
29296         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
29297         FREE(untag_ptr(_res));
29298         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
29299 }
29300
29301 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
29302         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29303         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
29304         return tag_ptr(ret_conv, true);
29305 }
29306 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29307         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
29308         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
29309         return ret_conv;
29310 }
29311
29312 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
29313         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
29314         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29315         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
29316         return tag_ptr(ret_conv, true);
29317 }
29318
29319 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
29320         LDKUpdateFailMalformedHTLC o_conv;
29321         o_conv.inner = untag_ptr(o);
29322         o_conv.is_owned = ptr_is_owned(o);
29323         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29324         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
29325         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29326         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
29327         return tag_ptr(ret_conv, true);
29328 }
29329
29330 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
29331         void* e_ptr = untag_ptr(e);
29332         CHECK_ACCESS(e_ptr);
29333         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29334         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29335         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29336         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
29337         return tag_ptr(ret_conv, true);
29338 }
29339
29340 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
29341         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
29342         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
29343         return ret_conv;
29344 }
29345
29346 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
29347         if (!ptr_is_owned(_res)) return;
29348         void* _res_ptr = untag_ptr(_res);
29349         CHECK_ACCESS(_res_ptr);
29350         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
29351         FREE(untag_ptr(_res));
29352         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
29353 }
29354
29355 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
29356         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29357         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
29358         return tag_ptr(ret_conv, true);
29359 }
29360 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29361         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
29362         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
29363         return ret_conv;
29364 }
29365
29366 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
29367         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
29368         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29369         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
29370         return tag_ptr(ret_conv, true);
29371 }
29372
29373 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
29374         LDKUpdateFee o_conv;
29375         o_conv.inner = untag_ptr(o);
29376         o_conv.is_owned = ptr_is_owned(o);
29377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29378         o_conv = UpdateFee_clone(&o_conv);
29379         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29380         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
29381         return tag_ptr(ret_conv, true);
29382 }
29383
29384 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
29385         void* e_ptr = untag_ptr(e);
29386         CHECK_ACCESS(e_ptr);
29387         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29388         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29389         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29390         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
29391         return tag_ptr(ret_conv, true);
29392 }
29393
29394 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
29395         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
29396         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
29397         return ret_conv;
29398 }
29399
29400 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
29401         if (!ptr_is_owned(_res)) return;
29402         void* _res_ptr = untag_ptr(_res);
29403         CHECK_ACCESS(_res_ptr);
29404         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
29405         FREE(untag_ptr(_res));
29406         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
29407 }
29408
29409 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
29410         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29411         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
29412         return tag_ptr(ret_conv, true);
29413 }
29414 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
29415         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
29416         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
29417         return ret_conv;
29418 }
29419
29420 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
29421         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
29422         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29423         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
29424         return tag_ptr(ret_conv, true);
29425 }
29426
29427 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
29428         LDKUpdateFulfillHTLC o_conv;
29429         o_conv.inner = untag_ptr(o);
29430         o_conv.is_owned = ptr_is_owned(o);
29431         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29432         o_conv = UpdateFulfillHTLC_clone(&o_conv);
29433         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29434         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
29435         return tag_ptr(ret_conv, true);
29436 }
29437
29438 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
29439         void* e_ptr = untag_ptr(e);
29440         CHECK_ACCESS(e_ptr);
29441         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29442         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29443         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29444         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
29445         return tag_ptr(ret_conv, true);
29446 }
29447
29448 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
29449         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
29450         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
29451         return ret_conv;
29452 }
29453
29454 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
29455         if (!ptr_is_owned(_res)) return;
29456         void* _res_ptr = untag_ptr(_res);
29457         CHECK_ACCESS(_res_ptr);
29458         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
29459         FREE(untag_ptr(_res));
29460         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
29461 }
29462
29463 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
29464         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29465         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
29466         return tag_ptr(ret_conv, true);
29467 }
29468 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29469         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
29470         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
29471         return ret_conv;
29472 }
29473
29474 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
29475         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
29476         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29477         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
29478         return tag_ptr(ret_conv, true);
29479 }
29480
29481 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_ok"))) TS_CResult_OnionPacketDecodeErrorZ_ok(uint64_t o) {
29482         LDKOnionPacket o_conv;
29483         o_conv.inner = untag_ptr(o);
29484         o_conv.is_owned = ptr_is_owned(o);
29485         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29486         o_conv = OnionPacket_clone(&o_conv);
29487         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29488         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
29489         return tag_ptr(ret_conv, true);
29490 }
29491
29492 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_err"))) TS_CResult_OnionPacketDecodeErrorZ_err(uint64_t e) {
29493         void* e_ptr = untag_ptr(e);
29494         CHECK_ACCESS(e_ptr);
29495         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29496         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29497         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29498         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
29499         return tag_ptr(ret_conv, true);
29500 }
29501
29502 jboolean  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_is_ok"))) TS_CResult_OnionPacketDecodeErrorZ_is_ok(uint64_t o) {
29503         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
29504         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
29505         return ret_conv;
29506 }
29507
29508 void  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_free"))) TS_CResult_OnionPacketDecodeErrorZ_free(uint64_t _res) {
29509         if (!ptr_is_owned(_res)) return;
29510         void* _res_ptr = untag_ptr(_res);
29511         CHECK_ACCESS(_res_ptr);
29512         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
29513         FREE(untag_ptr(_res));
29514         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
29515 }
29516
29517 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
29518         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29519         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
29520         return tag_ptr(ret_conv, true);
29521 }
29522 int64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_clone_ptr"))) TS_CResult_OnionPacketDecodeErrorZ_clone_ptr(uint64_t arg) {
29523         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
29524         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
29525         return ret_conv;
29526 }
29527
29528 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_clone"))) TS_CResult_OnionPacketDecodeErrorZ_clone(uint64_t orig) {
29529         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
29530         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29531         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
29532         return tag_ptr(ret_conv, true);
29533 }
29534
29535 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
29536         LDKUpdateAddHTLC o_conv;
29537         o_conv.inner = untag_ptr(o);
29538         o_conv.is_owned = ptr_is_owned(o);
29539         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29540         o_conv = UpdateAddHTLC_clone(&o_conv);
29541         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29542         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
29543         return tag_ptr(ret_conv, true);
29544 }
29545
29546 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
29547         void* e_ptr = untag_ptr(e);
29548         CHECK_ACCESS(e_ptr);
29549         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29550         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29551         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29552         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
29553         return tag_ptr(ret_conv, true);
29554 }
29555
29556 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
29557         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
29558         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
29559         return ret_conv;
29560 }
29561
29562 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
29563         if (!ptr_is_owned(_res)) return;
29564         void* _res_ptr = untag_ptr(_res);
29565         CHECK_ACCESS(_res_ptr);
29566         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
29567         FREE(untag_ptr(_res));
29568         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
29569 }
29570
29571 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
29572         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29573         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
29574         return tag_ptr(ret_conv, true);
29575 }
29576 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29577         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
29578         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
29579         return ret_conv;
29580 }
29581
29582 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
29583         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
29584         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29585         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
29586         return tag_ptr(ret_conv, true);
29587 }
29588
29589 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
29590         LDKOnionMessage o_conv;
29591         o_conv.inner = untag_ptr(o);
29592         o_conv.is_owned = ptr_is_owned(o);
29593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29594         o_conv = OnionMessage_clone(&o_conv);
29595         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29596         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
29597         return tag_ptr(ret_conv, true);
29598 }
29599
29600 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
29601         void* e_ptr = untag_ptr(e);
29602         CHECK_ACCESS(e_ptr);
29603         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29604         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29605         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29606         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
29607         return tag_ptr(ret_conv, true);
29608 }
29609
29610 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
29611         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
29612         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
29613         return ret_conv;
29614 }
29615
29616 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
29617         if (!ptr_is_owned(_res)) return;
29618         void* _res_ptr = untag_ptr(_res);
29619         CHECK_ACCESS(_res_ptr);
29620         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
29621         FREE(untag_ptr(_res));
29622         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
29623 }
29624
29625 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
29626         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29627         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
29628         return tag_ptr(ret_conv, true);
29629 }
29630 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
29631         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
29632         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
29633         return ret_conv;
29634 }
29635
29636 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
29637         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
29638         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29639         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
29640         return tag_ptr(ret_conv, true);
29641 }
29642
29643 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_ok(uint64_t o) {
29644         LDKFinalOnionHopData o_conv;
29645         o_conv.inner = untag_ptr(o);
29646         o_conv.is_owned = ptr_is_owned(o);
29647         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29648         o_conv = FinalOnionHopData_clone(&o_conv);
29649         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29650         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
29651         return tag_ptr(ret_conv, true);
29652 }
29653
29654 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_err"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_err(uint64_t e) {
29655         void* e_ptr = untag_ptr(e);
29656         CHECK_ACCESS(e_ptr);
29657         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29658         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29659         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29660         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
29661         return tag_ptr(ret_conv, true);
29662 }
29663
29664 jboolean  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_is_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_is_ok(uint64_t o) {
29665         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
29666         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
29667         return ret_conv;
29668 }
29669
29670 void  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_free"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_free(uint64_t _res) {
29671         if (!ptr_is_owned(_res)) return;
29672         void* _res_ptr = untag_ptr(_res);
29673         CHECK_ACCESS(_res_ptr);
29674         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
29675         FREE(untag_ptr(_res));
29676         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
29677 }
29678
29679 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
29680         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29681         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
29682         return tag_ptr(ret_conv, true);
29683 }
29684 int64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(uint64_t arg) {
29685         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
29686         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
29687         return ret_conv;
29688 }
29689
29690 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_clone"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_clone(uint64_t orig) {
29691         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
29692         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29693         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
29694         return tag_ptr(ret_conv, true);
29695 }
29696
29697 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
29698         LDKPing o_conv;
29699         o_conv.inner = untag_ptr(o);
29700         o_conv.is_owned = ptr_is_owned(o);
29701         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29702         o_conv = Ping_clone(&o_conv);
29703         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29704         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
29705         return tag_ptr(ret_conv, true);
29706 }
29707
29708 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
29709         void* e_ptr = untag_ptr(e);
29710         CHECK_ACCESS(e_ptr);
29711         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29712         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29713         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29714         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
29715         return tag_ptr(ret_conv, true);
29716 }
29717
29718 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
29719         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
29720         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
29721         return ret_conv;
29722 }
29723
29724 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
29725         if (!ptr_is_owned(_res)) return;
29726         void* _res_ptr = untag_ptr(_res);
29727         CHECK_ACCESS(_res_ptr);
29728         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
29729         FREE(untag_ptr(_res));
29730         CResult_PingDecodeErrorZ_free(_res_conv);
29731 }
29732
29733 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
29734         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29735         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
29736         return tag_ptr(ret_conv, true);
29737 }
29738 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
29739         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
29740         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
29741         return ret_conv;
29742 }
29743
29744 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
29745         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
29746         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29747         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
29748         return tag_ptr(ret_conv, true);
29749 }
29750
29751 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
29752         LDKPong o_conv;
29753         o_conv.inner = untag_ptr(o);
29754         o_conv.is_owned = ptr_is_owned(o);
29755         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29756         o_conv = Pong_clone(&o_conv);
29757         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29758         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
29759         return tag_ptr(ret_conv, true);
29760 }
29761
29762 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
29763         void* e_ptr = untag_ptr(e);
29764         CHECK_ACCESS(e_ptr);
29765         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29766         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29767         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29768         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
29769         return tag_ptr(ret_conv, true);
29770 }
29771
29772 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
29773         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
29774         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
29775         return ret_conv;
29776 }
29777
29778 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
29779         if (!ptr_is_owned(_res)) return;
29780         void* _res_ptr = untag_ptr(_res);
29781         CHECK_ACCESS(_res_ptr);
29782         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
29783         FREE(untag_ptr(_res));
29784         CResult_PongDecodeErrorZ_free(_res_conv);
29785 }
29786
29787 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
29788         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29789         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
29790         return tag_ptr(ret_conv, true);
29791 }
29792 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
29793         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
29794         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
29795         return ret_conv;
29796 }
29797
29798 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
29799         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
29800         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29801         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
29802         return tag_ptr(ret_conv, true);
29803 }
29804
29805 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
29806         LDKUnsignedChannelAnnouncement o_conv;
29807         o_conv.inner = untag_ptr(o);
29808         o_conv.is_owned = ptr_is_owned(o);
29809         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29810         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
29811         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
29812         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
29813         return tag_ptr(ret_conv, true);
29814 }
29815
29816 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
29817         void* e_ptr = untag_ptr(e);
29818         CHECK_ACCESS(e_ptr);
29819         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29820         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29821         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
29822         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
29823         return tag_ptr(ret_conv, true);
29824 }
29825
29826 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
29827         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
29828         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
29829         return ret_conv;
29830 }
29831
29832 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
29833         if (!ptr_is_owned(_res)) return;
29834         void* _res_ptr = untag_ptr(_res);
29835         CHECK_ACCESS(_res_ptr);
29836         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
29837         FREE(untag_ptr(_res));
29838         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
29839 }
29840
29841 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
29842         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
29843         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
29844         return tag_ptr(ret_conv, true);
29845 }
29846 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
29847         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
29848         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
29849         return ret_conv;
29850 }
29851
29852 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
29853         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
29854         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
29855         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
29856         return tag_ptr(ret_conv, true);
29857 }
29858
29859 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
29860         LDKChannelAnnouncement o_conv;
29861         o_conv.inner = untag_ptr(o);
29862         o_conv.is_owned = ptr_is_owned(o);
29863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29864         o_conv = ChannelAnnouncement_clone(&o_conv);
29865         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
29866         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
29867         return tag_ptr(ret_conv, true);
29868 }
29869
29870 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
29871         void* e_ptr = untag_ptr(e);
29872         CHECK_ACCESS(e_ptr);
29873         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29874         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29875         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
29876         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
29877         return tag_ptr(ret_conv, true);
29878 }
29879
29880 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
29881         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
29882         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
29883         return ret_conv;
29884 }
29885
29886 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
29887         if (!ptr_is_owned(_res)) return;
29888         void* _res_ptr = untag_ptr(_res);
29889         CHECK_ACCESS(_res_ptr);
29890         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
29891         FREE(untag_ptr(_res));
29892         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
29893 }
29894
29895 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
29896         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
29897         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
29898         return tag_ptr(ret_conv, true);
29899 }
29900 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
29901         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
29902         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
29903         return ret_conv;
29904 }
29905
29906 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
29907         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
29908         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
29909         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
29910         return tag_ptr(ret_conv, true);
29911 }
29912
29913 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
29914         LDKUnsignedChannelUpdate o_conv;
29915         o_conv.inner = untag_ptr(o);
29916         o_conv.is_owned = ptr_is_owned(o);
29917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29918         o_conv = UnsignedChannelUpdate_clone(&o_conv);
29919         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
29920         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
29921         return tag_ptr(ret_conv, true);
29922 }
29923
29924 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
29925         void* e_ptr = untag_ptr(e);
29926         CHECK_ACCESS(e_ptr);
29927         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29928         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29929         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
29930         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
29931         return tag_ptr(ret_conv, true);
29932 }
29933
29934 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
29935         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
29936         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
29937         return ret_conv;
29938 }
29939
29940 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
29941         if (!ptr_is_owned(_res)) return;
29942         void* _res_ptr = untag_ptr(_res);
29943         CHECK_ACCESS(_res_ptr);
29944         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
29945         FREE(untag_ptr(_res));
29946         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
29947 }
29948
29949 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
29950         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
29951         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
29952         return tag_ptr(ret_conv, true);
29953 }
29954 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
29955         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
29956         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
29957         return ret_conv;
29958 }
29959
29960 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
29961         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
29962         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
29963         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
29964         return tag_ptr(ret_conv, true);
29965 }
29966
29967 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
29968         LDKChannelUpdate o_conv;
29969         o_conv.inner = untag_ptr(o);
29970         o_conv.is_owned = ptr_is_owned(o);
29971         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29972         o_conv = ChannelUpdate_clone(&o_conv);
29973         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
29974         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
29975         return tag_ptr(ret_conv, true);
29976 }
29977
29978 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
29979         void* e_ptr = untag_ptr(e);
29980         CHECK_ACCESS(e_ptr);
29981         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29982         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29983         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
29984         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
29985         return tag_ptr(ret_conv, true);
29986 }
29987
29988 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
29989         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
29990         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
29991         return ret_conv;
29992 }
29993
29994 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
29995         if (!ptr_is_owned(_res)) return;
29996         void* _res_ptr = untag_ptr(_res);
29997         CHECK_ACCESS(_res_ptr);
29998         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
29999         FREE(untag_ptr(_res));
30000         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
30001 }
30002
30003 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30004         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30005         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
30006         return tag_ptr(ret_conv, true);
30007 }
30008 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
30009         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30010         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30011         return ret_conv;
30012 }
30013
30014 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
30015         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30016         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30017         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
30018         return tag_ptr(ret_conv, true);
30019 }
30020
30021 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
30022         LDKErrorMessage o_conv;
30023         o_conv.inner = untag_ptr(o);
30024         o_conv.is_owned = ptr_is_owned(o);
30025         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30026         o_conv = ErrorMessage_clone(&o_conv);
30027         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30028         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
30029         return tag_ptr(ret_conv, true);
30030 }
30031
30032 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
30033         void* e_ptr = untag_ptr(e);
30034         CHECK_ACCESS(e_ptr);
30035         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30036         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30037         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30038         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
30039         return tag_ptr(ret_conv, true);
30040 }
30041
30042 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
30043         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
30044         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
30045         return ret_conv;
30046 }
30047
30048 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
30049         if (!ptr_is_owned(_res)) return;
30050         void* _res_ptr = untag_ptr(_res);
30051         CHECK_ACCESS(_res_ptr);
30052         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
30053         FREE(untag_ptr(_res));
30054         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
30055 }
30056
30057 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
30058         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30059         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
30060         return tag_ptr(ret_conv, true);
30061 }
30062 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
30063         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
30064         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
30065         return ret_conv;
30066 }
30067
30068 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
30069         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
30070         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30071         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
30072         return tag_ptr(ret_conv, true);
30073 }
30074
30075 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
30076         LDKWarningMessage o_conv;
30077         o_conv.inner = untag_ptr(o);
30078         o_conv.is_owned = ptr_is_owned(o);
30079         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30080         o_conv = WarningMessage_clone(&o_conv);
30081         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30082         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
30083         return tag_ptr(ret_conv, true);
30084 }
30085
30086 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
30087         void* e_ptr = untag_ptr(e);
30088         CHECK_ACCESS(e_ptr);
30089         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30090         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30091         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30092         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
30093         return tag_ptr(ret_conv, true);
30094 }
30095
30096 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
30097         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
30098         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
30099         return ret_conv;
30100 }
30101
30102 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
30103         if (!ptr_is_owned(_res)) return;
30104         void* _res_ptr = untag_ptr(_res);
30105         CHECK_ACCESS(_res_ptr);
30106         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
30107         FREE(untag_ptr(_res));
30108         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
30109 }
30110
30111 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
30112         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30113         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
30114         return tag_ptr(ret_conv, true);
30115 }
30116 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
30117         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
30118         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
30119         return ret_conv;
30120 }
30121
30122 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
30123         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
30124         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30125         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
30126         return tag_ptr(ret_conv, true);
30127 }
30128
30129 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
30130         LDKUnsignedNodeAnnouncement o_conv;
30131         o_conv.inner = untag_ptr(o);
30132         o_conv.is_owned = ptr_is_owned(o);
30133         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30134         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
30135         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30136         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
30137         return tag_ptr(ret_conv, true);
30138 }
30139
30140 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
30141         void* e_ptr = untag_ptr(e);
30142         CHECK_ACCESS(e_ptr);
30143         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30144         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30145         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30146         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
30147         return tag_ptr(ret_conv, true);
30148 }
30149
30150 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
30151         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30152         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30153         return ret_conv;
30154 }
30155
30156 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
30157         if (!ptr_is_owned(_res)) return;
30158         void* _res_ptr = untag_ptr(_res);
30159         CHECK_ACCESS(_res_ptr);
30160         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
30161         FREE(untag_ptr(_res));
30162         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
30163 }
30164
30165 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30166         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30167         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
30168         return tag_ptr(ret_conv, true);
30169 }
30170 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
30171         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30172         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30173         return ret_conv;
30174 }
30175
30176 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
30177         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30178         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30179         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
30180         return tag_ptr(ret_conv, true);
30181 }
30182
30183 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
30184         LDKNodeAnnouncement o_conv;
30185         o_conv.inner = untag_ptr(o);
30186         o_conv.is_owned = ptr_is_owned(o);
30187         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30188         o_conv = NodeAnnouncement_clone(&o_conv);
30189         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30190         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
30191         return tag_ptr(ret_conv, true);
30192 }
30193
30194 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
30195         void* e_ptr = untag_ptr(e);
30196         CHECK_ACCESS(e_ptr);
30197         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30198         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30199         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30200         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
30201         return tag_ptr(ret_conv, true);
30202 }
30203
30204 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
30205         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30206         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30207         return ret_conv;
30208 }
30209
30210 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
30211         if (!ptr_is_owned(_res)) return;
30212         void* _res_ptr = untag_ptr(_res);
30213         CHECK_ACCESS(_res_ptr);
30214         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
30215         FREE(untag_ptr(_res));
30216         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
30217 }
30218
30219 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30220         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30221         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
30222         return tag_ptr(ret_conv, true);
30223 }
30224 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
30225         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30226         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30227         return ret_conv;
30228 }
30229
30230 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
30231         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30232         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30233         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
30234         return tag_ptr(ret_conv, true);
30235 }
30236
30237 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
30238         LDKQueryShortChannelIds o_conv;
30239         o_conv.inner = untag_ptr(o);
30240         o_conv.is_owned = ptr_is_owned(o);
30241         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30242         o_conv = QueryShortChannelIds_clone(&o_conv);
30243         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30244         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
30245         return tag_ptr(ret_conv, true);
30246 }
30247
30248 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
30249         void* e_ptr = untag_ptr(e);
30250         CHECK_ACCESS(e_ptr);
30251         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30252         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30253         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30254         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
30255         return tag_ptr(ret_conv, true);
30256 }
30257
30258 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
30259         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
30260         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
30261         return ret_conv;
30262 }
30263
30264 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
30265         if (!ptr_is_owned(_res)) return;
30266         void* _res_ptr = untag_ptr(_res);
30267         CHECK_ACCESS(_res_ptr);
30268         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
30269         FREE(untag_ptr(_res));
30270         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
30271 }
30272
30273 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
30274         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30275         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
30276         return tag_ptr(ret_conv, true);
30277 }
30278 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
30279         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
30280         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
30281         return ret_conv;
30282 }
30283
30284 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
30285         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
30286         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30287         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
30288         return tag_ptr(ret_conv, true);
30289 }
30290
30291 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
30292         LDKReplyShortChannelIdsEnd o_conv;
30293         o_conv.inner = untag_ptr(o);
30294         o_conv.is_owned = ptr_is_owned(o);
30295         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30296         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
30297         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30298         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
30299         return tag_ptr(ret_conv, true);
30300 }
30301
30302 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
30303         void* e_ptr = untag_ptr(e);
30304         CHECK_ACCESS(e_ptr);
30305         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30306         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30307         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30308         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
30309         return tag_ptr(ret_conv, true);
30310 }
30311
30312 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
30313         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
30314         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
30315         return ret_conv;
30316 }
30317
30318 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
30319         if (!ptr_is_owned(_res)) return;
30320         void* _res_ptr = untag_ptr(_res);
30321         CHECK_ACCESS(_res_ptr);
30322         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
30323         FREE(untag_ptr(_res));
30324         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
30325 }
30326
30327 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
30328         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30329         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
30330         return tag_ptr(ret_conv, true);
30331 }
30332 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
30333         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
30334         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
30335         return ret_conv;
30336 }
30337
30338 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
30339         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
30340         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30341         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
30342         return tag_ptr(ret_conv, true);
30343 }
30344
30345 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
30346         LDKQueryChannelRange o_conv;
30347         o_conv.inner = untag_ptr(o);
30348         o_conv.is_owned = ptr_is_owned(o);
30349         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30350         o_conv = QueryChannelRange_clone(&o_conv);
30351         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30352         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
30353         return tag_ptr(ret_conv, true);
30354 }
30355
30356 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
30357         void* e_ptr = untag_ptr(e);
30358         CHECK_ACCESS(e_ptr);
30359         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30360         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30361         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30362         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
30363         return tag_ptr(ret_conv, true);
30364 }
30365
30366 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
30367         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
30368         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
30369         return ret_conv;
30370 }
30371
30372 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
30373         if (!ptr_is_owned(_res)) return;
30374         void* _res_ptr = untag_ptr(_res);
30375         CHECK_ACCESS(_res_ptr);
30376         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
30377         FREE(untag_ptr(_res));
30378         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
30379 }
30380
30381 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30382         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30383         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
30384         return tag_ptr(ret_conv, true);
30385 }
30386 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
30387         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
30388         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30389         return ret_conv;
30390 }
30391
30392 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
30393         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
30394         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30395         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
30396         return tag_ptr(ret_conv, true);
30397 }
30398
30399 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
30400         LDKReplyChannelRange o_conv;
30401         o_conv.inner = untag_ptr(o);
30402         o_conv.is_owned = ptr_is_owned(o);
30403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30404         o_conv = ReplyChannelRange_clone(&o_conv);
30405         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30406         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
30407         return tag_ptr(ret_conv, true);
30408 }
30409
30410 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
30411         void* e_ptr = untag_ptr(e);
30412         CHECK_ACCESS(e_ptr);
30413         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30414         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30415         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30416         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
30417         return tag_ptr(ret_conv, true);
30418 }
30419
30420 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
30421         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
30422         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
30423         return ret_conv;
30424 }
30425
30426 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
30427         if (!ptr_is_owned(_res)) return;
30428         void* _res_ptr = untag_ptr(_res);
30429         CHECK_ACCESS(_res_ptr);
30430         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
30431         FREE(untag_ptr(_res));
30432         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
30433 }
30434
30435 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30436         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30437         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
30438         return tag_ptr(ret_conv, true);
30439 }
30440 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
30441         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
30442         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30443         return ret_conv;
30444 }
30445
30446 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
30447         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
30448         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30449         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
30450         return tag_ptr(ret_conv, true);
30451 }
30452
30453 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
30454         LDKGossipTimestampFilter o_conv;
30455         o_conv.inner = untag_ptr(o);
30456         o_conv.is_owned = ptr_is_owned(o);
30457         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30458         o_conv = GossipTimestampFilter_clone(&o_conv);
30459         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30460         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
30461         return tag_ptr(ret_conv, true);
30462 }
30463
30464 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
30465         void* e_ptr = untag_ptr(e);
30466         CHECK_ACCESS(e_ptr);
30467         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30468         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30469         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30470         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
30471         return tag_ptr(ret_conv, true);
30472 }
30473
30474 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
30475         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
30476         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
30477         return ret_conv;
30478 }
30479
30480 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
30481         if (!ptr_is_owned(_res)) return;
30482         void* _res_ptr = untag_ptr(_res);
30483         CHECK_ACCESS(_res_ptr);
30484         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
30485         FREE(untag_ptr(_res));
30486         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
30487 }
30488
30489 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
30490         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30491         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
30492         return tag_ptr(ret_conv, true);
30493 }
30494 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
30495         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
30496         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
30497         return ret_conv;
30498 }
30499
30500 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
30501         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
30502         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30503         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
30504         return tag_ptr(ret_conv, true);
30505 }
30506
30507 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
30508         LDKCVec_PhantomRouteHintsZ _res_constr;
30509         _res_constr.datalen = _res->arr_len;
30510         if (_res_constr.datalen > 0)
30511                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
30512         else
30513                 _res_constr.data = NULL;
30514         uint64_t* _res_vals = _res->elems;
30515         for (size_t t = 0; t < _res_constr.datalen; t++) {
30516                 uint64_t _res_conv_19 = _res_vals[t];
30517                 LDKPhantomRouteHints _res_conv_19_conv;
30518                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
30519                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
30520                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
30521                 _res_constr.data[t] = _res_conv_19_conv;
30522         }
30523         FREE(_res);
30524         CVec_PhantomRouteHintsZ_free(_res_constr);
30525 }
30526
30527 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
30528         LDKBolt11Invoice o_conv;
30529         o_conv.inner = untag_ptr(o);
30530         o_conv.is_owned = ptr_is_owned(o);
30531         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30532         o_conv = Bolt11Invoice_clone(&o_conv);
30533         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30534         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
30535         return tag_ptr(ret_conv, true);
30536 }
30537
30538 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(uint64_t e) {
30539         void* e_ptr = untag_ptr(e);
30540         CHECK_ACCESS(e_ptr);
30541         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
30542         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
30543         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30544         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
30545         return tag_ptr(ret_conv, true);
30546 }
30547
30548 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
30549         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
30550         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
30551         return ret_conv;
30552 }
30553
30554 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
30555         if (!ptr_is_owned(_res)) return;
30556         void* _res_ptr = untag_ptr(_res);
30557         CHECK_ACCESS(_res_ptr);
30558         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
30559         FREE(untag_ptr(_res));
30560         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
30561 }
30562
30563 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
30564         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30565         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
30566         return tag_ptr(ret_conv, true);
30567 }
30568 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
30569         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
30570         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
30571         return ret_conv;
30572 }
30573
30574 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
30575         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
30576         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30577         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
30578         return tag_ptr(ret_conv, true);
30579 }
30580
30581 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_ok"))) TS_CResult_OffersMessageDecodeErrorZ_ok(uint64_t o) {
30582         void* o_ptr = untag_ptr(o);
30583         CHECK_ACCESS(o_ptr);
30584         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
30585         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
30586         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
30587         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
30588         return tag_ptr(ret_conv, true);
30589 }
30590
30591 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_err"))) TS_CResult_OffersMessageDecodeErrorZ_err(uint64_t e) {
30592         void* e_ptr = untag_ptr(e);
30593         CHECK_ACCESS(e_ptr);
30594         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30595         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30596         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
30597         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
30598         return tag_ptr(ret_conv, true);
30599 }
30600
30601 jboolean  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_is_ok"))) TS_CResult_OffersMessageDecodeErrorZ_is_ok(uint64_t o) {
30602         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
30603         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
30604         return ret_conv;
30605 }
30606
30607 void  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_free"))) TS_CResult_OffersMessageDecodeErrorZ_free(uint64_t _res) {
30608         if (!ptr_is_owned(_res)) return;
30609         void* _res_ptr = untag_ptr(_res);
30610         CHECK_ACCESS(_res_ptr);
30611         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
30612         FREE(untag_ptr(_res));
30613         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
30614 }
30615
30616 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
30617         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
30618         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
30619         return tag_ptr(ret_conv, true);
30620 }
30621 int64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OffersMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
30622         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
30623         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
30624         return ret_conv;
30625 }
30626
30627 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone"))) TS_CResult_OffersMessageDecodeErrorZ_clone(uint64_t orig) {
30628         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
30629         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
30630         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
30631         return tag_ptr(ret_conv, true);
30632 }
30633
30634 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
30635         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
30636         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
30637         *ret_copy = COption_HTLCClaimZ_some(o_conv);
30638         uint64_t ret_ref = tag_ptr(ret_copy, true);
30639         return ret_ref;
30640 }
30641
30642 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
30643         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
30644         *ret_copy = COption_HTLCClaimZ_none();
30645         uint64_t ret_ref = tag_ptr(ret_copy, true);
30646         return ret_ref;
30647 }
30648
30649 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
30650         if (!ptr_is_owned(_res)) return;
30651         void* _res_ptr = untag_ptr(_res);
30652         CHECK_ACCESS(_res_ptr);
30653         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
30654         FREE(untag_ptr(_res));
30655         COption_HTLCClaimZ_free(_res_conv);
30656 }
30657
30658 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
30659         LDKCounterpartyCommitmentSecrets o_conv;
30660         o_conv.inner = untag_ptr(o);
30661         o_conv.is_owned = ptr_is_owned(o);
30662         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30663         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
30664         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
30665         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
30666         return tag_ptr(ret_conv, true);
30667 }
30668
30669 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
30670         void* e_ptr = untag_ptr(e);
30671         CHECK_ACCESS(e_ptr);
30672         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30673         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30674         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
30675         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
30676         return tag_ptr(ret_conv, true);
30677 }
30678
30679 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
30680         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
30681         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
30682         return ret_conv;
30683 }
30684
30685 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
30686         if (!ptr_is_owned(_res)) return;
30687         void* _res_ptr = untag_ptr(_res);
30688         CHECK_ACCESS(_res_ptr);
30689         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
30690         FREE(untag_ptr(_res));
30691         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
30692 }
30693
30694 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
30695         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
30696         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
30697         return tag_ptr(ret_conv, true);
30698 }
30699 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
30700         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
30701         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
30702         return ret_conv;
30703 }
30704
30705 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
30706         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
30707         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
30708         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
30709         return tag_ptr(ret_conv, true);
30710 }
30711
30712 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
30713         LDKTxCreationKeys o_conv;
30714         o_conv.inner = untag_ptr(o);
30715         o_conv.is_owned = ptr_is_owned(o);
30716         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30717         o_conv = TxCreationKeys_clone(&o_conv);
30718         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
30719         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
30720         return tag_ptr(ret_conv, true);
30721 }
30722
30723 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
30724         void* e_ptr = untag_ptr(e);
30725         CHECK_ACCESS(e_ptr);
30726         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30727         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30728         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
30729         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
30730         return tag_ptr(ret_conv, true);
30731 }
30732
30733 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
30734         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
30735         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
30736         return ret_conv;
30737 }
30738
30739 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
30740         if (!ptr_is_owned(_res)) return;
30741         void* _res_ptr = untag_ptr(_res);
30742         CHECK_ACCESS(_res_ptr);
30743         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
30744         FREE(untag_ptr(_res));
30745         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
30746 }
30747
30748 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
30749         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
30750         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
30751         return tag_ptr(ret_conv, true);
30752 }
30753 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
30754         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
30755         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
30756         return ret_conv;
30757 }
30758
30759 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
30760         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
30761         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
30762         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
30763         return tag_ptr(ret_conv, true);
30764 }
30765
30766 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
30767         LDKChannelPublicKeys o_conv;
30768         o_conv.inner = untag_ptr(o);
30769         o_conv.is_owned = ptr_is_owned(o);
30770         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30771         o_conv = ChannelPublicKeys_clone(&o_conv);
30772         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
30773         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
30774         return tag_ptr(ret_conv, true);
30775 }
30776
30777 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
30778         void* e_ptr = untag_ptr(e);
30779         CHECK_ACCESS(e_ptr);
30780         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30781         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30782         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
30783         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
30784         return tag_ptr(ret_conv, true);
30785 }
30786
30787 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
30788         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
30789         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
30790         return ret_conv;
30791 }
30792
30793 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
30794         if (!ptr_is_owned(_res)) return;
30795         void* _res_ptr = untag_ptr(_res);
30796         CHECK_ACCESS(_res_ptr);
30797         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
30798         FREE(untag_ptr(_res));
30799         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
30800 }
30801
30802 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
30803         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
30804         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
30805         return tag_ptr(ret_conv, true);
30806 }
30807 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
30808         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
30809         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
30810         return ret_conv;
30811 }
30812
30813 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
30814         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
30815         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
30816         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
30817         return tag_ptr(ret_conv, true);
30818 }
30819
30820 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
30821         LDKHTLCOutputInCommitment o_conv;
30822         o_conv.inner = untag_ptr(o);
30823         o_conv.is_owned = ptr_is_owned(o);
30824         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30825         o_conv = HTLCOutputInCommitment_clone(&o_conv);
30826         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
30827         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
30828         return tag_ptr(ret_conv, true);
30829 }
30830
30831 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
30832         void* e_ptr = untag_ptr(e);
30833         CHECK_ACCESS(e_ptr);
30834         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30835         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30836         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
30837         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
30838         return tag_ptr(ret_conv, true);
30839 }
30840
30841 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
30842         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
30843         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
30844         return ret_conv;
30845 }
30846
30847 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
30848         if (!ptr_is_owned(_res)) return;
30849         void* _res_ptr = untag_ptr(_res);
30850         CHECK_ACCESS(_res_ptr);
30851         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
30852         FREE(untag_ptr(_res));
30853         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
30854 }
30855
30856 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
30857         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
30858         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
30859         return tag_ptr(ret_conv, true);
30860 }
30861 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
30862         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
30863         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
30864         return ret_conv;
30865 }
30866
30867 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
30868         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
30869         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
30870         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
30871         return tag_ptr(ret_conv, true);
30872 }
30873
30874 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
30875         LDKCounterpartyChannelTransactionParameters o_conv;
30876         o_conv.inner = untag_ptr(o);
30877         o_conv.is_owned = ptr_is_owned(o);
30878         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30879         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
30880         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
30881         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
30882         return tag_ptr(ret_conv, true);
30883 }
30884
30885 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
30886         void* e_ptr = untag_ptr(e);
30887         CHECK_ACCESS(e_ptr);
30888         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30889         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30890         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
30891         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
30892         return tag_ptr(ret_conv, true);
30893 }
30894
30895 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
30896         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
30897         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
30898         return ret_conv;
30899 }
30900
30901 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
30902         if (!ptr_is_owned(_res)) return;
30903         void* _res_ptr = untag_ptr(_res);
30904         CHECK_ACCESS(_res_ptr);
30905         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
30906         FREE(untag_ptr(_res));
30907         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
30908 }
30909
30910 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
30911         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
30912         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
30913         return tag_ptr(ret_conv, true);
30914 }
30915 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
30916         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
30917         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
30918         return ret_conv;
30919 }
30920
30921 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
30922         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
30923         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
30924         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
30925         return tag_ptr(ret_conv, true);
30926 }
30927
30928 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
30929         LDKChannelTransactionParameters o_conv;
30930         o_conv.inner = untag_ptr(o);
30931         o_conv.is_owned = ptr_is_owned(o);
30932         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30933         o_conv = ChannelTransactionParameters_clone(&o_conv);
30934         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
30935         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
30936         return tag_ptr(ret_conv, true);
30937 }
30938
30939 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
30940         void* e_ptr = untag_ptr(e);
30941         CHECK_ACCESS(e_ptr);
30942         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30943         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30944         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
30945         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
30946         return tag_ptr(ret_conv, true);
30947 }
30948
30949 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
30950         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
30951         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
30952         return ret_conv;
30953 }
30954
30955 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
30956         if (!ptr_is_owned(_res)) return;
30957         void* _res_ptr = untag_ptr(_res);
30958         CHECK_ACCESS(_res_ptr);
30959         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
30960         FREE(untag_ptr(_res));
30961         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
30962 }
30963
30964 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
30965         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
30966         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
30967         return tag_ptr(ret_conv, true);
30968 }
30969 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
30970         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
30971         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
30972         return ret_conv;
30973 }
30974
30975 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
30976         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
30977         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
30978         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
30979         return tag_ptr(ret_conv, true);
30980 }
30981
30982 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
30983         LDKHolderCommitmentTransaction o_conv;
30984         o_conv.inner = untag_ptr(o);
30985         o_conv.is_owned = ptr_is_owned(o);
30986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30987         o_conv = HolderCommitmentTransaction_clone(&o_conv);
30988         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
30989         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
30990         return tag_ptr(ret_conv, true);
30991 }
30992
30993 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
30994         void* e_ptr = untag_ptr(e);
30995         CHECK_ACCESS(e_ptr);
30996         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30997         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30998         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
30999         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
31000         return tag_ptr(ret_conv, true);
31001 }
31002
31003 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
31004         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31005         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31006         return ret_conv;
31007 }
31008
31009 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
31010         if (!ptr_is_owned(_res)) return;
31011         void* _res_ptr = untag_ptr(_res);
31012         CHECK_ACCESS(_res_ptr);
31013         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31014         FREE(untag_ptr(_res));
31015         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
31016 }
31017
31018 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31019         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31020         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
31021         return tag_ptr(ret_conv, true);
31022 }
31023 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
31024         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31025         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31026         return ret_conv;
31027 }
31028
31029 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
31030         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31031         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31032         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31033         return tag_ptr(ret_conv, true);
31034 }
31035
31036 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
31037         LDKBuiltCommitmentTransaction o_conv;
31038         o_conv.inner = untag_ptr(o);
31039         o_conv.is_owned = ptr_is_owned(o);
31040         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31041         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
31042         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31043         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
31044         return tag_ptr(ret_conv, true);
31045 }
31046
31047 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
31048         void* e_ptr = untag_ptr(e);
31049         CHECK_ACCESS(e_ptr);
31050         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31051         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31052         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31053         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
31054         return tag_ptr(ret_conv, true);
31055 }
31056
31057 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
31058         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31059         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31060         return ret_conv;
31061 }
31062
31063 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
31064         if (!ptr_is_owned(_res)) return;
31065         void* _res_ptr = untag_ptr(_res);
31066         CHECK_ACCESS(_res_ptr);
31067         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31068         FREE(untag_ptr(_res));
31069         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
31070 }
31071
31072 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31073         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31074         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
31075         return tag_ptr(ret_conv, true);
31076 }
31077 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
31078         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31079         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31080         return ret_conv;
31081 }
31082
31083 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
31084         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31085         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31086         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31087         return tag_ptr(ret_conv, true);
31088 }
31089
31090 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
31091         LDKTrustedClosingTransaction o_conv;
31092         o_conv.inner = untag_ptr(o);
31093         o_conv.is_owned = ptr_is_owned(o);
31094         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31095         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
31096         
31097         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31098         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
31099         return tag_ptr(ret_conv, true);
31100 }
31101
31102 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
31103         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31104         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
31105         return tag_ptr(ret_conv, true);
31106 }
31107
31108 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
31109         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
31110         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
31111         return ret_conv;
31112 }
31113
31114 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
31115         if (!ptr_is_owned(_res)) return;
31116         void* _res_ptr = untag_ptr(_res);
31117         CHECK_ACCESS(_res_ptr);
31118         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
31119         FREE(untag_ptr(_res));
31120         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
31121 }
31122
31123 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
31124         LDKCommitmentTransaction o_conv;
31125         o_conv.inner = untag_ptr(o);
31126         o_conv.is_owned = ptr_is_owned(o);
31127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31128         o_conv = CommitmentTransaction_clone(&o_conv);
31129         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31130         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
31131         return tag_ptr(ret_conv, true);
31132 }
31133
31134 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
31135         void* e_ptr = untag_ptr(e);
31136         CHECK_ACCESS(e_ptr);
31137         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31138         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31139         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31140         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
31141         return tag_ptr(ret_conv, true);
31142 }
31143
31144 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
31145         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31146         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31147         return ret_conv;
31148 }
31149
31150 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
31151         if (!ptr_is_owned(_res)) return;
31152         void* _res_ptr = untag_ptr(_res);
31153         CHECK_ACCESS(_res_ptr);
31154         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
31155         FREE(untag_ptr(_res));
31156         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
31157 }
31158
31159 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31160         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31161         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
31162         return tag_ptr(ret_conv, true);
31163 }
31164 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
31165         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31166         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31167         return ret_conv;
31168 }
31169
31170 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
31171         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31172         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31173         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
31174         return tag_ptr(ret_conv, true);
31175 }
31176
31177 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
31178         LDKTrustedCommitmentTransaction o_conv;
31179         o_conv.inner = untag_ptr(o);
31180         o_conv.is_owned = ptr_is_owned(o);
31181         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31182         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
31183         
31184         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31185         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
31186         return tag_ptr(ret_conv, true);
31187 }
31188
31189 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
31190         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31191         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
31192         return tag_ptr(ret_conv, true);
31193 }
31194
31195 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
31196         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
31197         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
31198         return ret_conv;
31199 }
31200
31201 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
31202         if (!ptr_is_owned(_res)) return;
31203         void* _res_ptr = untag_ptr(_res);
31204         CHECK_ACCESS(_res_ptr);
31205         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
31206         FREE(untag_ptr(_res));
31207         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
31208 }
31209
31210 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
31211         LDKCVec_ECDSASignatureZ o_constr;
31212         o_constr.datalen = o->arr_len;
31213         if (o_constr.datalen > 0)
31214                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
31215         else
31216                 o_constr.data = NULL;
31217         int8_tArray* o_vals = (void*) o->elems;
31218         for (size_t m = 0; m < o_constr.datalen; m++) {
31219                 int8_tArray o_conv_12 = o_vals[m];
31220                 LDKECDSASignature o_conv_12_ref;
31221                 CHECK(o_conv_12->arr_len == 64);
31222                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
31223                 o_constr.data[m] = o_conv_12_ref;
31224         }
31225         FREE(o);
31226         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31227         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
31228         return tag_ptr(ret_conv, true);
31229 }
31230
31231 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_err() {
31232         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31233         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
31234         return tag_ptr(ret_conv, true);
31235 }
31236
31237 jboolean  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok(uint64_t o) {
31238         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
31239         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
31240         return ret_conv;
31241 }
31242
31243 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_free"))) TS_CResult_CVec_ECDSASignatureZNoneZ_free(uint64_t _res) {
31244         if (!ptr_is_owned(_res)) return;
31245         void* _res_ptr = untag_ptr(_res);
31246         CHECK_ACCESS(_res_ptr);
31247         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
31248         FREE(untag_ptr(_res));
31249         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
31250 }
31251
31252 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
31253         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31254         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
31255         return tag_ptr(ret_conv, true);
31256 }
31257 int64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(uint64_t arg) {
31258         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
31259         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
31260         return ret_conv;
31261 }
31262
31263 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone(uint64_t orig) {
31264         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
31265         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31266         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
31267         return tag_ptr(ret_conv, true);
31268 }
31269
31270 uint64_t  __attribute__((export_name("TS_COption_usizeZ_some"))) TS_COption_usizeZ_some(uint32_t o) {
31271         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31272         *ret_copy = COption_usizeZ_some(o);
31273         uint64_t ret_ref = tag_ptr(ret_copy, true);
31274         return ret_ref;
31275 }
31276
31277 uint64_t  __attribute__((export_name("TS_COption_usizeZ_none"))) TS_COption_usizeZ_none() {
31278         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31279         *ret_copy = COption_usizeZ_none();
31280         uint64_t ret_ref = tag_ptr(ret_copy, true);
31281         return ret_ref;
31282 }
31283
31284 void  __attribute__((export_name("TS_COption_usizeZ_free"))) TS_COption_usizeZ_free(uint64_t _res) {
31285         if (!ptr_is_owned(_res)) return;
31286         void* _res_ptr = untag_ptr(_res);
31287         CHECK_ACCESS(_res_ptr);
31288         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
31289         FREE(untag_ptr(_res));
31290         COption_usizeZ_free(_res_conv);
31291 }
31292
31293 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
31294         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31295         *ret_copy = COption_usizeZ_clone(arg);
31296         uint64_t ret_ref = tag_ptr(ret_copy, true);
31297         return ret_ref;
31298 }
31299 int64_t  __attribute__((export_name("TS_COption_usizeZ_clone_ptr"))) TS_COption_usizeZ_clone_ptr(uint64_t arg) {
31300         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
31301         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
31302         return ret_conv;
31303 }
31304
31305 uint64_t  __attribute__((export_name("TS_COption_usizeZ_clone"))) TS_COption_usizeZ_clone(uint64_t orig) {
31306         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
31307         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31308         *ret_copy = COption_usizeZ_clone(orig_conv);
31309         uint64_t ret_ref = tag_ptr(ret_copy, true);
31310         return ret_ref;
31311 }
31312
31313 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
31314         LDKShutdownScript o_conv;
31315         o_conv.inner = untag_ptr(o);
31316         o_conv.is_owned = ptr_is_owned(o);
31317         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31318         o_conv = ShutdownScript_clone(&o_conv);
31319         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31320         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
31321         return tag_ptr(ret_conv, true);
31322 }
31323
31324 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
31325         void* e_ptr = untag_ptr(e);
31326         CHECK_ACCESS(e_ptr);
31327         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31328         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31329         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31330         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
31331         return tag_ptr(ret_conv, true);
31332 }
31333
31334 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
31335         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
31336         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
31337         return ret_conv;
31338 }
31339
31340 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
31341         if (!ptr_is_owned(_res)) return;
31342         void* _res_ptr = untag_ptr(_res);
31343         CHECK_ACCESS(_res_ptr);
31344         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
31345         FREE(untag_ptr(_res));
31346         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
31347 }
31348
31349 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
31350         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31351         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
31352         return tag_ptr(ret_conv, true);
31353 }
31354 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
31355         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
31356         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
31357         return ret_conv;
31358 }
31359
31360 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
31361         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
31362         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31363         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
31364         return tag_ptr(ret_conv, true);
31365 }
31366
31367 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
31368         LDKShutdownScript o_conv;
31369         o_conv.inner = untag_ptr(o);
31370         o_conv.is_owned = ptr_is_owned(o);
31371         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31372         o_conv = ShutdownScript_clone(&o_conv);
31373         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31374         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
31375         return tag_ptr(ret_conv, true);
31376 }
31377
31378 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
31379         LDKInvalidShutdownScript e_conv;
31380         e_conv.inner = untag_ptr(e);
31381         e_conv.is_owned = ptr_is_owned(e);
31382         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
31383         e_conv = InvalidShutdownScript_clone(&e_conv);
31384         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31385         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
31386         return tag_ptr(ret_conv, true);
31387 }
31388
31389 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
31390         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
31391         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
31392         return ret_conv;
31393 }
31394
31395 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
31396         if (!ptr_is_owned(_res)) return;
31397         void* _res_ptr = untag_ptr(_res);
31398         CHECK_ACCESS(_res_ptr);
31399         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
31400         FREE(untag_ptr(_res));
31401         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
31402 }
31403
31404 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
31405         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31406         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
31407         return tag_ptr(ret_conv, true);
31408 }
31409 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
31410         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
31411         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
31412         return ret_conv;
31413 }
31414
31415 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
31416         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
31417         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31418         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
31419         return tag_ptr(ret_conv, true);
31420 }
31421
31422 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
31423         LDKCVec_TransactionZ _res_constr;
31424         _res_constr.datalen = _res->arr_len;
31425         if (_res_constr.datalen > 0)
31426                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
31427         else
31428                 _res_constr.data = NULL;
31429         int8_tArray* _res_vals = (void*) _res->elems;
31430         for (size_t m = 0; m < _res_constr.datalen; m++) {
31431                 int8_tArray _res_conv_12 = _res_vals[m];
31432                 LDKTransaction _res_conv_12_ref;
31433                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
31434                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
31435                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
31436                 _res_conv_12_ref.data_is_owned = true;
31437                 _res_constr.data[m] = _res_conv_12_ref;
31438         }
31439         FREE(_res);
31440         CVec_TransactionZ_free(_res_constr);
31441 }
31442
31443 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
31444         void* o_ptr = untag_ptr(o);
31445         CHECK_ACCESS(o_ptr);
31446         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
31447         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
31448         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31449         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
31450         return tag_ptr(ret_conv, true);
31451 }
31452
31453 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
31454         void* e_ptr = untag_ptr(e);
31455         CHECK_ACCESS(e_ptr);
31456         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31457         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31458         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31459         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
31460         return tag_ptr(ret_conv, true);
31461 }
31462
31463 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
31464         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
31465         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
31466         return ret_conv;
31467 }
31468
31469 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
31470         if (!ptr_is_owned(_res)) return;
31471         void* _res_ptr = untag_ptr(_res);
31472         CHECK_ACCESS(_res_ptr);
31473         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
31474         FREE(untag_ptr(_res));
31475         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
31476 }
31477
31478 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
31479         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31480         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
31481         return tag_ptr(ret_conv, true);
31482 }
31483 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
31484         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
31485         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
31486         return ret_conv;
31487 }
31488
31489 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
31490         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
31491         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31492         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
31493         return tag_ptr(ret_conv, true);
31494 }
31495
31496 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_ok(uint64_t o) {
31497         LDKClaimedHTLC o_conv;
31498         o_conv.inner = untag_ptr(o);
31499         o_conv.is_owned = ptr_is_owned(o);
31500         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31501         o_conv = ClaimedHTLC_clone(&o_conv);
31502         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31503         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
31504         return tag_ptr(ret_conv, true);
31505 }
31506
31507 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_err(uint64_t e) {
31508         void* e_ptr = untag_ptr(e);
31509         CHECK_ACCESS(e_ptr);
31510         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31511         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31512         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31513         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
31514         return tag_ptr(ret_conv, true);
31515 }
31516
31517 jboolean  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok(uint64_t o) {
31518         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
31519         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
31520         return ret_conv;
31521 }
31522
31523 void  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_free"))) TS_CResult_ClaimedHTLCDecodeErrorZ_free(uint64_t _res) {
31524         if (!ptr_is_owned(_res)) return;
31525         void* _res_ptr = untag_ptr(_res);
31526         CHECK_ACCESS(_res_ptr);
31527         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
31528         FREE(untag_ptr(_res));
31529         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
31530 }
31531
31532 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
31533         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31534         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
31535         return tag_ptr(ret_conv, true);
31536 }
31537 int64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
31538         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
31539         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
31540         return ret_conv;
31541 }
31542
31543 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone(uint64_t orig) {
31544         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
31545         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31546         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
31547         return tag_ptr(ret_conv, true);
31548 }
31549
31550 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
31551         void* o_ptr = untag_ptr(o);
31552         CHECK_ACCESS(o_ptr);
31553         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
31554         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
31555         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31556         *ret_copy = COption_PathFailureZ_some(o_conv);
31557         uint64_t ret_ref = tag_ptr(ret_copy, true);
31558         return ret_ref;
31559 }
31560
31561 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
31562         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31563         *ret_copy = COption_PathFailureZ_none();
31564         uint64_t ret_ref = tag_ptr(ret_copy, true);
31565         return ret_ref;
31566 }
31567
31568 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
31569         if (!ptr_is_owned(_res)) return;
31570         void* _res_ptr = untag_ptr(_res);
31571         CHECK_ACCESS(_res_ptr);
31572         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
31573         FREE(untag_ptr(_res));
31574         COption_PathFailureZ_free(_res_conv);
31575 }
31576
31577 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
31578         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31579         *ret_copy = COption_PathFailureZ_clone(arg);
31580         uint64_t ret_ref = tag_ptr(ret_copy, true);
31581         return ret_ref;
31582 }
31583 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
31584         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
31585         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
31586         return ret_conv;
31587 }
31588
31589 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
31590         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
31591         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31592         *ret_copy = COption_PathFailureZ_clone(orig_conv);
31593         uint64_t ret_ref = tag_ptr(ret_copy, true);
31594         return ret_ref;
31595 }
31596
31597 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
31598         void* o_ptr = untag_ptr(o);
31599         CHECK_ACCESS(o_ptr);
31600         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
31601         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
31602         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31603         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
31604         return tag_ptr(ret_conv, true);
31605 }
31606
31607 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
31608         void* e_ptr = untag_ptr(e);
31609         CHECK_ACCESS(e_ptr);
31610         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31611         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31612         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31613         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
31614         return tag_ptr(ret_conv, true);
31615 }
31616
31617 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
31618         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
31619         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
31620         return ret_conv;
31621 }
31622
31623 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
31624         if (!ptr_is_owned(_res)) return;
31625         void* _res_ptr = untag_ptr(_res);
31626         CHECK_ACCESS(_res_ptr);
31627         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
31628         FREE(untag_ptr(_res));
31629         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
31630 }
31631
31632 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
31633         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31634         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
31635         return tag_ptr(ret_conv, true);
31636 }
31637 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
31638         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
31639         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
31640         return ret_conv;
31641 }
31642
31643 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
31644         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
31645         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31646         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
31647         return tag_ptr(ret_conv, true);
31648 }
31649
31650 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
31651         void* o_ptr = untag_ptr(o);
31652         CHECK_ACCESS(o_ptr);
31653         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
31654         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
31655         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
31656         *ret_copy = COption_ClosureReasonZ_some(o_conv);
31657         uint64_t ret_ref = tag_ptr(ret_copy, true);
31658         return ret_ref;
31659 }
31660
31661 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
31662         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
31663         *ret_copy = COption_ClosureReasonZ_none();
31664         uint64_t ret_ref = tag_ptr(ret_copy, true);
31665         return ret_ref;
31666 }
31667
31668 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
31669         if (!ptr_is_owned(_res)) return;
31670         void* _res_ptr = untag_ptr(_res);
31671         CHECK_ACCESS(_res_ptr);
31672         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
31673         FREE(untag_ptr(_res));
31674         COption_ClosureReasonZ_free(_res_conv);
31675 }
31676
31677 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
31678         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
31679         *ret_copy = COption_ClosureReasonZ_clone(arg);
31680         uint64_t ret_ref = tag_ptr(ret_copy, true);
31681         return ret_ref;
31682 }
31683 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
31684         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
31685         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
31686         return ret_conv;
31687 }
31688
31689 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
31690         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
31691         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
31692         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
31693         uint64_t ret_ref = tag_ptr(ret_copy, true);
31694         return ret_ref;
31695 }
31696
31697 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
31698         void* o_ptr = untag_ptr(o);
31699         CHECK_ACCESS(o_ptr);
31700         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
31701         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
31702         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
31703         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
31704         return tag_ptr(ret_conv, true);
31705 }
31706
31707 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
31708         void* e_ptr = untag_ptr(e);
31709         CHECK_ACCESS(e_ptr);
31710         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31711         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31712         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
31713         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
31714         return tag_ptr(ret_conv, true);
31715 }
31716
31717 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
31718         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
31719         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
31720         return ret_conv;
31721 }
31722
31723 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
31724         if (!ptr_is_owned(_res)) return;
31725         void* _res_ptr = untag_ptr(_res);
31726         CHECK_ACCESS(_res_ptr);
31727         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
31728         FREE(untag_ptr(_res));
31729         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
31730 }
31731
31732 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
31733         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
31734         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
31735         return tag_ptr(ret_conv, true);
31736 }
31737 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
31738         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
31739         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
31740         return ret_conv;
31741 }
31742
31743 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
31744         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
31745         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
31746         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
31747         return tag_ptr(ret_conv, true);
31748 }
31749
31750 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
31751         void* o_ptr = untag_ptr(o);
31752         CHECK_ACCESS(o_ptr);
31753         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
31754         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
31755         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
31756         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
31757         uint64_t ret_ref = tag_ptr(ret_copy, true);
31758         return ret_ref;
31759 }
31760
31761 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
31762         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
31763         *ret_copy = COption_HTLCDestinationZ_none();
31764         uint64_t ret_ref = tag_ptr(ret_copy, true);
31765         return ret_ref;
31766 }
31767
31768 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
31769         if (!ptr_is_owned(_res)) return;
31770         void* _res_ptr = untag_ptr(_res);
31771         CHECK_ACCESS(_res_ptr);
31772         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
31773         FREE(untag_ptr(_res));
31774         COption_HTLCDestinationZ_free(_res_conv);
31775 }
31776
31777 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
31778         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
31779         *ret_copy = COption_HTLCDestinationZ_clone(arg);
31780         uint64_t ret_ref = tag_ptr(ret_copy, true);
31781         return ret_ref;
31782 }
31783 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
31784         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
31785         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
31786         return ret_conv;
31787 }
31788
31789 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
31790         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
31791         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
31792         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
31793         uint64_t ret_ref = tag_ptr(ret_copy, true);
31794         return ret_ref;
31795 }
31796
31797 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
31798         void* o_ptr = untag_ptr(o);
31799         CHECK_ACCESS(o_ptr);
31800         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
31801         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
31802         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
31803         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
31804         return tag_ptr(ret_conv, true);
31805 }
31806
31807 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
31808         void* e_ptr = untag_ptr(e);
31809         CHECK_ACCESS(e_ptr);
31810         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31811         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31812         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
31813         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
31814         return tag_ptr(ret_conv, true);
31815 }
31816
31817 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
31818         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
31819         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
31820         return ret_conv;
31821 }
31822
31823 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
31824         if (!ptr_is_owned(_res)) return;
31825         void* _res_ptr = untag_ptr(_res);
31826         CHECK_ACCESS(_res_ptr);
31827         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
31828         FREE(untag_ptr(_res));
31829         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
31830 }
31831
31832 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
31833         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
31834         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
31835         return tag_ptr(ret_conv, true);
31836 }
31837 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
31838         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
31839         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
31840         return ret_conv;
31841 }
31842
31843 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
31844         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
31845         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
31846         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
31847         return tag_ptr(ret_conv, true);
31848 }
31849
31850 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
31851         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
31852         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
31853         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
31854         return tag_ptr(ret_conv, true);
31855 }
31856
31857 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
31858         void* e_ptr = untag_ptr(e);
31859         CHECK_ACCESS(e_ptr);
31860         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31861         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31862         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
31863         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
31864         return tag_ptr(ret_conv, true);
31865 }
31866
31867 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
31868         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
31869         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
31870         return ret_conv;
31871 }
31872
31873 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
31874         if (!ptr_is_owned(_res)) return;
31875         void* _res_ptr = untag_ptr(_res);
31876         CHECK_ACCESS(_res_ptr);
31877         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
31878         FREE(untag_ptr(_res));
31879         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
31880 }
31881
31882 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
31883         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
31884         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
31885         return tag_ptr(ret_conv, true);
31886 }
31887 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
31888         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
31889         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
31890         return ret_conv;
31891 }
31892
31893 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
31894         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
31895         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
31896         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
31897         return tag_ptr(ret_conv, true);
31898 }
31899
31900 uint64_t  __attribute__((export_name("TS_COption_U128Z_some"))) TS_COption_U128Z_some(int8_tArray o) {
31901         LDKU128 o_ref;
31902         CHECK(o->arr_len == 16);
31903         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
31904         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
31905         *ret_copy = COption_U128Z_some(o_ref);
31906         uint64_t ret_ref = tag_ptr(ret_copy, true);
31907         return ret_ref;
31908 }
31909
31910 uint64_t  __attribute__((export_name("TS_COption_U128Z_none"))) TS_COption_U128Z_none() {
31911         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
31912         *ret_copy = COption_U128Z_none();
31913         uint64_t ret_ref = tag_ptr(ret_copy, true);
31914         return ret_ref;
31915 }
31916
31917 void  __attribute__((export_name("TS_COption_U128Z_free"))) TS_COption_U128Z_free(uint64_t _res) {
31918         if (!ptr_is_owned(_res)) return;
31919         void* _res_ptr = untag_ptr(_res);
31920         CHECK_ACCESS(_res_ptr);
31921         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
31922         FREE(untag_ptr(_res));
31923         COption_U128Z_free(_res_conv);
31924 }
31925
31926 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
31927         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
31928         *ret_copy = COption_U128Z_clone(arg);
31929         uint64_t ret_ref = tag_ptr(ret_copy, true);
31930         return ret_ref;
31931 }
31932 int64_t  __attribute__((export_name("TS_COption_U128Z_clone_ptr"))) TS_COption_U128Z_clone_ptr(uint64_t arg) {
31933         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
31934         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
31935         return ret_conv;
31936 }
31937
31938 uint64_t  __attribute__((export_name("TS_COption_U128Z_clone"))) TS_COption_U128Z_clone(uint64_t orig) {
31939         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
31940         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
31941         *ret_copy = COption_U128Z_clone(orig_conv);
31942         uint64_t ret_ref = tag_ptr(ret_copy, true);
31943         return ret_ref;
31944 }
31945
31946 void  __attribute__((export_name("TS_CVec_ClaimedHTLCZ_free"))) TS_CVec_ClaimedHTLCZ_free(uint64_tArray _res) {
31947         LDKCVec_ClaimedHTLCZ _res_constr;
31948         _res_constr.datalen = _res->arr_len;
31949         if (_res_constr.datalen > 0)
31950                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
31951         else
31952                 _res_constr.data = NULL;
31953         uint64_t* _res_vals = _res->elems;
31954         for (size_t n = 0; n < _res_constr.datalen; n++) {
31955                 uint64_t _res_conv_13 = _res_vals[n];
31956                 LDKClaimedHTLC _res_conv_13_conv;
31957                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
31958                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
31959                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
31960                 _res_constr.data[n] = _res_conv_13_conv;
31961         }
31962         FREE(_res);
31963         CVec_ClaimedHTLCZ_free(_res_constr);
31964 }
31965
31966 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
31967         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
31968         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
31969         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
31970         uint64_t ret_ref = tag_ptr(ret_copy, true);
31971         return ret_ref;
31972 }
31973
31974 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
31975         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
31976         *ret_copy = COption_PaymentFailureReasonZ_none();
31977         uint64_t ret_ref = tag_ptr(ret_copy, true);
31978         return ret_ref;
31979 }
31980
31981 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
31982         if (!ptr_is_owned(_res)) return;
31983         void* _res_ptr = untag_ptr(_res);
31984         CHECK_ACCESS(_res_ptr);
31985         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
31986         FREE(untag_ptr(_res));
31987         COption_PaymentFailureReasonZ_free(_res_conv);
31988 }
31989
31990 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
31991         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
31992         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
31993         uint64_t ret_ref = tag_ptr(ret_copy, true);
31994         return ret_ref;
31995 }
31996 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
31997         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
31998         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
31999         return ret_conv;
32000 }
32001
32002 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
32003         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
32004         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32005         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
32006         uint64_t ret_ref = tag_ptr(ret_copy, true);
32007         return ret_ref;
32008 }
32009
32010 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
32011         void* o_ptr = untag_ptr(o);
32012         CHECK_ACCESS(o_ptr);
32013         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
32014         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
32015         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32016         *ret_copy = COption_EventZ_some(o_conv);
32017         uint64_t ret_ref = tag_ptr(ret_copy, true);
32018         return ret_ref;
32019 }
32020
32021 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
32022         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32023         *ret_copy = COption_EventZ_none();
32024         uint64_t ret_ref = tag_ptr(ret_copy, true);
32025         return ret_ref;
32026 }
32027
32028 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
32029         if (!ptr_is_owned(_res)) return;
32030         void* _res_ptr = untag_ptr(_res);
32031         CHECK_ACCESS(_res_ptr);
32032         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
32033         FREE(untag_ptr(_res));
32034         COption_EventZ_free(_res_conv);
32035 }
32036
32037 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
32038         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32039         *ret_copy = COption_EventZ_clone(arg);
32040         uint64_t ret_ref = tag_ptr(ret_copy, true);
32041         return ret_ref;
32042 }
32043 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
32044         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
32045         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
32046         return ret_conv;
32047 }
32048
32049 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
32050         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
32051         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32052         *ret_copy = COption_EventZ_clone(orig_conv);
32053         uint64_t ret_ref = tag_ptr(ret_copy, true);
32054         return ret_ref;
32055 }
32056
32057 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
32058         void* o_ptr = untag_ptr(o);
32059         CHECK_ACCESS(o_ptr);
32060         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
32061         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
32062         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32063         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
32064         return tag_ptr(ret_conv, true);
32065 }
32066
32067 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
32068         void* e_ptr = untag_ptr(e);
32069         CHECK_ACCESS(e_ptr);
32070         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32071         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32072         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32073         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
32074         return tag_ptr(ret_conv, true);
32075 }
32076
32077 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
32078         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
32079         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
32080         return ret_conv;
32081 }
32082
32083 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
32084         if (!ptr_is_owned(_res)) return;
32085         void* _res_ptr = untag_ptr(_res);
32086         CHECK_ACCESS(_res_ptr);
32087         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
32088         FREE(untag_ptr(_res));
32089         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
32090 }
32091
32092 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
32093         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32094         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
32095         return tag_ptr(ret_conv, true);
32096 }
32097 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
32098         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
32099         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
32100         return ret_conv;
32101 }
32102
32103 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
32104         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
32105         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32106         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
32107         return tag_ptr(ret_conv, true);
32108 }
32109
32110 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_ok(uint32_t o) {
32111         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
32112         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32113         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
32114         return tag_ptr(ret_conv, true);
32115 }
32116
32117 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_err(uint64_t e) {
32118         void* e_ptr = untag_ptr(e);
32119         CHECK_ACCESS(e_ptr);
32120         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32121         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32122         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32123         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
32124         return tag_ptr(ret_conv, true);
32125 }
32126
32127 jboolean  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok(uint64_t o) {
32128         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
32129         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
32130         return ret_conv;
32131 }
32132
32133 void  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_free"))) TS_CResult_SiPrefixBolt11ParseErrorZ_free(uint64_t _res) {
32134         if (!ptr_is_owned(_res)) return;
32135         void* _res_ptr = untag_ptr(_res);
32136         CHECK_ACCESS(_res_ptr);
32137         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
32138         FREE(untag_ptr(_res));
32139         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
32140 }
32141
32142 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
32143         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32144         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
32145         return tag_ptr(ret_conv, true);
32146 }
32147 int64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
32148         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
32149         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
32150         return ret_conv;
32151 }
32152
32153 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone(uint64_t orig) {
32154         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
32155         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32156         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
32157         return tag_ptr(ret_conv, true);
32158 }
32159
32160 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
32161         LDKBolt11Invoice o_conv;
32162         o_conv.inner = untag_ptr(o);
32163         o_conv.is_owned = ptr_is_owned(o);
32164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32165         o_conv = Bolt11Invoice_clone(&o_conv);
32166         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32167         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
32168         return tag_ptr(ret_conv, true);
32169 }
32170
32171 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
32172         void* e_ptr = untag_ptr(e);
32173         CHECK_ACCESS(e_ptr);
32174         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
32175         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
32176         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32177         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
32178         return tag_ptr(ret_conv, true);
32179 }
32180
32181 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
32182         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
32183         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
32184         return ret_conv;
32185 }
32186
32187 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
32188         if (!ptr_is_owned(_res)) return;
32189         void* _res_ptr = untag_ptr(_res);
32190         CHECK_ACCESS(_res_ptr);
32191         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
32192         FREE(untag_ptr(_res));
32193         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
32194 }
32195
32196 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
32197         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32198         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
32199         return tag_ptr(ret_conv, true);
32200 }
32201 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
32202         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
32203         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
32204         return ret_conv;
32205 }
32206
32207 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
32208         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
32209         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32210         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
32211         return tag_ptr(ret_conv, true);
32212 }
32213
32214 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(uint64_t o) {
32215         LDKSignedRawBolt11Invoice o_conv;
32216         o_conv.inner = untag_ptr(o);
32217         o_conv.is_owned = ptr_is_owned(o);
32218         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32219         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
32220         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32221         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
32222         return tag_ptr(ret_conv, true);
32223 }
32224
32225 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(uint64_t e) {
32226         void* e_ptr = untag_ptr(e);
32227         CHECK_ACCESS(e_ptr);
32228         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32229         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32230         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32231         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
32232         return tag_ptr(ret_conv, true);
32233 }
32234
32235 jboolean  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(uint64_t o) {
32236         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
32237         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
32238         return ret_conv;
32239 }
32240
32241 void  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(uint64_t _res) {
32242         if (!ptr_is_owned(_res)) return;
32243         void* _res_ptr = untag_ptr(_res);
32244         CHECK_ACCESS(_res_ptr);
32245         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
32246         FREE(untag_ptr(_res));
32247         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
32248 }
32249
32250 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
32251         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32252         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
32253         return tag_ptr(ret_conv, true);
32254 }
32255 int64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
32256         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
32257         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
32258         return ret_conv;
32259 }
32260
32261 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(uint64_t orig) {
32262         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
32263         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32264         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
32265         return tag_ptr(ret_conv, true);
32266 }
32267
32268 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
32269         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32270         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
32271         return tag_ptr(ret_conv, true);
32272 }
32273 int64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(uint64_t arg) {
32274         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
32275         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
32276         return ret_conv;
32277 }
32278
32279 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(uint64_t orig) {
32280         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
32281         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32282         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
32283         return tag_ptr(ret_conv, true);
32284 }
32285
32286 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
32287         LDKRawBolt11Invoice a_conv;
32288         a_conv.inner = untag_ptr(a);
32289         a_conv.is_owned = ptr_is_owned(a);
32290         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32291         a_conv = RawBolt11Invoice_clone(&a_conv);
32292         LDKThirtyTwoBytes b_ref;
32293         CHECK(b->arr_len == 32);
32294         memcpy(b_ref.data, b->elems, 32); FREE(b);
32295         LDKBolt11InvoiceSignature c_conv;
32296         c_conv.inner = untag_ptr(c);
32297         c_conv.is_owned = ptr_is_owned(c);
32298         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
32299         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
32300         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32301         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
32302         return tag_ptr(ret_conv, true);
32303 }
32304
32305 void  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(uint64_t _res) {
32306         if (!ptr_is_owned(_res)) return;
32307         void* _res_ptr = untag_ptr(_res);
32308         CHECK_ACCESS(_res_ptr);
32309         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
32310         FREE(untag_ptr(_res));
32311         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
32312 }
32313
32314 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_ok(uint64_t o) {
32315         LDKPayeePubKey o_conv;
32316         o_conv.inner = untag_ptr(o);
32317         o_conv.is_owned = ptr_is_owned(o);
32318         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32319         o_conv = PayeePubKey_clone(&o_conv);
32320         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32321         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
32322         return tag_ptr(ret_conv, true);
32323 }
32324
32325 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_err(uint32_t e) {
32326         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
32327         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32328         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
32329         return tag_ptr(ret_conv, true);
32330 }
32331
32332 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(uint64_t o) {
32333         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
32334         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
32335         return ret_conv;
32336 }
32337
32338 void  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_free"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_free(uint64_t _res) {
32339         if (!ptr_is_owned(_res)) return;
32340         void* _res_ptr = untag_ptr(_res);
32341         CHECK_ACCESS(_res_ptr);
32342         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
32343         FREE(untag_ptr(_res));
32344         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
32345 }
32346
32347 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
32348         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32349         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
32350         return tag_ptr(ret_conv, true);
32351 }
32352 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
32353         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
32354         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
32355         return ret_conv;
32356 }
32357
32358 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone(uint64_t orig) {
32359         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
32360         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32361         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
32362         return tag_ptr(ret_conv, true);
32363 }
32364
32365 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
32366         LDKCVec_PrivateRouteZ _res_constr;
32367         _res_constr.datalen = _res->arr_len;
32368         if (_res_constr.datalen > 0)
32369                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
32370         else
32371                 _res_constr.data = NULL;
32372         uint64_t* _res_vals = _res->elems;
32373         for (size_t o = 0; o < _res_constr.datalen; o++) {
32374                 uint64_t _res_conv_14 = _res_vals[o];
32375                 LDKPrivateRoute _res_conv_14_conv;
32376                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
32377                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
32378                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
32379                 _res_constr.data[o] = _res_conv_14_conv;
32380         }
32381         FREE(_res);
32382         CVec_PrivateRouteZ_free(_res_constr);
32383 }
32384
32385 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
32386         LDKPositiveTimestamp o_conv;
32387         o_conv.inner = untag_ptr(o);
32388         o_conv.is_owned = ptr_is_owned(o);
32389         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32390         o_conv = PositiveTimestamp_clone(&o_conv);
32391         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32392         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
32393         return tag_ptr(ret_conv, true);
32394 }
32395
32396 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
32397         LDKCreationError e_conv = LDKCreationError_from_js(e);
32398         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32399         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
32400         return tag_ptr(ret_conv, true);
32401 }
32402
32403 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
32404         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
32405         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
32406         return ret_conv;
32407 }
32408
32409 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
32410         if (!ptr_is_owned(_res)) return;
32411         void* _res_ptr = untag_ptr(_res);
32412         CHECK_ACCESS(_res_ptr);
32413         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
32414         FREE(untag_ptr(_res));
32415         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
32416 }
32417
32418 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
32419         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32420         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
32421         return tag_ptr(ret_conv, true);
32422 }
32423 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
32424         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
32425         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
32426         return ret_conv;
32427 }
32428
32429 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
32430         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
32431         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32432         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
32433         return tag_ptr(ret_conv, true);
32434 }
32435
32436 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_ok() {
32437         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32438         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
32439         return tag_ptr(ret_conv, true);
32440 }
32441
32442 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_err"))) TS_CResult_NoneBolt11SemanticErrorZ_err(uint32_t e) {
32443         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
32444         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32445         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
32446         return tag_ptr(ret_conv, true);
32447 }
32448
32449 jboolean  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_is_ok(uint64_t o) {
32450         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
32451         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
32452         return ret_conv;
32453 }
32454
32455 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_free"))) TS_CResult_NoneBolt11SemanticErrorZ_free(uint64_t _res) {
32456         if (!ptr_is_owned(_res)) return;
32457         void* _res_ptr = untag_ptr(_res);
32458         CHECK_ACCESS(_res_ptr);
32459         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
32460         FREE(untag_ptr(_res));
32461         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
32462 }
32463
32464 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
32465         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32466         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
32467         return tag_ptr(ret_conv, true);
32468 }
32469 int64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
32470         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
32471         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
32472         return ret_conv;
32473 }
32474
32475 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone"))) TS_CResult_NoneBolt11SemanticErrorZ_clone(uint64_t orig) {
32476         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
32477         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32478         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
32479         return tag_ptr(ret_conv, true);
32480 }
32481
32482 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(uint64_t o) {
32483         LDKBolt11Invoice o_conv;
32484         o_conv.inner = untag_ptr(o);
32485         o_conv.is_owned = ptr_is_owned(o);
32486         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32487         o_conv = Bolt11Invoice_clone(&o_conv);
32488         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32489         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
32490         return tag_ptr(ret_conv, true);
32491 }
32492
32493 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(uint32_t e) {
32494         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
32495         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32496         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
32497         return tag_ptr(ret_conv, true);
32498 }
32499
32500 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(uint64_t o) {
32501         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
32502         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
32503         return ret_conv;
32504 }
32505
32506 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(uint64_t _res) {
32507         if (!ptr_is_owned(_res)) return;
32508         void* _res_ptr = untag_ptr(_res);
32509         CHECK_ACCESS(_res_ptr);
32510         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
32511         FREE(untag_ptr(_res));
32512         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
32513 }
32514
32515 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
32516         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32517         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
32518         return tag_ptr(ret_conv, true);
32519 }
32520 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
32521         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
32522         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
32523         return ret_conv;
32524 }
32525
32526 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(uint64_t orig) {
32527         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
32528         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32529         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
32530         return tag_ptr(ret_conv, true);
32531 }
32532
32533 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
32534         LDKDescription o_conv;
32535         o_conv.inner = untag_ptr(o);
32536         o_conv.is_owned = ptr_is_owned(o);
32537         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32538         o_conv = Description_clone(&o_conv);
32539         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32540         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
32541         return tag_ptr(ret_conv, true);
32542 }
32543
32544 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
32545         LDKCreationError e_conv = LDKCreationError_from_js(e);
32546         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32547         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
32548         return tag_ptr(ret_conv, true);
32549 }
32550
32551 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
32552         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
32553         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
32554         return ret_conv;
32555 }
32556
32557 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
32558         if (!ptr_is_owned(_res)) return;
32559         void* _res_ptr = untag_ptr(_res);
32560         CHECK_ACCESS(_res_ptr);
32561         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
32562         FREE(untag_ptr(_res));
32563         CResult_DescriptionCreationErrorZ_free(_res_conv);
32564 }
32565
32566 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
32567         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32568         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
32569         return tag_ptr(ret_conv, true);
32570 }
32571 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
32572         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
32573         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
32574         return ret_conv;
32575 }
32576
32577 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
32578         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
32579         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32580         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
32581         return tag_ptr(ret_conv, true);
32582 }
32583
32584 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
32585         LDKPrivateRoute o_conv;
32586         o_conv.inner = untag_ptr(o);
32587         o_conv.is_owned = ptr_is_owned(o);
32588         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32589         o_conv = PrivateRoute_clone(&o_conv);
32590         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32591         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
32592         return tag_ptr(ret_conv, true);
32593 }
32594
32595 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
32596         LDKCreationError e_conv = LDKCreationError_from_js(e);
32597         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32598         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
32599         return tag_ptr(ret_conv, true);
32600 }
32601
32602 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
32603         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
32604         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
32605         return ret_conv;
32606 }
32607
32608 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
32609         if (!ptr_is_owned(_res)) return;
32610         void* _res_ptr = untag_ptr(_res);
32611         CHECK_ACCESS(_res_ptr);
32612         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
32613         FREE(untag_ptr(_res));
32614         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
32615 }
32616
32617 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
32618         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32619         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
32620         return tag_ptr(ret_conv, true);
32621 }
32622 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
32623         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
32624         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
32625         return ret_conv;
32626 }
32627
32628 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
32629         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
32630         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32631         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
32632         return tag_ptr(ret_conv, true);
32633 }
32634
32635 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
32636         LDKOutPoint o_conv;
32637         o_conv.inner = untag_ptr(o);
32638         o_conv.is_owned = ptr_is_owned(o);
32639         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32640         o_conv = OutPoint_clone(&o_conv);
32641         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
32642         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
32643         return tag_ptr(ret_conv, true);
32644 }
32645
32646 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
32647         void* e_ptr = untag_ptr(e);
32648         CHECK_ACCESS(e_ptr);
32649         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32650         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32651         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
32652         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
32653         return tag_ptr(ret_conv, true);
32654 }
32655
32656 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
32657         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
32658         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
32659         return ret_conv;
32660 }
32661
32662 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
32663         if (!ptr_is_owned(_res)) return;
32664         void* _res_ptr = untag_ptr(_res);
32665         CHECK_ACCESS(_res_ptr);
32666         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
32667         FREE(untag_ptr(_res));
32668         CResult_OutPointDecodeErrorZ_free(_res_conv);
32669 }
32670
32671 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
32672         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
32673         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
32674         return tag_ptr(ret_conv, true);
32675 }
32676 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
32677         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
32678         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
32679         return ret_conv;
32680 }
32681
32682 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
32683         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
32684         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
32685         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
32686         return tag_ptr(ret_conv, true);
32687 }
32688
32689 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_ok"))) TS_CResult_BigSizeDecodeErrorZ_ok(uint64_t o) {
32690         LDKBigSize o_conv;
32691         o_conv.inner = untag_ptr(o);
32692         o_conv.is_owned = ptr_is_owned(o);
32693         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32694         o_conv = BigSize_clone(&o_conv);
32695         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32696         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
32697         return tag_ptr(ret_conv, true);
32698 }
32699
32700 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_err"))) TS_CResult_BigSizeDecodeErrorZ_err(uint64_t e) {
32701         void* e_ptr = untag_ptr(e);
32702         CHECK_ACCESS(e_ptr);
32703         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32704         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32705         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32706         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
32707         return tag_ptr(ret_conv, true);
32708 }
32709
32710 jboolean  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_is_ok"))) TS_CResult_BigSizeDecodeErrorZ_is_ok(uint64_t o) {
32711         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
32712         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
32713         return ret_conv;
32714 }
32715
32716 void  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_free"))) TS_CResult_BigSizeDecodeErrorZ_free(uint64_t _res) {
32717         if (!ptr_is_owned(_res)) return;
32718         void* _res_ptr = untag_ptr(_res);
32719         CHECK_ACCESS(_res_ptr);
32720         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
32721         FREE(untag_ptr(_res));
32722         CResult_BigSizeDecodeErrorZ_free(_res_conv);
32723 }
32724
32725 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
32726         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32727         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
32728         return tag_ptr(ret_conv, true);
32729 }
32730 int64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone_ptr"))) TS_CResult_BigSizeDecodeErrorZ_clone_ptr(uint64_t arg) {
32731         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
32732         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
32733         return ret_conv;
32734 }
32735
32736 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone"))) TS_CResult_BigSizeDecodeErrorZ_clone(uint64_t orig) {
32737         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
32738         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32739         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
32740         return tag_ptr(ret_conv, true);
32741 }
32742
32743 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_ok"))) TS_CResult_HostnameDecodeErrorZ_ok(uint64_t o) {
32744         LDKHostname o_conv;
32745         o_conv.inner = untag_ptr(o);
32746         o_conv.is_owned = ptr_is_owned(o);
32747         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32748         o_conv = Hostname_clone(&o_conv);
32749         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32750         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
32751         return tag_ptr(ret_conv, true);
32752 }
32753
32754 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_err"))) TS_CResult_HostnameDecodeErrorZ_err(uint64_t e) {
32755         void* e_ptr = untag_ptr(e);
32756         CHECK_ACCESS(e_ptr);
32757         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32758         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32759         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32760         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
32761         return tag_ptr(ret_conv, true);
32762 }
32763
32764 jboolean  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_is_ok"))) TS_CResult_HostnameDecodeErrorZ_is_ok(uint64_t o) {
32765         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
32766         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
32767         return ret_conv;
32768 }
32769
32770 void  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_free"))) TS_CResult_HostnameDecodeErrorZ_free(uint64_t _res) {
32771         if (!ptr_is_owned(_res)) return;
32772         void* _res_ptr = untag_ptr(_res);
32773         CHECK_ACCESS(_res_ptr);
32774         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
32775         FREE(untag_ptr(_res));
32776         CResult_HostnameDecodeErrorZ_free(_res_conv);
32777 }
32778
32779 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
32780         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32781         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
32782         return tag_ptr(ret_conv, true);
32783 }
32784 int64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone_ptr"))) TS_CResult_HostnameDecodeErrorZ_clone_ptr(uint64_t arg) {
32785         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
32786         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
32787         return ret_conv;
32788 }
32789
32790 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone"))) TS_CResult_HostnameDecodeErrorZ_clone(uint64_t orig) {
32791         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
32792         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32793         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
32794         return tag_ptr(ret_conv, true);
32795 }
32796
32797 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_ok(uint64_t o) {
32798         LDKTransactionU16LenLimited o_conv;
32799         o_conv.inner = untag_ptr(o);
32800         o_conv.is_owned = ptr_is_owned(o);
32801         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32802         o_conv = TransactionU16LenLimited_clone(&o_conv);
32803         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32804         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
32805         return tag_ptr(ret_conv, true);
32806 }
32807
32808 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_err() {
32809         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32810         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
32811         return tag_ptr(ret_conv, true);
32812 }
32813
32814 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_is_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_is_ok(uint64_t o) {
32815         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
32816         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
32817         return ret_conv;
32818 }
32819
32820 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_free"))) TS_CResult_TransactionU16LenLimitedNoneZ_free(uint64_t _res) {
32821         if (!ptr_is_owned(_res)) return;
32822         void* _res_ptr = untag_ptr(_res);
32823         CHECK_ACCESS(_res_ptr);
32824         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
32825         FREE(untag_ptr(_res));
32826         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
32827 }
32828
32829 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
32830         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32831         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
32832         return tag_ptr(ret_conv, true);
32833 }
32834 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(uint64_t arg) {
32835         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
32836         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
32837         return ret_conv;
32838 }
32839
32840 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone(uint64_t orig) {
32841         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
32842         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32843         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
32844         return tag_ptr(ret_conv, true);
32845 }
32846
32847 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(uint64_t o) {
32848         LDKTransactionU16LenLimited o_conv;
32849         o_conv.inner = untag_ptr(o);
32850         o_conv.is_owned = ptr_is_owned(o);
32851         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32852         o_conv = TransactionU16LenLimited_clone(&o_conv);
32853         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32854         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
32855         return tag_ptr(ret_conv, true);
32856 }
32857
32858 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err(uint64_t e) {
32859         void* e_ptr = untag_ptr(e);
32860         CHECK_ACCESS(e_ptr);
32861         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32862         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32863         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32864         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
32865         return tag_ptr(ret_conv, true);
32866 }
32867
32868 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(uint64_t o) {
32869         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
32870         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
32871         return ret_conv;
32872 }
32873
32874 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free(uint64_t _res) {
32875         if (!ptr_is_owned(_res)) return;
32876         void* _res_ptr = untag_ptr(_res);
32877         CHECK_ACCESS(_res_ptr);
32878         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
32879         FREE(untag_ptr(_res));
32880         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
32881 }
32882
32883 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
32884         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32885         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
32886         return tag_ptr(ret_conv, true);
32887 }
32888 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(uint64_t arg) {
32889         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
32890         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
32891         return ret_conv;
32892 }
32893
32894 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(uint64_t orig) {
32895         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
32896         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32897         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
32898         return tag_ptr(ret_conv, true);
32899 }
32900
32901 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
32902         LDKUntrustedString o_conv;
32903         o_conv.inner = untag_ptr(o);
32904         o_conv.is_owned = ptr_is_owned(o);
32905         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32906         o_conv = UntrustedString_clone(&o_conv);
32907         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
32908         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
32909         return tag_ptr(ret_conv, true);
32910 }
32911
32912 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
32913         void* e_ptr = untag_ptr(e);
32914         CHECK_ACCESS(e_ptr);
32915         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32916         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32917         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
32918         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
32919         return tag_ptr(ret_conv, true);
32920 }
32921
32922 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
32923         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
32924         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
32925         return ret_conv;
32926 }
32927
32928 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
32929         if (!ptr_is_owned(_res)) return;
32930         void* _res_ptr = untag_ptr(_res);
32931         CHECK_ACCESS(_res_ptr);
32932         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
32933         FREE(untag_ptr(_res));
32934         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
32935 }
32936
32937 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
32938         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
32939         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
32940         return tag_ptr(ret_conv, true);
32941 }
32942 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
32943         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
32944         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
32945         return ret_conv;
32946 }
32947
32948 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
32949         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
32950         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
32951         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
32952         return tag_ptr(ret_conv, true);
32953 }
32954
32955 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_ok"))) TS_CResult_ChannelIdDecodeErrorZ_ok(uint64_t o) {
32956         LDKChannelId o_conv;
32957         o_conv.inner = untag_ptr(o);
32958         o_conv.is_owned = ptr_is_owned(o);
32959         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32960         o_conv = ChannelId_clone(&o_conv);
32961         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
32962         *ret_conv = CResult_ChannelIdDecodeErrorZ_ok(o_conv);
32963         return tag_ptr(ret_conv, true);
32964 }
32965
32966 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_err"))) TS_CResult_ChannelIdDecodeErrorZ_err(uint64_t e) {
32967         void* e_ptr = untag_ptr(e);
32968         CHECK_ACCESS(e_ptr);
32969         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32970         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32971         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
32972         *ret_conv = CResult_ChannelIdDecodeErrorZ_err(e_conv);
32973         return tag_ptr(ret_conv, true);
32974 }
32975
32976 jboolean  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_is_ok"))) TS_CResult_ChannelIdDecodeErrorZ_is_ok(uint64_t o) {
32977         LDKCResult_ChannelIdDecodeErrorZ* o_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(o);
32978         jboolean ret_conv = CResult_ChannelIdDecodeErrorZ_is_ok(o_conv);
32979         return ret_conv;
32980 }
32981
32982 void  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_free"))) TS_CResult_ChannelIdDecodeErrorZ_free(uint64_t _res) {
32983         if (!ptr_is_owned(_res)) return;
32984         void* _res_ptr = untag_ptr(_res);
32985         CHECK_ACCESS(_res_ptr);
32986         LDKCResult_ChannelIdDecodeErrorZ _res_conv = *(LDKCResult_ChannelIdDecodeErrorZ*)(_res_ptr);
32987         FREE(untag_ptr(_res));
32988         CResult_ChannelIdDecodeErrorZ_free(_res_conv);
32989 }
32990
32991 static inline uint64_t CResult_ChannelIdDecodeErrorZ_clone_ptr(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR arg) {
32992         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
32993         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(arg);
32994         return tag_ptr(ret_conv, true);
32995 }
32996 int64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelIdDecodeErrorZ_clone_ptr(uint64_t arg) {
32997         LDKCResult_ChannelIdDecodeErrorZ* arg_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(arg);
32998         int64_t ret_conv = CResult_ChannelIdDecodeErrorZ_clone_ptr(arg_conv);
32999         return ret_conv;
33000 }
33001
33002 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_clone"))) TS_CResult_ChannelIdDecodeErrorZ_clone(uint64_t orig) {
33003         LDKCResult_ChannelIdDecodeErrorZ* orig_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(orig);
33004         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33005         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(orig_conv);
33006         return tag_ptr(ret_conv, true);
33007 }
33008
33009 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
33010         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33011         *ret_conv = C2Tuple__u832u16Z_clone(arg);
33012         return tag_ptr(ret_conv, true);
33013 }
33014 int64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_clone_ptr"))) TS_C2Tuple__u832u16Z_clone_ptr(uint64_t arg) {
33015         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
33016         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
33017         return ret_conv;
33018 }
33019
33020 uint64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_clone"))) TS_C2Tuple__u832u16Z_clone(uint64_t orig) {
33021         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
33022         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33023         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
33024         return tag_ptr(ret_conv, true);
33025 }
33026
33027 uint64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_new"))) TS_C2Tuple__u832u16Z_new(int8_tArray a, int16_t b) {
33028         LDKThirtyTwoBytes a_ref;
33029         CHECK(a->arr_len == 32);
33030         memcpy(a_ref.data, a->elems, 32); FREE(a);
33031         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33032         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
33033         return tag_ptr(ret_conv, true);
33034 }
33035
33036 void  __attribute__((export_name("TS_C2Tuple__u832u16Z_free"))) TS_C2Tuple__u832u16Z_free(uint64_t _res) {
33037         if (!ptr_is_owned(_res)) return;
33038         void* _res_ptr = untag_ptr(_res);
33039         CHECK_ACCESS(_res_ptr);
33040         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
33041         FREE(untag_ptr(_res));
33042         C2Tuple__u832u16Z_free(_res_conv);
33043 }
33044
33045 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_ok(uint64_t o) {
33046         LDKPaymentRelay o_conv;
33047         o_conv.inner = untag_ptr(o);
33048         o_conv.is_owned = ptr_is_owned(o);
33049         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33050         o_conv = PaymentRelay_clone(&o_conv);
33051         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33052         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
33053         return tag_ptr(ret_conv, true);
33054 }
33055
33056 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_err"))) TS_CResult_PaymentRelayDecodeErrorZ_err(uint64_t e) {
33057         void* e_ptr = untag_ptr(e);
33058         CHECK_ACCESS(e_ptr);
33059         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33060         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33061         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33062         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
33063         return tag_ptr(ret_conv, true);
33064 }
33065
33066 jboolean  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_is_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_is_ok(uint64_t o) {
33067         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
33068         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
33069         return ret_conv;
33070 }
33071
33072 void  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_free"))) TS_CResult_PaymentRelayDecodeErrorZ_free(uint64_t _res) {
33073         if (!ptr_is_owned(_res)) return;
33074         void* _res_ptr = untag_ptr(_res);
33075         CHECK_ACCESS(_res_ptr);
33076         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
33077         FREE(untag_ptr(_res));
33078         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
33079 }
33080
33081 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
33082         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33083         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
33084         return tag_ptr(ret_conv, true);
33085 }
33086 int64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr(uint64_t arg) {
33087         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
33088         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
33089         return ret_conv;
33090 }
33091
33092 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone"))) TS_CResult_PaymentRelayDecodeErrorZ_clone(uint64_t orig) {
33093         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
33094         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33095         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
33096         return tag_ptr(ret_conv, true);
33097 }
33098
33099 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_ok(uint64_t o) {
33100         LDKPaymentConstraints o_conv;
33101         o_conv.inner = untag_ptr(o);
33102         o_conv.is_owned = ptr_is_owned(o);
33103         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33104         o_conv = PaymentConstraints_clone(&o_conv);
33105         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33106         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
33107         return tag_ptr(ret_conv, true);
33108 }
33109
33110 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_err(uint64_t e) {
33111         void* e_ptr = untag_ptr(e);
33112         CHECK_ACCESS(e_ptr);
33113         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33114         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33115         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33116         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
33117         return tag_ptr(ret_conv, true);
33118 }
33119
33120 jboolean  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok(uint64_t o) {
33121         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
33122         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
33123         return ret_conv;
33124 }
33125
33126 void  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_free"))) TS_CResult_PaymentConstraintsDecodeErrorZ_free(uint64_t _res) {
33127         if (!ptr_is_owned(_res)) return;
33128         void* _res_ptr = untag_ptr(_res);
33129         CHECK_ACCESS(_res_ptr);
33130         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
33131         FREE(untag_ptr(_res));
33132         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
33133 }
33134
33135 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
33136         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33137         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
33138         return tag_ptr(ret_conv, true);
33139 }
33140 int64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(uint64_t arg) {
33141         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
33142         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
33143         return ret_conv;
33144 }
33145
33146 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone(uint64_t orig) {
33147         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
33148         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33149         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
33150         return tag_ptr(ret_conv, true);
33151 }
33152
33153 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_ok"))) TS_CResult_PaymentContextDecodeErrorZ_ok(uint64_t o) {
33154         void* o_ptr = untag_ptr(o);
33155         CHECK_ACCESS(o_ptr);
33156         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
33157         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
33158         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33159         *ret_conv = CResult_PaymentContextDecodeErrorZ_ok(o_conv);
33160         return tag_ptr(ret_conv, true);
33161 }
33162
33163 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_err"))) TS_CResult_PaymentContextDecodeErrorZ_err(uint64_t e) {
33164         void* e_ptr = untag_ptr(e);
33165         CHECK_ACCESS(e_ptr);
33166         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33167         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33168         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33169         *ret_conv = CResult_PaymentContextDecodeErrorZ_err(e_conv);
33170         return tag_ptr(ret_conv, true);
33171 }
33172
33173 jboolean  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_is_ok"))) TS_CResult_PaymentContextDecodeErrorZ_is_ok(uint64_t o) {
33174         LDKCResult_PaymentContextDecodeErrorZ* o_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(o);
33175         jboolean ret_conv = CResult_PaymentContextDecodeErrorZ_is_ok(o_conv);
33176         return ret_conv;
33177 }
33178
33179 void  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_free"))) TS_CResult_PaymentContextDecodeErrorZ_free(uint64_t _res) {
33180         if (!ptr_is_owned(_res)) return;
33181         void* _res_ptr = untag_ptr(_res);
33182         CHECK_ACCESS(_res_ptr);
33183         LDKCResult_PaymentContextDecodeErrorZ _res_conv = *(LDKCResult_PaymentContextDecodeErrorZ*)(_res_ptr);
33184         FREE(untag_ptr(_res));
33185         CResult_PaymentContextDecodeErrorZ_free(_res_conv);
33186 }
33187
33188 static inline uint64_t CResult_PaymentContextDecodeErrorZ_clone_ptr(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR arg) {
33189         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33190         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(arg);
33191         return tag_ptr(ret_conv, true);
33192 }
33193 int64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentContextDecodeErrorZ_clone_ptr(uint64_t arg) {
33194         LDKCResult_PaymentContextDecodeErrorZ* arg_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(arg);
33195         int64_t ret_conv = CResult_PaymentContextDecodeErrorZ_clone_ptr(arg_conv);
33196         return ret_conv;
33197 }
33198
33199 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_clone"))) TS_CResult_PaymentContextDecodeErrorZ_clone(uint64_t orig) {
33200         LDKCResult_PaymentContextDecodeErrorZ* orig_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(orig);
33201         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33202         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(orig_conv);
33203         return tag_ptr(ret_conv, true);
33204 }
33205
33206 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_ok"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_ok(uint64_t o) {
33207         LDKUnknownPaymentContext o_conv;
33208         o_conv.inner = untag_ptr(o);
33209         o_conv.is_owned = ptr_is_owned(o);
33210         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33211         o_conv = UnknownPaymentContext_clone(&o_conv);
33212         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33213         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_ok(o_conv);
33214         return tag_ptr(ret_conv, true);
33215 }
33216
33217 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_err"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_err(uint64_t e) {
33218         void* e_ptr = untag_ptr(e);
33219         CHECK_ACCESS(e_ptr);
33220         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33221         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33222         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33223         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_err(e_conv);
33224         return tag_ptr(ret_conv, true);
33225 }
33226
33227 jboolean  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_is_ok"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_is_ok(uint64_t o) {
33228         LDKCResult_UnknownPaymentContextDecodeErrorZ* o_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(o);
33229         jboolean ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o_conv);
33230         return ret_conv;
33231 }
33232
33233 void  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_free"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_free(uint64_t _res) {
33234         if (!ptr_is_owned(_res)) return;
33235         void* _res_ptr = untag_ptr(_res);
33236         CHECK_ACCESS(_res_ptr);
33237         LDKCResult_UnknownPaymentContextDecodeErrorZ _res_conv = *(LDKCResult_UnknownPaymentContextDecodeErrorZ*)(_res_ptr);
33238         FREE(untag_ptr(_res));
33239         CResult_UnknownPaymentContextDecodeErrorZ_free(_res_conv);
33240 }
33241
33242 static inline uint64_t CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR arg) {
33243         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33244         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(arg);
33245         return tag_ptr(ret_conv, true);
33246 }
33247 int64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(uint64_t arg) {
33248         LDKCResult_UnknownPaymentContextDecodeErrorZ* arg_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(arg);
33249         int64_t ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(arg_conv);
33250         return ret_conv;
33251 }
33252
33253 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_clone"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_clone(uint64_t orig) {
33254         LDKCResult_UnknownPaymentContextDecodeErrorZ* orig_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(orig);
33255         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33256         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(orig_conv);
33257         return tag_ptr(ret_conv, true);
33258 }
33259
33260 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_ok"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_ok(uint64_t o) {
33261         LDKBolt12OfferContext o_conv;
33262         o_conv.inner = untag_ptr(o);
33263         o_conv.is_owned = ptr_is_owned(o);
33264         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33265         o_conv = Bolt12OfferContext_clone(&o_conv);
33266         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33267         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_ok(o_conv);
33268         return tag_ptr(ret_conv, true);
33269 }
33270
33271 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_err"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_err(uint64_t e) {
33272         void* e_ptr = untag_ptr(e);
33273         CHECK_ACCESS(e_ptr);
33274         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33275         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33276         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33277         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_err(e_conv);
33278         return tag_ptr(ret_conv, true);
33279 }
33280
33281 jboolean  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_is_ok"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_is_ok(uint64_t o) {
33282         LDKCResult_Bolt12OfferContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(o);
33283         jboolean ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o_conv);
33284         return ret_conv;
33285 }
33286
33287 void  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_free"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_free(uint64_t _res) {
33288         if (!ptr_is_owned(_res)) return;
33289         void* _res_ptr = untag_ptr(_res);
33290         CHECK_ACCESS(_res_ptr);
33291         LDKCResult_Bolt12OfferContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12OfferContextDecodeErrorZ*)(_res_ptr);
33292         FREE(untag_ptr(_res));
33293         CResult_Bolt12OfferContextDecodeErrorZ_free(_res_conv);
33294 }
33295
33296 static inline uint64_t CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR arg) {
33297         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33298         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(arg);
33299         return tag_ptr(ret_conv, true);
33300 }
33301 int64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(uint64_t arg) {
33302         LDKCResult_Bolt12OfferContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(arg);
33303         int64_t ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(arg_conv);
33304         return ret_conv;
33305 }
33306
33307 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_clone"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_clone(uint64_t orig) {
33308         LDKCResult_Bolt12OfferContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(orig);
33309         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33310         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(orig_conv);
33311         return tag_ptr(ret_conv, true);
33312 }
33313
33314 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_ok"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_ok(uint64_t o) {
33315         LDKBolt12RefundContext o_conv;
33316         o_conv.inner = untag_ptr(o);
33317         o_conv.is_owned = ptr_is_owned(o);
33318         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33319         o_conv = Bolt12RefundContext_clone(&o_conv);
33320         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33321         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_ok(o_conv);
33322         return tag_ptr(ret_conv, true);
33323 }
33324
33325 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_err"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_err(uint64_t e) {
33326         void* e_ptr = untag_ptr(e);
33327         CHECK_ACCESS(e_ptr);
33328         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33329         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33330         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33331         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_err(e_conv);
33332         return tag_ptr(ret_conv, true);
33333 }
33334
33335 jboolean  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_is_ok"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_is_ok(uint64_t o) {
33336         LDKCResult_Bolt12RefundContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(o);
33337         jboolean ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o_conv);
33338         return ret_conv;
33339 }
33340
33341 void  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_free"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_free(uint64_t _res) {
33342         if (!ptr_is_owned(_res)) return;
33343         void* _res_ptr = untag_ptr(_res);
33344         CHECK_ACCESS(_res_ptr);
33345         LDKCResult_Bolt12RefundContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12RefundContextDecodeErrorZ*)(_res_ptr);
33346         FREE(untag_ptr(_res));
33347         CResult_Bolt12RefundContextDecodeErrorZ_free(_res_conv);
33348 }
33349
33350 static inline uint64_t CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR arg) {
33351         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33352         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(arg);
33353         return tag_ptr(ret_conv, true);
33354 }
33355 int64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(uint64_t arg) {
33356         LDKCResult_Bolt12RefundContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(arg);
33357         int64_t ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(arg_conv);
33358         return ret_conv;
33359 }
33360
33361 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_clone"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_clone(uint64_t orig) {
33362         LDKCResult_Bolt12RefundContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(orig);
33363         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33364         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(orig_conv);
33365         return tag_ptr(ret_conv, true);
33366 }
33367
33368 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_ok"))) TS_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
33369         LDKStr o_conv = str_ref_to_owned_c(o);
33370         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33371         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
33372         return tag_ptr(ret_conv, true);
33373 }
33374
33375 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_err"))) TS_CResult_StrSecp256k1ErrorZ_err(uint32_t e) {
33376         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
33377         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33378         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
33379         return tag_ptr(ret_conv, true);
33380 }
33381
33382 jboolean  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_is_ok"))) TS_CResult_StrSecp256k1ErrorZ_is_ok(uint64_t o) {
33383         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
33384         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
33385         return ret_conv;
33386 }
33387
33388 void  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_free"))) TS_CResult_StrSecp256k1ErrorZ_free(uint64_t _res) {
33389         if (!ptr_is_owned(_res)) return;
33390         void* _res_ptr = untag_ptr(_res);
33391         CHECK_ACCESS(_res_ptr);
33392         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
33393         FREE(untag_ptr(_res));
33394         CResult_StrSecp256k1ErrorZ_free(_res_conv);
33395 }
33396
33397 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
33398         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33399         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
33400         return tag_ptr(ret_conv, true);
33401 }
33402 int64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone_ptr"))) TS_CResult_StrSecp256k1ErrorZ_clone_ptr(uint64_t arg) {
33403         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
33404         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
33405         return ret_conv;
33406 }
33407
33408 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone"))) TS_CResult_StrSecp256k1ErrorZ_clone(uint64_t orig) {
33409         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
33410         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33411         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
33412         return tag_ptr(ret_conv, true);
33413 }
33414
33415 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
33416         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
33417         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
33418         return tag_ptr(ret_conv, true);
33419 }
33420 int64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(uint64_t arg) {
33421         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
33422         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
33423         return ret_conv;
33424 }
33425
33426 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(uint64_t orig) {
33427         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
33428         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
33429         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
33430         return tag_ptr(ret_conv, true);
33431 }
33432
33433 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(int8_tArray a, uint64_t b, uint64_t c) {
33434         LDKThirtyTwoBytes a_ref;
33435         CHECK(a->arr_len == 32);
33436         memcpy(a_ref.data, a->elems, 32); FREE(a);
33437         LDKRecipientOnionFields b_conv;
33438         b_conv.inner = untag_ptr(b);
33439         b_conv.is_owned = ptr_is_owned(b);
33440         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33441         b_conv = RecipientOnionFields_clone(&b_conv);
33442         LDKRouteParameters c_conv;
33443         c_conv.inner = untag_ptr(c);
33444         c_conv.is_owned = ptr_is_owned(c);
33445         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
33446         c_conv = RouteParameters_clone(&c_conv);
33447         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
33448         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
33449         return tag_ptr(ret_conv, true);
33450 }
33451
33452 void  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(uint64_t _res) {
33453         if (!ptr_is_owned(_res)) return;
33454         void* _res_ptr = untag_ptr(_res);
33455         CHECK_ACCESS(_res_ptr);
33456         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
33457         FREE(untag_ptr(_res));
33458         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
33459 }
33460
33461 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(uint64_t o) {
33462         void* o_ptr = untag_ptr(o);
33463         CHECK_ACCESS(o_ptr);
33464         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
33465         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
33466         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33467         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
33468         return tag_ptr(ret_conv, true);
33469 }
33470
33471 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() {
33472         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33473         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
33474         return tag_ptr(ret_conv, true);
33475 }
33476
33477 jboolean  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(uint64_t o) {
33478         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
33479         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
33480         return ret_conv;
33481 }
33482
33483 void  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(uint64_t _res) {
33484         if (!ptr_is_owned(_res)) return;
33485         void* _res_ptr = untag_ptr(_res);
33486         CHECK_ACCESS(_res_ptr);
33487         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
33488         FREE(untag_ptr(_res));
33489         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
33490 }
33491
33492 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
33493         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33494         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
33495         return tag_ptr(ret_conv, true);
33496 }
33497 int64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(uint64_t arg) {
33498         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
33499         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
33500         return ret_conv;
33501 }
33502
33503 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(uint64_t orig) {
33504         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
33505         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33506         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
33507         return tag_ptr(ret_conv, true);
33508 }
33509
33510 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
33511         void* o_ptr = untag_ptr(o);
33512         CHECK_ACCESS(o_ptr);
33513         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
33514         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
33515         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33516         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
33517         return tag_ptr(ret_conv, true);
33518 }
33519
33520 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
33521         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
33522         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33523         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
33524         return tag_ptr(ret_conv, true);
33525 }
33526
33527 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
33528         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
33529         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
33530         return ret_conv;
33531 }
33532
33533 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
33534         if (!ptr_is_owned(_res)) return;
33535         void* _res_ptr = untag_ptr(_res);
33536         CHECK_ACCESS(_res_ptr);
33537         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
33538         FREE(untag_ptr(_res));
33539         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
33540 }
33541
33542 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
33543         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33544         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
33545         return tag_ptr(ret_conv, true);
33546 }
33547 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
33548         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
33549         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
33550         return ret_conv;
33551 }
33552
33553 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
33554         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
33555         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33556         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
33557         return tag_ptr(ret_conv, true);
33558 }
33559
33560 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
33561         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
33562         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
33563         return tag_ptr(ret_conv, true);
33564 }
33565 int64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(uint64_t arg) {
33566         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
33567         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
33568         return ret_conv;
33569 }
33570
33571 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(uint64_t orig) {
33572         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
33573         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
33574         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
33575         return tag_ptr(ret_conv, true);
33576 }
33577
33578 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) {
33579         LDKPublicKey a_ref;
33580         CHECK(a->arr_len == 33);
33581         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
33582         LDKOnionMessage b_conv;
33583         b_conv.inner = untag_ptr(b);
33584         b_conv.is_owned = ptr_is_owned(b);
33585         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33586         b_conv = OnionMessage_clone(&b_conv);
33587         void* c_ptr = untag_ptr(c);
33588         CHECK_ACCESS(c_ptr);
33589         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
33590         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
33591         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
33592         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
33593         return tag_ptr(ret_conv, true);
33594 }
33595
33596 void  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(uint64_t _res) {
33597         if (!ptr_is_owned(_res)) return;
33598         void* _res_ptr = untag_ptr(_res);
33599         CHECK_ACCESS(_res_ptr);
33600         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
33601         FREE(untag_ptr(_res));
33602         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
33603 }
33604
33605 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(uint64_t o) {
33606         void* o_ptr = untag_ptr(o);
33607         CHECK_ACCESS(o_ptr);
33608         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
33609         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
33610         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
33611         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
33612         return tag_ptr(ret_conv, true);
33613 }
33614
33615 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(uint64_t e) {
33616         void* e_ptr = untag_ptr(e);
33617         CHECK_ACCESS(e_ptr);
33618         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
33619         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
33620         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
33621         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
33622         return tag_ptr(ret_conv, true);
33623 }
33624
33625 jboolean  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(uint64_t o) {
33626         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
33627         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
33628         return ret_conv;
33629 }
33630
33631 void  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(uint64_t _res) {
33632         if (!ptr_is_owned(_res)) return;
33633         void* _res_ptr = untag_ptr(_res);
33634         CHECK_ACCESS(_res_ptr);
33635         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
33636         FREE(untag_ptr(_res));
33637         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
33638 }
33639
33640 static inline uint64_t CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR arg) {
33641         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
33642         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(arg);
33643         return tag_ptr(ret_conv, true);
33644 }
33645 int64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(uint64_t arg) {
33646         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* arg_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(arg);
33647         int64_t ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(arg_conv);
33648         return ret_conv;
33649 }
33650
33651 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(uint64_t orig) {
33652         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* orig_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(orig);
33653         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
33654         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig_conv);
33655         return tag_ptr(ret_conv, true);
33656 }
33657
33658 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_ok"))) TS_CResult_PeeledOnionNoneZ_ok(uint64_t o) {
33659         void* o_ptr = untag_ptr(o);
33660         CHECK_ACCESS(o_ptr);
33661         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
33662         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
33663         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
33664         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
33665         return tag_ptr(ret_conv, true);
33666 }
33667
33668 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_err"))) TS_CResult_PeeledOnionNoneZ_err() {
33669         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
33670         *ret_conv = CResult_PeeledOnionNoneZ_err();
33671         return tag_ptr(ret_conv, true);
33672 }
33673
33674 jboolean  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_is_ok"))) TS_CResult_PeeledOnionNoneZ_is_ok(uint64_t o) {
33675         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
33676         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
33677         return ret_conv;
33678 }
33679
33680 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_free"))) TS_CResult_PeeledOnionNoneZ_free(uint64_t _res) {
33681         if (!ptr_is_owned(_res)) return;
33682         void* _res_ptr = untag_ptr(_res);
33683         CHECK_ACCESS(_res_ptr);
33684         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
33685         FREE(untag_ptr(_res));
33686         CResult_PeeledOnionNoneZ_free(_res_conv);
33687 }
33688
33689 static inline uint64_t CResult_PeeledOnionNoneZ_clone_ptr(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR arg) {
33690         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
33691         *ret_conv = CResult_PeeledOnionNoneZ_clone(arg);
33692         return tag_ptr(ret_conv, true);
33693 }
33694 int64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_clone_ptr"))) TS_CResult_PeeledOnionNoneZ_clone_ptr(uint64_t arg) {
33695         LDKCResult_PeeledOnionNoneZ* arg_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(arg);
33696         int64_t ret_conv = CResult_PeeledOnionNoneZ_clone_ptr(arg_conv);
33697         return ret_conv;
33698 }
33699
33700 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_clone"))) TS_CResult_PeeledOnionNoneZ_clone(uint64_t orig) {
33701         LDKCResult_PeeledOnionNoneZ* orig_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(orig);
33702         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
33703         *ret_conv = CResult_PeeledOnionNoneZ_clone(orig_conv);
33704         return tag_ptr(ret_conv, true);
33705 }
33706
33707 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_ok"))) TS_CResult_SendSuccessSendErrorZ_ok(uint64_t o) {
33708         void* o_ptr = untag_ptr(o);
33709         CHECK_ACCESS(o_ptr);
33710         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
33711         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
33712         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
33713         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
33714         return tag_ptr(ret_conv, true);
33715 }
33716
33717 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_err"))) TS_CResult_SendSuccessSendErrorZ_err(uint64_t e) {
33718         void* e_ptr = untag_ptr(e);
33719         CHECK_ACCESS(e_ptr);
33720         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
33721         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
33722         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
33723         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
33724         return tag_ptr(ret_conv, true);
33725 }
33726
33727 jboolean  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_is_ok"))) TS_CResult_SendSuccessSendErrorZ_is_ok(uint64_t o) {
33728         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
33729         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
33730         return ret_conv;
33731 }
33732
33733 void  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_free"))) TS_CResult_SendSuccessSendErrorZ_free(uint64_t _res) {
33734         if (!ptr_is_owned(_res)) return;
33735         void* _res_ptr = untag_ptr(_res);
33736         CHECK_ACCESS(_res_ptr);
33737         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
33738         FREE(untag_ptr(_res));
33739         CResult_SendSuccessSendErrorZ_free(_res_conv);
33740 }
33741
33742 static inline uint64_t CResult_SendSuccessSendErrorZ_clone_ptr(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR arg) {
33743         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
33744         *ret_conv = CResult_SendSuccessSendErrorZ_clone(arg);
33745         return tag_ptr(ret_conv, true);
33746 }
33747 int64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_clone_ptr"))) TS_CResult_SendSuccessSendErrorZ_clone_ptr(uint64_t arg) {
33748         LDKCResult_SendSuccessSendErrorZ* arg_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(arg);
33749         int64_t ret_conv = CResult_SendSuccessSendErrorZ_clone_ptr(arg_conv);
33750         return ret_conv;
33751 }
33752
33753 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_clone"))) TS_CResult_SendSuccessSendErrorZ_clone(uint64_t orig) {
33754         LDKCResult_SendSuccessSendErrorZ* orig_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(orig);
33755         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
33756         *ret_conv = CResult_SendSuccessSendErrorZ_clone(orig_conv);
33757         return tag_ptr(ret_conv, true);
33758 }
33759
33760 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
33761         LDKBlindedPath o_conv;
33762         o_conv.inner = untag_ptr(o);
33763         o_conv.is_owned = ptr_is_owned(o);
33764         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33765         o_conv = BlindedPath_clone(&o_conv);
33766         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33767         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
33768         return tag_ptr(ret_conv, true);
33769 }
33770
33771 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
33772         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33773         *ret_conv = CResult_BlindedPathNoneZ_err();
33774         return tag_ptr(ret_conv, true);
33775 }
33776
33777 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
33778         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
33779         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
33780         return ret_conv;
33781 }
33782
33783 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
33784         if (!ptr_is_owned(_res)) return;
33785         void* _res_ptr = untag_ptr(_res);
33786         CHECK_ACCESS(_res_ptr);
33787         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
33788         FREE(untag_ptr(_res));
33789         CResult_BlindedPathNoneZ_free(_res_conv);
33790 }
33791
33792 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
33793         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33794         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
33795         return tag_ptr(ret_conv, true);
33796 }
33797 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
33798         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
33799         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
33800         return ret_conv;
33801 }
33802
33803 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
33804         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
33805         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33806         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
33807         return tag_ptr(ret_conv, true);
33808 }
33809
33810 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(uint64_t o) {
33811         void* o_ptr = untag_ptr(o);
33812         CHECK_ACCESS(o_ptr);
33813         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
33814         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
33815         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
33816         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
33817         return tag_ptr(ret_conv, true);
33818 }
33819
33820 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
33821         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
33822         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
33823         return tag_ptr(ret_conv, true);
33824 }
33825
33826 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(uint64_t o) {
33827         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
33828         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
33829         return ret_conv;
33830 }
33831
33832 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(uint64_t _res) {
33833         if (!ptr_is_owned(_res)) return;
33834         void* _res_ptr = untag_ptr(_res);
33835         CHECK_ACCESS(_res_ptr);
33836         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
33837         FREE(untag_ptr(_res));
33838         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
33839 }
33840
33841 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
33842         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
33843         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
33844         return tag_ptr(ret_conv, true);
33845 }
33846 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(uint64_t arg) {
33847         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
33848         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
33849         return ret_conv;
33850 }
33851
33852 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(uint64_t orig) {
33853         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
33854         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
33855         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
33856         return tag_ptr(ret_conv, true);
33857 }
33858
33859 void  __attribute__((export_name("TS_CVec_ForwardNodeZ_free"))) TS_CVec_ForwardNodeZ_free(uint64_tArray _res) {
33860         LDKCVec_ForwardNodeZ _res_constr;
33861         _res_constr.datalen = _res->arr_len;
33862         if (_res_constr.datalen > 0)
33863                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
33864         else
33865                 _res_constr.data = NULL;
33866         uint64_t* _res_vals = _res->elems;
33867         for (size_t n = 0; n < _res_constr.datalen; n++) {
33868                 uint64_t _res_conv_13 = _res_vals[n];
33869                 LDKForwardNode _res_conv_13_conv;
33870                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
33871                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
33872                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
33873                 _res_constr.data[n] = _res_conv_13_conv;
33874         }
33875         FREE(_res);
33876         CVec_ForwardNodeZ_free(_res_constr);
33877 }
33878
33879 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
33880         LDKBlindedPath o_conv;
33881         o_conv.inner = untag_ptr(o);
33882         o_conv.is_owned = ptr_is_owned(o);
33883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33884         o_conv = BlindedPath_clone(&o_conv);
33885         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
33886         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
33887         return tag_ptr(ret_conv, true);
33888 }
33889
33890 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
33891         void* e_ptr = untag_ptr(e);
33892         CHECK_ACCESS(e_ptr);
33893         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33894         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33895         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
33896         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
33897         return tag_ptr(ret_conv, true);
33898 }
33899
33900 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
33901         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
33902         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
33903         return ret_conv;
33904 }
33905
33906 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
33907         if (!ptr_is_owned(_res)) return;
33908         void* _res_ptr = untag_ptr(_res);
33909         CHECK_ACCESS(_res_ptr);
33910         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
33911         FREE(untag_ptr(_res));
33912         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
33913 }
33914
33915 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
33916         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
33917         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
33918         return tag_ptr(ret_conv, true);
33919 }
33920 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
33921         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
33922         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
33923         return ret_conv;
33924 }
33925
33926 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
33927         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
33928         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
33929         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
33930         return tag_ptr(ret_conv, true);
33931 }
33932
33933 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
33934         LDKBlindedHop o_conv;
33935         o_conv.inner = untag_ptr(o);
33936         o_conv.is_owned = ptr_is_owned(o);
33937         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33938         o_conv = BlindedHop_clone(&o_conv);
33939         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
33940         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
33941         return tag_ptr(ret_conv, true);
33942 }
33943
33944 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
33945         void* e_ptr = untag_ptr(e);
33946         CHECK_ACCESS(e_ptr);
33947         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33948         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33949         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
33950         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
33951         return tag_ptr(ret_conv, true);
33952 }
33953
33954 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
33955         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
33956         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
33957         return ret_conv;
33958 }
33959
33960 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
33961         if (!ptr_is_owned(_res)) return;
33962         void* _res_ptr = untag_ptr(_res);
33963         CHECK_ACCESS(_res_ptr);
33964         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
33965         FREE(untag_ptr(_res));
33966         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
33967 }
33968
33969 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
33970         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
33971         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
33972         return tag_ptr(ret_conv, true);
33973 }
33974 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
33975         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
33976         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
33977         return ret_conv;
33978 }
33979
33980 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
33981         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
33982         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
33983         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
33984         return tag_ptr(ret_conv, true);
33985 }
33986
33987 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_ok(uint64_t o) {
33988         LDKInvoiceError o_conv;
33989         o_conv.inner = untag_ptr(o);
33990         o_conv.is_owned = ptr_is_owned(o);
33991         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33992         o_conv = InvoiceError_clone(&o_conv);
33993         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
33994         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
33995         return tag_ptr(ret_conv, true);
33996 }
33997
33998 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_err(uint64_t e) {
33999         void* e_ptr = untag_ptr(e);
34000         CHECK_ACCESS(e_ptr);
34001         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34002         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34003         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34004         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
34005         return tag_ptr(ret_conv, true);
34006 }
34007
34008 jboolean  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_is_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_is_ok(uint64_t o) {
34009         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
34010         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
34011         return ret_conv;
34012 }
34013
34014 void  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_free"))) TS_CResult_InvoiceErrorDecodeErrorZ_free(uint64_t _res) {
34015         if (!ptr_is_owned(_res)) return;
34016         void* _res_ptr = untag_ptr(_res);
34017         CHECK_ACCESS(_res_ptr);
34018         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
34019         FREE(untag_ptr(_res));
34020         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
34021 }
34022
34023 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
34024         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34025         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
34026         return tag_ptr(ret_conv, true);
34027 }
34028 int64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(uint64_t arg) {
34029         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
34030         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
34031         return ret_conv;
34032 }
34033
34034 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone(uint64_t orig) {
34035         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
34036         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34037         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
34038         return tag_ptr(ret_conv, true);
34039 }
34040
34041 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_ok"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_ok(uint64_t o) {
34042         LDKTrackedSpendableOutput o_conv;
34043         o_conv.inner = untag_ptr(o);
34044         o_conv.is_owned = ptr_is_owned(o);
34045         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34046         o_conv = TrackedSpendableOutput_clone(&o_conv);
34047         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34048         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_ok(o_conv);
34049         return tag_ptr(ret_conv, true);
34050 }
34051
34052 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_err"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_err(uint64_t e) {
34053         void* e_ptr = untag_ptr(e);
34054         CHECK_ACCESS(e_ptr);
34055         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34056         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34057         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34058         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_err(e_conv);
34059         return tag_ptr(ret_conv, true);
34060 }
34061
34062 jboolean  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_is_ok"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(uint64_t o) {
34063         LDKCResult_TrackedSpendableOutputDecodeErrorZ* o_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(o);
34064         jboolean ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o_conv);
34065         return ret_conv;
34066 }
34067
34068 void  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_free"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_free(uint64_t _res) {
34069         if (!ptr_is_owned(_res)) return;
34070         void* _res_ptr = untag_ptr(_res);
34071         CHECK_ACCESS(_res_ptr);
34072         LDKCResult_TrackedSpendableOutputDecodeErrorZ _res_conv = *(LDKCResult_TrackedSpendableOutputDecodeErrorZ*)(_res_ptr);
34073         FREE(untag_ptr(_res));
34074         CResult_TrackedSpendableOutputDecodeErrorZ_free(_res_conv);
34075 }
34076
34077 static inline uint64_t CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR arg) {
34078         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34079         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(arg);
34080         return tag_ptr(ret_conv, true);
34081 }
34082 int64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
34083         LDKCResult_TrackedSpendableOutputDecodeErrorZ* arg_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(arg);
34084         int64_t ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(arg_conv);
34085         return ret_conv;
34086 }
34087
34088 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_clone"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_clone(uint64_t orig) {
34089         LDKCResult_TrackedSpendableOutputDecodeErrorZ* orig_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(orig);
34090         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34091         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig_conv);
34092         return tag_ptr(ret_conv, true);
34093 }
34094
34095 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_ok"))) TS_CResult_OutputSpendStatusDecodeErrorZ_ok(uint64_t o) {
34096         void* o_ptr = untag_ptr(o);
34097         CHECK_ACCESS(o_ptr);
34098         LDKOutputSpendStatus o_conv = *(LDKOutputSpendStatus*)(o_ptr);
34099         o_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(o));
34100         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34101         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_ok(o_conv);
34102         return tag_ptr(ret_conv, true);
34103 }
34104
34105 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_err"))) TS_CResult_OutputSpendStatusDecodeErrorZ_err(uint64_t e) {
34106         void* e_ptr = untag_ptr(e);
34107         CHECK_ACCESS(e_ptr);
34108         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34109         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34110         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34111         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_err(e_conv);
34112         return tag_ptr(ret_conv, true);
34113 }
34114
34115 jboolean  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_is_ok"))) TS_CResult_OutputSpendStatusDecodeErrorZ_is_ok(uint64_t o) {
34116         LDKCResult_OutputSpendStatusDecodeErrorZ* o_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(o);
34117         jboolean ret_conv = CResult_OutputSpendStatusDecodeErrorZ_is_ok(o_conv);
34118         return ret_conv;
34119 }
34120
34121 void  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_free"))) TS_CResult_OutputSpendStatusDecodeErrorZ_free(uint64_t _res) {
34122         if (!ptr_is_owned(_res)) return;
34123         void* _res_ptr = untag_ptr(_res);
34124         CHECK_ACCESS(_res_ptr);
34125         LDKCResult_OutputSpendStatusDecodeErrorZ _res_conv = *(LDKCResult_OutputSpendStatusDecodeErrorZ*)(_res_ptr);
34126         FREE(untag_ptr(_res));
34127         CResult_OutputSpendStatusDecodeErrorZ_free(_res_conv);
34128 }
34129
34130 static inline uint64_t CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR arg) {
34131         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34132         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(arg);
34133         return tag_ptr(ret_conv, true);
34134 }
34135 int64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_clone_ptr"))) TS_CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(uint64_t arg) {
34136         LDKCResult_OutputSpendStatusDecodeErrorZ* arg_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(arg);
34137         int64_t ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(arg_conv);
34138         return ret_conv;
34139 }
34140
34141 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_clone"))) TS_CResult_OutputSpendStatusDecodeErrorZ_clone(uint64_t orig) {
34142         LDKCResult_OutputSpendStatusDecodeErrorZ* orig_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(orig);
34143         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34144         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(orig_conv);
34145         return tag_ptr(ret_conv, true);
34146 }
34147
34148 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
34149         void* o_ptr = untag_ptr(o);
34150         CHECK_ACCESS(o_ptr);
34151         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
34152         if (o_conv.free == LDKFilter_JCalls_free) {
34153                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34154                 LDKFilter_JCalls_cloned(&o_conv);
34155         }
34156         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34157         *ret_copy = COption_FilterZ_some(o_conv);
34158         uint64_t ret_ref = tag_ptr(ret_copy, true);
34159         return ret_ref;
34160 }
34161
34162 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
34163         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34164         *ret_copy = COption_FilterZ_none();
34165         uint64_t ret_ref = tag_ptr(ret_copy, true);
34166         return ret_ref;
34167 }
34168
34169 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
34170         if (!ptr_is_owned(_res)) return;
34171         void* _res_ptr = untag_ptr(_res);
34172         CHECK_ACCESS(_res_ptr);
34173         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
34174         FREE(untag_ptr(_res));
34175         COption_FilterZ_free(_res_conv);
34176 }
34177
34178 void  __attribute__((export_name("TS_CVec_TrackedSpendableOutputZ_free"))) TS_CVec_TrackedSpendableOutputZ_free(uint64_tArray _res) {
34179         LDKCVec_TrackedSpendableOutputZ _res_constr;
34180         _res_constr.datalen = _res->arr_len;
34181         if (_res_constr.datalen > 0)
34182                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTrackedSpendableOutput), "LDKCVec_TrackedSpendableOutputZ Elements");
34183         else
34184                 _res_constr.data = NULL;
34185         uint64_t* _res_vals = _res->elems;
34186         for (size_t y = 0; y < _res_constr.datalen; y++) {
34187                 uint64_t _res_conv_24 = _res_vals[y];
34188                 LDKTrackedSpendableOutput _res_conv_24_conv;
34189                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
34190                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
34191                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
34192                 _res_constr.data[y] = _res_conv_24_conv;
34193         }
34194         FREE(_res);
34195         CVec_TrackedSpendableOutputZ_free(_res_constr);
34196 }
34197
34198 uint64_t  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_ok"))) TS_CResult_OutputSweeperDecodeErrorZ_ok(uint64_t o) {
34199         LDKOutputSweeper o_conv;
34200         o_conv.inner = untag_ptr(o);
34201         o_conv.is_owned = ptr_is_owned(o);
34202         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34203         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
34204         
34205         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
34206         *ret_conv = CResult_OutputSweeperDecodeErrorZ_ok(o_conv);
34207         return tag_ptr(ret_conv, true);
34208 }
34209
34210 uint64_t  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_err"))) TS_CResult_OutputSweeperDecodeErrorZ_err(uint64_t e) {
34211         void* e_ptr = untag_ptr(e);
34212         CHECK_ACCESS(e_ptr);
34213         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34214         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34215         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
34216         *ret_conv = CResult_OutputSweeperDecodeErrorZ_err(e_conv);
34217         return tag_ptr(ret_conv, true);
34218 }
34219
34220 jboolean  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_is_ok"))) TS_CResult_OutputSweeperDecodeErrorZ_is_ok(uint64_t o) {
34221         LDKCResult_OutputSweeperDecodeErrorZ* o_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(o);
34222         jboolean ret_conv = CResult_OutputSweeperDecodeErrorZ_is_ok(o_conv);
34223         return ret_conv;
34224 }
34225
34226 void  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_free"))) TS_CResult_OutputSweeperDecodeErrorZ_free(uint64_t _res) {
34227         if (!ptr_is_owned(_res)) return;
34228         void* _res_ptr = untag_ptr(_res);
34229         CHECK_ACCESS(_res_ptr);
34230         LDKCResult_OutputSweeperDecodeErrorZ _res_conv = *(LDKCResult_OutputSweeperDecodeErrorZ*)(_res_ptr);
34231         FREE(untag_ptr(_res));
34232         CResult_OutputSweeperDecodeErrorZ_free(_res_conv);
34233 }
34234
34235 uint64_t  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_new"))) TS_C2Tuple_BestBlockOutputSweeperZ_new(uint64_t a, uint64_t b) {
34236         LDKBestBlock a_conv;
34237         a_conv.inner = untag_ptr(a);
34238         a_conv.is_owned = ptr_is_owned(a);
34239         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34240         a_conv = BestBlock_clone(&a_conv);
34241         LDKOutputSweeper b_conv;
34242         b_conv.inner = untag_ptr(b);
34243         b_conv.is_owned = ptr_is_owned(b);
34244         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34245         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
34246         
34247         LDKC2Tuple_BestBlockOutputSweeperZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BestBlockOutputSweeperZ), "LDKC2Tuple_BestBlockOutputSweeperZ");
34248         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_new(a_conv, b_conv);
34249         return tag_ptr(ret_conv, true);
34250 }
34251
34252 void  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_free"))) TS_C2Tuple_BestBlockOutputSweeperZ_free(uint64_t _res) {
34253         if (!ptr_is_owned(_res)) return;
34254         void* _res_ptr = untag_ptr(_res);
34255         CHECK_ACCESS(_res_ptr);
34256         LDKC2Tuple_BestBlockOutputSweeperZ _res_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(_res_ptr);
34257         FREE(untag_ptr(_res));
34258         C2Tuple_BestBlockOutputSweeperZ_free(_res_conv);
34259 }
34260
34261 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(uint64_t o) {
34262         void* o_ptr = untag_ptr(o);
34263         CHECK_ACCESS(o_ptr);
34264         LDKC2Tuple_BestBlockOutputSweeperZ o_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(o_ptr);
34265         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BestBlockOutputSweeperZ
34266         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
34267         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o_conv);
34268         return tag_ptr(ret_conv, true);
34269 }
34270
34271 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(uint64_t e) {
34272         void* e_ptr = untag_ptr(e);
34273         CHECK_ACCESS(e_ptr);
34274         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34275         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34276         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
34277         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e_conv);
34278         return tag_ptr(ret_conv, true);
34279 }
34280
34281 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(uint64_t o) {
34282         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(o);
34283         jboolean ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o_conv);
34284         return ret_conv;
34285 }
34286
34287 void  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(uint64_t _res) {
34288         if (!ptr_is_owned(_res)) return;
34289         void* _res_ptr = untag_ptr(_res);
34290         CHECK_ACCESS(_res_ptr);
34291         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)(_res_ptr);
34292         FREE(untag_ptr(_res));
34293         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res_conv);
34294 }
34295
34296 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_ok(uint64_t o) {
34297         LDKDelayedPaymentBasepoint o_conv;
34298         o_conv.inner = untag_ptr(o);
34299         o_conv.is_owned = ptr_is_owned(o);
34300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34301         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
34302         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34303         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
34304         return tag_ptr(ret_conv, true);
34305 }
34306
34307 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_err"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_err(uint64_t e) {
34308         void* e_ptr = untag_ptr(e);
34309         CHECK_ACCESS(e_ptr);
34310         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34311         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34312         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34313         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
34314         return tag_ptr(ret_conv, true);
34315 }
34316
34317 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(uint64_t o) {
34318         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
34319         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
34320         return ret_conv;
34321 }
34322
34323 void  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_free"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_free(uint64_t _res) {
34324         if (!ptr_is_owned(_res)) return;
34325         void* _res_ptr = untag_ptr(_res);
34326         CHECK_ACCESS(_res_ptr);
34327         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
34328         FREE(untag_ptr(_res));
34329         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
34330 }
34331
34332 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
34333         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34334         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
34335         return tag_ptr(ret_conv, true);
34336 }
34337 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
34338         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
34339         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
34340         return ret_conv;
34341 }
34342
34343 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone(uint64_t orig) {
34344         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
34345         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34346         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
34347         return tag_ptr(ret_conv, true);
34348 }
34349
34350 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_ok(uint64_t o) {
34351         LDKDelayedPaymentKey o_conv;
34352         o_conv.inner = untag_ptr(o);
34353         o_conv.is_owned = ptr_is_owned(o);
34354         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34355         o_conv = DelayedPaymentKey_clone(&o_conv);
34356         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34357         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
34358         return tag_ptr(ret_conv, true);
34359 }
34360
34361 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_err"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_err(uint64_t e) {
34362         void* e_ptr = untag_ptr(e);
34363         CHECK_ACCESS(e_ptr);
34364         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34365         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34366         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34367         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
34368         return tag_ptr(ret_conv, true);
34369 }
34370
34371 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(uint64_t o) {
34372         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
34373         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
34374         return ret_conv;
34375 }
34376
34377 void  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_free"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_free(uint64_t _res) {
34378         if (!ptr_is_owned(_res)) return;
34379         void* _res_ptr = untag_ptr(_res);
34380         CHECK_ACCESS(_res_ptr);
34381         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
34382         FREE(untag_ptr(_res));
34383         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
34384 }
34385
34386 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
34387         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34388         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
34389         return tag_ptr(ret_conv, true);
34390 }
34391 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
34392         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
34393         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
34394         return ret_conv;
34395 }
34396
34397 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone(uint64_t orig) {
34398         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
34399         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34400         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
34401         return tag_ptr(ret_conv, true);
34402 }
34403
34404 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_ok(uint64_t o) {
34405         LDKHtlcBasepoint o_conv;
34406         o_conv.inner = untag_ptr(o);
34407         o_conv.is_owned = ptr_is_owned(o);
34408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34409         o_conv = HtlcBasepoint_clone(&o_conv);
34410         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34411         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
34412         return tag_ptr(ret_conv, true);
34413 }
34414
34415 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_err"))) TS_CResult_HtlcBasepointDecodeErrorZ_err(uint64_t e) {
34416         void* e_ptr = untag_ptr(e);
34417         CHECK_ACCESS(e_ptr);
34418         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34419         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34420         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34421         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
34422         return tag_ptr(ret_conv, true);
34423 }
34424
34425 jboolean  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_is_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_is_ok(uint64_t o) {
34426         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
34427         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
34428         return ret_conv;
34429 }
34430
34431 void  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_free"))) TS_CResult_HtlcBasepointDecodeErrorZ_free(uint64_t _res) {
34432         if (!ptr_is_owned(_res)) return;
34433         void* _res_ptr = untag_ptr(_res);
34434         CHECK_ACCESS(_res_ptr);
34435         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
34436         FREE(untag_ptr(_res));
34437         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
34438 }
34439
34440 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
34441         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34442         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
34443         return tag_ptr(ret_conv, true);
34444 }
34445 int64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_HtlcBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
34446         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
34447         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
34448         return ret_conv;
34449 }
34450
34451 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_clone"))) TS_CResult_HtlcBasepointDecodeErrorZ_clone(uint64_t orig) {
34452         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
34453         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34454         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
34455         return tag_ptr(ret_conv, true);
34456 }
34457
34458 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_ok(uint64_t o) {
34459         LDKHtlcKey o_conv;
34460         o_conv.inner = untag_ptr(o);
34461         o_conv.is_owned = ptr_is_owned(o);
34462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34463         o_conv = HtlcKey_clone(&o_conv);
34464         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34465         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
34466         return tag_ptr(ret_conv, true);
34467 }
34468
34469 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_err"))) TS_CResult_HtlcKeyDecodeErrorZ_err(uint64_t e) {
34470         void* e_ptr = untag_ptr(e);
34471         CHECK_ACCESS(e_ptr);
34472         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34473         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34474         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34475         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
34476         return tag_ptr(ret_conv, true);
34477 }
34478
34479 jboolean  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_is_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_is_ok(uint64_t o) {
34480         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
34481         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
34482         return ret_conv;
34483 }
34484
34485 void  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_free"))) TS_CResult_HtlcKeyDecodeErrorZ_free(uint64_t _res) {
34486         if (!ptr_is_owned(_res)) return;
34487         void* _res_ptr = untag_ptr(_res);
34488         CHECK_ACCESS(_res_ptr);
34489         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
34490         FREE(untag_ptr(_res));
34491         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
34492 }
34493
34494 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
34495         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34496         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
34497         return tag_ptr(ret_conv, true);
34498 }
34499 int64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_clone_ptr"))) TS_CResult_HtlcKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
34500         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
34501         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
34502         return ret_conv;
34503 }
34504
34505 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_clone"))) TS_CResult_HtlcKeyDecodeErrorZ_clone(uint64_t orig) {
34506         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
34507         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34508         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
34509         return tag_ptr(ret_conv, true);
34510 }
34511
34512 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_ok(uint64_t o) {
34513         LDKRevocationBasepoint o_conv;
34514         o_conv.inner = untag_ptr(o);
34515         o_conv.is_owned = ptr_is_owned(o);
34516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34517         o_conv = RevocationBasepoint_clone(&o_conv);
34518         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
34519         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
34520         return tag_ptr(ret_conv, true);
34521 }
34522
34523 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_err"))) TS_CResult_RevocationBasepointDecodeErrorZ_err(uint64_t e) {
34524         void* e_ptr = untag_ptr(e);
34525         CHECK_ACCESS(e_ptr);
34526         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34527         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34528         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
34529         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
34530         return tag_ptr(ret_conv, true);
34531 }
34532
34533 jboolean  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_is_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_is_ok(uint64_t o) {
34534         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
34535         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
34536         return ret_conv;
34537 }
34538
34539 void  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_free"))) TS_CResult_RevocationBasepointDecodeErrorZ_free(uint64_t _res) {
34540         if (!ptr_is_owned(_res)) return;
34541         void* _res_ptr = untag_ptr(_res);
34542         CHECK_ACCESS(_res_ptr);
34543         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
34544         FREE(untag_ptr(_res));
34545         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
34546 }
34547
34548 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
34549         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
34550         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
34551         return tag_ptr(ret_conv, true);
34552 }
34553 int64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_RevocationBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
34554         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
34555         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
34556         return ret_conv;
34557 }
34558
34559 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_clone"))) TS_CResult_RevocationBasepointDecodeErrorZ_clone(uint64_t orig) {
34560         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
34561         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
34562         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
34563         return tag_ptr(ret_conv, true);
34564 }
34565
34566 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_ok(uint64_t o) {
34567         LDKRevocationKey o_conv;
34568         o_conv.inner = untag_ptr(o);
34569         o_conv.is_owned = ptr_is_owned(o);
34570         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34571         o_conv = RevocationKey_clone(&o_conv);
34572         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
34573         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
34574         return tag_ptr(ret_conv, true);
34575 }
34576
34577 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_err"))) TS_CResult_RevocationKeyDecodeErrorZ_err(uint64_t e) {
34578         void* e_ptr = untag_ptr(e);
34579         CHECK_ACCESS(e_ptr);
34580         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34581         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34582         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
34583         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
34584         return tag_ptr(ret_conv, true);
34585 }
34586
34587 jboolean  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_is_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_is_ok(uint64_t o) {
34588         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
34589         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
34590         return ret_conv;
34591 }
34592
34593 void  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_free"))) TS_CResult_RevocationKeyDecodeErrorZ_free(uint64_t _res) {
34594         if (!ptr_is_owned(_res)) return;
34595         void* _res_ptr = untag_ptr(_res);
34596         CHECK_ACCESS(_res_ptr);
34597         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
34598         FREE(untag_ptr(_res));
34599         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
34600 }
34601
34602 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
34603         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
34604         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
34605         return tag_ptr(ret_conv, true);
34606 }
34607 int64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_clone_ptr"))) TS_CResult_RevocationKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
34608         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
34609         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
34610         return ret_conv;
34611 }
34612
34613 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_clone"))) TS_CResult_RevocationKeyDecodeErrorZ_clone(uint64_t orig) {
34614         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
34615         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
34616         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
34617         return tag_ptr(ret_conv, true);
34618 }
34619
34620 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
34621         LDKLockedChannelMonitor o_conv;
34622         o_conv.inner = untag_ptr(o);
34623         o_conv.is_owned = ptr_is_owned(o);
34624         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34625         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
34626         
34627         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34628         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
34629         return tag_ptr(ret_conv, true);
34630 }
34631
34632 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
34633         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34634         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
34635         return tag_ptr(ret_conv, true);
34636 }
34637
34638 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
34639         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
34640         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
34641         return ret_conv;
34642 }
34643
34644 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
34645         if (!ptr_is_owned(_res)) return;
34646         void* _res_ptr = untag_ptr(_res);
34647         CHECK_ACCESS(_res_ptr);
34648         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
34649         FREE(untag_ptr(_res));
34650         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
34651 }
34652
34653 static inline uint64_t C2Tuple_OutPointChannelIdZ_clone_ptr(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR arg) {
34654         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
34655         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(arg);
34656         return tag_ptr(ret_conv, true);
34657 }
34658 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_clone_ptr"))) TS_C2Tuple_OutPointChannelIdZ_clone_ptr(uint64_t arg) {
34659         LDKC2Tuple_OutPointChannelIdZ* arg_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(arg);
34660         int64_t ret_conv = C2Tuple_OutPointChannelIdZ_clone_ptr(arg_conv);
34661         return ret_conv;
34662 }
34663
34664 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_clone"))) TS_C2Tuple_OutPointChannelIdZ_clone(uint64_t orig) {
34665         LDKC2Tuple_OutPointChannelIdZ* orig_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(orig);
34666         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
34667         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(orig_conv);
34668         return tag_ptr(ret_conv, true);
34669 }
34670
34671 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_new"))) TS_C2Tuple_OutPointChannelIdZ_new(uint64_t a, uint64_t b) {
34672         LDKOutPoint a_conv;
34673         a_conv.inner = untag_ptr(a);
34674         a_conv.is_owned = ptr_is_owned(a);
34675         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34676         a_conv = OutPoint_clone(&a_conv);
34677         LDKChannelId b_conv;
34678         b_conv.inner = untag_ptr(b);
34679         b_conv.is_owned = ptr_is_owned(b);
34680         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34681         b_conv = ChannelId_clone(&b_conv);
34682         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
34683         *ret_conv = C2Tuple_OutPointChannelIdZ_new(a_conv, b_conv);
34684         return tag_ptr(ret_conv, true);
34685 }
34686
34687 void  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_free"))) TS_C2Tuple_OutPointChannelIdZ_free(uint64_t _res) {
34688         if (!ptr_is_owned(_res)) return;
34689         void* _res_ptr = untag_ptr(_res);
34690         CHECK_ACCESS(_res_ptr);
34691         LDKC2Tuple_OutPointChannelIdZ _res_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_ptr);
34692         FREE(untag_ptr(_res));
34693         C2Tuple_OutPointChannelIdZ_free(_res_conv);
34694 }
34695
34696 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointChannelIdZZ_free"))) TS_CVec_C2Tuple_OutPointChannelIdZZ_free(uint64_tArray _res) {
34697         LDKCVec_C2Tuple_OutPointChannelIdZZ _res_constr;
34698         _res_constr.datalen = _res->arr_len;
34699         if (_res_constr.datalen > 0)
34700                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKCVec_C2Tuple_OutPointChannelIdZZ Elements");
34701         else
34702                 _res_constr.data = NULL;
34703         uint64_t* _res_vals = _res->elems;
34704         for (size_t d = 0; d < _res_constr.datalen; d++) {
34705                 uint64_t _res_conv_29 = _res_vals[d];
34706                 void* _res_conv_29_ptr = untag_ptr(_res_conv_29);
34707                 CHECK_ACCESS(_res_conv_29_ptr);
34708                 LDKC2Tuple_OutPointChannelIdZ _res_conv_29_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_conv_29_ptr);
34709                 FREE(untag_ptr(_res_conv_29));
34710                 _res_constr.data[d] = _res_conv_29_conv;
34711         }
34712         FREE(_res);
34713         CVec_C2Tuple_OutPointChannelIdZZ_free(_res_constr);
34714 }
34715
34716 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
34717         LDKCVec_MonitorUpdateIdZ _res_constr;
34718         _res_constr.datalen = _res->arr_len;
34719         if (_res_constr.datalen > 0)
34720                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
34721         else
34722                 _res_constr.data = NULL;
34723         uint64_t* _res_vals = _res->elems;
34724         for (size_t r = 0; r < _res_constr.datalen; r++) {
34725                 uint64_t _res_conv_17 = _res_vals[r];
34726                 LDKMonitorUpdateId _res_conv_17_conv;
34727                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
34728                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
34729                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
34730                 _res_constr.data[r] = _res_conv_17_conv;
34731         }
34732         FREE(_res);
34733         CVec_MonitorUpdateIdZ_free(_res_constr);
34734 }
34735
34736 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
34737         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34738         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
34739         return tag_ptr(ret_conv, true);
34740 }
34741 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
34742         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
34743         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
34744         return ret_conv;
34745 }
34746
34747 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
34748         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
34749         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34750         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
34751         return tag_ptr(ret_conv, true);
34752 }
34753
34754 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
34755         LDKOutPoint a_conv;
34756         a_conv.inner = untag_ptr(a);
34757         a_conv.is_owned = ptr_is_owned(a);
34758         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34759         a_conv = OutPoint_clone(&a_conv);
34760         LDKCVec_MonitorUpdateIdZ b_constr;
34761         b_constr.datalen = b->arr_len;
34762         if (b_constr.datalen > 0)
34763                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
34764         else
34765                 b_constr.data = NULL;
34766         uint64_t* b_vals = b->elems;
34767         for (size_t r = 0; r < b_constr.datalen; r++) {
34768                 uint64_t b_conv_17 = b_vals[r];
34769                 LDKMonitorUpdateId b_conv_17_conv;
34770                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
34771                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
34772                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
34773                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
34774                 b_constr.data[r] = b_conv_17_conv;
34775         }
34776         FREE(b);
34777         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34778         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
34779         return tag_ptr(ret_conv, true);
34780 }
34781
34782 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
34783         if (!ptr_is_owned(_res)) return;
34784         void* _res_ptr = untag_ptr(_res);
34785         CHECK_ACCESS(_res_ptr);
34786         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
34787         FREE(untag_ptr(_res));
34788         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
34789 }
34790
34791 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
34792         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
34793         _res_constr.datalen = _res->arr_len;
34794         if (_res_constr.datalen > 0)
34795                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
34796         else
34797                 _res_constr.data = NULL;
34798         uint64_t* _res_vals = _res->elems;
34799         for (size_t p = 0; p < _res_constr.datalen; p++) {
34800                 uint64_t _res_conv_41 = _res_vals[p];
34801                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
34802                 CHECK_ACCESS(_res_conv_41_ptr);
34803                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
34804                 FREE(untag_ptr(_res_conv_41));
34805                 _res_constr.data[p] = _res_conv_41_conv;
34806         }
34807         FREE(_res);
34808         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
34809 }
34810
34811 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
34812         if (!ptr_is_owned(this_ptr)) return;
34813         void* this_ptr_ptr = untag_ptr(this_ptr);
34814         CHECK_ACCESS(this_ptr_ptr);
34815         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
34816         FREE(untag_ptr(this_ptr));
34817         APIError_free(this_ptr_conv);
34818 }
34819
34820 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
34821         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34822         *ret_copy = APIError_clone(arg);
34823         uint64_t ret_ref = tag_ptr(ret_copy, true);
34824         return ret_ref;
34825 }
34826 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
34827         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
34828         int64_t ret_conv = APIError_clone_ptr(arg_conv);
34829         return ret_conv;
34830 }
34831
34832 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
34833         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
34834         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34835         *ret_copy = APIError_clone(orig_conv);
34836         uint64_t ret_ref = tag_ptr(ret_copy, true);
34837         return ret_ref;
34838 }
34839
34840 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
34841         LDKStr err_conv = str_ref_to_owned_c(err);
34842         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34843         *ret_copy = APIError_apimisuse_error(err_conv);
34844         uint64_t ret_ref = tag_ptr(ret_copy, true);
34845         return ret_ref;
34846 }
34847
34848 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
34849         LDKStr err_conv = str_ref_to_owned_c(err);
34850         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34851         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
34852         uint64_t ret_ref = tag_ptr(ret_copy, true);
34853         return ret_ref;
34854 }
34855
34856 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
34857         LDKStr err_conv = str_ref_to_owned_c(err);
34858         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34859         *ret_copy = APIError_invalid_route(err_conv);
34860         uint64_t ret_ref = tag_ptr(ret_copy, true);
34861         return ret_ref;
34862 }
34863
34864 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
34865         LDKStr err_conv = str_ref_to_owned_c(err);
34866         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34867         *ret_copy = APIError_channel_unavailable(err_conv);
34868         uint64_t ret_ref = tag_ptr(ret_copy, true);
34869         return ret_ref;
34870 }
34871
34872 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
34873         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34874         *ret_copy = APIError_monitor_update_in_progress();
34875         uint64_t ret_ref = tag_ptr(ret_copy, true);
34876         return ret_ref;
34877 }
34878
34879 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
34880         LDKShutdownScript script_conv;
34881         script_conv.inner = untag_ptr(script);
34882         script_conv.is_owned = ptr_is_owned(script);
34883         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
34884         script_conv = ShutdownScript_clone(&script_conv);
34885         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34886         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
34887         uint64_t ret_ref = tag_ptr(ret_copy, true);
34888         return ret_ref;
34889 }
34890
34891 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
34892         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
34893         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
34894         jboolean ret_conv = APIError_eq(a_conv, b_conv);
34895         return ret_conv;
34896 }
34897
34898 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
34899         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
34900         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
34901         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34902         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34903         CVec_u8Z_free(ret_var);
34904         return ret_arr;
34905 }
34906
34907 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
34908         LDKu8slice ser_ref;
34909         ser_ref.datalen = ser->arr_len;
34910         ser_ref.data = ser->elems;
34911         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
34912         *ret_conv = APIError_read(ser_ref);
34913         FREE(ser);
34914         return tag_ptr(ret_conv, true);
34915 }
34916
34917 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
34918         LDKBigSize this_obj_conv;
34919         this_obj_conv.inner = untag_ptr(this_obj);
34920         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34922         BigSize_free(this_obj_conv);
34923 }
34924
34925 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
34926         LDKBigSize this_ptr_conv;
34927         this_ptr_conv.inner = untag_ptr(this_ptr);
34928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34930         this_ptr_conv.is_owned = false;
34931         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
34932         return ret_conv;
34933 }
34934
34935 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
34936         LDKBigSize this_ptr_conv;
34937         this_ptr_conv.inner = untag_ptr(this_ptr);
34938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34940         this_ptr_conv.is_owned = false;
34941         BigSize_set_a(&this_ptr_conv, val);
34942 }
34943
34944 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
34945         LDKBigSize ret_var = BigSize_new(a_arg);
34946         uint64_t ret_ref = 0;
34947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34949         return ret_ref;
34950 }
34951
34952 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
34953         LDKBigSize ret_var = BigSize_clone(arg);
34954         uint64_t ret_ref = 0;
34955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34957         return ret_ref;
34958 }
34959 int64_t  __attribute__((export_name("TS_BigSize_clone_ptr"))) TS_BigSize_clone_ptr(uint64_t arg) {
34960         LDKBigSize arg_conv;
34961         arg_conv.inner = untag_ptr(arg);
34962         arg_conv.is_owned = ptr_is_owned(arg);
34963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34964         arg_conv.is_owned = false;
34965         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
34966         return ret_conv;
34967 }
34968
34969 uint64_t  __attribute__((export_name("TS_BigSize_clone"))) TS_BigSize_clone(uint64_t orig) {
34970         LDKBigSize orig_conv;
34971         orig_conv.inner = untag_ptr(orig);
34972         orig_conv.is_owned = ptr_is_owned(orig);
34973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34974         orig_conv.is_owned = false;
34975         LDKBigSize ret_var = BigSize_clone(&orig_conv);
34976         uint64_t ret_ref = 0;
34977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34979         return ret_ref;
34980 }
34981
34982 int64_t  __attribute__((export_name("TS_BigSize_hash"))) TS_BigSize_hash(uint64_t o) {
34983         LDKBigSize o_conv;
34984         o_conv.inner = untag_ptr(o);
34985         o_conv.is_owned = ptr_is_owned(o);
34986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34987         o_conv.is_owned = false;
34988         int64_t ret_conv = BigSize_hash(&o_conv);
34989         return ret_conv;
34990 }
34991
34992 jboolean  __attribute__((export_name("TS_BigSize_eq"))) TS_BigSize_eq(uint64_t a, uint64_t b) {
34993         LDKBigSize a_conv;
34994         a_conv.inner = untag_ptr(a);
34995         a_conv.is_owned = ptr_is_owned(a);
34996         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34997         a_conv.is_owned = false;
34998         LDKBigSize b_conv;
34999         b_conv.inner = untag_ptr(b);
35000         b_conv.is_owned = ptr_is_owned(b);
35001         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35002         b_conv.is_owned = false;
35003         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
35004         return ret_conv;
35005 }
35006
35007 int8_tArray  __attribute__((export_name("TS_BigSize_write"))) TS_BigSize_write(uint64_t obj) {
35008         LDKBigSize obj_conv;
35009         obj_conv.inner = untag_ptr(obj);
35010         obj_conv.is_owned = ptr_is_owned(obj);
35011         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35012         obj_conv.is_owned = false;
35013         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
35014         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35015         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35016         CVec_u8Z_free(ret_var);
35017         return ret_arr;
35018 }
35019
35020 uint64_t  __attribute__((export_name("TS_BigSize_read"))) TS_BigSize_read(int8_tArray ser) {
35021         LDKu8slice ser_ref;
35022         ser_ref.datalen = ser->arr_len;
35023         ser_ref.data = ser->elems;
35024         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35025         *ret_conv = BigSize_read(ser_ref);
35026         FREE(ser);
35027         return tag_ptr(ret_conv, true);
35028 }
35029
35030 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
35031         LDKHostname this_obj_conv;
35032         this_obj_conv.inner = untag_ptr(this_obj);
35033         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35035         Hostname_free(this_obj_conv);
35036 }
35037
35038 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
35039         LDKHostname ret_var = Hostname_clone(arg);
35040         uint64_t ret_ref = 0;
35041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35043         return ret_ref;
35044 }
35045 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
35046         LDKHostname arg_conv;
35047         arg_conv.inner = untag_ptr(arg);
35048         arg_conv.is_owned = ptr_is_owned(arg);
35049         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35050         arg_conv.is_owned = false;
35051         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
35052         return ret_conv;
35053 }
35054
35055 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
35056         LDKHostname orig_conv;
35057         orig_conv.inner = untag_ptr(orig);
35058         orig_conv.is_owned = ptr_is_owned(orig);
35059         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35060         orig_conv.is_owned = false;
35061         LDKHostname ret_var = Hostname_clone(&orig_conv);
35062         uint64_t ret_ref = 0;
35063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35065         return ret_ref;
35066 }
35067
35068 int64_t  __attribute__((export_name("TS_Hostname_hash"))) TS_Hostname_hash(uint64_t o) {
35069         LDKHostname o_conv;
35070         o_conv.inner = untag_ptr(o);
35071         o_conv.is_owned = ptr_is_owned(o);
35072         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35073         o_conv.is_owned = false;
35074         int64_t ret_conv = Hostname_hash(&o_conv);
35075         return ret_conv;
35076 }
35077
35078 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
35079         LDKHostname a_conv;
35080         a_conv.inner = untag_ptr(a);
35081         a_conv.is_owned = ptr_is_owned(a);
35082         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35083         a_conv.is_owned = false;
35084         LDKHostname b_conv;
35085         b_conv.inner = untag_ptr(b);
35086         b_conv.is_owned = ptr_is_owned(b);
35087         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35088         b_conv.is_owned = false;
35089         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
35090         return ret_conv;
35091 }
35092
35093 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
35094         LDKHostname this_arg_conv;
35095         this_arg_conv.inner = untag_ptr(this_arg);
35096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35098         this_arg_conv.is_owned = false;
35099         int8_t ret_conv = Hostname_len(&this_arg_conv);
35100         return ret_conv;
35101 }
35102
35103 int8_tArray  __attribute__((export_name("TS_Hostname_write"))) TS_Hostname_write(uint64_t obj) {
35104         LDKHostname obj_conv;
35105         obj_conv.inner = untag_ptr(obj);
35106         obj_conv.is_owned = ptr_is_owned(obj);
35107         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35108         obj_conv.is_owned = false;
35109         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
35110         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35111         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35112         CVec_u8Z_free(ret_var);
35113         return ret_arr;
35114 }
35115
35116 uint64_t  __attribute__((export_name("TS_Hostname_read"))) TS_Hostname_read(int8_tArray ser) {
35117         LDKu8slice ser_ref;
35118         ser_ref.datalen = ser->arr_len;
35119         ser_ref.data = ser->elems;
35120         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35121         *ret_conv = Hostname_read(ser_ref);
35122         FREE(ser);
35123         return tag_ptr(ret_conv, true);
35124 }
35125
35126 void  __attribute__((export_name("TS_TransactionU16LenLimited_free"))) TS_TransactionU16LenLimited_free(uint64_t this_obj) {
35127         LDKTransactionU16LenLimited this_obj_conv;
35128         this_obj_conv.inner = untag_ptr(this_obj);
35129         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35131         TransactionU16LenLimited_free(this_obj_conv);
35132 }
35133
35134 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
35135         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
35136         uint64_t ret_ref = 0;
35137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35139         return ret_ref;
35140 }
35141 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone_ptr"))) TS_TransactionU16LenLimited_clone_ptr(uint64_t arg) {
35142         LDKTransactionU16LenLimited arg_conv;
35143         arg_conv.inner = untag_ptr(arg);
35144         arg_conv.is_owned = ptr_is_owned(arg);
35145         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35146         arg_conv.is_owned = false;
35147         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
35148         return ret_conv;
35149 }
35150
35151 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone"))) TS_TransactionU16LenLimited_clone(uint64_t orig) {
35152         LDKTransactionU16LenLimited orig_conv;
35153         orig_conv.inner = untag_ptr(orig);
35154         orig_conv.is_owned = ptr_is_owned(orig);
35155         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35156         orig_conv.is_owned = false;
35157         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
35158         uint64_t ret_ref = 0;
35159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35161         return ret_ref;
35162 }
35163
35164 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_hash"))) TS_TransactionU16LenLimited_hash(uint64_t o) {
35165         LDKTransactionU16LenLimited o_conv;
35166         o_conv.inner = untag_ptr(o);
35167         o_conv.is_owned = ptr_is_owned(o);
35168         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35169         o_conv.is_owned = false;
35170         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
35171         return ret_conv;
35172 }
35173
35174 jboolean  __attribute__((export_name("TS_TransactionU16LenLimited_eq"))) TS_TransactionU16LenLimited_eq(uint64_t a, uint64_t b) {
35175         LDKTransactionU16LenLimited a_conv;
35176         a_conv.inner = untag_ptr(a);
35177         a_conv.is_owned = ptr_is_owned(a);
35178         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35179         a_conv.is_owned = false;
35180         LDKTransactionU16LenLimited b_conv;
35181         b_conv.inner = untag_ptr(b);
35182         b_conv.is_owned = ptr_is_owned(b);
35183         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35184         b_conv.is_owned = false;
35185         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
35186         return ret_conv;
35187 }
35188
35189 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_new"))) TS_TransactionU16LenLimited_new(int8_tArray transaction) {
35190         LDKTransaction transaction_ref;
35191         transaction_ref.datalen = transaction->arr_len;
35192         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
35193         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
35194         transaction_ref.data_is_owned = true;
35195         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35196         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
35197         return tag_ptr(ret_conv, true);
35198 }
35199
35200 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_into_transaction"))) TS_TransactionU16LenLimited_into_transaction(uint64_t this_arg) {
35201         LDKTransactionU16LenLimited this_arg_conv;
35202         this_arg_conv.inner = untag_ptr(this_arg);
35203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35205         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
35206         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
35207         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35208         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35209         Transaction_free(ret_var);
35210         return ret_arr;
35211 }
35212
35213 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_as_transaction"))) TS_TransactionU16LenLimited_as_transaction(uint64_t this_arg) {
35214         LDKTransactionU16LenLimited this_arg_conv;
35215         this_arg_conv.inner = untag_ptr(this_arg);
35216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35218         this_arg_conv.is_owned = false;
35219         LDKTransaction ret_var = TransactionU16LenLimited_as_transaction(&this_arg_conv);
35220         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35221         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35222         Transaction_free(ret_var);
35223         return ret_arr;
35224 }
35225
35226 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_write"))) TS_TransactionU16LenLimited_write(uint64_t obj) {
35227         LDKTransactionU16LenLimited obj_conv;
35228         obj_conv.inner = untag_ptr(obj);
35229         obj_conv.is_owned = ptr_is_owned(obj);
35230         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35231         obj_conv.is_owned = false;
35232         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
35233         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35234         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35235         CVec_u8Z_free(ret_var);
35236         return ret_arr;
35237 }
35238
35239 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_read"))) TS_TransactionU16LenLimited_read(int8_tArray ser) {
35240         LDKu8slice ser_ref;
35241         ser_ref.datalen = ser->arr_len;
35242         ser_ref.data = ser->elems;
35243         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35244         *ret_conv = TransactionU16LenLimited_read(ser_ref);
35245         FREE(ser);
35246         return tag_ptr(ret_conv, true);
35247 }
35248
35249 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
35250         LDKu8slice msg_ref;
35251         msg_ref.datalen = msg->arr_len;
35252         msg_ref.data = msg->elems;
35253         uint8_t sk_arr[32];
35254         CHECK(sk->arr_len == 32);
35255         memcpy(sk_arr, sk->elems, 32); FREE(sk);
35256         uint8_t (*sk_ref)[32] = &sk_arr;
35257         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
35258         *ret_conv = sign(msg_ref, sk_ref);
35259         FREE(msg);
35260         return tag_ptr(ret_conv, true);
35261 }
35262
35263 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
35264         LDKu8slice msg_ref;
35265         msg_ref.datalen = msg->arr_len;
35266         msg_ref.data = msg->elems;
35267         LDKStr sig_conv = str_ref_to_owned_c(sig);
35268         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
35269         *ret_conv = recover_pk(msg_ref, sig_conv);
35270         FREE(msg);
35271         return tag_ptr(ret_conv, true);
35272 }
35273
35274 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
35275         LDKu8slice msg_ref;
35276         msg_ref.datalen = msg->arr_len;
35277         msg_ref.data = msg->elems;
35278         LDKStr sig_conv = str_ref_to_owned_c(sig);
35279         LDKPublicKey pk_ref;
35280         CHECK(pk->arr_len == 33);
35281         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
35282         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
35283         FREE(msg);
35284         return ret_conv;
35285 }
35286
35287 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
35288         LDKu8slice hrp_bytes_ref;
35289         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
35290         hrp_bytes_ref.data = hrp_bytes->elems;
35291         LDKCVec_U5Z data_without_signature_constr;
35292         data_without_signature_constr.datalen = data_without_signature->arr_len;
35293         if (data_without_signature_constr.datalen > 0)
35294                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
35295         else
35296                 data_without_signature_constr.data = NULL;
35297         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
35298         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
35299                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
35300                 
35301                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
35302         }
35303         FREE(data_without_signature);
35304         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
35305         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35306         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35307         CVec_u8Z_free(ret_var);
35308         FREE(hrp_bytes);
35309         return ret_arr;
35310 }
35311
35312 void  __attribute__((export_name("TS_KVStore_free"))) TS_KVStore_free(uint64_t this_ptr) {
35313         if (!ptr_is_owned(this_ptr)) return;
35314         void* this_ptr_ptr = untag_ptr(this_ptr);
35315         CHECK_ACCESS(this_ptr_ptr);
35316         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
35317         FREE(untag_ptr(this_ptr));
35318         KVStore_free(this_ptr_conv);
35319 }
35320
35321 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
35322         if (!ptr_is_owned(this_ptr)) return;
35323         void* this_ptr_ptr = untag_ptr(this_ptr);
35324         CHECK_ACCESS(this_ptr_ptr);
35325         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
35326         FREE(untag_ptr(this_ptr));
35327         Persister_free(this_ptr_conv);
35328 }
35329
35330 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) {
35331         void* kv_store_ptr = untag_ptr(kv_store);
35332         CHECK_ACCESS(kv_store_ptr);
35333         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
35334         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
35335                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35336                 LDKKVStore_JCalls_cloned(&kv_store_conv);
35337         }
35338         void* entropy_source_ptr = untag_ptr(entropy_source);
35339         CHECK_ACCESS(entropy_source_ptr);
35340         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35341         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35342                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35343                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35344         }
35345         void* signer_provider_ptr = untag_ptr(signer_provider);
35346         CHECK_ACCESS(signer_provider_ptr);
35347         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35348         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35349                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35350                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35351         }
35352         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
35353         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
35354         return tag_ptr(ret_conv, true);
35355 }
35356
35357 void  __attribute__((export_name("TS_MonitorUpdatingPersister_free"))) TS_MonitorUpdatingPersister_free(uint64_t this_obj) {
35358         LDKMonitorUpdatingPersister this_obj_conv;
35359         this_obj_conv.inner = untag_ptr(this_obj);
35360         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35362         MonitorUpdatingPersister_free(this_obj_conv);
35363 }
35364
35365 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) {
35366         void* kv_store_ptr = untag_ptr(kv_store);
35367         CHECK_ACCESS(kv_store_ptr);
35368         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
35369         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
35370                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35371                 LDKKVStore_JCalls_cloned(&kv_store_conv);
35372         }
35373         void* logger_ptr = untag_ptr(logger);
35374         CHECK_ACCESS(logger_ptr);
35375         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35376         if (logger_conv.free == LDKLogger_JCalls_free) {
35377                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35378                 LDKLogger_JCalls_cloned(&logger_conv);
35379         }
35380         void* entropy_source_ptr = untag_ptr(entropy_source);
35381         CHECK_ACCESS(entropy_source_ptr);
35382         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35383         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35384                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35385                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35386         }
35387         void* signer_provider_ptr = untag_ptr(signer_provider);
35388         CHECK_ACCESS(signer_provider_ptr);
35389         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35390         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35391                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35392                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35393         }
35394         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
35395         uint64_t ret_ref = 0;
35396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35398         return ret_ref;
35399 }
35400
35401 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) {
35402         LDKMonitorUpdatingPersister this_arg_conv;
35403         this_arg_conv.inner = untag_ptr(this_arg);
35404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35406         this_arg_conv.is_owned = false;
35407         void* broadcaster_ptr = untag_ptr(broadcaster);
35408         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35409         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35410         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35411         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35412         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35413         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
35414         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
35415         return tag_ptr(ret_conv, true);
35416 }
35417
35418 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) {
35419         LDKMonitorUpdatingPersister this_arg_conv;
35420         this_arg_conv.inner = untag_ptr(this_arg);
35421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35423         this_arg_conv.is_owned = false;
35424         void* broadcaster_ptr = untag_ptr(broadcaster);
35425         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35426         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35427         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35428         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35429         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35430         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
35431         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
35432         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
35433         return tag_ptr(ret_conv, true);
35434 }
35435
35436 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_cleanup_stale_updates"))) TS_MonitorUpdatingPersister_cleanup_stale_updates(uint64_t this_arg, jboolean lazy) {
35437         LDKMonitorUpdatingPersister this_arg_conv;
35438         this_arg_conv.inner = untag_ptr(this_arg);
35439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35441         this_arg_conv.is_owned = false;
35442         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
35443         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
35444         return tag_ptr(ret_conv, true);
35445 }
35446
35447 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_as_Persist"))) TS_MonitorUpdatingPersister_as_Persist(uint64_t this_arg) {
35448         LDKMonitorUpdatingPersister this_arg_conv;
35449         this_arg_conv.inner = untag_ptr(this_arg);
35450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35452         this_arg_conv.is_owned = false;
35453         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
35454         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
35455         return tag_ptr(ret_ret, true);
35456 }
35457
35458 uint32_t  __attribute__((export_name("TS_ShortChannelIdError_clone"))) TS_ShortChannelIdError_clone(uint64_t orig) {
35459         LDKShortChannelIdError* orig_conv = (LDKShortChannelIdError*)untag_ptr(orig);
35460         uint32_t ret_conv = LDKShortChannelIdError_to_js(ShortChannelIdError_clone(orig_conv));
35461         return ret_conv;
35462 }
35463
35464 uint32_t  __attribute__((export_name("TS_ShortChannelIdError_block_overflow"))) TS_ShortChannelIdError_block_overflow() {
35465         uint32_t ret_conv = LDKShortChannelIdError_to_js(ShortChannelIdError_block_overflow());
35466         return ret_conv;
35467 }
35468
35469 uint32_t  __attribute__((export_name("TS_ShortChannelIdError_tx_index_overflow"))) TS_ShortChannelIdError_tx_index_overflow() {
35470         uint32_t ret_conv = LDKShortChannelIdError_to_js(ShortChannelIdError_tx_index_overflow());
35471         return ret_conv;
35472 }
35473
35474 uint32_t  __attribute__((export_name("TS_ShortChannelIdError_vout_index_overflow"))) TS_ShortChannelIdError_vout_index_overflow() {
35475         uint32_t ret_conv = LDKShortChannelIdError_to_js(ShortChannelIdError_vout_index_overflow());
35476         return ret_conv;
35477 }
35478
35479 jboolean  __attribute__((export_name("TS_ShortChannelIdError_eq"))) TS_ShortChannelIdError_eq(uint64_t a, uint64_t b) {
35480         LDKShortChannelIdError* a_conv = (LDKShortChannelIdError*)untag_ptr(a);
35481         LDKShortChannelIdError* b_conv = (LDKShortChannelIdError*)untag_ptr(b);
35482         jboolean ret_conv = ShortChannelIdError_eq(a_conv, b_conv);
35483         return ret_conv;
35484 }
35485
35486 int32_t  __attribute__((export_name("TS_block_from_scid"))) TS_block_from_scid(int64_t short_channel_id) {
35487         int32_t ret_conv = block_from_scid(short_channel_id);
35488         return ret_conv;
35489 }
35490
35491 int32_t  __attribute__((export_name("TS_tx_index_from_scid"))) TS_tx_index_from_scid(int64_t short_channel_id) {
35492         int32_t ret_conv = tx_index_from_scid(short_channel_id);
35493         return ret_conv;
35494 }
35495
35496 int16_t  __attribute__((export_name("TS_vout_from_scid"))) TS_vout_from_scid(int64_t short_channel_id) {
35497         int16_t ret_conv = vout_from_scid(short_channel_id);
35498         return ret_conv;
35499 }
35500
35501 uint64_t  __attribute__((export_name("TS_scid_from_parts"))) TS_scid_from_parts(int64_t block, int64_t tx_index, int64_t vout_index) {
35502         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
35503         *ret_conv = scid_from_parts(block, tx_index, vout_index);
35504         return tag_ptr(ret_conv, true);
35505 }
35506
35507 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
35508         LDKUntrustedString this_obj_conv;
35509         this_obj_conv.inner = untag_ptr(this_obj);
35510         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35512         UntrustedString_free(this_obj_conv);
35513 }
35514
35515 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
35516         LDKUntrustedString this_ptr_conv;
35517         this_ptr_conv.inner = untag_ptr(this_ptr);
35518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35520         this_ptr_conv.is_owned = false;
35521         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
35522         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35523         Str_free(ret_str);
35524         return ret_conv;
35525 }
35526
35527 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
35528         LDKUntrustedString this_ptr_conv;
35529         this_ptr_conv.inner = untag_ptr(this_ptr);
35530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35532         this_ptr_conv.is_owned = false;
35533         LDKStr val_conv = str_ref_to_owned_c(val);
35534         UntrustedString_set_a(&this_ptr_conv, val_conv);
35535 }
35536
35537 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
35538         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
35539         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
35540         uint64_t ret_ref = 0;
35541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35543         return ret_ref;
35544 }
35545
35546 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
35547         LDKUntrustedString ret_var = UntrustedString_clone(arg);
35548         uint64_t ret_ref = 0;
35549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35551         return ret_ref;
35552 }
35553 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
35554         LDKUntrustedString arg_conv;
35555         arg_conv.inner = untag_ptr(arg);
35556         arg_conv.is_owned = ptr_is_owned(arg);
35557         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35558         arg_conv.is_owned = false;
35559         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
35560         return ret_conv;
35561 }
35562
35563 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
35564         LDKUntrustedString orig_conv;
35565         orig_conv.inner = untag_ptr(orig);
35566         orig_conv.is_owned = ptr_is_owned(orig);
35567         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35568         orig_conv.is_owned = false;
35569         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
35570         uint64_t ret_ref = 0;
35571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35573         return ret_ref;
35574 }
35575
35576 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
35577         LDKUntrustedString a_conv;
35578         a_conv.inner = untag_ptr(a);
35579         a_conv.is_owned = ptr_is_owned(a);
35580         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35581         a_conv.is_owned = false;
35582         LDKUntrustedString b_conv;
35583         b_conv.inner = untag_ptr(b);
35584         b_conv.is_owned = ptr_is_owned(b);
35585         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35586         b_conv.is_owned = false;
35587         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
35588         return ret_conv;
35589 }
35590
35591 int64_t  __attribute__((export_name("TS_UntrustedString_hash"))) TS_UntrustedString_hash(uint64_t o) {
35592         LDKUntrustedString o_conv;
35593         o_conv.inner = untag_ptr(o);
35594         o_conv.is_owned = ptr_is_owned(o);
35595         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35596         o_conv.is_owned = false;
35597         int64_t ret_conv = UntrustedString_hash(&o_conv);
35598         return ret_conv;
35599 }
35600
35601 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
35602         LDKUntrustedString obj_conv;
35603         obj_conv.inner = untag_ptr(obj);
35604         obj_conv.is_owned = ptr_is_owned(obj);
35605         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35606         obj_conv.is_owned = false;
35607         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
35608         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35609         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35610         CVec_u8Z_free(ret_var);
35611         return ret_arr;
35612 }
35613
35614 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
35615         LDKu8slice ser_ref;
35616         ser_ref.datalen = ser->arr_len;
35617         ser_ref.data = ser->elems;
35618         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35619         *ret_conv = UntrustedString_read(ser_ref);
35620         FREE(ser);
35621         return tag_ptr(ret_conv, true);
35622 }
35623
35624 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
35625         LDKPrintableString this_obj_conv;
35626         this_obj_conv.inner = untag_ptr(this_obj);
35627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35629         PrintableString_free(this_obj_conv);
35630 }
35631
35632 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
35633         LDKPrintableString this_ptr_conv;
35634         this_ptr_conv.inner = untag_ptr(this_ptr);
35635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35637         this_ptr_conv.is_owned = false;
35638         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
35639         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35640         Str_free(ret_str);
35641         return ret_conv;
35642 }
35643
35644 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
35645         LDKPrintableString this_ptr_conv;
35646         this_ptr_conv.inner = untag_ptr(this_ptr);
35647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35649         this_ptr_conv.is_owned = false;
35650         LDKStr val_conv = str_ref_to_owned_c(val);
35651         PrintableString_set_a(&this_ptr_conv, val_conv);
35652 }
35653
35654 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
35655         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
35656         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
35657         uint64_t ret_ref = 0;
35658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35660         return ret_ref;
35661 }
35662
35663 void  __attribute__((export_name("TS_TrackedSpendableOutput_free"))) TS_TrackedSpendableOutput_free(uint64_t this_obj) {
35664         LDKTrackedSpendableOutput this_obj_conv;
35665         this_obj_conv.inner = untag_ptr(this_obj);
35666         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35668         TrackedSpendableOutput_free(this_obj_conv);
35669 }
35670
35671 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_get_descriptor"))) TS_TrackedSpendableOutput_get_descriptor(uint64_t this_ptr) {
35672         LDKTrackedSpendableOutput this_ptr_conv;
35673         this_ptr_conv.inner = untag_ptr(this_ptr);
35674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35676         this_ptr_conv.is_owned = false;
35677         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
35678         *ret_copy = TrackedSpendableOutput_get_descriptor(&this_ptr_conv);
35679         uint64_t ret_ref = tag_ptr(ret_copy, true);
35680         return ret_ref;
35681 }
35682
35683 void  __attribute__((export_name("TS_TrackedSpendableOutput_set_descriptor"))) TS_TrackedSpendableOutput_set_descriptor(uint64_t this_ptr, uint64_t val) {
35684         LDKTrackedSpendableOutput this_ptr_conv;
35685         this_ptr_conv.inner = untag_ptr(this_ptr);
35686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35688         this_ptr_conv.is_owned = false;
35689         void* val_ptr = untag_ptr(val);
35690         CHECK_ACCESS(val_ptr);
35691         LDKSpendableOutputDescriptor val_conv = *(LDKSpendableOutputDescriptor*)(val_ptr);
35692         val_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(val));
35693         TrackedSpendableOutput_set_descriptor(&this_ptr_conv, val_conv);
35694 }
35695
35696 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_get_channel_id"))) TS_TrackedSpendableOutput_get_channel_id(uint64_t this_ptr) {
35697         LDKTrackedSpendableOutput this_ptr_conv;
35698         this_ptr_conv.inner = untag_ptr(this_ptr);
35699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35701         this_ptr_conv.is_owned = false;
35702         LDKChannelId ret_var = TrackedSpendableOutput_get_channel_id(&this_ptr_conv);
35703         uint64_t ret_ref = 0;
35704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35706         return ret_ref;
35707 }
35708
35709 void  __attribute__((export_name("TS_TrackedSpendableOutput_set_channel_id"))) TS_TrackedSpendableOutput_set_channel_id(uint64_t this_ptr, uint64_t val) {
35710         LDKTrackedSpendableOutput this_ptr_conv;
35711         this_ptr_conv.inner = untag_ptr(this_ptr);
35712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35714         this_ptr_conv.is_owned = false;
35715         LDKChannelId val_conv;
35716         val_conv.inner = untag_ptr(val);
35717         val_conv.is_owned = ptr_is_owned(val);
35718         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35719         val_conv = ChannelId_clone(&val_conv);
35720         TrackedSpendableOutput_set_channel_id(&this_ptr_conv, val_conv);
35721 }
35722
35723 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_get_status"))) TS_TrackedSpendableOutput_get_status(uint64_t this_ptr) {
35724         LDKTrackedSpendableOutput this_ptr_conv;
35725         this_ptr_conv.inner = untag_ptr(this_ptr);
35726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35728         this_ptr_conv.is_owned = false;
35729         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
35730         *ret_copy = TrackedSpendableOutput_get_status(&this_ptr_conv);
35731         uint64_t ret_ref = tag_ptr(ret_copy, true);
35732         return ret_ref;
35733 }
35734
35735 void  __attribute__((export_name("TS_TrackedSpendableOutput_set_status"))) TS_TrackedSpendableOutput_set_status(uint64_t this_ptr, uint64_t val) {
35736         LDKTrackedSpendableOutput this_ptr_conv;
35737         this_ptr_conv.inner = untag_ptr(this_ptr);
35738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35740         this_ptr_conv.is_owned = false;
35741         void* val_ptr = untag_ptr(val);
35742         CHECK_ACCESS(val_ptr);
35743         LDKOutputSpendStatus val_conv = *(LDKOutputSpendStatus*)(val_ptr);
35744         val_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(val));
35745         TrackedSpendableOutput_set_status(&this_ptr_conv, val_conv);
35746 }
35747
35748 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_new"))) TS_TrackedSpendableOutput_new(uint64_t descriptor_arg, uint64_t channel_id_arg, uint64_t status_arg) {
35749         void* descriptor_arg_ptr = untag_ptr(descriptor_arg);
35750         CHECK_ACCESS(descriptor_arg_ptr);
35751         LDKSpendableOutputDescriptor descriptor_arg_conv = *(LDKSpendableOutputDescriptor*)(descriptor_arg_ptr);
35752         descriptor_arg_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptor_arg));
35753         LDKChannelId channel_id_arg_conv;
35754         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
35755         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
35756         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
35757         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
35758         void* status_arg_ptr = untag_ptr(status_arg);
35759         CHECK_ACCESS(status_arg_ptr);
35760         LDKOutputSpendStatus status_arg_conv = *(LDKOutputSpendStatus*)(status_arg_ptr);
35761         status_arg_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(status_arg));
35762         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_new(descriptor_arg_conv, channel_id_arg_conv, status_arg_conv);
35763         uint64_t ret_ref = 0;
35764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35766         return ret_ref;
35767 }
35768
35769 static inline uint64_t TrackedSpendableOutput_clone_ptr(LDKTrackedSpendableOutput *NONNULL_PTR arg) {
35770         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(arg);
35771         uint64_t ret_ref = 0;
35772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35774         return ret_ref;
35775 }
35776 int64_t  __attribute__((export_name("TS_TrackedSpendableOutput_clone_ptr"))) TS_TrackedSpendableOutput_clone_ptr(uint64_t arg) {
35777         LDKTrackedSpendableOutput arg_conv;
35778         arg_conv.inner = untag_ptr(arg);
35779         arg_conv.is_owned = ptr_is_owned(arg);
35780         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35781         arg_conv.is_owned = false;
35782         int64_t ret_conv = TrackedSpendableOutput_clone_ptr(&arg_conv);
35783         return ret_conv;
35784 }
35785
35786 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_clone"))) TS_TrackedSpendableOutput_clone(uint64_t orig) {
35787         LDKTrackedSpendableOutput orig_conv;
35788         orig_conv.inner = untag_ptr(orig);
35789         orig_conv.is_owned = ptr_is_owned(orig);
35790         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35791         orig_conv.is_owned = false;
35792         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(&orig_conv);
35793         uint64_t ret_ref = 0;
35794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35796         return ret_ref;
35797 }
35798
35799 jboolean  __attribute__((export_name("TS_TrackedSpendableOutput_eq"))) TS_TrackedSpendableOutput_eq(uint64_t a, uint64_t b) {
35800         LDKTrackedSpendableOutput a_conv;
35801         a_conv.inner = untag_ptr(a);
35802         a_conv.is_owned = ptr_is_owned(a);
35803         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35804         a_conv.is_owned = false;
35805         LDKTrackedSpendableOutput b_conv;
35806         b_conv.inner = untag_ptr(b);
35807         b_conv.is_owned = ptr_is_owned(b);
35808         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35809         b_conv.is_owned = false;
35810         jboolean ret_conv = TrackedSpendableOutput_eq(&a_conv, &b_conv);
35811         return ret_conv;
35812 }
35813
35814 jboolean  __attribute__((export_name("TS_TrackedSpendableOutput_is_spent_in"))) TS_TrackedSpendableOutput_is_spent_in(uint64_t this_arg, int8_tArray tx) {
35815         LDKTrackedSpendableOutput this_arg_conv;
35816         this_arg_conv.inner = untag_ptr(this_arg);
35817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35819         this_arg_conv.is_owned = false;
35820         LDKTransaction tx_ref;
35821         tx_ref.datalen = tx->arr_len;
35822         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
35823         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
35824         tx_ref.data_is_owned = true;
35825         jboolean ret_conv = TrackedSpendableOutput_is_spent_in(&this_arg_conv, tx_ref);
35826         return ret_conv;
35827 }
35828
35829 int8_tArray  __attribute__((export_name("TS_TrackedSpendableOutput_write"))) TS_TrackedSpendableOutput_write(uint64_t obj) {
35830         LDKTrackedSpendableOutput obj_conv;
35831         obj_conv.inner = untag_ptr(obj);
35832         obj_conv.is_owned = ptr_is_owned(obj);
35833         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35834         obj_conv.is_owned = false;
35835         LDKCVec_u8Z ret_var = TrackedSpendableOutput_write(&obj_conv);
35836         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35837         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35838         CVec_u8Z_free(ret_var);
35839         return ret_arr;
35840 }
35841
35842 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_read"))) TS_TrackedSpendableOutput_read(int8_tArray ser) {
35843         LDKu8slice ser_ref;
35844         ser_ref.datalen = ser->arr_len;
35845         ser_ref.data = ser->elems;
35846         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
35847         *ret_conv = TrackedSpendableOutput_read(ser_ref);
35848         FREE(ser);
35849         return tag_ptr(ret_conv, true);
35850 }
35851
35852 void  __attribute__((export_name("TS_OutputSpendStatus_free"))) TS_OutputSpendStatus_free(uint64_t this_ptr) {
35853         if (!ptr_is_owned(this_ptr)) return;
35854         void* this_ptr_ptr = untag_ptr(this_ptr);
35855         CHECK_ACCESS(this_ptr_ptr);
35856         LDKOutputSpendStatus this_ptr_conv = *(LDKOutputSpendStatus*)(this_ptr_ptr);
35857         FREE(untag_ptr(this_ptr));
35858         OutputSpendStatus_free(this_ptr_conv);
35859 }
35860
35861 static inline uint64_t OutputSpendStatus_clone_ptr(LDKOutputSpendStatus *NONNULL_PTR arg) {
35862         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
35863         *ret_copy = OutputSpendStatus_clone(arg);
35864         uint64_t ret_ref = tag_ptr(ret_copy, true);
35865         return ret_ref;
35866 }
35867 int64_t  __attribute__((export_name("TS_OutputSpendStatus_clone_ptr"))) TS_OutputSpendStatus_clone_ptr(uint64_t arg) {
35868         LDKOutputSpendStatus* arg_conv = (LDKOutputSpendStatus*)untag_ptr(arg);
35869         int64_t ret_conv = OutputSpendStatus_clone_ptr(arg_conv);
35870         return ret_conv;
35871 }
35872
35873 uint64_t  __attribute__((export_name("TS_OutputSpendStatus_clone"))) TS_OutputSpendStatus_clone(uint64_t orig) {
35874         LDKOutputSpendStatus* orig_conv = (LDKOutputSpendStatus*)untag_ptr(orig);
35875         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
35876         *ret_copy = OutputSpendStatus_clone(orig_conv);
35877         uint64_t ret_ref = tag_ptr(ret_copy, true);
35878         return ret_ref;
35879 }
35880
35881 uint64_t  __attribute__((export_name("TS_OutputSpendStatus_pending_initial_broadcast"))) TS_OutputSpendStatus_pending_initial_broadcast(uint64_t delayed_until_height) {
35882         void* delayed_until_height_ptr = untag_ptr(delayed_until_height);
35883         CHECK_ACCESS(delayed_until_height_ptr);
35884         LDKCOption_u32Z delayed_until_height_conv = *(LDKCOption_u32Z*)(delayed_until_height_ptr);
35885         delayed_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delayed_until_height));
35886         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
35887         *ret_copy = OutputSpendStatus_pending_initial_broadcast(delayed_until_height_conv);
35888         uint64_t ret_ref = tag_ptr(ret_copy, true);
35889         return ret_ref;
35890 }
35891
35892 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) {
35893         LDKThirtyTwoBytes first_broadcast_hash_ref;
35894         CHECK(first_broadcast_hash->arr_len == 32);
35895         memcpy(first_broadcast_hash_ref.data, first_broadcast_hash->elems, 32); FREE(first_broadcast_hash);
35896         LDKTransaction latest_spending_tx_ref;
35897         latest_spending_tx_ref.datalen = latest_spending_tx->arr_len;
35898         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
35899         memcpy(latest_spending_tx_ref.data, latest_spending_tx->elems, latest_spending_tx_ref.datalen); FREE(latest_spending_tx);
35900         latest_spending_tx_ref.data_is_owned = true;
35901         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
35902         *ret_copy = OutputSpendStatus_pending_first_confirmation(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref);
35903         uint64_t ret_ref = tag_ptr(ret_copy, true);
35904         return ret_ref;
35905 }
35906
35907 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) {
35908         LDKThirtyTwoBytes first_broadcast_hash_ref;
35909         CHECK(first_broadcast_hash->arr_len == 32);
35910         memcpy(first_broadcast_hash_ref.data, first_broadcast_hash->elems, 32); FREE(first_broadcast_hash);
35911         LDKTransaction latest_spending_tx_ref;
35912         latest_spending_tx_ref.datalen = latest_spending_tx->arr_len;
35913         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
35914         memcpy(latest_spending_tx_ref.data, latest_spending_tx->elems, latest_spending_tx_ref.datalen); FREE(latest_spending_tx);
35915         latest_spending_tx_ref.data_is_owned = true;
35916         LDKThirtyTwoBytes confirmation_hash_ref;
35917         CHECK(confirmation_hash->arr_len == 32);
35918         memcpy(confirmation_hash_ref.data, confirmation_hash->elems, 32); FREE(confirmation_hash);
35919         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
35920         *ret_copy = OutputSpendStatus_pending_threshold_confirmations(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref, confirmation_height, confirmation_hash_ref);
35921         uint64_t ret_ref = tag_ptr(ret_copy, true);
35922         return ret_ref;
35923 }
35924
35925 jboolean  __attribute__((export_name("TS_OutputSpendStatus_eq"))) TS_OutputSpendStatus_eq(uint64_t a, uint64_t b) {
35926         LDKOutputSpendStatus* a_conv = (LDKOutputSpendStatus*)untag_ptr(a);
35927         LDKOutputSpendStatus* b_conv = (LDKOutputSpendStatus*)untag_ptr(b);
35928         jboolean ret_conv = OutputSpendStatus_eq(a_conv, b_conv);
35929         return ret_conv;
35930 }
35931
35932 int8_tArray  __attribute__((export_name("TS_OutputSpendStatus_write"))) TS_OutputSpendStatus_write(uint64_t obj) {
35933         LDKOutputSpendStatus* obj_conv = (LDKOutputSpendStatus*)untag_ptr(obj);
35934         LDKCVec_u8Z ret_var = OutputSpendStatus_write(obj_conv);
35935         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35936         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35937         CVec_u8Z_free(ret_var);
35938         return ret_arr;
35939 }
35940
35941 uint64_t  __attribute__((export_name("TS_OutputSpendStatus_read"))) TS_OutputSpendStatus_read(int8_tArray ser) {
35942         LDKu8slice ser_ref;
35943         ser_ref.datalen = ser->arr_len;
35944         ser_ref.data = ser->elems;
35945         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
35946         *ret_conv = OutputSpendStatus_read(ser_ref);
35947         FREE(ser);
35948         return tag_ptr(ret_conv, true);
35949 }
35950
35951 void  __attribute__((export_name("TS_OutputSweeper_free"))) TS_OutputSweeper_free(uint64_t this_obj) {
35952         LDKOutputSweeper this_obj_conv;
35953         this_obj_conv.inner = untag_ptr(this_obj);
35954         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35956         OutputSweeper_free(this_obj_conv);
35957 }
35958
35959 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) {
35960         LDKBestBlock best_block_conv;
35961         best_block_conv.inner = untag_ptr(best_block);
35962         best_block_conv.is_owned = ptr_is_owned(best_block);
35963         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_conv);
35964         best_block_conv = BestBlock_clone(&best_block_conv);
35965         void* broadcaster_ptr = untag_ptr(broadcaster);
35966         CHECK_ACCESS(broadcaster_ptr);
35967         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35968         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35969                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35970                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35971         }
35972         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35973         CHECK_ACCESS(fee_estimator_ptr);
35974         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35975         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35976                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35977                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35978         }
35979         void* chain_data_source_ptr = untag_ptr(chain_data_source);
35980         CHECK_ACCESS(chain_data_source_ptr);
35981         LDKCOption_FilterZ chain_data_source_conv = *(LDKCOption_FilterZ*)(chain_data_source_ptr);
35982         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
35983         if (chain_data_source_conv.tag == LDKCOption_FilterZ_Some) {
35984                 // Manually implement clone for Java trait instances
35985                 if (chain_data_source_conv.some.free == LDKFilter_JCalls_free) {
35986                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35987                         LDKFilter_JCalls_cloned(&chain_data_source_conv.some);
35988                 }
35989         }
35990         void* output_spender_ptr = untag_ptr(output_spender);
35991         CHECK_ACCESS(output_spender_ptr);
35992         LDKOutputSpender output_spender_conv = *(LDKOutputSpender*)(output_spender_ptr);
35993         if (output_spender_conv.free == LDKOutputSpender_JCalls_free) {
35994                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35995                 LDKOutputSpender_JCalls_cloned(&output_spender_conv);
35996         }
35997         void* change_destination_source_ptr = untag_ptr(change_destination_source);
35998         CHECK_ACCESS(change_destination_source_ptr);
35999         LDKChangeDestinationSource change_destination_source_conv = *(LDKChangeDestinationSource*)(change_destination_source_ptr);
36000         if (change_destination_source_conv.free == LDKChangeDestinationSource_JCalls_free) {
36001                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36002                 LDKChangeDestinationSource_JCalls_cloned(&change_destination_source_conv);
36003         }
36004         void* kv_store_ptr = untag_ptr(kv_store);
36005         CHECK_ACCESS(kv_store_ptr);
36006         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
36007         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
36008                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36009                 LDKKVStore_JCalls_cloned(&kv_store_conv);
36010         }
36011         void* logger_ptr = untag_ptr(logger);
36012         CHECK_ACCESS(logger_ptr);
36013         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36014         if (logger_conv.free == LDKLogger_JCalls_free) {
36015                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36016                 LDKLogger_JCalls_cloned(&logger_conv);
36017         }
36018         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);
36019         uint64_t ret_ref = 0;
36020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36022         return ret_ref;
36023 }
36024
36025 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) {
36026         LDKOutputSweeper this_arg_conv;
36027         this_arg_conv.inner = untag_ptr(this_arg);
36028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36030         this_arg_conv.is_owned = false;
36031         LDKCVec_SpendableOutputDescriptorZ output_descriptors_constr;
36032         output_descriptors_constr.datalen = output_descriptors->arr_len;
36033         if (output_descriptors_constr.datalen > 0)
36034                 output_descriptors_constr.data = MALLOC(output_descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
36035         else
36036                 output_descriptors_constr.data = NULL;
36037         uint64_t* output_descriptors_vals = output_descriptors->elems;
36038         for (size_t b = 0; b < output_descriptors_constr.datalen; b++) {
36039                 uint64_t output_descriptors_conv_27 = output_descriptors_vals[b];
36040                 void* output_descriptors_conv_27_ptr = untag_ptr(output_descriptors_conv_27);
36041                 CHECK_ACCESS(output_descriptors_conv_27_ptr);
36042                 LDKSpendableOutputDescriptor output_descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(output_descriptors_conv_27_ptr);
36043                 output_descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(output_descriptors_conv_27));
36044                 output_descriptors_constr.data[b] = output_descriptors_conv_27_conv;
36045         }
36046         FREE(output_descriptors);
36047         LDKChannelId channel_id_conv;
36048         channel_id_conv.inner = untag_ptr(channel_id);
36049         channel_id_conv.is_owned = ptr_is_owned(channel_id);
36050         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
36051         channel_id_conv = ChannelId_clone(&channel_id_conv);
36052         void* delay_until_height_ptr = untag_ptr(delay_until_height);
36053         CHECK_ACCESS(delay_until_height_ptr);
36054         LDKCOption_u32Z delay_until_height_conv = *(LDKCOption_u32Z*)(delay_until_height_ptr);
36055         delay_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delay_until_height));
36056         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
36057         *ret_conv = OutputSweeper_track_spendable_outputs(&this_arg_conv, output_descriptors_constr, channel_id_conv, exclude_static_outputs, delay_until_height_conv);
36058         return tag_ptr(ret_conv, true);
36059 }
36060
36061 uint64_tArray  __attribute__((export_name("TS_OutputSweeper_tracked_spendable_outputs"))) TS_OutputSweeper_tracked_spendable_outputs(uint64_t this_arg) {
36062         LDKOutputSweeper this_arg_conv;
36063         this_arg_conv.inner = untag_ptr(this_arg);
36064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36066         this_arg_conv.is_owned = false;
36067         LDKCVec_TrackedSpendableOutputZ ret_var = OutputSweeper_tracked_spendable_outputs(&this_arg_conv);
36068         uint64_tArray ret_arr = NULL;
36069         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36070         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36071         for (size_t y = 0; y < ret_var.datalen; y++) {
36072                 LDKTrackedSpendableOutput ret_conv_24_var = ret_var.data[y];
36073                 uint64_t ret_conv_24_ref = 0;
36074                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_24_var);
36075                 ret_conv_24_ref = tag_ptr(ret_conv_24_var.inner, ret_conv_24_var.is_owned);
36076                 ret_arr_ptr[y] = ret_conv_24_ref;
36077         }
36078         
36079         FREE(ret_var.data);
36080         return ret_arr;
36081 }
36082
36083 uint64_t  __attribute__((export_name("TS_OutputSweeper_current_best_block"))) TS_OutputSweeper_current_best_block(uint64_t this_arg) {
36084         LDKOutputSweeper this_arg_conv;
36085         this_arg_conv.inner = untag_ptr(this_arg);
36086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36088         this_arg_conv.is_owned = false;
36089         LDKBestBlock ret_var = OutputSweeper_current_best_block(&this_arg_conv);
36090         uint64_t ret_ref = 0;
36091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36093         return ret_ref;
36094 }
36095
36096 uint64_t  __attribute__((export_name("TS_OutputSweeper_as_Listen"))) TS_OutputSweeper_as_Listen(uint64_t this_arg) {
36097         LDKOutputSweeper this_arg_conv;
36098         this_arg_conv.inner = untag_ptr(this_arg);
36099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36101         this_arg_conv.is_owned = false;
36102         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
36103         *ret_ret = OutputSweeper_as_Listen(&this_arg_conv);
36104         return tag_ptr(ret_ret, true);
36105 }
36106
36107 uint64_t  __attribute__((export_name("TS_OutputSweeper_as_Confirm"))) TS_OutputSweeper_as_Confirm(uint64_t this_arg) {
36108         LDKOutputSweeper this_arg_conv;
36109         this_arg_conv.inner = untag_ptr(this_arg);
36110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36112         this_arg_conv.is_owned = false;
36113         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
36114         *ret_ret = OutputSweeper_as_Confirm(&this_arg_conv);
36115         return tag_ptr(ret_ret, true);
36116 }
36117
36118 void  __attribute__((export_name("TS_SpendingDelay_free"))) TS_SpendingDelay_free(uint64_t this_ptr) {
36119         if (!ptr_is_owned(this_ptr)) return;
36120         void* this_ptr_ptr = untag_ptr(this_ptr);
36121         CHECK_ACCESS(this_ptr_ptr);
36122         LDKSpendingDelay this_ptr_conv = *(LDKSpendingDelay*)(this_ptr_ptr);
36123         FREE(untag_ptr(this_ptr));
36124         SpendingDelay_free(this_ptr_conv);
36125 }
36126
36127 static inline uint64_t SpendingDelay_clone_ptr(LDKSpendingDelay *NONNULL_PTR arg) {
36128         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36129         *ret_copy = SpendingDelay_clone(arg);
36130         uint64_t ret_ref = tag_ptr(ret_copy, true);
36131         return ret_ref;
36132 }
36133 int64_t  __attribute__((export_name("TS_SpendingDelay_clone_ptr"))) TS_SpendingDelay_clone_ptr(uint64_t arg) {
36134         LDKSpendingDelay* arg_conv = (LDKSpendingDelay*)untag_ptr(arg);
36135         int64_t ret_conv = SpendingDelay_clone_ptr(arg_conv);
36136         return ret_conv;
36137 }
36138
36139 uint64_t  __attribute__((export_name("TS_SpendingDelay_clone"))) TS_SpendingDelay_clone(uint64_t orig) {
36140         LDKSpendingDelay* orig_conv = (LDKSpendingDelay*)untag_ptr(orig);
36141         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36142         *ret_copy = SpendingDelay_clone(orig_conv);
36143         uint64_t ret_ref = tag_ptr(ret_copy, true);
36144         return ret_ref;
36145 }
36146
36147 uint64_t  __attribute__((export_name("TS_SpendingDelay_relative"))) TS_SpendingDelay_relative(int32_t num_blocks) {
36148         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36149         *ret_copy = SpendingDelay_relative(num_blocks);
36150         uint64_t ret_ref = tag_ptr(ret_copy, true);
36151         return ret_ref;
36152 }
36153
36154 uint64_t  __attribute__((export_name("TS_SpendingDelay_absolute"))) TS_SpendingDelay_absolute(int32_t height) {
36155         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36156         *ret_copy = SpendingDelay_absolute(height);
36157         uint64_t ret_ref = tag_ptr(ret_copy, true);
36158         return ret_ref;
36159 }
36160
36161 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) {
36162         LDKu8slice ser_ref;
36163         ser_ref.datalen = ser->arr_len;
36164         ser_ref.data = ser->elems;
36165         void* arg_a_ptr = untag_ptr(arg_a);
36166         CHECK_ACCESS(arg_a_ptr);
36167         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
36168         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
36169                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36170                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
36171         }
36172         void* arg_b_ptr = untag_ptr(arg_b);
36173         CHECK_ACCESS(arg_b_ptr);
36174         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
36175         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
36176                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36177                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
36178         }
36179         void* arg_c_ptr = untag_ptr(arg_c);
36180         CHECK_ACCESS(arg_c_ptr);
36181         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
36182         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
36183         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
36184                 // Manually implement clone for Java trait instances
36185                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
36186                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36187                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
36188                 }
36189         }
36190         void* arg_d_ptr = untag_ptr(arg_d);
36191         CHECK_ACCESS(arg_d_ptr);
36192         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
36193         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
36194                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36195                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
36196         }
36197         void* arg_e_ptr = untag_ptr(arg_e);
36198         CHECK_ACCESS(arg_e_ptr);
36199         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
36200         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
36201                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36202                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
36203         }
36204         void* arg_f_ptr = untag_ptr(arg_f);
36205         CHECK_ACCESS(arg_f_ptr);
36206         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
36207         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
36208                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36209                 LDKKVStore_JCalls_cloned(&arg_f_conv);
36210         }
36211         void* arg_g_ptr = untag_ptr(arg_g);
36212         CHECK_ACCESS(arg_g_ptr);
36213         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
36214         if (arg_g_conv.free == LDKLogger_JCalls_free) {
36215                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36216                 LDKLogger_JCalls_cloned(&arg_g_conv);
36217         }
36218         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
36219         *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);
36220         FREE(ser);
36221         return tag_ptr(ret_conv, true);
36222 }
36223
36224 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) {
36225         LDKu8slice ser_ref;
36226         ser_ref.datalen = ser->arr_len;
36227         ser_ref.data = ser->elems;
36228         void* arg_a_ptr = untag_ptr(arg_a);
36229         CHECK_ACCESS(arg_a_ptr);
36230         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
36231         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
36232                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36233                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
36234         }
36235         void* arg_b_ptr = untag_ptr(arg_b);
36236         CHECK_ACCESS(arg_b_ptr);
36237         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
36238         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
36239                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36240                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
36241         }
36242         void* arg_c_ptr = untag_ptr(arg_c);
36243         CHECK_ACCESS(arg_c_ptr);
36244         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
36245         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
36246         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
36247                 // Manually implement clone for Java trait instances
36248                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
36249                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36250                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
36251                 }
36252         }
36253         void* arg_d_ptr = untag_ptr(arg_d);
36254         CHECK_ACCESS(arg_d_ptr);
36255         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
36256         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
36257                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36258                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
36259         }
36260         void* arg_e_ptr = untag_ptr(arg_e);
36261         CHECK_ACCESS(arg_e_ptr);
36262         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
36263         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
36264                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36265                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
36266         }
36267         void* arg_f_ptr = untag_ptr(arg_f);
36268         CHECK_ACCESS(arg_f_ptr);
36269         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
36270         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
36271                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36272                 LDKKVStore_JCalls_cloned(&arg_f_conv);
36273         }
36274         void* arg_g_ptr = untag_ptr(arg_g);
36275         CHECK_ACCESS(arg_g_ptr);
36276         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
36277         if (arg_g_conv.free == LDKLogger_JCalls_free) {
36278                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36279                 LDKLogger_JCalls_cloned(&arg_g_conv);
36280         }
36281         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
36282         *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);
36283         FREE(ser);
36284         return tag_ptr(ret_conv, true);
36285 }
36286
36287 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
36288         if (!ptr_is_owned(this_ptr)) return;
36289         void* this_ptr_ptr = untag_ptr(this_ptr);
36290         CHECK_ACCESS(this_ptr_ptr);
36291         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
36292         FREE(untag_ptr(this_ptr));
36293         FutureCallback_free(this_ptr_conv);
36294 }
36295
36296 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
36297         LDKFuture this_obj_conv;
36298         this_obj_conv.inner = untag_ptr(this_obj);
36299         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36301         Future_free(this_obj_conv);
36302 }
36303
36304 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
36305         LDKFuture this_arg_conv;
36306         this_arg_conv.inner = untag_ptr(this_arg);
36307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36309         this_arg_conv.is_owned = false;
36310         void* callback_ptr = untag_ptr(callback);
36311         CHECK_ACCESS(callback_ptr);
36312         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
36313         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
36314                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36315                 LDKFutureCallback_JCalls_cloned(&callback_conv);
36316         }
36317         Future_register_callback_fn(&this_arg_conv, callback_conv);
36318 }
36319
36320 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
36321         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
36322         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
36323         return ret_conv;
36324 }
36325
36326 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
36327         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
36328         return ret_conv;
36329 }
36330
36331 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
36332         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
36333         return ret_conv;
36334 }
36335
36336 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
36337         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
36338         return ret_conv;
36339 }
36340
36341 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
36342         uint32_t ret_conv = LDKLevel_to_js(Level_info());
36343         return ret_conv;
36344 }
36345
36346 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
36347         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
36348         return ret_conv;
36349 }
36350
36351 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
36352         uint32_t ret_conv = LDKLevel_to_js(Level_error());
36353         return ret_conv;
36354 }
36355
36356 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
36357         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
36358         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
36359         jboolean ret_conv = Level_eq(a_conv, b_conv);
36360         return ret_conv;
36361 }
36362
36363 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
36364         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
36365         int64_t ret_conv = Level_hash(o_conv);
36366         return ret_conv;
36367 }
36368
36369 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
36370         uint32_t ret_conv = LDKLevel_to_js(Level_max());
36371         return ret_conv;
36372 }
36373
36374 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
36375         LDKRecord this_obj_conv;
36376         this_obj_conv.inner = untag_ptr(this_obj);
36377         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36379         Record_free(this_obj_conv);
36380 }
36381
36382 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
36383         LDKRecord this_ptr_conv;
36384         this_ptr_conv.inner = untag_ptr(this_ptr);
36385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36387         this_ptr_conv.is_owned = false;
36388         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
36389         return ret_conv;
36390 }
36391
36392 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
36393         LDKRecord this_ptr_conv;
36394         this_ptr_conv.inner = untag_ptr(this_ptr);
36395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36397         this_ptr_conv.is_owned = false;
36398         LDKLevel val_conv = LDKLevel_from_js(val);
36399         Record_set_level(&this_ptr_conv, val_conv);
36400 }
36401
36402 int8_tArray  __attribute__((export_name("TS_Record_get_peer_id"))) TS_Record_get_peer_id(uint64_t this_ptr) {
36403         LDKRecord this_ptr_conv;
36404         this_ptr_conv.inner = untag_ptr(this_ptr);
36405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36407         this_ptr_conv.is_owned = false;
36408         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36409         memcpy(ret_arr->elems, Record_get_peer_id(&this_ptr_conv).compressed_form, 33);
36410         return ret_arr;
36411 }
36412
36413 void  __attribute__((export_name("TS_Record_set_peer_id"))) TS_Record_set_peer_id(uint64_t this_ptr, int8_tArray val) {
36414         LDKRecord this_ptr_conv;
36415         this_ptr_conv.inner = untag_ptr(this_ptr);
36416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36418         this_ptr_conv.is_owned = false;
36419         LDKPublicKey val_ref;
36420         CHECK(val->arr_len == 33);
36421         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36422         Record_set_peer_id(&this_ptr_conv, val_ref);
36423 }
36424
36425 uint64_t  __attribute__((export_name("TS_Record_get_channel_id"))) TS_Record_get_channel_id(uint64_t this_ptr) {
36426         LDKRecord this_ptr_conv;
36427         this_ptr_conv.inner = untag_ptr(this_ptr);
36428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36430         this_ptr_conv.is_owned = false;
36431         LDKChannelId ret_var = Record_get_channel_id(&this_ptr_conv);
36432         uint64_t ret_ref = 0;
36433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36435         return ret_ref;
36436 }
36437
36438 void  __attribute__((export_name("TS_Record_set_channel_id"))) TS_Record_set_channel_id(uint64_t this_ptr, uint64_t val) {
36439         LDKRecord this_ptr_conv;
36440         this_ptr_conv.inner = untag_ptr(this_ptr);
36441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36443         this_ptr_conv.is_owned = false;
36444         LDKChannelId val_conv;
36445         val_conv.inner = untag_ptr(val);
36446         val_conv.is_owned = ptr_is_owned(val);
36447         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36448         val_conv = ChannelId_clone(&val_conv);
36449         Record_set_channel_id(&this_ptr_conv, val_conv);
36450 }
36451
36452 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
36453         LDKRecord this_ptr_conv;
36454         this_ptr_conv.inner = untag_ptr(this_ptr);
36455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36457         this_ptr_conv.is_owned = false;
36458         LDKStr ret_str = Record_get_args(&this_ptr_conv);
36459         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36460         Str_free(ret_str);
36461         return ret_conv;
36462 }
36463
36464 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
36465         LDKRecord this_ptr_conv;
36466         this_ptr_conv.inner = untag_ptr(this_ptr);
36467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36469         this_ptr_conv.is_owned = false;
36470         LDKStr val_conv = str_ref_to_owned_c(val);
36471         Record_set_args(&this_ptr_conv, val_conv);
36472 }
36473
36474 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
36475         LDKRecord this_ptr_conv;
36476         this_ptr_conv.inner = untag_ptr(this_ptr);
36477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36479         this_ptr_conv.is_owned = false;
36480         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
36481         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36482         Str_free(ret_str);
36483         return ret_conv;
36484 }
36485
36486 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
36487         LDKRecord this_ptr_conv;
36488         this_ptr_conv.inner = untag_ptr(this_ptr);
36489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36491         this_ptr_conv.is_owned = false;
36492         LDKStr val_conv = str_ref_to_owned_c(val);
36493         Record_set_module_path(&this_ptr_conv, val_conv);
36494 }
36495
36496 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
36497         LDKRecord this_ptr_conv;
36498         this_ptr_conv.inner = untag_ptr(this_ptr);
36499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36501         this_ptr_conv.is_owned = false;
36502         LDKStr ret_str = Record_get_file(&this_ptr_conv);
36503         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36504         Str_free(ret_str);
36505         return ret_conv;
36506 }
36507
36508 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
36509         LDKRecord this_ptr_conv;
36510         this_ptr_conv.inner = untag_ptr(this_ptr);
36511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36513         this_ptr_conv.is_owned = false;
36514         LDKStr val_conv = str_ref_to_owned_c(val);
36515         Record_set_file(&this_ptr_conv, val_conv);
36516 }
36517
36518 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
36519         LDKRecord this_ptr_conv;
36520         this_ptr_conv.inner = untag_ptr(this_ptr);
36521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36523         this_ptr_conv.is_owned = false;
36524         int32_t ret_conv = Record_get_line(&this_ptr_conv);
36525         return ret_conv;
36526 }
36527
36528 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
36529         LDKRecord this_ptr_conv;
36530         this_ptr_conv.inner = untag_ptr(this_ptr);
36531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36533         this_ptr_conv.is_owned = false;
36534         Record_set_line(&this_ptr_conv, val);
36535 }
36536
36537 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) {
36538         LDKLevel level_arg_conv = LDKLevel_from_js(level_arg);
36539         LDKPublicKey peer_id_arg_ref;
36540         CHECK(peer_id_arg->arr_len == 33);
36541         memcpy(peer_id_arg_ref.compressed_form, peer_id_arg->elems, 33); FREE(peer_id_arg);
36542         LDKChannelId channel_id_arg_conv;
36543         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
36544         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
36545         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
36546         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
36547         LDKStr args_arg_conv = str_ref_to_owned_c(args_arg);
36548         LDKStr module_path_arg_conv = str_ref_to_owned_c(module_path_arg);
36549         LDKStr file_arg_conv = str_ref_to_owned_c(file_arg);
36550         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);
36551         uint64_t ret_ref = 0;
36552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36554         return ret_ref;
36555 }
36556
36557 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
36558         LDKRecord ret_var = Record_clone(arg);
36559         uint64_t ret_ref = 0;
36560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36562         return ret_ref;
36563 }
36564 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
36565         LDKRecord arg_conv;
36566         arg_conv.inner = untag_ptr(arg);
36567         arg_conv.is_owned = ptr_is_owned(arg);
36568         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36569         arg_conv.is_owned = false;
36570         int64_t ret_conv = Record_clone_ptr(&arg_conv);
36571         return ret_conv;
36572 }
36573
36574 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
36575         LDKRecord orig_conv;
36576         orig_conv.inner = untag_ptr(orig);
36577         orig_conv.is_owned = ptr_is_owned(orig);
36578         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36579         orig_conv.is_owned = false;
36580         LDKRecord ret_var = Record_clone(&orig_conv);
36581         uint64_t ret_ref = 0;
36582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36584         return ret_ref;
36585 }
36586
36587 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
36588         if (!ptr_is_owned(this_ptr)) return;
36589         void* this_ptr_ptr = untag_ptr(this_ptr);
36590         CHECK_ACCESS(this_ptr_ptr);
36591         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
36592         FREE(untag_ptr(this_ptr));
36593         Logger_free(this_ptr_conv);
36594 }
36595
36596 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
36597         LDKChannelHandshakeConfig this_obj_conv;
36598         this_obj_conv.inner = untag_ptr(this_obj);
36599         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36601         ChannelHandshakeConfig_free(this_obj_conv);
36602 }
36603
36604 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
36605         LDKChannelHandshakeConfig this_ptr_conv;
36606         this_ptr_conv.inner = untag_ptr(this_ptr);
36607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36609         this_ptr_conv.is_owned = false;
36610         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
36611         return ret_conv;
36612 }
36613
36614 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
36615         LDKChannelHandshakeConfig this_ptr_conv;
36616         this_ptr_conv.inner = untag_ptr(this_ptr);
36617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36619         this_ptr_conv.is_owned = false;
36620         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
36621 }
36622
36623 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
36624         LDKChannelHandshakeConfig this_ptr_conv;
36625         this_ptr_conv.inner = untag_ptr(this_ptr);
36626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36628         this_ptr_conv.is_owned = false;
36629         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
36630         return ret_conv;
36631 }
36632
36633 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) {
36634         LDKChannelHandshakeConfig this_ptr_conv;
36635         this_ptr_conv.inner = untag_ptr(this_ptr);
36636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36638         this_ptr_conv.is_owned = false;
36639         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
36640 }
36641
36642 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
36643         LDKChannelHandshakeConfig this_ptr_conv;
36644         this_ptr_conv.inner = untag_ptr(this_ptr);
36645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36647         this_ptr_conv.is_owned = false;
36648         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
36649         return ret_conv;
36650 }
36651
36652 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) {
36653         LDKChannelHandshakeConfig this_ptr_conv;
36654         this_ptr_conv.inner = untag_ptr(this_ptr);
36655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36657         this_ptr_conv.is_owned = false;
36658         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
36659 }
36660
36661 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) {
36662         LDKChannelHandshakeConfig this_ptr_conv;
36663         this_ptr_conv.inner = untag_ptr(this_ptr);
36664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36666         this_ptr_conv.is_owned = false;
36667         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
36668         return ret_conv;
36669 }
36670
36671 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) {
36672         LDKChannelHandshakeConfig this_ptr_conv;
36673         this_ptr_conv.inner = untag_ptr(this_ptr);
36674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36676         this_ptr_conv.is_owned = false;
36677         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
36678 }
36679
36680 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
36681         LDKChannelHandshakeConfig this_ptr_conv;
36682         this_ptr_conv.inner = untag_ptr(this_ptr);
36683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36685         this_ptr_conv.is_owned = false;
36686         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
36687         return ret_conv;
36688 }
36689
36690 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
36691         LDKChannelHandshakeConfig this_ptr_conv;
36692         this_ptr_conv.inner = untag_ptr(this_ptr);
36693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36695         this_ptr_conv.is_owned = false;
36696         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
36697 }
36698
36699 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
36700         LDKChannelHandshakeConfig this_ptr_conv;
36701         this_ptr_conv.inner = untag_ptr(this_ptr);
36702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36704         this_ptr_conv.is_owned = false;
36705         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
36706         return ret_conv;
36707 }
36708
36709 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
36710         LDKChannelHandshakeConfig this_ptr_conv;
36711         this_ptr_conv.inner = untag_ptr(this_ptr);
36712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36714         this_ptr_conv.is_owned = false;
36715         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
36716 }
36717
36718 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
36719         LDKChannelHandshakeConfig this_ptr_conv;
36720         this_ptr_conv.inner = untag_ptr(this_ptr);
36721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36723         this_ptr_conv.is_owned = false;
36724         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
36725         return ret_conv;
36726 }
36727
36728 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
36729         LDKChannelHandshakeConfig this_ptr_conv;
36730         this_ptr_conv.inner = untag_ptr(this_ptr);
36731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36733         this_ptr_conv.is_owned = false;
36734         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
36735 }
36736
36737 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) {
36738         LDKChannelHandshakeConfig this_ptr_conv;
36739         this_ptr_conv.inner = untag_ptr(this_ptr);
36740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36742         this_ptr_conv.is_owned = false;
36743         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
36744         return ret_conv;
36745 }
36746
36747 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) {
36748         LDKChannelHandshakeConfig this_ptr_conv;
36749         this_ptr_conv.inner = untag_ptr(this_ptr);
36750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36752         this_ptr_conv.is_owned = false;
36753         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
36754 }
36755
36756 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) {
36757         LDKChannelHandshakeConfig this_ptr_conv;
36758         this_ptr_conv.inner = untag_ptr(this_ptr);
36759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36761         this_ptr_conv.is_owned = false;
36762         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
36763         return ret_conv;
36764 }
36765
36766 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) {
36767         LDKChannelHandshakeConfig this_ptr_conv;
36768         this_ptr_conv.inner = untag_ptr(this_ptr);
36769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36771         this_ptr_conv.is_owned = false;
36772         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
36773 }
36774
36775 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
36776         LDKChannelHandshakeConfig this_ptr_conv;
36777         this_ptr_conv.inner = untag_ptr(this_ptr);
36778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36780         this_ptr_conv.is_owned = false;
36781         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
36782         return ret_conv;
36783 }
36784
36785 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) {
36786         LDKChannelHandshakeConfig this_ptr_conv;
36787         this_ptr_conv.inner = untag_ptr(this_ptr);
36788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36790         this_ptr_conv.is_owned = false;
36791         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
36792 }
36793
36794 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) {
36795         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);
36796         uint64_t ret_ref = 0;
36797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36799         return ret_ref;
36800 }
36801
36802 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
36803         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
36804         uint64_t ret_ref = 0;
36805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36807         return ret_ref;
36808 }
36809 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
36810         LDKChannelHandshakeConfig arg_conv;
36811         arg_conv.inner = untag_ptr(arg);
36812         arg_conv.is_owned = ptr_is_owned(arg);
36813         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36814         arg_conv.is_owned = false;
36815         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
36816         return ret_conv;
36817 }
36818
36819 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
36820         LDKChannelHandshakeConfig orig_conv;
36821         orig_conv.inner = untag_ptr(orig);
36822         orig_conv.is_owned = ptr_is_owned(orig);
36823         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36824         orig_conv.is_owned = false;
36825         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
36826         uint64_t ret_ref = 0;
36827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36829         return ret_ref;
36830 }
36831
36832 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
36833         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
36834         uint64_t ret_ref = 0;
36835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36837         return ret_ref;
36838 }
36839
36840 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
36841         LDKChannelHandshakeLimits this_obj_conv;
36842         this_obj_conv.inner = untag_ptr(this_obj);
36843         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36845         ChannelHandshakeLimits_free(this_obj_conv);
36846 }
36847
36848 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
36849         LDKChannelHandshakeLimits this_ptr_conv;
36850         this_ptr_conv.inner = untag_ptr(this_ptr);
36851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36853         this_ptr_conv.is_owned = false;
36854         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
36855         return ret_conv;
36856 }
36857
36858 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
36859         LDKChannelHandshakeLimits this_ptr_conv;
36860         this_ptr_conv.inner = untag_ptr(this_ptr);
36861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36863         this_ptr_conv.is_owned = false;
36864         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
36865 }
36866
36867 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
36868         LDKChannelHandshakeLimits this_ptr_conv;
36869         this_ptr_conv.inner = untag_ptr(this_ptr);
36870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36872         this_ptr_conv.is_owned = false;
36873         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
36874         return ret_conv;
36875 }
36876
36877 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
36878         LDKChannelHandshakeLimits this_ptr_conv;
36879         this_ptr_conv.inner = untag_ptr(this_ptr);
36880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36882         this_ptr_conv.is_owned = false;
36883         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
36884 }
36885
36886 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
36887         LDKChannelHandshakeLimits this_ptr_conv;
36888         this_ptr_conv.inner = untag_ptr(this_ptr);
36889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36891         this_ptr_conv.is_owned = false;
36892         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
36893         return ret_conv;
36894 }
36895
36896 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) {
36897         LDKChannelHandshakeLimits this_ptr_conv;
36898         this_ptr_conv.inner = untag_ptr(this_ptr);
36899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36901         this_ptr_conv.is_owned = false;
36902         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
36903 }
36904
36905 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) {
36906         LDKChannelHandshakeLimits this_ptr_conv;
36907         this_ptr_conv.inner = untag_ptr(this_ptr);
36908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36910         this_ptr_conv.is_owned = false;
36911         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
36912         return ret_conv;
36913 }
36914
36915 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) {
36916         LDKChannelHandshakeLimits this_ptr_conv;
36917         this_ptr_conv.inner = untag_ptr(this_ptr);
36918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36920         this_ptr_conv.is_owned = false;
36921         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
36922 }
36923
36924 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
36925         LDKChannelHandshakeLimits this_ptr_conv;
36926         this_ptr_conv.inner = untag_ptr(this_ptr);
36927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36929         this_ptr_conv.is_owned = false;
36930         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
36931         return ret_conv;
36932 }
36933
36934 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) {
36935         LDKChannelHandshakeLimits this_ptr_conv;
36936         this_ptr_conv.inner = untag_ptr(this_ptr);
36937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36939         this_ptr_conv.is_owned = false;
36940         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
36941 }
36942
36943 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
36944         LDKChannelHandshakeLimits this_ptr_conv;
36945         this_ptr_conv.inner = untag_ptr(this_ptr);
36946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36948         this_ptr_conv.is_owned = false;
36949         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
36950         return ret_conv;
36951 }
36952
36953 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) {
36954         LDKChannelHandshakeLimits this_ptr_conv;
36955         this_ptr_conv.inner = untag_ptr(this_ptr);
36956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36958         this_ptr_conv.is_owned = false;
36959         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
36960 }
36961
36962 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
36963         LDKChannelHandshakeLimits this_ptr_conv;
36964         this_ptr_conv.inner = untag_ptr(this_ptr);
36965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36967         this_ptr_conv.is_owned = false;
36968         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
36969         return ret_conv;
36970 }
36971
36972 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
36973         LDKChannelHandshakeLimits this_ptr_conv;
36974         this_ptr_conv.inner = untag_ptr(this_ptr);
36975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36977         this_ptr_conv.is_owned = false;
36978         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
36979 }
36980
36981 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
36982         LDKChannelHandshakeLimits this_ptr_conv;
36983         this_ptr_conv.inner = untag_ptr(this_ptr);
36984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36986         this_ptr_conv.is_owned = false;
36987         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
36988         return ret_conv;
36989 }
36990
36991 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
36992         LDKChannelHandshakeLimits this_ptr_conv;
36993         this_ptr_conv.inner = untag_ptr(this_ptr);
36994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36996         this_ptr_conv.is_owned = false;
36997         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
36998 }
36999
37000 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
37001         LDKChannelHandshakeLimits this_ptr_conv;
37002         this_ptr_conv.inner = untag_ptr(this_ptr);
37003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37005         this_ptr_conv.is_owned = false;
37006         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
37007         return ret_conv;
37008 }
37009
37010 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
37011         LDKChannelHandshakeLimits this_ptr_conv;
37012         this_ptr_conv.inner = untag_ptr(this_ptr);
37013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37015         this_ptr_conv.is_owned = false;
37016         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
37017 }
37018
37019 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
37020         LDKChannelHandshakeLimits this_ptr_conv;
37021         this_ptr_conv.inner = untag_ptr(this_ptr);
37022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37024         this_ptr_conv.is_owned = false;
37025         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
37026         return ret_conv;
37027 }
37028
37029 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) {
37030         LDKChannelHandshakeLimits this_ptr_conv;
37031         this_ptr_conv.inner = untag_ptr(this_ptr);
37032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37034         this_ptr_conv.is_owned = false;
37035         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
37036 }
37037
37038 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) {
37039         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);
37040         uint64_t ret_ref = 0;
37041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37043         return ret_ref;
37044 }
37045
37046 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
37047         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
37048         uint64_t ret_ref = 0;
37049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37051         return ret_ref;
37052 }
37053 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
37054         LDKChannelHandshakeLimits arg_conv;
37055         arg_conv.inner = untag_ptr(arg);
37056         arg_conv.is_owned = ptr_is_owned(arg);
37057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37058         arg_conv.is_owned = false;
37059         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
37060         return ret_conv;
37061 }
37062
37063 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
37064         LDKChannelHandshakeLimits orig_conv;
37065         orig_conv.inner = untag_ptr(orig);
37066         orig_conv.is_owned = ptr_is_owned(orig);
37067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37068         orig_conv.is_owned = false;
37069         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
37070         uint64_t ret_ref = 0;
37071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37073         return ret_ref;
37074 }
37075
37076 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
37077         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
37078         uint64_t ret_ref = 0;
37079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37081         return ret_ref;
37082 }
37083
37084 void  __attribute__((export_name("TS_MaxDustHTLCExposure_free"))) TS_MaxDustHTLCExposure_free(uint64_t this_ptr) {
37085         if (!ptr_is_owned(this_ptr)) return;
37086         void* this_ptr_ptr = untag_ptr(this_ptr);
37087         CHECK_ACCESS(this_ptr_ptr);
37088         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
37089         FREE(untag_ptr(this_ptr));
37090         MaxDustHTLCExposure_free(this_ptr_conv);
37091 }
37092
37093 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
37094         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37095         *ret_copy = MaxDustHTLCExposure_clone(arg);
37096         uint64_t ret_ref = tag_ptr(ret_copy, true);
37097         return ret_ref;
37098 }
37099 int64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone_ptr"))) TS_MaxDustHTLCExposure_clone_ptr(uint64_t arg) {
37100         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
37101         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
37102         return ret_conv;
37103 }
37104
37105 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone"))) TS_MaxDustHTLCExposure_clone(uint64_t orig) {
37106         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
37107         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37108         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
37109         uint64_t ret_ref = tag_ptr(ret_copy, true);
37110         return ret_ref;
37111 }
37112
37113 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fixed_limit_msat"))) TS_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
37114         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37115         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
37116         uint64_t ret_ref = tag_ptr(ret_copy, true);
37117         return ret_ref;
37118 }
37119
37120 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fee_rate_multiplier"))) TS_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
37121         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37122         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
37123         uint64_t ret_ref = tag_ptr(ret_copy, true);
37124         return ret_ref;
37125 }
37126
37127 jboolean  __attribute__((export_name("TS_MaxDustHTLCExposure_eq"))) TS_MaxDustHTLCExposure_eq(uint64_t a, uint64_t b) {
37128         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
37129         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
37130         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
37131         return ret_conv;
37132 }
37133
37134 int8_tArray  __attribute__((export_name("TS_MaxDustHTLCExposure_write"))) TS_MaxDustHTLCExposure_write(uint64_t obj) {
37135         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
37136         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
37137         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37138         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37139         CVec_u8Z_free(ret_var);
37140         return ret_arr;
37141 }
37142
37143 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_read"))) TS_MaxDustHTLCExposure_read(int8_tArray ser) {
37144         LDKu8slice ser_ref;
37145         ser_ref.datalen = ser->arr_len;
37146         ser_ref.data = ser->elems;
37147         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
37148         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
37149         FREE(ser);
37150         return tag_ptr(ret_conv, true);
37151 }
37152
37153 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
37154         LDKChannelConfig this_obj_conv;
37155         this_obj_conv.inner = untag_ptr(this_obj);
37156         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37158         ChannelConfig_free(this_obj_conv);
37159 }
37160
37161 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
37162         LDKChannelConfig this_ptr_conv;
37163         this_ptr_conv.inner = untag_ptr(this_ptr);
37164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37166         this_ptr_conv.is_owned = false;
37167         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
37168         return ret_conv;
37169 }
37170
37171 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) {
37172         LDKChannelConfig this_ptr_conv;
37173         this_ptr_conv.inner = untag_ptr(this_ptr);
37174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37176         this_ptr_conv.is_owned = false;
37177         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
37178 }
37179
37180 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
37181         LDKChannelConfig this_ptr_conv;
37182         this_ptr_conv.inner = untag_ptr(this_ptr);
37183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37185         this_ptr_conv.is_owned = false;
37186         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
37187         return ret_conv;
37188 }
37189
37190 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) {
37191         LDKChannelConfig this_ptr_conv;
37192         this_ptr_conv.inner = untag_ptr(this_ptr);
37193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37195         this_ptr_conv.is_owned = false;
37196         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
37197 }
37198
37199 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
37200         LDKChannelConfig this_ptr_conv;
37201         this_ptr_conv.inner = untag_ptr(this_ptr);
37202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37204         this_ptr_conv.is_owned = false;
37205         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
37206         return ret_conv;
37207 }
37208
37209 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
37210         LDKChannelConfig this_ptr_conv;
37211         this_ptr_conv.inner = untag_ptr(this_ptr);
37212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37214         this_ptr_conv.is_owned = false;
37215         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
37216 }
37217
37218 uint64_t  __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure"))) TS_ChannelConfig_get_max_dust_htlc_exposure(uint64_t this_ptr) {
37219         LDKChannelConfig this_ptr_conv;
37220         this_ptr_conv.inner = untag_ptr(this_ptr);
37221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37223         this_ptr_conv.is_owned = false;
37224         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37225         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
37226         uint64_t ret_ref = tag_ptr(ret_copy, true);
37227         return ret_ref;
37228 }
37229
37230 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) {
37231         LDKChannelConfig this_ptr_conv;
37232         this_ptr_conv.inner = untag_ptr(this_ptr);
37233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37235         this_ptr_conv.is_owned = false;
37236         void* val_ptr = untag_ptr(val);
37237         CHECK_ACCESS(val_ptr);
37238         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
37239         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
37240         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
37241 }
37242
37243 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) {
37244         LDKChannelConfig this_ptr_conv;
37245         this_ptr_conv.inner = untag_ptr(this_ptr);
37246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37248         this_ptr_conv.is_owned = false;
37249         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
37250         return ret_conv;
37251 }
37252
37253 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) {
37254         LDKChannelConfig this_ptr_conv;
37255         this_ptr_conv.inner = untag_ptr(this_ptr);
37256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37258         this_ptr_conv.is_owned = false;
37259         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
37260 }
37261
37262 jboolean  __attribute__((export_name("TS_ChannelConfig_get_accept_underpaying_htlcs"))) TS_ChannelConfig_get_accept_underpaying_htlcs(uint64_t this_ptr) {
37263         LDKChannelConfig this_ptr_conv;
37264         this_ptr_conv.inner = untag_ptr(this_ptr);
37265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37267         this_ptr_conv.is_owned = false;
37268         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
37269         return ret_conv;
37270 }
37271
37272 void  __attribute__((export_name("TS_ChannelConfig_set_accept_underpaying_htlcs"))) TS_ChannelConfig_set_accept_underpaying_htlcs(uint64_t this_ptr, jboolean val) {
37273         LDKChannelConfig this_ptr_conv;
37274         this_ptr_conv.inner = untag_ptr(this_ptr);
37275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37277         this_ptr_conv.is_owned = false;
37278         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
37279 }
37280
37281 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) {
37282         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
37283         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
37284         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
37285         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
37286         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);
37287         uint64_t ret_ref = 0;
37288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37290         return ret_ref;
37291 }
37292
37293 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
37294         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
37295         uint64_t ret_ref = 0;
37296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37298         return ret_ref;
37299 }
37300 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
37301         LDKChannelConfig arg_conv;
37302         arg_conv.inner = untag_ptr(arg);
37303         arg_conv.is_owned = ptr_is_owned(arg);
37304         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37305         arg_conv.is_owned = false;
37306         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
37307         return ret_conv;
37308 }
37309
37310 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
37311         LDKChannelConfig orig_conv;
37312         orig_conv.inner = untag_ptr(orig);
37313         orig_conv.is_owned = ptr_is_owned(orig);
37314         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37315         orig_conv.is_owned = false;
37316         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
37317         uint64_t ret_ref = 0;
37318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37320         return ret_ref;
37321 }
37322
37323 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
37324         LDKChannelConfig a_conv;
37325         a_conv.inner = untag_ptr(a);
37326         a_conv.is_owned = ptr_is_owned(a);
37327         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37328         a_conv.is_owned = false;
37329         LDKChannelConfig b_conv;
37330         b_conv.inner = untag_ptr(b);
37331         b_conv.is_owned = ptr_is_owned(b);
37332         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37333         b_conv.is_owned = false;
37334         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
37335         return ret_conv;
37336 }
37337
37338 void  __attribute__((export_name("TS_ChannelConfig_apply"))) TS_ChannelConfig_apply(uint64_t this_arg, uint64_t update) {
37339         LDKChannelConfig this_arg_conv;
37340         this_arg_conv.inner = untag_ptr(this_arg);
37341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37343         this_arg_conv.is_owned = false;
37344         LDKChannelConfigUpdate update_conv;
37345         update_conv.inner = untag_ptr(update);
37346         update_conv.is_owned = ptr_is_owned(update);
37347         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
37348         update_conv.is_owned = false;
37349         ChannelConfig_apply(&this_arg_conv, &update_conv);
37350 }
37351
37352 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
37353         LDKChannelConfig ret_var = ChannelConfig_default();
37354         uint64_t ret_ref = 0;
37355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37357         return ret_ref;
37358 }
37359
37360 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
37361         LDKChannelConfig obj_conv;
37362         obj_conv.inner = untag_ptr(obj);
37363         obj_conv.is_owned = ptr_is_owned(obj);
37364         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37365         obj_conv.is_owned = false;
37366         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
37367         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37368         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37369         CVec_u8Z_free(ret_var);
37370         return ret_arr;
37371 }
37372
37373 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
37374         LDKu8slice ser_ref;
37375         ser_ref.datalen = ser->arr_len;
37376         ser_ref.data = ser->elems;
37377         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
37378         *ret_conv = ChannelConfig_read(ser_ref);
37379         FREE(ser);
37380         return tag_ptr(ret_conv, true);
37381 }
37382
37383 void  __attribute__((export_name("TS_ChannelConfigUpdate_free"))) TS_ChannelConfigUpdate_free(uint64_t this_obj) {
37384         LDKChannelConfigUpdate this_obj_conv;
37385         this_obj_conv.inner = untag_ptr(this_obj);
37386         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37388         ChannelConfigUpdate_free(this_obj_conv);
37389 }
37390
37391 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
37392         LDKChannelConfigUpdate this_ptr_conv;
37393         this_ptr_conv.inner = untag_ptr(this_ptr);
37394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37396         this_ptr_conv.is_owned = false;
37397         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37398         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
37399         uint64_t ret_ref = tag_ptr(ret_copy, true);
37400         return ret_ref;
37401 }
37402
37403 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) {
37404         LDKChannelConfigUpdate this_ptr_conv;
37405         this_ptr_conv.inner = untag_ptr(this_ptr);
37406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37408         this_ptr_conv.is_owned = false;
37409         void* val_ptr = untag_ptr(val);
37410         CHECK_ACCESS(val_ptr);
37411         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37412         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37413         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
37414 }
37415
37416 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_base_msat"))) TS_ChannelConfigUpdate_get_forwarding_fee_base_msat(uint64_t this_ptr) {
37417         LDKChannelConfigUpdate this_ptr_conv;
37418         this_ptr_conv.inner = untag_ptr(this_ptr);
37419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37421         this_ptr_conv.is_owned = false;
37422         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37423         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
37424         uint64_t ret_ref = tag_ptr(ret_copy, true);
37425         return ret_ref;
37426 }
37427
37428 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) {
37429         LDKChannelConfigUpdate this_ptr_conv;
37430         this_ptr_conv.inner = untag_ptr(this_ptr);
37431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37433         this_ptr_conv.is_owned = false;
37434         void* val_ptr = untag_ptr(val);
37435         CHECK_ACCESS(val_ptr);
37436         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37437         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37438         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
37439 }
37440
37441 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_cltv_expiry_delta"))) TS_ChannelConfigUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
37442         LDKChannelConfigUpdate this_ptr_conv;
37443         this_ptr_conv.inner = untag_ptr(this_ptr);
37444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37446         this_ptr_conv.is_owned = false;
37447         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
37448         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
37449         uint64_t ret_ref = tag_ptr(ret_copy, true);
37450         return ret_ref;
37451 }
37452
37453 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_cltv_expiry_delta"))) TS_ChannelConfigUpdate_set_cltv_expiry_delta(uint64_t this_ptr, uint64_t val) {
37454         LDKChannelConfigUpdate this_ptr_conv;
37455         this_ptr_conv.inner = untag_ptr(this_ptr);
37456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37458         this_ptr_conv.is_owned = false;
37459         void* val_ptr = untag_ptr(val);
37460         CHECK_ACCESS(val_ptr);
37461         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
37462         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
37463         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
37464 }
37465
37466 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) {
37467         LDKChannelConfigUpdate this_ptr_conv;
37468         this_ptr_conv.inner = untag_ptr(this_ptr);
37469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37471         this_ptr_conv.is_owned = false;
37472         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
37473         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
37474         uint64_t ret_ref = tag_ptr(ret_copy, true);
37475         return ret_ref;
37476 }
37477
37478 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) {
37479         LDKChannelConfigUpdate this_ptr_conv;
37480         this_ptr_conv.inner = untag_ptr(this_ptr);
37481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37483         this_ptr_conv.is_owned = false;
37484         void* val_ptr = untag_ptr(val);
37485         CHECK_ACCESS(val_ptr);
37486         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
37487         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
37488         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
37489 }
37490
37491 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) {
37492         LDKChannelConfigUpdate this_ptr_conv;
37493         this_ptr_conv.inner = untag_ptr(this_ptr);
37494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37496         this_ptr_conv.is_owned = false;
37497         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37498         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
37499         uint64_t ret_ref = tag_ptr(ret_copy, true);
37500         return ret_ref;
37501 }
37502
37503 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) {
37504         LDKChannelConfigUpdate this_ptr_conv;
37505         this_ptr_conv.inner = untag_ptr(this_ptr);
37506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37508         this_ptr_conv.is_owned = false;
37509         void* val_ptr = untag_ptr(val);
37510         CHECK_ACCESS(val_ptr);
37511         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37512         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37513         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
37514 }
37515
37516 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) {
37517         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
37518         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
37519         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
37520         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
37521         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
37522         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
37523         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
37524         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
37525         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
37526         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
37527         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
37528         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
37529         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
37530         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
37531         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
37532         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
37533         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
37534         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
37535         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
37536         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
37537         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);
37538         uint64_t ret_ref = 0;
37539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37541         return ret_ref;
37542 }
37543
37544 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_default"))) TS_ChannelConfigUpdate_default() {
37545         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
37546         uint64_t ret_ref = 0;
37547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37549         return ret_ref;
37550 }
37551
37552 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
37553         LDKUserConfig this_obj_conv;
37554         this_obj_conv.inner = untag_ptr(this_obj);
37555         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37557         UserConfig_free(this_obj_conv);
37558 }
37559
37560 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
37561         LDKUserConfig this_ptr_conv;
37562         this_ptr_conv.inner = untag_ptr(this_ptr);
37563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37565         this_ptr_conv.is_owned = false;
37566         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
37567         uint64_t ret_ref = 0;
37568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37570         return ret_ref;
37571 }
37572
37573 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
37574         LDKUserConfig this_ptr_conv;
37575         this_ptr_conv.inner = untag_ptr(this_ptr);
37576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37578         this_ptr_conv.is_owned = false;
37579         LDKChannelHandshakeConfig val_conv;
37580         val_conv.inner = untag_ptr(val);
37581         val_conv.is_owned = ptr_is_owned(val);
37582         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37583         val_conv = ChannelHandshakeConfig_clone(&val_conv);
37584         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
37585 }
37586
37587 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
37588         LDKUserConfig this_ptr_conv;
37589         this_ptr_conv.inner = untag_ptr(this_ptr);
37590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37592         this_ptr_conv.is_owned = false;
37593         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
37594         uint64_t ret_ref = 0;
37595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37597         return ret_ref;
37598 }
37599
37600 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
37601         LDKUserConfig this_ptr_conv;
37602         this_ptr_conv.inner = untag_ptr(this_ptr);
37603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37605         this_ptr_conv.is_owned = false;
37606         LDKChannelHandshakeLimits val_conv;
37607         val_conv.inner = untag_ptr(val);
37608         val_conv.is_owned = ptr_is_owned(val);
37609         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37610         val_conv = ChannelHandshakeLimits_clone(&val_conv);
37611         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
37612 }
37613
37614 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
37615         LDKUserConfig this_ptr_conv;
37616         this_ptr_conv.inner = untag_ptr(this_ptr);
37617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37619         this_ptr_conv.is_owned = false;
37620         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
37621         uint64_t ret_ref = 0;
37622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37624         return ret_ref;
37625 }
37626
37627 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
37628         LDKUserConfig this_ptr_conv;
37629         this_ptr_conv.inner = untag_ptr(this_ptr);
37630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37632         this_ptr_conv.is_owned = false;
37633         LDKChannelConfig val_conv;
37634         val_conv.inner = untag_ptr(val);
37635         val_conv.is_owned = ptr_is_owned(val);
37636         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37637         val_conv = ChannelConfig_clone(&val_conv);
37638         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
37639 }
37640
37641 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
37642         LDKUserConfig this_ptr_conv;
37643         this_ptr_conv.inner = untag_ptr(this_ptr);
37644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37646         this_ptr_conv.is_owned = false;
37647         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
37648         return ret_conv;
37649 }
37650
37651 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) {
37652         LDKUserConfig this_ptr_conv;
37653         this_ptr_conv.inner = untag_ptr(this_ptr);
37654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37656         this_ptr_conv.is_owned = false;
37657         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
37658 }
37659
37660 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
37661         LDKUserConfig this_ptr_conv;
37662         this_ptr_conv.inner = untag_ptr(this_ptr);
37663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37665         this_ptr_conv.is_owned = false;
37666         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
37667         return ret_conv;
37668 }
37669
37670 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
37671         LDKUserConfig this_ptr_conv;
37672         this_ptr_conv.inner = untag_ptr(this_ptr);
37673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37675         this_ptr_conv.is_owned = false;
37676         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
37677 }
37678
37679 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
37680         LDKUserConfig this_ptr_conv;
37681         this_ptr_conv.inner = untag_ptr(this_ptr);
37682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37684         this_ptr_conv.is_owned = false;
37685         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
37686         return ret_conv;
37687 }
37688
37689 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
37690         LDKUserConfig this_ptr_conv;
37691         this_ptr_conv.inner = untag_ptr(this_ptr);
37692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37694         this_ptr_conv.is_owned = false;
37695         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
37696 }
37697
37698 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
37699         LDKUserConfig this_ptr_conv;
37700         this_ptr_conv.inner = untag_ptr(this_ptr);
37701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37703         this_ptr_conv.is_owned = false;
37704         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
37705         return ret_conv;
37706 }
37707
37708 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
37709         LDKUserConfig this_ptr_conv;
37710         this_ptr_conv.inner = untag_ptr(this_ptr);
37711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37713         this_ptr_conv.is_owned = false;
37714         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
37715 }
37716
37717 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_mpp_keysend"))) TS_UserConfig_get_accept_mpp_keysend(uint64_t this_ptr) {
37718         LDKUserConfig this_ptr_conv;
37719         this_ptr_conv.inner = untag_ptr(this_ptr);
37720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37722         this_ptr_conv.is_owned = false;
37723         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
37724         return ret_conv;
37725 }
37726
37727 void  __attribute__((export_name("TS_UserConfig_set_accept_mpp_keysend"))) TS_UserConfig_set_accept_mpp_keysend(uint64_t this_ptr, jboolean val) {
37728         LDKUserConfig this_ptr_conv;
37729         this_ptr_conv.inner = untag_ptr(this_ptr);
37730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37732         this_ptr_conv.is_owned = false;
37733         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
37734 }
37735
37736 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) {
37737         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
37738         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
37739         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
37740         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
37741         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
37742         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
37743         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
37744         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
37745         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
37746         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
37747         LDKChannelConfig channel_config_arg_conv;
37748         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
37749         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
37750         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
37751         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
37752         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);
37753         uint64_t ret_ref = 0;
37754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37756         return ret_ref;
37757 }
37758
37759 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
37760         LDKUserConfig ret_var = UserConfig_clone(arg);
37761         uint64_t ret_ref = 0;
37762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37764         return ret_ref;
37765 }
37766 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
37767         LDKUserConfig arg_conv;
37768         arg_conv.inner = untag_ptr(arg);
37769         arg_conv.is_owned = ptr_is_owned(arg);
37770         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37771         arg_conv.is_owned = false;
37772         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
37773         return ret_conv;
37774 }
37775
37776 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
37777         LDKUserConfig orig_conv;
37778         orig_conv.inner = untag_ptr(orig);
37779         orig_conv.is_owned = ptr_is_owned(orig);
37780         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37781         orig_conv.is_owned = false;
37782         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
37783         uint64_t ret_ref = 0;
37784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37786         return ret_ref;
37787 }
37788
37789 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
37790         LDKUserConfig ret_var = UserConfig_default();
37791         uint64_t ret_ref = 0;
37792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37794         return ret_ref;
37795 }
37796
37797 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
37798         LDKBestBlock this_obj_conv;
37799         this_obj_conv.inner = untag_ptr(this_obj);
37800         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37802         BestBlock_free(this_obj_conv);
37803 }
37804
37805 int8_tArray  __attribute__((export_name("TS_BestBlock_get_block_hash"))) TS_BestBlock_get_block_hash(uint64_t this_ptr) {
37806         LDKBestBlock this_ptr_conv;
37807         this_ptr_conv.inner = untag_ptr(this_ptr);
37808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37810         this_ptr_conv.is_owned = false;
37811         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37812         memcpy(ret_arr->elems, *BestBlock_get_block_hash(&this_ptr_conv), 32);
37813         return ret_arr;
37814 }
37815
37816 void  __attribute__((export_name("TS_BestBlock_set_block_hash"))) TS_BestBlock_set_block_hash(uint64_t this_ptr, int8_tArray val) {
37817         LDKBestBlock this_ptr_conv;
37818         this_ptr_conv.inner = untag_ptr(this_ptr);
37819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37821         this_ptr_conv.is_owned = false;
37822         LDKThirtyTwoBytes val_ref;
37823         CHECK(val->arr_len == 32);
37824         memcpy(val_ref.data, val->elems, 32); FREE(val);
37825         BestBlock_set_block_hash(&this_ptr_conv, val_ref);
37826 }
37827
37828 int32_t  __attribute__((export_name("TS_BestBlock_get_height"))) TS_BestBlock_get_height(uint64_t this_ptr) {
37829         LDKBestBlock this_ptr_conv;
37830         this_ptr_conv.inner = untag_ptr(this_ptr);
37831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37833         this_ptr_conv.is_owned = false;
37834         int32_t ret_conv = BestBlock_get_height(&this_ptr_conv);
37835         return ret_conv;
37836 }
37837
37838 void  __attribute__((export_name("TS_BestBlock_set_height"))) TS_BestBlock_set_height(uint64_t this_ptr, int32_t val) {
37839         LDKBestBlock this_ptr_conv;
37840         this_ptr_conv.inner = untag_ptr(this_ptr);
37841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37843         this_ptr_conv.is_owned = false;
37844         BestBlock_set_height(&this_ptr_conv, val);
37845 }
37846
37847 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash_arg, int32_t height_arg) {
37848         LDKThirtyTwoBytes block_hash_arg_ref;
37849         CHECK(block_hash_arg->arr_len == 32);
37850         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
37851         LDKBestBlock ret_var = BestBlock_new(block_hash_arg_ref, height_arg);
37852         uint64_t ret_ref = 0;
37853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37855         return ret_ref;
37856 }
37857
37858 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
37859         LDKBestBlock ret_var = BestBlock_clone(arg);
37860         uint64_t ret_ref = 0;
37861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37863         return ret_ref;
37864 }
37865 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
37866         LDKBestBlock arg_conv;
37867         arg_conv.inner = untag_ptr(arg);
37868         arg_conv.is_owned = ptr_is_owned(arg);
37869         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37870         arg_conv.is_owned = false;
37871         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
37872         return ret_conv;
37873 }
37874
37875 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
37876         LDKBestBlock orig_conv;
37877         orig_conv.inner = untag_ptr(orig);
37878         orig_conv.is_owned = ptr_is_owned(orig);
37879         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37880         orig_conv.is_owned = false;
37881         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
37882         uint64_t ret_ref = 0;
37883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37885         return ret_ref;
37886 }
37887
37888 int64_t  __attribute__((export_name("TS_BestBlock_hash"))) TS_BestBlock_hash(uint64_t o) {
37889         LDKBestBlock o_conv;
37890         o_conv.inner = untag_ptr(o);
37891         o_conv.is_owned = ptr_is_owned(o);
37892         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37893         o_conv.is_owned = false;
37894         int64_t ret_conv = BestBlock_hash(&o_conv);
37895         return ret_conv;
37896 }
37897
37898 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
37899         LDKBestBlock a_conv;
37900         a_conv.inner = untag_ptr(a);
37901         a_conv.is_owned = ptr_is_owned(a);
37902         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37903         a_conv.is_owned = false;
37904         LDKBestBlock b_conv;
37905         b_conv.inner = untag_ptr(b);
37906         b_conv.is_owned = ptr_is_owned(b);
37907         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37908         b_conv.is_owned = false;
37909         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
37910         return ret_conv;
37911 }
37912
37913 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
37914         LDKNetwork network_conv = LDKNetwork_from_js(network);
37915         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
37916         uint64_t ret_ref = 0;
37917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37919         return ret_ref;
37920 }
37921
37922 int8_tArray  __attribute__((export_name("TS_BestBlock_write"))) TS_BestBlock_write(uint64_t obj) {
37923         LDKBestBlock obj_conv;
37924         obj_conv.inner = untag_ptr(obj);
37925         obj_conv.is_owned = ptr_is_owned(obj);
37926         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37927         obj_conv.is_owned = false;
37928         LDKCVec_u8Z ret_var = BestBlock_write(&obj_conv);
37929         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37930         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37931         CVec_u8Z_free(ret_var);
37932         return ret_arr;
37933 }
37934
37935 uint64_t  __attribute__((export_name("TS_BestBlock_read"))) TS_BestBlock_read(int8_tArray ser) {
37936         LDKu8slice ser_ref;
37937         ser_ref.datalen = ser->arr_len;
37938         ser_ref.data = ser->elems;
37939         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
37940         *ret_conv = BestBlock_read(ser_ref);
37941         FREE(ser);
37942         return tag_ptr(ret_conv, true);
37943 }
37944
37945 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
37946         if (!ptr_is_owned(this_ptr)) return;
37947         void* this_ptr_ptr = untag_ptr(this_ptr);
37948         CHECK_ACCESS(this_ptr_ptr);
37949         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
37950         FREE(untag_ptr(this_ptr));
37951         Listen_free(this_ptr_conv);
37952 }
37953
37954 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
37955         if (!ptr_is_owned(this_ptr)) return;
37956         void* this_ptr_ptr = untag_ptr(this_ptr);
37957         CHECK_ACCESS(this_ptr_ptr);
37958         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
37959         FREE(untag_ptr(this_ptr));
37960         Confirm_free(this_ptr_conv);
37961 }
37962
37963 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
37964         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
37965         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
37966         return ret_conv;
37967 }
37968
37969 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
37970         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
37971         return ret_conv;
37972 }
37973
37974 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
37975         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
37976         return ret_conv;
37977 }
37978
37979 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_unrecoverable_error"))) TS_ChannelMonitorUpdateStatus_unrecoverable_error() {
37980         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_unrecoverable_error());
37981         return ret_conv;
37982 }
37983
37984 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
37985         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
37986         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
37987         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
37988         return ret_conv;
37989 }
37990
37991 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
37992         if (!ptr_is_owned(this_ptr)) return;
37993         void* this_ptr_ptr = untag_ptr(this_ptr);
37994         CHECK_ACCESS(this_ptr_ptr);
37995         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
37996         FREE(untag_ptr(this_ptr));
37997         Watch_free(this_ptr_conv);
37998 }
37999
38000 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
38001         if (!ptr_is_owned(this_ptr)) return;
38002         void* this_ptr_ptr = untag_ptr(this_ptr);
38003         CHECK_ACCESS(this_ptr_ptr);
38004         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
38005         FREE(untag_ptr(this_ptr));
38006         Filter_free(this_ptr_conv);
38007 }
38008
38009 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
38010         LDKWatchedOutput this_obj_conv;
38011         this_obj_conv.inner = untag_ptr(this_obj);
38012         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38014         WatchedOutput_free(this_obj_conv);
38015 }
38016
38017 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
38018         LDKWatchedOutput this_ptr_conv;
38019         this_ptr_conv.inner = untag_ptr(this_ptr);
38020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38022         this_ptr_conv.is_owned = false;
38023         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
38024         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
38025         uint64_t ret_ref = tag_ptr(ret_copy, true);
38026         return ret_ref;
38027 }
38028
38029 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, uint64_t val) {
38030         LDKWatchedOutput this_ptr_conv;
38031         this_ptr_conv.inner = untag_ptr(this_ptr);
38032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38034         this_ptr_conv.is_owned = false;
38035         void* val_ptr = untag_ptr(val);
38036         CHECK_ACCESS(val_ptr);
38037         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
38038         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
38039         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
38040 }
38041
38042 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
38043         LDKWatchedOutput this_ptr_conv;
38044         this_ptr_conv.inner = untag_ptr(this_ptr);
38045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38047         this_ptr_conv.is_owned = false;
38048         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
38049         uint64_t ret_ref = 0;
38050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38052         return ret_ref;
38053 }
38054
38055 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
38056         LDKWatchedOutput this_ptr_conv;
38057         this_ptr_conv.inner = untag_ptr(this_ptr);
38058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38060         this_ptr_conv.is_owned = false;
38061         LDKOutPoint val_conv;
38062         val_conv.inner = untag_ptr(val);
38063         val_conv.is_owned = ptr_is_owned(val);
38064         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38065         val_conv = OutPoint_clone(&val_conv);
38066         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
38067 }
38068
38069 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
38070         LDKWatchedOutput this_ptr_conv;
38071         this_ptr_conv.inner = untag_ptr(this_ptr);
38072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38074         this_ptr_conv.is_owned = false;
38075         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
38076         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38077         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38078         CVec_u8Z_free(ret_var);
38079         return ret_arr;
38080 }
38081
38082 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
38083         LDKWatchedOutput this_ptr_conv;
38084         this_ptr_conv.inner = untag_ptr(this_ptr);
38085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38087         this_ptr_conv.is_owned = false;
38088         LDKCVec_u8Z val_ref;
38089         val_ref.datalen = val->arr_len;
38090         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
38091         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
38092         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
38093 }
38094
38095 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) {
38096         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
38097         CHECK_ACCESS(block_hash_arg_ptr);
38098         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
38099         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
38100         LDKOutPoint outpoint_arg_conv;
38101         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
38102         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
38103         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
38104         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
38105         LDKCVec_u8Z script_pubkey_arg_ref;
38106         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
38107         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
38108         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
38109         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
38110         uint64_t ret_ref = 0;
38111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38113         return ret_ref;
38114 }
38115
38116 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
38117         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
38118         uint64_t ret_ref = 0;
38119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38121         return ret_ref;
38122 }
38123 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
38124         LDKWatchedOutput arg_conv;
38125         arg_conv.inner = untag_ptr(arg);
38126         arg_conv.is_owned = ptr_is_owned(arg);
38127         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38128         arg_conv.is_owned = false;
38129         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
38130         return ret_conv;
38131 }
38132
38133 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
38134         LDKWatchedOutput orig_conv;
38135         orig_conv.inner = untag_ptr(orig);
38136         orig_conv.is_owned = ptr_is_owned(orig);
38137         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38138         orig_conv.is_owned = false;
38139         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
38140         uint64_t ret_ref = 0;
38141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38143         return ret_ref;
38144 }
38145
38146 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
38147         LDKWatchedOutput a_conv;
38148         a_conv.inner = untag_ptr(a);
38149         a_conv.is_owned = ptr_is_owned(a);
38150         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38151         a_conv.is_owned = false;
38152         LDKWatchedOutput b_conv;
38153         b_conv.inner = untag_ptr(b);
38154         b_conv.is_owned = ptr_is_owned(b);
38155         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38156         b_conv.is_owned = false;
38157         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
38158         return ret_conv;
38159 }
38160
38161 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
38162         LDKWatchedOutput o_conv;
38163         o_conv.inner = untag_ptr(o);
38164         o_conv.is_owned = ptr_is_owned(o);
38165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38166         o_conv.is_owned = false;
38167         int64_t ret_conv = WatchedOutput_hash(&o_conv);
38168         return ret_conv;
38169 }
38170
38171 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
38172         if (!ptr_is_owned(this_ptr)) return;
38173         void* this_ptr_ptr = untag_ptr(this_ptr);
38174         CHECK_ACCESS(this_ptr_ptr);
38175         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
38176         FREE(untag_ptr(this_ptr));
38177         BroadcasterInterface_free(this_ptr_conv);
38178 }
38179
38180 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
38181         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
38182         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
38183         return ret_conv;
38184 }
38185
38186 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_on_chain_sweep"))) TS_ConfirmationTarget_on_chain_sweep() {
38187         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_on_chain_sweep());
38188         return ret_conv;
38189 }
38190
38191 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee() {
38192         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
38193         return ret_conv;
38194 }
38195
38196 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee() {
38197         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
38198         return ret_conv;
38199 }
38200
38201 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_anchor_channel_fee"))) TS_ConfirmationTarget_anchor_channel_fee() {
38202         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_anchor_channel_fee());
38203         return ret_conv;
38204 }
38205
38206 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_non_anchor_channel_fee"))) TS_ConfirmationTarget_non_anchor_channel_fee() {
38207         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_non_anchor_channel_fee());
38208         return ret_conv;
38209 }
38210
38211 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_channel_close_minimum"))) TS_ConfirmationTarget_channel_close_minimum() {
38212         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_channel_close_minimum());
38213         return ret_conv;
38214 }
38215
38216 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_output_spending_fee"))) TS_ConfirmationTarget_output_spending_fee() {
38217         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_output_spending_fee());
38218         return ret_conv;
38219 }
38220
38221 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
38222         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
38223         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
38224         return ret_conv;
38225 }
38226
38227 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
38228         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
38229         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
38230         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
38231         return ret_conv;
38232 }
38233
38234 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
38235         if (!ptr_is_owned(this_ptr)) return;
38236         void* this_ptr_ptr = untag_ptr(this_ptr);
38237         CHECK_ACCESS(this_ptr_ptr);
38238         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
38239         FREE(untag_ptr(this_ptr));
38240         FeeEstimator_free(this_ptr_conv);
38241 }
38242
38243 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
38244         LDKMonitorUpdateId this_obj_conv;
38245         this_obj_conv.inner = untag_ptr(this_obj);
38246         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38248         MonitorUpdateId_free(this_obj_conv);
38249 }
38250
38251 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
38252         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
38253         uint64_t ret_ref = 0;
38254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38256         return ret_ref;
38257 }
38258 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
38259         LDKMonitorUpdateId arg_conv;
38260         arg_conv.inner = untag_ptr(arg);
38261         arg_conv.is_owned = ptr_is_owned(arg);
38262         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38263         arg_conv.is_owned = false;
38264         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
38265         return ret_conv;
38266 }
38267
38268 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
38269         LDKMonitorUpdateId orig_conv;
38270         orig_conv.inner = untag_ptr(orig);
38271         orig_conv.is_owned = ptr_is_owned(orig);
38272         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38273         orig_conv.is_owned = false;
38274         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
38275         uint64_t ret_ref = 0;
38276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38278         return ret_ref;
38279 }
38280
38281 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
38282         LDKMonitorUpdateId o_conv;
38283         o_conv.inner = untag_ptr(o);
38284         o_conv.is_owned = ptr_is_owned(o);
38285         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38286         o_conv.is_owned = false;
38287         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
38288         return ret_conv;
38289 }
38290
38291 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
38292         LDKMonitorUpdateId a_conv;
38293         a_conv.inner = untag_ptr(a);
38294         a_conv.is_owned = ptr_is_owned(a);
38295         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38296         a_conv.is_owned = false;
38297         LDKMonitorUpdateId b_conv;
38298         b_conv.inner = untag_ptr(b);
38299         b_conv.is_owned = ptr_is_owned(b);
38300         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38301         b_conv.is_owned = false;
38302         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
38303         return ret_conv;
38304 }
38305
38306 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
38307         if (!ptr_is_owned(this_ptr)) return;
38308         void* this_ptr_ptr = untag_ptr(this_ptr);
38309         CHECK_ACCESS(this_ptr_ptr);
38310         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
38311         FREE(untag_ptr(this_ptr));
38312         Persist_free(this_ptr_conv);
38313 }
38314
38315 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
38316         LDKLockedChannelMonitor this_obj_conv;
38317         this_obj_conv.inner = untag_ptr(this_obj);
38318         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38320         LockedChannelMonitor_free(this_obj_conv);
38321 }
38322
38323 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
38324         LDKChainMonitor this_obj_conv;
38325         this_obj_conv.inner = untag_ptr(this_obj);
38326         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38328         ChainMonitor_free(this_obj_conv);
38329 }
38330
38331 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) {
38332         void* chain_source_ptr = untag_ptr(chain_source);
38333         CHECK_ACCESS(chain_source_ptr);
38334         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
38335         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
38336         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
38337                 // Manually implement clone for Java trait instances
38338                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
38339                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38340                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
38341                 }
38342         }
38343         void* broadcaster_ptr = untag_ptr(broadcaster);
38344         CHECK_ACCESS(broadcaster_ptr);
38345         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38346         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38347                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38348                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38349         }
38350         void* logger_ptr = untag_ptr(logger);
38351         CHECK_ACCESS(logger_ptr);
38352         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38353         if (logger_conv.free == LDKLogger_JCalls_free) {
38354                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38355                 LDKLogger_JCalls_cloned(&logger_conv);
38356         }
38357         void* feeest_ptr = untag_ptr(feeest);
38358         CHECK_ACCESS(feeest_ptr);
38359         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
38360         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
38361                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38362                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
38363         }
38364         void* persister_ptr = untag_ptr(persister);
38365         CHECK_ACCESS(persister_ptr);
38366         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
38367         if (persister_conv.free == LDKPersist_JCalls_free) {
38368                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38369                 LDKPersist_JCalls_cloned(&persister_conv);
38370         }
38371         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
38372         uint64_t ret_ref = 0;
38373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38375         return ret_ref;
38376 }
38377
38378 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
38379         LDKChainMonitor this_arg_conv;
38380         this_arg_conv.inner = untag_ptr(this_arg);
38381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38383         this_arg_conv.is_owned = false;
38384         LDKCVec_ChannelDetailsZ ignored_channels_constr;
38385         ignored_channels_constr.datalen = ignored_channels->arr_len;
38386         if (ignored_channels_constr.datalen > 0)
38387                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
38388         else
38389                 ignored_channels_constr.data = NULL;
38390         uint64_t* ignored_channels_vals = ignored_channels->elems;
38391         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
38392                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
38393                 LDKChannelDetails ignored_channels_conv_16_conv;
38394                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
38395                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
38396                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
38397                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
38398                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
38399         }
38400         FREE(ignored_channels);
38401         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
38402         uint64_tArray ret_arr = NULL;
38403         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38404         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38405         for (size_t j = 0; j < ret_var.datalen; j++) {
38406                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38407                 *ret_conv_9_copy = ret_var.data[j];
38408                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
38409                 ret_arr_ptr[j] = ret_conv_9_ref;
38410         }
38411         
38412         FREE(ret_var.data);
38413         return ret_arr;
38414 }
38415
38416 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
38417         LDKChainMonitor this_arg_conv;
38418         this_arg_conv.inner = untag_ptr(this_arg);
38419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38421         this_arg_conv.is_owned = false;
38422         LDKOutPoint funding_txo_conv;
38423         funding_txo_conv.inner = untag_ptr(funding_txo);
38424         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
38425         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
38426         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
38427         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
38428         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
38429         return tag_ptr(ret_conv, true);
38430 }
38431
38432 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
38433         LDKChainMonitor this_arg_conv;
38434         this_arg_conv.inner = untag_ptr(this_arg);
38435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38437         this_arg_conv.is_owned = false;
38438         LDKCVec_C2Tuple_OutPointChannelIdZZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
38439         uint64_tArray ret_arr = NULL;
38440         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38441         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38442         for (size_t d = 0; d < ret_var.datalen; d++) {
38443                 LDKC2Tuple_OutPointChannelIdZ* ret_conv_29_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
38444                 *ret_conv_29_conv = ret_var.data[d];
38445                 ret_arr_ptr[d] = tag_ptr(ret_conv_29_conv, true);
38446         }
38447         
38448         FREE(ret_var.data);
38449         return ret_arr;
38450 }
38451
38452 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
38453         LDKChainMonitor this_arg_conv;
38454         this_arg_conv.inner = untag_ptr(this_arg);
38455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38457         this_arg_conv.is_owned = false;
38458         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
38459         uint64_tArray ret_arr = NULL;
38460         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38461         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38462         for (size_t p = 0; p < ret_var.datalen; p++) {
38463                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
38464                 *ret_conv_41_conv = ret_var.data[p];
38465                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
38466         }
38467         
38468         FREE(ret_var.data);
38469         return ret_arr;
38470 }
38471
38472 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) {
38473         LDKChainMonitor this_arg_conv;
38474         this_arg_conv.inner = untag_ptr(this_arg);
38475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38477         this_arg_conv.is_owned = false;
38478         LDKOutPoint funding_txo_conv;
38479         funding_txo_conv.inner = untag_ptr(funding_txo);
38480         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
38481         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
38482         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
38483         LDKMonitorUpdateId completed_update_id_conv;
38484         completed_update_id_conv.inner = untag_ptr(completed_update_id);
38485         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
38486         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
38487         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
38488         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38489         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
38490         return tag_ptr(ret_conv, true);
38491 }
38492
38493 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
38494         LDKChainMonitor this_arg_conv;
38495         this_arg_conv.inner = untag_ptr(this_arg);
38496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38498         this_arg_conv.is_owned = false;
38499         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
38500         uint64_t ret_ref = 0;
38501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38503         return ret_ref;
38504 }
38505
38506 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
38507         LDKChainMonitor this_arg_conv;
38508         this_arg_conv.inner = untag_ptr(this_arg);
38509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38511         this_arg_conv.is_owned = false;
38512         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
38513 }
38514
38515 void  __attribute__((export_name("TS_ChainMonitor_signer_unblocked"))) TS_ChainMonitor_signer_unblocked(uint64_t this_arg, uint64_t monitor_opt) {
38516         LDKChainMonitor this_arg_conv;
38517         this_arg_conv.inner = untag_ptr(this_arg);
38518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38520         this_arg_conv.is_owned = false;
38521         LDKOutPoint monitor_opt_conv;
38522         monitor_opt_conv.inner = untag_ptr(monitor_opt);
38523         monitor_opt_conv.is_owned = ptr_is_owned(monitor_opt);
38524         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_opt_conv);
38525         monitor_opt_conv = OutPoint_clone(&monitor_opt_conv);
38526         ChainMonitor_signer_unblocked(&this_arg_conv, monitor_opt_conv);
38527 }
38528
38529 void  __attribute__((export_name("TS_ChainMonitor_archive_fully_resolved_channel_monitors"))) TS_ChainMonitor_archive_fully_resolved_channel_monitors(uint64_t this_arg) {
38530         LDKChainMonitor this_arg_conv;
38531         this_arg_conv.inner = untag_ptr(this_arg);
38532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38534         this_arg_conv.is_owned = false;
38535         ChainMonitor_archive_fully_resolved_channel_monitors(&this_arg_conv);
38536 }
38537
38538 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
38539         LDKChainMonitor this_arg_conv;
38540         this_arg_conv.inner = untag_ptr(this_arg);
38541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38543         this_arg_conv.is_owned = false;
38544         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
38545         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
38546         return tag_ptr(ret_ret, true);
38547 }
38548
38549 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
38550         LDKChainMonitor this_arg_conv;
38551         this_arg_conv.inner = untag_ptr(this_arg);
38552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38554         this_arg_conv.is_owned = false;
38555         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
38556         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
38557         return tag_ptr(ret_ret, true);
38558 }
38559
38560 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
38561         LDKChainMonitor this_arg_conv;
38562         this_arg_conv.inner = untag_ptr(this_arg);
38563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38565         this_arg_conv.is_owned = false;
38566         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
38567         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
38568         return tag_ptr(ret_ret, true);
38569 }
38570
38571 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
38572         LDKChainMonitor this_arg_conv;
38573         this_arg_conv.inner = untag_ptr(this_arg);
38574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38576         this_arg_conv.is_owned = false;
38577         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
38578         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
38579         return tag_ptr(ret_ret, true);
38580 }
38581
38582 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
38583         LDKChannelMonitorUpdate this_obj_conv;
38584         this_obj_conv.inner = untag_ptr(this_obj);
38585         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38587         ChannelMonitorUpdate_free(this_obj_conv);
38588 }
38589
38590 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
38591         LDKChannelMonitorUpdate this_ptr_conv;
38592         this_ptr_conv.inner = untag_ptr(this_ptr);
38593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38595         this_ptr_conv.is_owned = false;
38596         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
38597         return ret_conv;
38598 }
38599
38600 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
38601         LDKChannelMonitorUpdate this_ptr_conv;
38602         this_ptr_conv.inner = untag_ptr(this_ptr);
38603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38605         this_ptr_conv.is_owned = false;
38606         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
38607 }
38608
38609 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_channel_id"))) TS_ChannelMonitorUpdate_get_channel_id(uint64_t this_ptr) {
38610         LDKChannelMonitorUpdate this_ptr_conv;
38611         this_ptr_conv.inner = untag_ptr(this_ptr);
38612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38614         this_ptr_conv.is_owned = false;
38615         LDKChannelId ret_var = ChannelMonitorUpdate_get_channel_id(&this_ptr_conv);
38616         uint64_t ret_ref = 0;
38617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38619         return ret_ref;
38620 }
38621
38622 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_channel_id"))) TS_ChannelMonitorUpdate_set_channel_id(uint64_t this_ptr, uint64_t val) {
38623         LDKChannelMonitorUpdate this_ptr_conv;
38624         this_ptr_conv.inner = untag_ptr(this_ptr);
38625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38627         this_ptr_conv.is_owned = false;
38628         LDKChannelId val_conv;
38629         val_conv.inner = untag_ptr(val);
38630         val_conv.is_owned = ptr_is_owned(val);
38631         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38632         val_conv = ChannelId_clone(&val_conv);
38633         ChannelMonitorUpdate_set_channel_id(&this_ptr_conv, val_conv);
38634 }
38635
38636 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
38637         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
38638         uint64_t ret_ref = 0;
38639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38641         return ret_ref;
38642 }
38643 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
38644         LDKChannelMonitorUpdate arg_conv;
38645         arg_conv.inner = untag_ptr(arg);
38646         arg_conv.is_owned = ptr_is_owned(arg);
38647         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38648         arg_conv.is_owned = false;
38649         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
38650         return ret_conv;
38651 }
38652
38653 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
38654         LDKChannelMonitorUpdate orig_conv;
38655         orig_conv.inner = untag_ptr(orig);
38656         orig_conv.is_owned = ptr_is_owned(orig);
38657         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38658         orig_conv.is_owned = false;
38659         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
38660         uint64_t ret_ref = 0;
38661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38663         return ret_ref;
38664 }
38665
38666 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
38667         LDKChannelMonitorUpdate a_conv;
38668         a_conv.inner = untag_ptr(a);
38669         a_conv.is_owned = ptr_is_owned(a);
38670         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38671         a_conv.is_owned = false;
38672         LDKChannelMonitorUpdate b_conv;
38673         b_conv.inner = untag_ptr(b);
38674         b_conv.is_owned = ptr_is_owned(b);
38675         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38676         b_conv.is_owned = false;
38677         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
38678         return ret_conv;
38679 }
38680
38681 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
38682         LDKChannelMonitorUpdate obj_conv;
38683         obj_conv.inner = untag_ptr(obj);
38684         obj_conv.is_owned = ptr_is_owned(obj);
38685         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38686         obj_conv.is_owned = false;
38687         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
38688         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38689         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38690         CVec_u8Z_free(ret_var);
38691         return ret_arr;
38692 }
38693
38694 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
38695         LDKu8slice ser_ref;
38696         ser_ref.datalen = ser->arr_len;
38697         ser_ref.data = ser->elems;
38698         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
38699         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
38700         FREE(ser);
38701         return tag_ptr(ret_conv, true);
38702 }
38703
38704 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
38705         if (!ptr_is_owned(this_ptr)) return;
38706         void* this_ptr_ptr = untag_ptr(this_ptr);
38707         CHECK_ACCESS(this_ptr_ptr);
38708         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
38709         FREE(untag_ptr(this_ptr));
38710         MonitorEvent_free(this_ptr_conv);
38711 }
38712
38713 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
38714         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38715         *ret_copy = MonitorEvent_clone(arg);
38716         uint64_t ret_ref = tag_ptr(ret_copy, true);
38717         return ret_ref;
38718 }
38719 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
38720         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
38721         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
38722         return ret_conv;
38723 }
38724
38725 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
38726         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
38727         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38728         *ret_copy = MonitorEvent_clone(orig_conv);
38729         uint64_t ret_ref = tag_ptr(ret_copy, true);
38730         return ret_ref;
38731 }
38732
38733 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
38734         LDKHTLCUpdate a_conv;
38735         a_conv.inner = untag_ptr(a);
38736         a_conv.is_owned = ptr_is_owned(a);
38737         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38738         a_conv = HTLCUpdate_clone(&a_conv);
38739         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38740         *ret_copy = MonitorEvent_htlcevent(a_conv);
38741         uint64_t ret_ref = tag_ptr(ret_copy, true);
38742         return ret_ref;
38743 }
38744
38745 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) {
38746         void* reason_ptr = untag_ptr(reason);
38747         CHECK_ACCESS(reason_ptr);
38748         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
38749         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
38750         LDKOutPoint outpoint_conv;
38751         outpoint_conv.inner = untag_ptr(outpoint);
38752         outpoint_conv.is_owned = ptr_is_owned(outpoint);
38753         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
38754         outpoint_conv = OutPoint_clone(&outpoint_conv);
38755         LDKChannelId channel_id_conv;
38756         channel_id_conv.inner = untag_ptr(channel_id);
38757         channel_id_conv.is_owned = ptr_is_owned(channel_id);
38758         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
38759         channel_id_conv = ChannelId_clone(&channel_id_conv);
38760         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38761         *ret_copy = MonitorEvent_holder_force_closed_with_info(reason_conv, outpoint_conv, channel_id_conv);
38762         uint64_t ret_ref = tag_ptr(ret_copy, true);
38763         return ret_ref;
38764 }
38765
38766 uint64_t  __attribute__((export_name("TS_MonitorEvent_holder_force_closed"))) TS_MonitorEvent_holder_force_closed(uint64_t a) {
38767         LDKOutPoint a_conv;
38768         a_conv.inner = untag_ptr(a);
38769         a_conv.is_owned = ptr_is_owned(a);
38770         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38771         a_conv = OutPoint_clone(&a_conv);
38772         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38773         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
38774         uint64_t ret_ref = tag_ptr(ret_copy, true);
38775         return ret_ref;
38776 }
38777
38778 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, uint64_t channel_id, int64_t monitor_update_id) {
38779         LDKOutPoint funding_txo_conv;
38780         funding_txo_conv.inner = untag_ptr(funding_txo);
38781         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
38782         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
38783         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
38784         LDKChannelId channel_id_conv;
38785         channel_id_conv.inner = untag_ptr(channel_id);
38786         channel_id_conv.is_owned = ptr_is_owned(channel_id);
38787         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
38788         channel_id_conv = ChannelId_clone(&channel_id_conv);
38789         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38790         *ret_copy = MonitorEvent_completed(funding_txo_conv, channel_id_conv, monitor_update_id);
38791         uint64_t ret_ref = tag_ptr(ret_copy, true);
38792         return ret_ref;
38793 }
38794
38795 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
38796         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
38797         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
38798         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
38799         return ret_conv;
38800 }
38801
38802 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
38803         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
38804         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
38805         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38806         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38807         CVec_u8Z_free(ret_var);
38808         return ret_arr;
38809 }
38810
38811 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
38812         LDKu8slice ser_ref;
38813         ser_ref.datalen = ser->arr_len;
38814         ser_ref.data = ser->elems;
38815         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
38816         *ret_conv = MonitorEvent_read(ser_ref);
38817         FREE(ser);
38818         return tag_ptr(ret_conv, true);
38819 }
38820
38821 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
38822         LDKHTLCUpdate this_obj_conv;
38823         this_obj_conv.inner = untag_ptr(this_obj);
38824         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38826         HTLCUpdate_free(this_obj_conv);
38827 }
38828
38829 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
38830         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
38831         uint64_t ret_ref = 0;
38832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38834         return ret_ref;
38835 }
38836 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
38837         LDKHTLCUpdate arg_conv;
38838         arg_conv.inner = untag_ptr(arg);
38839         arg_conv.is_owned = ptr_is_owned(arg);
38840         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38841         arg_conv.is_owned = false;
38842         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
38843         return ret_conv;
38844 }
38845
38846 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
38847         LDKHTLCUpdate orig_conv;
38848         orig_conv.inner = untag_ptr(orig);
38849         orig_conv.is_owned = ptr_is_owned(orig);
38850         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38851         orig_conv.is_owned = false;
38852         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
38853         uint64_t ret_ref = 0;
38854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38856         return ret_ref;
38857 }
38858
38859 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
38860         LDKHTLCUpdate a_conv;
38861         a_conv.inner = untag_ptr(a);
38862         a_conv.is_owned = ptr_is_owned(a);
38863         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38864         a_conv.is_owned = false;
38865         LDKHTLCUpdate b_conv;
38866         b_conv.inner = untag_ptr(b);
38867         b_conv.is_owned = ptr_is_owned(b);
38868         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38869         b_conv.is_owned = false;
38870         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
38871         return ret_conv;
38872 }
38873
38874 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
38875         LDKHTLCUpdate obj_conv;
38876         obj_conv.inner = untag_ptr(obj);
38877         obj_conv.is_owned = ptr_is_owned(obj);
38878         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38879         obj_conv.is_owned = false;
38880         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
38881         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38882         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38883         CVec_u8Z_free(ret_var);
38884         return ret_arr;
38885 }
38886
38887 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
38888         LDKu8slice ser_ref;
38889         ser_ref.datalen = ser->arr_len;
38890         ser_ref.data = ser->elems;
38891         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
38892         *ret_conv = HTLCUpdate_read(ser_ref);
38893         FREE(ser);
38894         return tag_ptr(ret_conv, true);
38895 }
38896
38897 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
38898         if (!ptr_is_owned(this_ptr)) return;
38899         void* this_ptr_ptr = untag_ptr(this_ptr);
38900         CHECK_ACCESS(this_ptr_ptr);
38901         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
38902         FREE(untag_ptr(this_ptr));
38903         Balance_free(this_ptr_conv);
38904 }
38905
38906 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
38907         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38908         *ret_copy = Balance_clone(arg);
38909         uint64_t ret_ref = tag_ptr(ret_copy, true);
38910         return ret_ref;
38911 }
38912 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
38913         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
38914         int64_t ret_conv = Balance_clone_ptr(arg_conv);
38915         return ret_conv;
38916 }
38917
38918 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
38919         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
38920         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38921         *ret_copy = Balance_clone(orig_conv);
38922         uint64_t ret_ref = tag_ptr(ret_copy, true);
38923         return ret_ref;
38924 }
38925
38926 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
38927         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38928         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
38929         uint64_t ret_ref = tag_ptr(ret_copy, true);
38930         return ret_ref;
38931 }
38932
38933 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
38934         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38935         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
38936         uint64_t ret_ref = tag_ptr(ret_copy, true);
38937         return ret_ref;
38938 }
38939
38940 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) {
38941         LDKThirtyTwoBytes payment_hash_ref;
38942         CHECK(payment_hash->arr_len == 32);
38943         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38944         LDKThirtyTwoBytes payment_preimage_ref;
38945         CHECK(payment_preimage->arr_len == 32);
38946         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
38947         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38948         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
38949         uint64_t ret_ref = tag_ptr(ret_copy, true);
38950         return ret_ref;
38951 }
38952
38953 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) {
38954         LDKThirtyTwoBytes payment_hash_ref;
38955         CHECK(payment_hash->arr_len == 32);
38956         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38957         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38958         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
38959         uint64_t ret_ref = tag_ptr(ret_copy, true);
38960         return ret_ref;
38961 }
38962
38963 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) {
38964         LDKThirtyTwoBytes payment_hash_ref;
38965         CHECK(payment_hash->arr_len == 32);
38966         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38967         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38968         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
38969         uint64_t ret_ref = tag_ptr(ret_copy, true);
38970         return ret_ref;
38971 }
38972
38973 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
38974         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38975         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
38976         uint64_t ret_ref = tag_ptr(ret_copy, true);
38977         return ret_ref;
38978 }
38979
38980 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
38981         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
38982         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
38983         jboolean ret_conv = Balance_eq(a_conv, b_conv);
38984         return ret_conv;
38985 }
38986
38987 int64_t  __attribute__((export_name("TS_Balance_claimable_amount_satoshis"))) TS_Balance_claimable_amount_satoshis(uint64_t this_arg) {
38988         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
38989         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
38990         return ret_conv;
38991 }
38992
38993 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
38994         LDKChannelMonitor this_obj_conv;
38995         this_obj_conv.inner = untag_ptr(this_obj);
38996         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38998         ChannelMonitor_free(this_obj_conv);
38999 }
39000
39001 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
39002         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
39003         uint64_t ret_ref = 0;
39004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39006         return ret_ref;
39007 }
39008 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
39009         LDKChannelMonitor arg_conv;
39010         arg_conv.inner = untag_ptr(arg);
39011         arg_conv.is_owned = ptr_is_owned(arg);
39012         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39013         arg_conv.is_owned = false;
39014         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
39015         return ret_conv;
39016 }
39017
39018 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
39019         LDKChannelMonitor orig_conv;
39020         orig_conv.inner = untag_ptr(orig);
39021         orig_conv.is_owned = ptr_is_owned(orig);
39022         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39023         orig_conv.is_owned = false;
39024         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
39025         uint64_t ret_ref = 0;
39026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39028         return ret_ref;
39029 }
39030
39031 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
39032         LDKChannelMonitor obj_conv;
39033         obj_conv.inner = untag_ptr(obj);
39034         obj_conv.is_owned = ptr_is_owned(obj);
39035         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39036         obj_conv.is_owned = false;
39037         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
39038         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39039         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39040         CVec_u8Z_free(ret_var);
39041         return ret_arr;
39042 }
39043
39044 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) {
39045         LDKChannelMonitor this_arg_conv;
39046         this_arg_conv.inner = untag_ptr(this_arg);
39047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39049         this_arg_conv.is_owned = false;
39050         LDKChannelMonitorUpdate updates_conv;
39051         updates_conv.inner = untag_ptr(updates);
39052         updates_conv.is_owned = ptr_is_owned(updates);
39053         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
39054         updates_conv.is_owned = false;
39055         void* broadcaster_ptr = untag_ptr(broadcaster);
39056         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
39057         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
39058         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39059         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
39060         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
39061         void* logger_ptr = untag_ptr(logger);
39062         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39063         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39064         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
39065         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39066         return tag_ptr(ret_conv, true);
39067 }
39068
39069 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
39070         LDKChannelMonitor this_arg_conv;
39071         this_arg_conv.inner = untag_ptr(this_arg);
39072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39074         this_arg_conv.is_owned = false;
39075         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
39076         return ret_conv;
39077 }
39078
39079 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
39080         LDKChannelMonitor this_arg_conv;
39081         this_arg_conv.inner = untag_ptr(this_arg);
39082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39084         this_arg_conv.is_owned = false;
39085         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
39086         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
39087         return tag_ptr(ret_conv, true);
39088 }
39089
39090 uint64_t  __attribute__((export_name("TS_ChannelMonitor_channel_id"))) TS_ChannelMonitor_channel_id(uint64_t this_arg) {
39091         LDKChannelMonitor this_arg_conv;
39092         this_arg_conv.inner = untag_ptr(this_arg);
39093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39095         this_arg_conv.is_owned = false;
39096         LDKChannelId ret_var = ChannelMonitor_channel_id(&this_arg_conv);
39097         uint64_t ret_ref = 0;
39098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39100         return ret_ref;
39101 }
39102
39103 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
39104         LDKChannelMonitor this_arg_conv;
39105         this_arg_conv.inner = untag_ptr(this_arg);
39106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39108         this_arg_conv.is_owned = false;
39109         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
39110         uint64_tArray ret_arr = NULL;
39111         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39112         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39113         for (size_t a = 0; a < ret_var.datalen; a++) {
39114                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
39115                 *ret_conv_52_conv = ret_var.data[a];
39116                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
39117         }
39118         
39119         FREE(ret_var.data);
39120         return ret_arr;
39121 }
39122
39123 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) {
39124         LDKChannelMonitor this_arg_conv;
39125         this_arg_conv.inner = untag_ptr(this_arg);
39126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39128         this_arg_conv.is_owned = false;
39129         void* filter_ptr = untag_ptr(filter);
39130         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
39131         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
39132         void* logger_ptr = untag_ptr(logger);
39133         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39134         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39135         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
39136 }
39137
39138 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) {
39139         LDKChannelMonitor this_arg_conv;
39140         this_arg_conv.inner = untag_ptr(this_arg);
39141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39143         this_arg_conv.is_owned = false;
39144         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
39145         uint64_tArray ret_arr = NULL;
39146         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39147         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39148         for (size_t o = 0; o < ret_var.datalen; o++) {
39149                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39150                 *ret_conv_14_copy = ret_var.data[o];
39151                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
39152                 ret_arr_ptr[o] = ret_conv_14_ref;
39153         }
39154         
39155         FREE(ret_var.data);
39156         return ret_arr;
39157 }
39158
39159 void  __attribute__((export_name("TS_ChannelMonitor_process_pending_events"))) TS_ChannelMonitor_process_pending_events(uint64_t this_arg, uint64_t handler) {
39160         LDKChannelMonitor this_arg_conv;
39161         this_arg_conv.inner = untag_ptr(this_arg);
39162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39164         this_arg_conv.is_owned = false;
39165         void* handler_ptr = untag_ptr(handler);
39166         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
39167         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
39168         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
39169 }
39170
39171 uint64_t  __attribute__((export_name("TS_ChannelMonitor_initial_counterparty_commitment_tx"))) TS_ChannelMonitor_initial_counterparty_commitment_tx(uint64_t this_arg) {
39172         LDKChannelMonitor this_arg_conv;
39173         this_arg_conv.inner = untag_ptr(this_arg);
39174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39176         this_arg_conv.is_owned = false;
39177         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
39178         uint64_t ret_ref = 0;
39179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39181         return ret_ref;
39182 }
39183
39184 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) {
39185         LDKChannelMonitor this_arg_conv;
39186         this_arg_conv.inner = untag_ptr(this_arg);
39187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39189         this_arg_conv.is_owned = false;
39190         LDKChannelMonitorUpdate update_conv;
39191         update_conv.inner = untag_ptr(update);
39192         update_conv.is_owned = ptr_is_owned(update);
39193         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
39194         update_conv.is_owned = false;
39195         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
39196         uint64_tArray ret_arr = NULL;
39197         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39198         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39199         for (size_t x = 0; x < ret_var.datalen; x++) {
39200                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
39201                 uint64_t ret_conv_23_ref = 0;
39202                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
39203                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
39204                 ret_arr_ptr[x] = ret_conv_23_ref;
39205         }
39206         
39207         FREE(ret_var.data);
39208         return ret_arr;
39209 }
39210
39211 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) {
39212         LDKChannelMonitor this_arg_conv;
39213         this_arg_conv.inner = untag_ptr(this_arg);
39214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39216         this_arg_conv.is_owned = false;
39217         LDKTransaction justice_tx_ref;
39218         justice_tx_ref.datalen = justice_tx->arr_len;
39219         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
39220         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
39221         justice_tx_ref.data_is_owned = true;
39222         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
39223         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
39224         return tag_ptr(ret_conv, true);
39225 }
39226
39227 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
39228         LDKChannelMonitor this_arg_conv;
39229         this_arg_conv.inner = untag_ptr(this_arg);
39230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39232         this_arg_conv.is_owned = false;
39233         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39234         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
39235         return ret_arr;
39236 }
39237
39238 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) {
39239         LDKChannelMonitor this_arg_conv;
39240         this_arg_conv.inner = untag_ptr(this_arg);
39241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39243         this_arg_conv.is_owned = false;
39244         void* broadcaster_ptr = untag_ptr(broadcaster);
39245         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
39246         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
39247         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39248         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
39249         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
39250         void* logger_ptr = untag_ptr(logger);
39251         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39252         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39253         ChannelMonitor_broadcast_latest_holder_commitment_txn(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39254 }
39255
39256 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) {
39257         LDKChannelMonitor this_arg_conv;
39258         this_arg_conv.inner = untag_ptr(this_arg);
39259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39261         this_arg_conv.is_owned = false;
39262         uint8_t header_arr[80];
39263         CHECK(header->arr_len == 80);
39264         memcpy(header_arr, header->elems, 80); FREE(header);
39265         uint8_t (*header_ref)[80] = &header_arr;
39266         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
39267         txdata_constr.datalen = txdata->arr_len;
39268         if (txdata_constr.datalen > 0)
39269                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
39270         else
39271                 txdata_constr.data = NULL;
39272         uint64_t* txdata_vals = txdata->elems;
39273         for (size_t c = 0; c < txdata_constr.datalen; c++) {
39274                 uint64_t txdata_conv_28 = txdata_vals[c];
39275                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
39276                 CHECK_ACCESS(txdata_conv_28_ptr);
39277                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
39278                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
39279                 txdata_constr.data[c] = txdata_conv_28_conv;
39280         }
39281         FREE(txdata);
39282         void* broadcaster_ptr = untag_ptr(broadcaster);
39283         CHECK_ACCESS(broadcaster_ptr);
39284         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39285         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39286                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39287                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39288         }
39289         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39290         CHECK_ACCESS(fee_estimator_ptr);
39291         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39292         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39293                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39294                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39295         }
39296         void* logger_ptr = untag_ptr(logger);
39297         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39298         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39299         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);
39300         uint64_tArray ret_arr = NULL;
39301         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39302         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39303         for (size_t x = 0; x < ret_var.datalen; x++) {
39304                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
39305                 *ret_conv_49_conv = ret_var.data[x];
39306                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
39307         }
39308         
39309         FREE(ret_var.data);
39310         return ret_arr;
39311 }
39312
39313 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) {
39314         LDKChannelMonitor this_arg_conv;
39315         this_arg_conv.inner = untag_ptr(this_arg);
39316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39318         this_arg_conv.is_owned = false;
39319         uint8_t header_arr[80];
39320         CHECK(header->arr_len == 80);
39321         memcpy(header_arr, header->elems, 80); FREE(header);
39322         uint8_t (*header_ref)[80] = &header_arr;
39323         void* broadcaster_ptr = untag_ptr(broadcaster);
39324         CHECK_ACCESS(broadcaster_ptr);
39325         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39326         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39327                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39328                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39329         }
39330         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39331         CHECK_ACCESS(fee_estimator_ptr);
39332         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39333         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39334                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39335                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39336         }
39337         void* logger_ptr = untag_ptr(logger);
39338         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39339         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39340         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
39341 }
39342
39343 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) {
39344         LDKChannelMonitor this_arg_conv;
39345         this_arg_conv.inner = untag_ptr(this_arg);
39346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39348         this_arg_conv.is_owned = false;
39349         uint8_t header_arr[80];
39350         CHECK(header->arr_len == 80);
39351         memcpy(header_arr, header->elems, 80); FREE(header);
39352         uint8_t (*header_ref)[80] = &header_arr;
39353         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
39354         txdata_constr.datalen = txdata->arr_len;
39355         if (txdata_constr.datalen > 0)
39356                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
39357         else
39358                 txdata_constr.data = NULL;
39359         uint64_t* txdata_vals = txdata->elems;
39360         for (size_t c = 0; c < txdata_constr.datalen; c++) {
39361                 uint64_t txdata_conv_28 = txdata_vals[c];
39362                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
39363                 CHECK_ACCESS(txdata_conv_28_ptr);
39364                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
39365                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
39366                 txdata_constr.data[c] = txdata_conv_28_conv;
39367         }
39368         FREE(txdata);
39369         void* broadcaster_ptr = untag_ptr(broadcaster);
39370         CHECK_ACCESS(broadcaster_ptr);
39371         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39372         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39373                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39374                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39375         }
39376         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39377         CHECK_ACCESS(fee_estimator_ptr);
39378         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39379         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39380                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39381                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39382         }
39383         void* logger_ptr = untag_ptr(logger);
39384         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39385         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39386         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);
39387         uint64_tArray ret_arr = NULL;
39388         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39389         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39390         for (size_t x = 0; x < ret_var.datalen; x++) {
39391                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
39392                 *ret_conv_49_conv = ret_var.data[x];
39393                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
39394         }
39395         
39396         FREE(ret_var.data);
39397         return ret_arr;
39398 }
39399
39400 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) {
39401         LDKChannelMonitor this_arg_conv;
39402         this_arg_conv.inner = untag_ptr(this_arg);
39403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39405         this_arg_conv.is_owned = false;
39406         uint8_t txid_arr[32];
39407         CHECK(txid->arr_len == 32);
39408         memcpy(txid_arr, txid->elems, 32); FREE(txid);
39409         uint8_t (*txid_ref)[32] = &txid_arr;
39410         void* broadcaster_ptr = untag_ptr(broadcaster);
39411         CHECK_ACCESS(broadcaster_ptr);
39412         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39413         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39414                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39415                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39416         }
39417         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39418         CHECK_ACCESS(fee_estimator_ptr);
39419         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39420         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39421                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39422                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39423         }
39424         void* logger_ptr = untag_ptr(logger);
39425         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39426         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39427         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
39428 }
39429
39430 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) {
39431         LDKChannelMonitor this_arg_conv;
39432         this_arg_conv.inner = untag_ptr(this_arg);
39433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39435         this_arg_conv.is_owned = false;
39436         uint8_t header_arr[80];
39437         CHECK(header->arr_len == 80);
39438         memcpy(header_arr, header->elems, 80); FREE(header);
39439         uint8_t (*header_ref)[80] = &header_arr;
39440         void* broadcaster_ptr = untag_ptr(broadcaster);
39441         CHECK_ACCESS(broadcaster_ptr);
39442         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39443         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39444                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39445                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39446         }
39447         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39448         CHECK_ACCESS(fee_estimator_ptr);
39449         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39450         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39451                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39452                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39453         }
39454         void* logger_ptr = untag_ptr(logger);
39455         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39456         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39457         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
39458         uint64_tArray ret_arr = NULL;
39459         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39460         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39461         for (size_t x = 0; x < ret_var.datalen; x++) {
39462                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
39463                 *ret_conv_49_conv = ret_var.data[x];
39464                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
39465         }
39466         
39467         FREE(ret_var.data);
39468         return ret_arr;
39469 }
39470
39471 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
39472         LDKChannelMonitor this_arg_conv;
39473         this_arg_conv.inner = untag_ptr(this_arg);
39474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39476         this_arg_conv.is_owned = false;
39477         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
39478         uint64_tArray ret_arr = NULL;
39479         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39480         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39481         for (size_t c = 0; c < ret_var.datalen; c++) {
39482                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
39483                 *ret_conv_54_conv = ret_var.data[c];
39484                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
39485         }
39486         
39487         FREE(ret_var.data);
39488         return ret_arr;
39489 }
39490
39491 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
39492         LDKChannelMonitor this_arg_conv;
39493         this_arg_conv.inner = untag_ptr(this_arg);
39494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39496         this_arg_conv.is_owned = false;
39497         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
39498         uint64_t ret_ref = 0;
39499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39501         return ret_ref;
39502 }
39503
39504 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) {
39505         LDKChannelMonitor this_arg_conv;
39506         this_arg_conv.inner = untag_ptr(this_arg);
39507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39509         this_arg_conv.is_owned = false;
39510         void* broadcaster_ptr = untag_ptr(broadcaster);
39511         CHECK_ACCESS(broadcaster_ptr);
39512         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39513         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39514                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39515                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39516         }
39517         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39518         CHECK_ACCESS(fee_estimator_ptr);
39519         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39520         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39521                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39522                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39523         }
39524         void* logger_ptr = untag_ptr(logger);
39525         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39526         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39527         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39528 }
39529
39530 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) {
39531         LDKChannelMonitor this_arg_conv;
39532         this_arg_conv.inner = untag_ptr(this_arg);
39533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39535         this_arg_conv.is_owned = false;
39536         void* broadcaster_ptr = untag_ptr(broadcaster);
39537         CHECK_ACCESS(broadcaster_ptr);
39538         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39539         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39540                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39541                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39542         }
39543         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39544         CHECK_ACCESS(fee_estimator_ptr);
39545         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39546         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39547                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39548                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39549         }
39550         void* logger_ptr = untag_ptr(logger);
39551         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39552         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39553         ChannelMonitor_signer_unblocked(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39554 }
39555
39556 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) {
39557         LDKChannelMonitor this_arg_conv;
39558         this_arg_conv.inner = untag_ptr(this_arg);
39559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39561         this_arg_conv.is_owned = false;
39562         LDKTransaction tx_ref;
39563         tx_ref.datalen = tx->arr_len;
39564         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
39565         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
39566         tx_ref.data_is_owned = true;
39567         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
39568         uint64_tArray ret_arr = NULL;
39569         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39570         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39571         for (size_t b = 0; b < ret_var.datalen; b++) {
39572                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
39573                 *ret_conv_27_copy = ret_var.data[b];
39574                 uint64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
39575                 ret_arr_ptr[b] = ret_conv_27_ref;
39576         }
39577         
39578         FREE(ret_var.data);
39579         return ret_arr;
39580 }
39581
39582 jboolean  __attribute__((export_name("TS_ChannelMonitor_is_fully_resolved"))) TS_ChannelMonitor_is_fully_resolved(uint64_t this_arg, uint64_t logger) {
39583         LDKChannelMonitor this_arg_conv;
39584         this_arg_conv.inner = untag_ptr(this_arg);
39585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39587         this_arg_conv.is_owned = false;
39588         void* logger_ptr = untag_ptr(logger);
39589         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39590         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39591         jboolean ret_conv = ChannelMonitor_is_fully_resolved(&this_arg_conv, logger_conv);
39592         return ret_conv;
39593 }
39594
39595 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
39596         LDKChannelMonitor this_arg_conv;
39597         this_arg_conv.inner = untag_ptr(this_arg);
39598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39600         this_arg_conv.is_owned = false;
39601         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
39602         uint64_tArray ret_arr = NULL;
39603         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39604         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39605         for (size_t j = 0; j < ret_var.datalen; j++) {
39606                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39607                 *ret_conv_9_copy = ret_var.data[j];
39608                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
39609                 ret_arr_ptr[j] = ret_conv_9_ref;
39610         }
39611         
39612         FREE(ret_var.data);
39613         return ret_arr;
39614 }
39615
39616 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
39617         LDKu8slice ser_ref;
39618         ser_ref.datalen = ser->arr_len;
39619         ser_ref.data = ser->elems;
39620         void* arg_a_ptr = untag_ptr(arg_a);
39621         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
39622         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
39623         void* arg_b_ptr = untag_ptr(arg_b);
39624         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
39625         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
39626         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
39627         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
39628         FREE(ser);
39629         return tag_ptr(ret_conv, true);
39630 }
39631
39632 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
39633         LDKOutPoint this_obj_conv;
39634         this_obj_conv.inner = untag_ptr(this_obj);
39635         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39637         OutPoint_free(this_obj_conv);
39638 }
39639
39640 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
39641         LDKOutPoint this_ptr_conv;
39642         this_ptr_conv.inner = untag_ptr(this_ptr);
39643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39645         this_ptr_conv.is_owned = false;
39646         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39647         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
39648         return ret_arr;
39649 }
39650
39651 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
39652         LDKOutPoint this_ptr_conv;
39653         this_ptr_conv.inner = untag_ptr(this_ptr);
39654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39656         this_ptr_conv.is_owned = false;
39657         LDKThirtyTwoBytes val_ref;
39658         CHECK(val->arr_len == 32);
39659         memcpy(val_ref.data, val->elems, 32); FREE(val);
39660         OutPoint_set_txid(&this_ptr_conv, val_ref);
39661 }
39662
39663 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
39664         LDKOutPoint this_ptr_conv;
39665         this_ptr_conv.inner = untag_ptr(this_ptr);
39666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39668         this_ptr_conv.is_owned = false;
39669         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
39670         return ret_conv;
39671 }
39672
39673 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
39674         LDKOutPoint this_ptr_conv;
39675         this_ptr_conv.inner = untag_ptr(this_ptr);
39676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39678         this_ptr_conv.is_owned = false;
39679         OutPoint_set_index(&this_ptr_conv, val);
39680 }
39681
39682 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
39683         LDKThirtyTwoBytes txid_arg_ref;
39684         CHECK(txid_arg->arr_len == 32);
39685         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
39686         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
39687         uint64_t ret_ref = 0;
39688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39690         return ret_ref;
39691 }
39692
39693 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
39694         LDKOutPoint ret_var = OutPoint_clone(arg);
39695         uint64_t ret_ref = 0;
39696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39698         return ret_ref;
39699 }
39700 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
39701         LDKOutPoint arg_conv;
39702         arg_conv.inner = untag_ptr(arg);
39703         arg_conv.is_owned = ptr_is_owned(arg);
39704         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39705         arg_conv.is_owned = false;
39706         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
39707         return ret_conv;
39708 }
39709
39710 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
39711         LDKOutPoint orig_conv;
39712         orig_conv.inner = untag_ptr(orig);
39713         orig_conv.is_owned = ptr_is_owned(orig);
39714         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39715         orig_conv.is_owned = false;
39716         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
39717         uint64_t ret_ref = 0;
39718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39720         return ret_ref;
39721 }
39722
39723 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
39724         LDKOutPoint a_conv;
39725         a_conv.inner = untag_ptr(a);
39726         a_conv.is_owned = ptr_is_owned(a);
39727         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39728         a_conv.is_owned = false;
39729         LDKOutPoint b_conv;
39730         b_conv.inner = untag_ptr(b);
39731         b_conv.is_owned = ptr_is_owned(b);
39732         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39733         b_conv.is_owned = false;
39734         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
39735         return ret_conv;
39736 }
39737
39738 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
39739         LDKOutPoint o_conv;
39740         o_conv.inner = untag_ptr(o);
39741         o_conv.is_owned = ptr_is_owned(o);
39742         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39743         o_conv.is_owned = false;
39744         int64_t ret_conv = OutPoint_hash(&o_conv);
39745         return ret_conv;
39746 }
39747
39748 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
39749         LDKOutPoint obj_conv;
39750         obj_conv.inner = untag_ptr(obj);
39751         obj_conv.is_owned = ptr_is_owned(obj);
39752         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39753         obj_conv.is_owned = false;
39754         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
39755         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39756         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39757         CVec_u8Z_free(ret_var);
39758         return ret_arr;
39759 }
39760
39761 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
39762         LDKu8slice ser_ref;
39763         ser_ref.datalen = ser->arr_len;
39764         ser_ref.data = ser->elems;
39765         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
39766         *ret_conv = OutPoint_read(ser_ref);
39767         FREE(ser);
39768         return tag_ptr(ret_conv, true);
39769 }
39770
39771 void  __attribute__((export_name("TS_InboundHTLCErr_free"))) TS_InboundHTLCErr_free(uint64_t this_obj) {
39772         LDKInboundHTLCErr this_obj_conv;
39773         this_obj_conv.inner = untag_ptr(this_obj);
39774         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39776         InboundHTLCErr_free(this_obj_conv);
39777 }
39778
39779 int16_t  __attribute__((export_name("TS_InboundHTLCErr_get_err_code"))) TS_InboundHTLCErr_get_err_code(uint64_t this_ptr) {
39780         LDKInboundHTLCErr this_ptr_conv;
39781         this_ptr_conv.inner = untag_ptr(this_ptr);
39782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39784         this_ptr_conv.is_owned = false;
39785         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
39786         return ret_conv;
39787 }
39788
39789 void  __attribute__((export_name("TS_InboundHTLCErr_set_err_code"))) TS_InboundHTLCErr_set_err_code(uint64_t this_ptr, int16_t val) {
39790         LDKInboundHTLCErr this_ptr_conv;
39791         this_ptr_conv.inner = untag_ptr(this_ptr);
39792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39794         this_ptr_conv.is_owned = false;
39795         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
39796 }
39797
39798 int8_tArray  __attribute__((export_name("TS_InboundHTLCErr_get_err_data"))) TS_InboundHTLCErr_get_err_data(uint64_t this_ptr) {
39799         LDKInboundHTLCErr this_ptr_conv;
39800         this_ptr_conv.inner = untag_ptr(this_ptr);
39801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39803         this_ptr_conv.is_owned = false;
39804         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
39805         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39806         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39807         CVec_u8Z_free(ret_var);
39808         return ret_arr;
39809 }
39810
39811 void  __attribute__((export_name("TS_InboundHTLCErr_set_err_data"))) TS_InboundHTLCErr_set_err_data(uint64_t this_ptr, int8_tArray val) {
39812         LDKInboundHTLCErr this_ptr_conv;
39813         this_ptr_conv.inner = untag_ptr(this_ptr);
39814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39816         this_ptr_conv.is_owned = false;
39817         LDKCVec_u8Z val_ref;
39818         val_ref.datalen = val->arr_len;
39819         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39820         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39821         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
39822 }
39823
39824 jstring  __attribute__((export_name("TS_InboundHTLCErr_get_msg"))) TS_InboundHTLCErr_get_msg(uint64_t this_ptr) {
39825         LDKInboundHTLCErr this_ptr_conv;
39826         this_ptr_conv.inner = untag_ptr(this_ptr);
39827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39829         this_ptr_conv.is_owned = false;
39830         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
39831         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
39832         Str_free(ret_str);
39833         return ret_conv;
39834 }
39835
39836 void  __attribute__((export_name("TS_InboundHTLCErr_set_msg"))) TS_InboundHTLCErr_set_msg(uint64_t this_ptr, jstring val) {
39837         LDKInboundHTLCErr this_ptr_conv;
39838         this_ptr_conv.inner = untag_ptr(this_ptr);
39839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39841         this_ptr_conv.is_owned = false;
39842         LDKStr val_conv = str_ref_to_owned_c(val);
39843         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
39844 }
39845
39846 uint64_t  __attribute__((export_name("TS_InboundHTLCErr_new"))) TS_InboundHTLCErr_new(int16_t err_code_arg, int8_tArray err_data_arg, jstring msg_arg) {
39847         LDKCVec_u8Z err_data_arg_ref;
39848         err_data_arg_ref.datalen = err_data_arg->arr_len;
39849         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39850         memcpy(err_data_arg_ref.data, err_data_arg->elems, err_data_arg_ref.datalen); FREE(err_data_arg);
39851         LDKStr msg_arg_conv = str_ref_to_owned_c(msg_arg);
39852         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
39853         uint64_t ret_ref = 0;
39854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39856         return ret_ref;
39857 }
39858
39859 static inline uint64_t InboundHTLCErr_clone_ptr(LDKInboundHTLCErr *NONNULL_PTR arg) {
39860         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(arg);
39861         uint64_t ret_ref = 0;
39862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39864         return ret_ref;
39865 }
39866 int64_t  __attribute__((export_name("TS_InboundHTLCErr_clone_ptr"))) TS_InboundHTLCErr_clone_ptr(uint64_t arg) {
39867         LDKInboundHTLCErr arg_conv;
39868         arg_conv.inner = untag_ptr(arg);
39869         arg_conv.is_owned = ptr_is_owned(arg);
39870         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39871         arg_conv.is_owned = false;
39872         int64_t ret_conv = InboundHTLCErr_clone_ptr(&arg_conv);
39873         return ret_conv;
39874 }
39875
39876 uint64_t  __attribute__((export_name("TS_InboundHTLCErr_clone"))) TS_InboundHTLCErr_clone(uint64_t orig) {
39877         LDKInboundHTLCErr orig_conv;
39878         orig_conv.inner = untag_ptr(orig);
39879         orig_conv.is_owned = ptr_is_owned(orig);
39880         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39881         orig_conv.is_owned = false;
39882         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(&orig_conv);
39883         uint64_t ret_ref = 0;
39884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39886         return ret_ref;
39887 }
39888
39889 int64_t  __attribute__((export_name("TS_InboundHTLCErr_hash"))) TS_InboundHTLCErr_hash(uint64_t o) {
39890         LDKInboundHTLCErr o_conv;
39891         o_conv.inner = untag_ptr(o);
39892         o_conv.is_owned = ptr_is_owned(o);
39893         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39894         o_conv.is_owned = false;
39895         int64_t ret_conv = InboundHTLCErr_hash(&o_conv);
39896         return ret_conv;
39897 }
39898
39899 jboolean  __attribute__((export_name("TS_InboundHTLCErr_eq"))) TS_InboundHTLCErr_eq(uint64_t a, uint64_t b) {
39900         LDKInboundHTLCErr a_conv;
39901         a_conv.inner = untag_ptr(a);
39902         a_conv.is_owned = ptr_is_owned(a);
39903         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39904         a_conv.is_owned = false;
39905         LDKInboundHTLCErr b_conv;
39906         b_conv.inner = untag_ptr(b);
39907         b_conv.is_owned = ptr_is_owned(b);
39908         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39909         b_conv.is_owned = false;
39910         jboolean ret_conv = InboundHTLCErr_eq(&a_conv, &b_conv);
39911         return ret_conv;
39912 }
39913
39914 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) {
39915         LDKUpdateAddHTLC msg_conv;
39916         msg_conv.inner = untag_ptr(msg);
39917         msg_conv.is_owned = ptr_is_owned(msg);
39918         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39919         msg_conv.is_owned = false;
39920         void* node_signer_ptr = untag_ptr(node_signer);
39921         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
39922         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
39923         void* logger_ptr = untag_ptr(logger);
39924         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39925         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39926         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
39927         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
39928         return tag_ptr(ret_conv, true);
39929 }
39930
39931 void  __attribute__((export_name("TS_PendingHTLCRouting_free"))) TS_PendingHTLCRouting_free(uint64_t this_ptr) {
39932         if (!ptr_is_owned(this_ptr)) return;
39933         void* this_ptr_ptr = untag_ptr(this_ptr);
39934         CHECK_ACCESS(this_ptr_ptr);
39935         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
39936         FREE(untag_ptr(this_ptr));
39937         PendingHTLCRouting_free(this_ptr_conv);
39938 }
39939
39940 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
39941         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
39942         *ret_copy = PendingHTLCRouting_clone(arg);
39943         uint64_t ret_ref = tag_ptr(ret_copy, true);
39944         return ret_ref;
39945 }
39946 int64_t  __attribute__((export_name("TS_PendingHTLCRouting_clone_ptr"))) TS_PendingHTLCRouting_clone_ptr(uint64_t arg) {
39947         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
39948         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
39949         return ret_conv;
39950 }
39951
39952 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_clone"))) TS_PendingHTLCRouting_clone(uint64_t orig) {
39953         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
39954         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
39955         *ret_copy = PendingHTLCRouting_clone(orig_conv);
39956         uint64_t ret_ref = tag_ptr(ret_copy, true);
39957         return ret_ref;
39958 }
39959
39960 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_forward"))) TS_PendingHTLCRouting_forward(uint64_t onion_packet, int64_t short_channel_id, uint64_t blinded) {
39961         LDKOnionPacket onion_packet_conv;
39962         onion_packet_conv.inner = untag_ptr(onion_packet);
39963         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
39964         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
39965         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
39966         LDKBlindedForward blinded_conv;
39967         blinded_conv.inner = untag_ptr(blinded);
39968         blinded_conv.is_owned = ptr_is_owned(blinded);
39969         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
39970         blinded_conv = BlindedForward_clone(&blinded_conv);
39971         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
39972         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
39973         uint64_t ret_ref = tag_ptr(ret_copy, true);
39974         return ret_ref;
39975 }
39976
39977 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) {
39978         LDKFinalOnionHopData payment_data_conv;
39979         payment_data_conv.inner = untag_ptr(payment_data);
39980         payment_data_conv.is_owned = ptr_is_owned(payment_data);
39981         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
39982         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
39983         void* payment_metadata_ptr = untag_ptr(payment_metadata);
39984         CHECK_ACCESS(payment_metadata_ptr);
39985         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
39986         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
39987         void* payment_context_ptr = untag_ptr(payment_context);
39988         CHECK_ACCESS(payment_context_ptr);
39989         LDKCOption_PaymentContextZ payment_context_conv = *(LDKCOption_PaymentContextZ*)(payment_context_ptr);
39990         payment_context_conv = COption_PaymentContextZ_clone((LDKCOption_PaymentContextZ*)untag_ptr(payment_context));
39991         LDKThirtyTwoBytes phantom_shared_secret_ref;
39992         CHECK(phantom_shared_secret->arr_len == 32);
39993         memcpy(phantom_shared_secret_ref.data, phantom_shared_secret->elems, 32); FREE(phantom_shared_secret);
39994         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
39995         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
39996         if (custom_tlvs_constr.datalen > 0)
39997                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
39998         else
39999                 custom_tlvs_constr.data = NULL;
40000         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
40001         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
40002                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
40003                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
40004                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
40005                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
40006                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
40007                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
40008         }
40009         FREE(custom_tlvs);
40010         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40011         *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);
40012         uint64_t ret_ref = tag_ptr(ret_copy, true);
40013         return ret_ref;
40014 }
40015
40016 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) {
40017         LDKFinalOnionHopData payment_data_conv;
40018         payment_data_conv.inner = untag_ptr(payment_data);
40019         payment_data_conv.is_owned = ptr_is_owned(payment_data);
40020         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
40021         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
40022         LDKThirtyTwoBytes payment_preimage_ref;
40023         CHECK(payment_preimage->arr_len == 32);
40024         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
40025         void* payment_metadata_ptr = untag_ptr(payment_metadata);
40026         CHECK_ACCESS(payment_metadata_ptr);
40027         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
40028         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
40029         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
40030         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
40031         if (custom_tlvs_constr.datalen > 0)
40032                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
40033         else
40034                 custom_tlvs_constr.data = NULL;
40035         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
40036         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
40037                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
40038                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
40039                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
40040                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
40041                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
40042                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
40043         }
40044         FREE(custom_tlvs);
40045         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40046         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr, requires_blinded_error);
40047         uint64_t ret_ref = tag_ptr(ret_copy, true);
40048         return ret_ref;
40049 }
40050
40051 void  __attribute__((export_name("TS_BlindedForward_free"))) TS_BlindedForward_free(uint64_t this_obj) {
40052         LDKBlindedForward this_obj_conv;
40053         this_obj_conv.inner = untag_ptr(this_obj);
40054         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40056         BlindedForward_free(this_obj_conv);
40057 }
40058
40059 int8_tArray  __attribute__((export_name("TS_BlindedForward_get_inbound_blinding_point"))) TS_BlindedForward_get_inbound_blinding_point(uint64_t this_ptr) {
40060         LDKBlindedForward this_ptr_conv;
40061         this_ptr_conv.inner = untag_ptr(this_ptr);
40062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40064         this_ptr_conv.is_owned = false;
40065         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40066         memcpy(ret_arr->elems, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form, 33);
40067         return ret_arr;
40068 }
40069
40070 void  __attribute__((export_name("TS_BlindedForward_set_inbound_blinding_point"))) TS_BlindedForward_set_inbound_blinding_point(uint64_t this_ptr, int8_tArray val) {
40071         LDKBlindedForward this_ptr_conv;
40072         this_ptr_conv.inner = untag_ptr(this_ptr);
40073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40075         this_ptr_conv.is_owned = false;
40076         LDKPublicKey val_ref;
40077         CHECK(val->arr_len == 33);
40078         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40079         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
40080 }
40081
40082 uint32_t  __attribute__((export_name("TS_BlindedForward_get_failure"))) TS_BlindedForward_get_failure(uint64_t this_ptr) {
40083         LDKBlindedForward this_ptr_conv;
40084         this_ptr_conv.inner = untag_ptr(this_ptr);
40085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40087         this_ptr_conv.is_owned = false;
40088         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedForward_get_failure(&this_ptr_conv));
40089         return ret_conv;
40090 }
40091
40092 void  __attribute__((export_name("TS_BlindedForward_set_failure"))) TS_BlindedForward_set_failure(uint64_t this_ptr, uint32_t val) {
40093         LDKBlindedForward this_ptr_conv;
40094         this_ptr_conv.inner = untag_ptr(this_ptr);
40095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40097         this_ptr_conv.is_owned = false;
40098         LDKBlindedFailure val_conv = LDKBlindedFailure_from_js(val);
40099         BlindedForward_set_failure(&this_ptr_conv, val_conv);
40100 }
40101
40102 uint64_t  __attribute__((export_name("TS_BlindedForward_new"))) TS_BlindedForward_new(int8_tArray inbound_blinding_point_arg, uint32_t failure_arg) {
40103         LDKPublicKey inbound_blinding_point_arg_ref;
40104         CHECK(inbound_blinding_point_arg->arr_len == 33);
40105         memcpy(inbound_blinding_point_arg_ref.compressed_form, inbound_blinding_point_arg->elems, 33); FREE(inbound_blinding_point_arg);
40106         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_js(failure_arg);
40107         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
40108         uint64_t ret_ref = 0;
40109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40111         return ret_ref;
40112 }
40113
40114 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
40115         LDKBlindedForward ret_var = BlindedForward_clone(arg);
40116         uint64_t ret_ref = 0;
40117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40119         return ret_ref;
40120 }
40121 int64_t  __attribute__((export_name("TS_BlindedForward_clone_ptr"))) TS_BlindedForward_clone_ptr(uint64_t arg) {
40122         LDKBlindedForward arg_conv;
40123         arg_conv.inner = untag_ptr(arg);
40124         arg_conv.is_owned = ptr_is_owned(arg);
40125         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40126         arg_conv.is_owned = false;
40127         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
40128         return ret_conv;
40129 }
40130
40131 uint64_t  __attribute__((export_name("TS_BlindedForward_clone"))) TS_BlindedForward_clone(uint64_t orig) {
40132         LDKBlindedForward orig_conv;
40133         orig_conv.inner = untag_ptr(orig);
40134         orig_conv.is_owned = ptr_is_owned(orig);
40135         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40136         orig_conv.is_owned = false;
40137         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
40138         uint64_t ret_ref = 0;
40139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40141         return ret_ref;
40142 }
40143
40144 int64_t  __attribute__((export_name("TS_BlindedForward_hash"))) TS_BlindedForward_hash(uint64_t o) {
40145         LDKBlindedForward o_conv;
40146         o_conv.inner = untag_ptr(o);
40147         o_conv.is_owned = ptr_is_owned(o);
40148         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40149         o_conv.is_owned = false;
40150         int64_t ret_conv = BlindedForward_hash(&o_conv);
40151         return ret_conv;
40152 }
40153
40154 jboolean  __attribute__((export_name("TS_BlindedForward_eq"))) TS_BlindedForward_eq(uint64_t a, uint64_t b) {
40155         LDKBlindedForward a_conv;
40156         a_conv.inner = untag_ptr(a);
40157         a_conv.is_owned = ptr_is_owned(a);
40158         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40159         a_conv.is_owned = false;
40160         LDKBlindedForward b_conv;
40161         b_conv.inner = untag_ptr(b);
40162         b_conv.is_owned = ptr_is_owned(b);
40163         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40164         b_conv.is_owned = false;
40165         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
40166         return ret_conv;
40167 }
40168
40169 void  __attribute__((export_name("TS_PendingHTLCInfo_free"))) TS_PendingHTLCInfo_free(uint64_t this_obj) {
40170         LDKPendingHTLCInfo this_obj_conv;
40171         this_obj_conv.inner = untag_ptr(this_obj);
40172         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40174         PendingHTLCInfo_free(this_obj_conv);
40175 }
40176
40177 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_routing"))) TS_PendingHTLCInfo_get_routing(uint64_t this_ptr) {
40178         LDKPendingHTLCInfo this_ptr_conv;
40179         this_ptr_conv.inner = untag_ptr(this_ptr);
40180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40182         this_ptr_conv.is_owned = false;
40183         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40184         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
40185         uint64_t ret_ref = tag_ptr(ret_copy, true);
40186         return ret_ref;
40187 }
40188
40189 void  __attribute__((export_name("TS_PendingHTLCInfo_set_routing"))) TS_PendingHTLCInfo_set_routing(uint64_t this_ptr, uint64_t val) {
40190         LDKPendingHTLCInfo this_ptr_conv;
40191         this_ptr_conv.inner = untag_ptr(this_ptr);
40192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40194         this_ptr_conv.is_owned = false;
40195         void* val_ptr = untag_ptr(val);
40196         CHECK_ACCESS(val_ptr);
40197         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
40198         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
40199         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
40200 }
40201
40202 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_get_incoming_shared_secret"))) TS_PendingHTLCInfo_get_incoming_shared_secret(uint64_t this_ptr) {
40203         LDKPendingHTLCInfo this_ptr_conv;
40204         this_ptr_conv.inner = untag_ptr(this_ptr);
40205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40207         this_ptr_conv.is_owned = false;
40208         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40209         memcpy(ret_arr->elems, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv), 32);
40210         return ret_arr;
40211 }
40212
40213 void  __attribute__((export_name("TS_PendingHTLCInfo_set_incoming_shared_secret"))) TS_PendingHTLCInfo_set_incoming_shared_secret(uint64_t this_ptr, int8_tArray val) {
40214         LDKPendingHTLCInfo this_ptr_conv;
40215         this_ptr_conv.inner = untag_ptr(this_ptr);
40216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40218         this_ptr_conv.is_owned = false;
40219         LDKThirtyTwoBytes val_ref;
40220         CHECK(val->arr_len == 32);
40221         memcpy(val_ref.data, val->elems, 32); FREE(val);
40222         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
40223 }
40224
40225 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_get_payment_hash"))) TS_PendingHTLCInfo_get_payment_hash(uint64_t this_ptr) {
40226         LDKPendingHTLCInfo this_ptr_conv;
40227         this_ptr_conv.inner = untag_ptr(this_ptr);
40228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40230         this_ptr_conv.is_owned = false;
40231         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40232         memcpy(ret_arr->elems, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv), 32);
40233         return ret_arr;
40234 }
40235
40236 void  __attribute__((export_name("TS_PendingHTLCInfo_set_payment_hash"))) TS_PendingHTLCInfo_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
40237         LDKPendingHTLCInfo this_ptr_conv;
40238         this_ptr_conv.inner = untag_ptr(this_ptr);
40239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40241         this_ptr_conv.is_owned = false;
40242         LDKThirtyTwoBytes val_ref;
40243         CHECK(val->arr_len == 32);
40244         memcpy(val_ref.data, val->elems, 32); FREE(val);
40245         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
40246 }
40247
40248 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_incoming_amt_msat"))) TS_PendingHTLCInfo_get_incoming_amt_msat(uint64_t this_ptr) {
40249         LDKPendingHTLCInfo this_ptr_conv;
40250         this_ptr_conv.inner = untag_ptr(this_ptr);
40251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40253         this_ptr_conv.is_owned = false;
40254         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40255         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
40256         uint64_t ret_ref = tag_ptr(ret_copy, true);
40257         return ret_ref;
40258 }
40259
40260 void  __attribute__((export_name("TS_PendingHTLCInfo_set_incoming_amt_msat"))) TS_PendingHTLCInfo_set_incoming_amt_msat(uint64_t this_ptr, uint64_t val) {
40261         LDKPendingHTLCInfo this_ptr_conv;
40262         this_ptr_conv.inner = untag_ptr(this_ptr);
40263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40265         this_ptr_conv.is_owned = false;
40266         void* val_ptr = untag_ptr(val);
40267         CHECK_ACCESS(val_ptr);
40268         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40269         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40270         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
40271 }
40272
40273 int64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_outgoing_amt_msat"))) TS_PendingHTLCInfo_get_outgoing_amt_msat(uint64_t this_ptr) {
40274         LDKPendingHTLCInfo this_ptr_conv;
40275         this_ptr_conv.inner = untag_ptr(this_ptr);
40276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40278         this_ptr_conv.is_owned = false;
40279         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
40280         return ret_conv;
40281 }
40282
40283 void  __attribute__((export_name("TS_PendingHTLCInfo_set_outgoing_amt_msat"))) TS_PendingHTLCInfo_set_outgoing_amt_msat(uint64_t this_ptr, int64_t val) {
40284         LDKPendingHTLCInfo this_ptr_conv;
40285         this_ptr_conv.inner = untag_ptr(this_ptr);
40286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40288         this_ptr_conv.is_owned = false;
40289         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
40290 }
40291
40292 int32_t  __attribute__((export_name("TS_PendingHTLCInfo_get_outgoing_cltv_value"))) TS_PendingHTLCInfo_get_outgoing_cltv_value(uint64_t this_ptr) {
40293         LDKPendingHTLCInfo this_ptr_conv;
40294         this_ptr_conv.inner = untag_ptr(this_ptr);
40295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40297         this_ptr_conv.is_owned = false;
40298         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
40299         return ret_conv;
40300 }
40301
40302 void  __attribute__((export_name("TS_PendingHTLCInfo_set_outgoing_cltv_value"))) TS_PendingHTLCInfo_set_outgoing_cltv_value(uint64_t this_ptr, int32_t val) {
40303         LDKPendingHTLCInfo this_ptr_conv;
40304         this_ptr_conv.inner = untag_ptr(this_ptr);
40305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40307         this_ptr_conv.is_owned = false;
40308         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
40309 }
40310
40311 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_skimmed_fee_msat"))) TS_PendingHTLCInfo_get_skimmed_fee_msat(uint64_t this_ptr) {
40312         LDKPendingHTLCInfo this_ptr_conv;
40313         this_ptr_conv.inner = untag_ptr(this_ptr);
40314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40316         this_ptr_conv.is_owned = false;
40317         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40318         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
40319         uint64_t ret_ref = tag_ptr(ret_copy, true);
40320         return ret_ref;
40321 }
40322
40323 void  __attribute__((export_name("TS_PendingHTLCInfo_set_skimmed_fee_msat"))) TS_PendingHTLCInfo_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
40324         LDKPendingHTLCInfo this_ptr_conv;
40325         this_ptr_conv.inner = untag_ptr(this_ptr);
40326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40328         this_ptr_conv.is_owned = false;
40329         void* val_ptr = untag_ptr(val);
40330         CHECK_ACCESS(val_ptr);
40331         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40332         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40333         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
40334 }
40335
40336 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) {
40337         void* routing_arg_ptr = untag_ptr(routing_arg);
40338         CHECK_ACCESS(routing_arg_ptr);
40339         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
40340         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
40341         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
40342         CHECK(incoming_shared_secret_arg->arr_len == 32);
40343         memcpy(incoming_shared_secret_arg_ref.data, incoming_shared_secret_arg->elems, 32); FREE(incoming_shared_secret_arg);
40344         LDKThirtyTwoBytes payment_hash_arg_ref;
40345         CHECK(payment_hash_arg->arr_len == 32);
40346         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
40347         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
40348         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
40349         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
40350         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
40351         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
40352         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
40353         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
40354         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
40355         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);
40356         uint64_t ret_ref = 0;
40357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40359         return ret_ref;
40360 }
40361
40362 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
40363         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
40364         uint64_t ret_ref = 0;
40365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40367         return ret_ref;
40368 }
40369 int64_t  __attribute__((export_name("TS_PendingHTLCInfo_clone_ptr"))) TS_PendingHTLCInfo_clone_ptr(uint64_t arg) {
40370         LDKPendingHTLCInfo arg_conv;
40371         arg_conv.inner = untag_ptr(arg);
40372         arg_conv.is_owned = ptr_is_owned(arg);
40373         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40374         arg_conv.is_owned = false;
40375         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
40376         return ret_conv;
40377 }
40378
40379 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_clone"))) TS_PendingHTLCInfo_clone(uint64_t orig) {
40380         LDKPendingHTLCInfo orig_conv;
40381         orig_conv.inner = untag_ptr(orig);
40382         orig_conv.is_owned = ptr_is_owned(orig);
40383         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40384         orig_conv.is_owned = false;
40385         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
40386         uint64_t ret_ref = 0;
40387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40389         return ret_ref;
40390 }
40391
40392 uint32_t  __attribute__((export_name("TS_BlindedFailure_clone"))) TS_BlindedFailure_clone(uint64_t orig) {
40393         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
40394         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_clone(orig_conv));
40395         return ret_conv;
40396 }
40397
40398 uint32_t  __attribute__((export_name("TS_BlindedFailure_from_introduction_node"))) TS_BlindedFailure_from_introduction_node() {
40399         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_from_introduction_node());
40400         return ret_conv;
40401 }
40402
40403 uint32_t  __attribute__((export_name("TS_BlindedFailure_from_blinded_node"))) TS_BlindedFailure_from_blinded_node() {
40404         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_from_blinded_node());
40405         return ret_conv;
40406 }
40407
40408 int64_t  __attribute__((export_name("TS_BlindedFailure_hash"))) TS_BlindedFailure_hash(uint64_t o) {
40409         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
40410         int64_t ret_conv = BlindedFailure_hash(o_conv);
40411         return ret_conv;
40412 }
40413
40414 jboolean  __attribute__((export_name("TS_BlindedFailure_eq"))) TS_BlindedFailure_eq(uint64_t a, uint64_t b) {
40415         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
40416         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
40417         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
40418         return ret_conv;
40419 }
40420
40421 void  __attribute__((export_name("TS_FailureCode_free"))) TS_FailureCode_free(uint64_t this_ptr) {
40422         if (!ptr_is_owned(this_ptr)) return;
40423         void* this_ptr_ptr = untag_ptr(this_ptr);
40424         CHECK_ACCESS(this_ptr_ptr);
40425         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
40426         FREE(untag_ptr(this_ptr));
40427         FailureCode_free(this_ptr_conv);
40428 }
40429
40430 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
40431         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40432         *ret_copy = FailureCode_clone(arg);
40433         uint64_t ret_ref = tag_ptr(ret_copy, true);
40434         return ret_ref;
40435 }
40436 int64_t  __attribute__((export_name("TS_FailureCode_clone_ptr"))) TS_FailureCode_clone_ptr(uint64_t arg) {
40437         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
40438         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
40439         return ret_conv;
40440 }
40441
40442 uint64_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
40443         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
40444         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40445         *ret_copy = FailureCode_clone(orig_conv);
40446         uint64_t ret_ref = tag_ptr(ret_copy, true);
40447         return ret_ref;
40448 }
40449
40450 uint64_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
40451         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40452         *ret_copy = FailureCode_temporary_node_failure();
40453         uint64_t ret_ref = tag_ptr(ret_copy, true);
40454         return ret_ref;
40455 }
40456
40457 uint64_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
40458         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40459         *ret_copy = FailureCode_required_node_feature_missing();
40460         uint64_t ret_ref = tag_ptr(ret_copy, true);
40461         return ret_ref;
40462 }
40463
40464 uint64_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
40465         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40466         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
40467         uint64_t ret_ref = tag_ptr(ret_copy, true);
40468         return ret_ref;
40469 }
40470
40471 uint64_t  __attribute__((export_name("TS_FailureCode_invalid_onion_payload"))) TS_FailureCode_invalid_onion_payload(uint64_t a) {
40472         void* a_ptr = untag_ptr(a);
40473         CHECK_ACCESS(a_ptr);
40474         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
40475         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
40476         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40477         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
40478         uint64_t ret_ref = tag_ptr(ret_copy, true);
40479         return ret_ref;
40480 }
40481
40482 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
40483         LDKChannelManager this_obj_conv;
40484         this_obj_conv.inner = untag_ptr(this_obj);
40485         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40487         ChannelManager_free(this_obj_conv);
40488 }
40489
40490 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
40491         LDKChainParameters this_obj_conv;
40492         this_obj_conv.inner = untag_ptr(this_obj);
40493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40495         ChainParameters_free(this_obj_conv);
40496 }
40497
40498 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
40499         LDKChainParameters this_ptr_conv;
40500         this_ptr_conv.inner = untag_ptr(this_ptr);
40501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40503         this_ptr_conv.is_owned = false;
40504         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
40505         return ret_conv;
40506 }
40507
40508 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
40509         LDKChainParameters this_ptr_conv;
40510         this_ptr_conv.inner = untag_ptr(this_ptr);
40511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40513         this_ptr_conv.is_owned = false;
40514         LDKNetwork val_conv = LDKNetwork_from_js(val);
40515         ChainParameters_set_network(&this_ptr_conv, val_conv);
40516 }
40517
40518 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
40519         LDKChainParameters this_ptr_conv;
40520         this_ptr_conv.inner = untag_ptr(this_ptr);
40521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40523         this_ptr_conv.is_owned = false;
40524         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
40525         uint64_t ret_ref = 0;
40526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40528         return ret_ref;
40529 }
40530
40531 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
40532         LDKChainParameters this_ptr_conv;
40533         this_ptr_conv.inner = untag_ptr(this_ptr);
40534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40536         this_ptr_conv.is_owned = false;
40537         LDKBestBlock val_conv;
40538         val_conv.inner = untag_ptr(val);
40539         val_conv.is_owned = ptr_is_owned(val);
40540         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40541         val_conv = BestBlock_clone(&val_conv);
40542         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
40543 }
40544
40545 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
40546         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
40547         LDKBestBlock best_block_arg_conv;
40548         best_block_arg_conv.inner = untag_ptr(best_block_arg);
40549         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
40550         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
40551         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
40552         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
40553         uint64_t ret_ref = 0;
40554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40556         return ret_ref;
40557 }
40558
40559 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
40560         LDKChainParameters ret_var = ChainParameters_clone(arg);
40561         uint64_t ret_ref = 0;
40562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40564         return ret_ref;
40565 }
40566 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
40567         LDKChainParameters arg_conv;
40568         arg_conv.inner = untag_ptr(arg);
40569         arg_conv.is_owned = ptr_is_owned(arg);
40570         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40571         arg_conv.is_owned = false;
40572         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
40573         return ret_conv;
40574 }
40575
40576 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
40577         LDKChainParameters orig_conv;
40578         orig_conv.inner = untag_ptr(orig);
40579         orig_conv.is_owned = ptr_is_owned(orig);
40580         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40581         orig_conv.is_owned = false;
40582         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
40583         uint64_t ret_ref = 0;
40584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40586         return ret_ref;
40587 }
40588
40589 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
40590         LDKCounterpartyForwardingInfo this_obj_conv;
40591         this_obj_conv.inner = untag_ptr(this_obj);
40592         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40594         CounterpartyForwardingInfo_free(this_obj_conv);
40595 }
40596
40597 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
40598         LDKCounterpartyForwardingInfo this_ptr_conv;
40599         this_ptr_conv.inner = untag_ptr(this_ptr);
40600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40602         this_ptr_conv.is_owned = false;
40603         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
40604         return ret_conv;
40605 }
40606
40607 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
40608         LDKCounterpartyForwardingInfo this_ptr_conv;
40609         this_ptr_conv.inner = untag_ptr(this_ptr);
40610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40612         this_ptr_conv.is_owned = false;
40613         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
40614 }
40615
40616 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
40617         LDKCounterpartyForwardingInfo this_ptr_conv;
40618         this_ptr_conv.inner = untag_ptr(this_ptr);
40619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40621         this_ptr_conv.is_owned = false;
40622         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
40623         return ret_conv;
40624 }
40625
40626 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
40627         LDKCounterpartyForwardingInfo this_ptr_conv;
40628         this_ptr_conv.inner = untag_ptr(this_ptr);
40629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40631         this_ptr_conv.is_owned = false;
40632         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
40633 }
40634
40635 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
40636         LDKCounterpartyForwardingInfo this_ptr_conv;
40637         this_ptr_conv.inner = untag_ptr(this_ptr);
40638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40640         this_ptr_conv.is_owned = false;
40641         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
40642         return ret_conv;
40643 }
40644
40645 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
40646         LDKCounterpartyForwardingInfo this_ptr_conv;
40647         this_ptr_conv.inner = untag_ptr(this_ptr);
40648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40650         this_ptr_conv.is_owned = false;
40651         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
40652 }
40653
40654 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) {
40655         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
40656         uint64_t ret_ref = 0;
40657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40659         return ret_ref;
40660 }
40661
40662 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
40663         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
40664         uint64_t ret_ref = 0;
40665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40667         return ret_ref;
40668 }
40669 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
40670         LDKCounterpartyForwardingInfo arg_conv;
40671         arg_conv.inner = untag_ptr(arg);
40672         arg_conv.is_owned = ptr_is_owned(arg);
40673         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40674         arg_conv.is_owned = false;
40675         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
40676         return ret_conv;
40677 }
40678
40679 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
40680         LDKCounterpartyForwardingInfo orig_conv;
40681         orig_conv.inner = untag_ptr(orig);
40682         orig_conv.is_owned = ptr_is_owned(orig);
40683         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40684         orig_conv.is_owned = false;
40685         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
40686         uint64_t ret_ref = 0;
40687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40689         return ret_ref;
40690 }
40691
40692 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
40693         LDKChannelCounterparty this_obj_conv;
40694         this_obj_conv.inner = untag_ptr(this_obj);
40695         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40697         ChannelCounterparty_free(this_obj_conv);
40698 }
40699
40700 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
40701         LDKChannelCounterparty this_ptr_conv;
40702         this_ptr_conv.inner = untag_ptr(this_ptr);
40703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40705         this_ptr_conv.is_owned = false;
40706         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40707         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
40708         return ret_arr;
40709 }
40710
40711 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
40712         LDKChannelCounterparty this_ptr_conv;
40713         this_ptr_conv.inner = untag_ptr(this_ptr);
40714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40716         this_ptr_conv.is_owned = false;
40717         LDKPublicKey val_ref;
40718         CHECK(val->arr_len == 33);
40719         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40720         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
40721 }
40722
40723 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
40724         LDKChannelCounterparty this_ptr_conv;
40725         this_ptr_conv.inner = untag_ptr(this_ptr);
40726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40728         this_ptr_conv.is_owned = false;
40729         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
40730         uint64_t ret_ref = 0;
40731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40733         return ret_ref;
40734 }
40735
40736 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
40737         LDKChannelCounterparty this_ptr_conv;
40738         this_ptr_conv.inner = untag_ptr(this_ptr);
40739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40741         this_ptr_conv.is_owned = false;
40742         LDKInitFeatures val_conv;
40743         val_conv.inner = untag_ptr(val);
40744         val_conv.is_owned = ptr_is_owned(val);
40745         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40746         val_conv = InitFeatures_clone(&val_conv);
40747         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
40748 }
40749
40750 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
40751         LDKChannelCounterparty this_ptr_conv;
40752         this_ptr_conv.inner = untag_ptr(this_ptr);
40753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40755         this_ptr_conv.is_owned = false;
40756         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
40757         return ret_conv;
40758 }
40759
40760 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
40761         LDKChannelCounterparty this_ptr_conv;
40762         this_ptr_conv.inner = untag_ptr(this_ptr);
40763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40765         this_ptr_conv.is_owned = false;
40766         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
40767 }
40768
40769 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
40770         LDKChannelCounterparty this_ptr_conv;
40771         this_ptr_conv.inner = untag_ptr(this_ptr);
40772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40774         this_ptr_conv.is_owned = false;
40775         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
40776         uint64_t ret_ref = 0;
40777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40779         return ret_ref;
40780 }
40781
40782 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
40783         LDKChannelCounterparty this_ptr_conv;
40784         this_ptr_conv.inner = untag_ptr(this_ptr);
40785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40787         this_ptr_conv.is_owned = false;
40788         LDKCounterpartyForwardingInfo val_conv;
40789         val_conv.inner = untag_ptr(val);
40790         val_conv.is_owned = ptr_is_owned(val);
40791         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40792         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
40793         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
40794 }
40795
40796 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
40797         LDKChannelCounterparty this_ptr_conv;
40798         this_ptr_conv.inner = untag_ptr(this_ptr);
40799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40801         this_ptr_conv.is_owned = false;
40802         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40803         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
40804         uint64_t ret_ref = tag_ptr(ret_copy, true);
40805         return ret_ref;
40806 }
40807
40808 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) {
40809         LDKChannelCounterparty this_ptr_conv;
40810         this_ptr_conv.inner = untag_ptr(this_ptr);
40811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40813         this_ptr_conv.is_owned = false;
40814         void* val_ptr = untag_ptr(val);
40815         CHECK_ACCESS(val_ptr);
40816         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40817         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40818         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
40819 }
40820
40821 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
40822         LDKChannelCounterparty this_ptr_conv;
40823         this_ptr_conv.inner = untag_ptr(this_ptr);
40824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40826         this_ptr_conv.is_owned = false;
40827         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40828         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
40829         uint64_t ret_ref = tag_ptr(ret_copy, true);
40830         return ret_ref;
40831 }
40832
40833 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) {
40834         LDKChannelCounterparty this_ptr_conv;
40835         this_ptr_conv.inner = untag_ptr(this_ptr);
40836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40838         this_ptr_conv.is_owned = false;
40839         void* val_ptr = untag_ptr(val);
40840         CHECK_ACCESS(val_ptr);
40841         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40842         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40843         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
40844 }
40845
40846 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) {
40847         LDKPublicKey node_id_arg_ref;
40848         CHECK(node_id_arg->arr_len == 33);
40849         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
40850         LDKInitFeatures features_arg_conv;
40851         features_arg_conv.inner = untag_ptr(features_arg);
40852         features_arg_conv.is_owned = ptr_is_owned(features_arg);
40853         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40854         features_arg_conv = InitFeatures_clone(&features_arg_conv);
40855         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
40856         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
40857         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
40858         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
40859         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
40860         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
40861         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
40862         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
40863         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
40864         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
40865         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
40866         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
40867         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
40868         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);
40869         uint64_t ret_ref = 0;
40870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40872         return ret_ref;
40873 }
40874
40875 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
40876         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
40877         uint64_t ret_ref = 0;
40878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40880         return ret_ref;
40881 }
40882 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
40883         LDKChannelCounterparty arg_conv;
40884         arg_conv.inner = untag_ptr(arg);
40885         arg_conv.is_owned = ptr_is_owned(arg);
40886         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40887         arg_conv.is_owned = false;
40888         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
40889         return ret_conv;
40890 }
40891
40892 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
40893         LDKChannelCounterparty orig_conv;
40894         orig_conv.inner = untag_ptr(orig);
40895         orig_conv.is_owned = ptr_is_owned(orig);
40896         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40897         orig_conv.is_owned = false;
40898         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
40899         uint64_t ret_ref = 0;
40900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40902         return ret_ref;
40903 }
40904
40905 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
40906         LDKChannelDetails this_obj_conv;
40907         this_obj_conv.inner = untag_ptr(this_obj);
40908         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40910         ChannelDetails_free(this_obj_conv);
40911 }
40912
40913 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
40914         LDKChannelDetails this_ptr_conv;
40915         this_ptr_conv.inner = untag_ptr(this_ptr);
40916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40918         this_ptr_conv.is_owned = false;
40919         LDKChannelId ret_var = ChannelDetails_get_channel_id(&this_ptr_conv);
40920         uint64_t ret_ref = 0;
40921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40923         return ret_ref;
40924 }
40925
40926 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, uint64_t val) {
40927         LDKChannelDetails this_ptr_conv;
40928         this_ptr_conv.inner = untag_ptr(this_ptr);
40929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40931         this_ptr_conv.is_owned = false;
40932         LDKChannelId val_conv;
40933         val_conv.inner = untag_ptr(val);
40934         val_conv.is_owned = ptr_is_owned(val);
40935         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40936         val_conv = ChannelId_clone(&val_conv);
40937         ChannelDetails_set_channel_id(&this_ptr_conv, val_conv);
40938 }
40939
40940 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
40941         LDKChannelDetails this_ptr_conv;
40942         this_ptr_conv.inner = untag_ptr(this_ptr);
40943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40945         this_ptr_conv.is_owned = false;
40946         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
40947         uint64_t ret_ref = 0;
40948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40950         return ret_ref;
40951 }
40952
40953 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
40954         LDKChannelDetails this_ptr_conv;
40955         this_ptr_conv.inner = untag_ptr(this_ptr);
40956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40958         this_ptr_conv.is_owned = false;
40959         LDKChannelCounterparty val_conv;
40960         val_conv.inner = untag_ptr(val);
40961         val_conv.is_owned = ptr_is_owned(val);
40962         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40963         val_conv = ChannelCounterparty_clone(&val_conv);
40964         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
40965 }
40966
40967 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
40968         LDKChannelDetails this_ptr_conv;
40969         this_ptr_conv.inner = untag_ptr(this_ptr);
40970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40972         this_ptr_conv.is_owned = false;
40973         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
40974         uint64_t ret_ref = 0;
40975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40977         return ret_ref;
40978 }
40979
40980 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
40981         LDKChannelDetails this_ptr_conv;
40982         this_ptr_conv.inner = untag_ptr(this_ptr);
40983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40985         this_ptr_conv.is_owned = false;
40986         LDKOutPoint val_conv;
40987         val_conv.inner = untag_ptr(val);
40988         val_conv.is_owned = ptr_is_owned(val);
40989         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40990         val_conv = OutPoint_clone(&val_conv);
40991         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
40992 }
40993
40994 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
40995         LDKChannelDetails this_ptr_conv;
40996         this_ptr_conv.inner = untag_ptr(this_ptr);
40997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40999         this_ptr_conv.is_owned = false;
41000         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
41001         uint64_t ret_ref = 0;
41002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41004         return ret_ref;
41005 }
41006
41007 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
41008         LDKChannelDetails this_ptr_conv;
41009         this_ptr_conv.inner = untag_ptr(this_ptr);
41010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41012         this_ptr_conv.is_owned = false;
41013         LDKChannelTypeFeatures val_conv;
41014         val_conv.inner = untag_ptr(val);
41015         val_conv.is_owned = ptr_is_owned(val);
41016         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41017         val_conv = ChannelTypeFeatures_clone(&val_conv);
41018         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
41019 }
41020
41021 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
41022         LDKChannelDetails this_ptr_conv;
41023         this_ptr_conv.inner = untag_ptr(this_ptr);
41024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41026         this_ptr_conv.is_owned = false;
41027         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41028         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
41029         uint64_t ret_ref = tag_ptr(ret_copy, true);
41030         return ret_ref;
41031 }
41032
41033 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
41034         LDKChannelDetails this_ptr_conv;
41035         this_ptr_conv.inner = untag_ptr(this_ptr);
41036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41038         this_ptr_conv.is_owned = false;
41039         void* val_ptr = untag_ptr(val);
41040         CHECK_ACCESS(val_ptr);
41041         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41042         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41043         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
41044 }
41045
41046 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
41047         LDKChannelDetails this_ptr_conv;
41048         this_ptr_conv.inner = untag_ptr(this_ptr);
41049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41051         this_ptr_conv.is_owned = false;
41052         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41053         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
41054         uint64_t ret_ref = tag_ptr(ret_copy, true);
41055         return ret_ref;
41056 }
41057
41058 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
41059         LDKChannelDetails this_ptr_conv;
41060         this_ptr_conv.inner = untag_ptr(this_ptr);
41061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41063         this_ptr_conv.is_owned = false;
41064         void* val_ptr = untag_ptr(val);
41065         CHECK_ACCESS(val_ptr);
41066         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41067         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41068         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
41069 }
41070
41071 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
41072         LDKChannelDetails this_ptr_conv;
41073         this_ptr_conv.inner = untag_ptr(this_ptr);
41074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41076         this_ptr_conv.is_owned = false;
41077         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41078         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
41079         uint64_t ret_ref = tag_ptr(ret_copy, true);
41080         return ret_ref;
41081 }
41082
41083 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
41084         LDKChannelDetails this_ptr_conv;
41085         this_ptr_conv.inner = untag_ptr(this_ptr);
41086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41088         this_ptr_conv.is_owned = false;
41089         void* val_ptr = untag_ptr(val);
41090         CHECK_ACCESS(val_ptr);
41091         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41092         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41093         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
41094 }
41095
41096 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
41097         LDKChannelDetails this_ptr_conv;
41098         this_ptr_conv.inner = untag_ptr(this_ptr);
41099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41101         this_ptr_conv.is_owned = false;
41102         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
41103         return ret_conv;
41104 }
41105
41106 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
41107         LDKChannelDetails this_ptr_conv;
41108         this_ptr_conv.inner = untag_ptr(this_ptr);
41109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41111         this_ptr_conv.is_owned = false;
41112         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
41113 }
41114
41115 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
41116         LDKChannelDetails this_ptr_conv;
41117         this_ptr_conv.inner = untag_ptr(this_ptr);
41118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41120         this_ptr_conv.is_owned = false;
41121         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41122         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
41123         uint64_t ret_ref = tag_ptr(ret_copy, true);
41124         return ret_ref;
41125 }
41126
41127 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
41128         LDKChannelDetails this_ptr_conv;
41129         this_ptr_conv.inner = untag_ptr(this_ptr);
41130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41132         this_ptr_conv.is_owned = false;
41133         void* val_ptr = untag_ptr(val);
41134         CHECK_ACCESS(val_ptr);
41135         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41136         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41137         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
41138 }
41139
41140 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
41141         LDKChannelDetails this_ptr_conv;
41142         this_ptr_conv.inner = untag_ptr(this_ptr);
41143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41145         this_ptr_conv.is_owned = false;
41146         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
41147         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
41148         return ret_arr;
41149 }
41150
41151 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
41152         LDKChannelDetails this_ptr_conv;
41153         this_ptr_conv.inner = untag_ptr(this_ptr);
41154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41156         this_ptr_conv.is_owned = false;
41157         LDKU128 val_ref;
41158         CHECK(val->arr_len == 16);
41159         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
41160         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
41161 }
41162
41163 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) {
41164         LDKChannelDetails this_ptr_conv;
41165         this_ptr_conv.inner = untag_ptr(this_ptr);
41166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41168         this_ptr_conv.is_owned = false;
41169         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
41170         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
41171         uint64_t ret_ref = tag_ptr(ret_copy, true);
41172         return ret_ref;
41173 }
41174
41175 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) {
41176         LDKChannelDetails this_ptr_conv;
41177         this_ptr_conv.inner = untag_ptr(this_ptr);
41178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41180         this_ptr_conv.is_owned = false;
41181         void* val_ptr = untag_ptr(val);
41182         CHECK_ACCESS(val_ptr);
41183         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
41184         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
41185         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
41186 }
41187
41188 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
41189         LDKChannelDetails this_ptr_conv;
41190         this_ptr_conv.inner = untag_ptr(this_ptr);
41191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41193         this_ptr_conv.is_owned = false;
41194         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
41195         return ret_conv;
41196 }
41197
41198 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
41199         LDKChannelDetails this_ptr_conv;
41200         this_ptr_conv.inner = untag_ptr(this_ptr);
41201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41203         this_ptr_conv.is_owned = false;
41204         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
41205 }
41206
41207 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
41208         LDKChannelDetails this_ptr_conv;
41209         this_ptr_conv.inner = untag_ptr(this_ptr);
41210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41212         this_ptr_conv.is_owned = false;
41213         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
41214         return ret_conv;
41215 }
41216
41217 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
41218         LDKChannelDetails this_ptr_conv;
41219         this_ptr_conv.inner = untag_ptr(this_ptr);
41220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41222         this_ptr_conv.is_owned = false;
41223         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
41224 }
41225
41226 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) {
41227         LDKChannelDetails this_ptr_conv;
41228         this_ptr_conv.inner = untag_ptr(this_ptr);
41229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41231         this_ptr_conv.is_owned = false;
41232         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
41233         return ret_conv;
41234 }
41235
41236 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) {
41237         LDKChannelDetails this_ptr_conv;
41238         this_ptr_conv.inner = untag_ptr(this_ptr);
41239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41241         this_ptr_conv.is_owned = false;
41242         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
41243 }
41244
41245 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) {
41246         LDKChannelDetails this_ptr_conv;
41247         this_ptr_conv.inner = untag_ptr(this_ptr);
41248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41250         this_ptr_conv.is_owned = false;
41251         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
41252         return ret_conv;
41253 }
41254
41255 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) {
41256         LDKChannelDetails this_ptr_conv;
41257         this_ptr_conv.inner = untag_ptr(this_ptr);
41258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41260         this_ptr_conv.is_owned = false;
41261         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
41262 }
41263
41264 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
41265         LDKChannelDetails this_ptr_conv;
41266         this_ptr_conv.inner = untag_ptr(this_ptr);
41267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41269         this_ptr_conv.is_owned = false;
41270         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
41271         return ret_conv;
41272 }
41273
41274 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
41275         LDKChannelDetails this_ptr_conv;
41276         this_ptr_conv.inner = untag_ptr(this_ptr);
41277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41279         this_ptr_conv.is_owned = false;
41280         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
41281 }
41282
41283 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
41284         LDKChannelDetails this_ptr_conv;
41285         this_ptr_conv.inner = untag_ptr(this_ptr);
41286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41288         this_ptr_conv.is_owned = false;
41289         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
41290         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
41291         uint64_t ret_ref = tag_ptr(ret_copy, true);
41292         return ret_ref;
41293 }
41294
41295 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
41296         LDKChannelDetails this_ptr_conv;
41297         this_ptr_conv.inner = untag_ptr(this_ptr);
41298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41300         this_ptr_conv.is_owned = false;
41301         void* val_ptr = untag_ptr(val);
41302         CHECK_ACCESS(val_ptr);
41303         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
41304         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
41305         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
41306 }
41307
41308 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
41309         LDKChannelDetails this_ptr_conv;
41310         this_ptr_conv.inner = untag_ptr(this_ptr);
41311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41313         this_ptr_conv.is_owned = false;
41314         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
41315         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
41316         uint64_t ret_ref = tag_ptr(ret_copy, true);
41317         return ret_ref;
41318 }
41319
41320 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
41321         LDKChannelDetails this_ptr_conv;
41322         this_ptr_conv.inner = untag_ptr(this_ptr);
41323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41325         this_ptr_conv.is_owned = false;
41326         void* val_ptr = untag_ptr(val);
41327         CHECK_ACCESS(val_ptr);
41328         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
41329         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
41330         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
41331 }
41332
41333 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
41334         LDKChannelDetails this_ptr_conv;
41335         this_ptr_conv.inner = untag_ptr(this_ptr);
41336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41338         this_ptr_conv.is_owned = false;
41339         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
41340         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
41341         uint64_t ret_ref = tag_ptr(ret_copy, true);
41342         return ret_ref;
41343 }
41344
41345 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) {
41346         LDKChannelDetails this_ptr_conv;
41347         this_ptr_conv.inner = untag_ptr(this_ptr);
41348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41350         this_ptr_conv.is_owned = false;
41351         void* val_ptr = untag_ptr(val);
41352         CHECK_ACCESS(val_ptr);
41353         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
41354         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
41355         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
41356 }
41357
41358 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
41359         LDKChannelDetails this_ptr_conv;
41360         this_ptr_conv.inner = untag_ptr(this_ptr);
41361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41363         this_ptr_conv.is_owned = false;
41364         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
41365         return ret_conv;
41366 }
41367
41368 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
41369         LDKChannelDetails this_ptr_conv;
41370         this_ptr_conv.inner = untag_ptr(this_ptr);
41371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41373         this_ptr_conv.is_owned = false;
41374         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
41375 }
41376
41377 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
41378         LDKChannelDetails this_ptr_conv;
41379         this_ptr_conv.inner = untag_ptr(this_ptr);
41380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41382         this_ptr_conv.is_owned = false;
41383         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
41384         return ret_conv;
41385 }
41386
41387 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
41388         LDKChannelDetails this_ptr_conv;
41389         this_ptr_conv.inner = untag_ptr(this_ptr);
41390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41392         this_ptr_conv.is_owned = false;
41393         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
41394 }
41395
41396 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_shutdown_state"))) TS_ChannelDetails_get_channel_shutdown_state(uint64_t this_ptr) {
41397         LDKChannelDetails this_ptr_conv;
41398         this_ptr_conv.inner = untag_ptr(this_ptr);
41399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41401         this_ptr_conv.is_owned = false;
41402         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
41403         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
41404         uint64_t ret_ref = tag_ptr(ret_copy, true);
41405         return ret_ref;
41406 }
41407
41408 void  __attribute__((export_name("TS_ChannelDetails_set_channel_shutdown_state"))) TS_ChannelDetails_set_channel_shutdown_state(uint64_t this_ptr, uint64_t val) {
41409         LDKChannelDetails this_ptr_conv;
41410         this_ptr_conv.inner = untag_ptr(this_ptr);
41411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41413         this_ptr_conv.is_owned = false;
41414         void* val_ptr = untag_ptr(val);
41415         CHECK_ACCESS(val_ptr);
41416         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
41417         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
41418         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
41419 }
41420
41421 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
41422         LDKChannelDetails this_ptr_conv;
41423         this_ptr_conv.inner = untag_ptr(this_ptr);
41424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41426         this_ptr_conv.is_owned = false;
41427         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
41428         return ret_conv;
41429 }
41430
41431 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
41432         LDKChannelDetails this_ptr_conv;
41433         this_ptr_conv.inner = untag_ptr(this_ptr);
41434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41436         this_ptr_conv.is_owned = false;
41437         ChannelDetails_set_is_usable(&this_ptr_conv, val);
41438 }
41439
41440 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
41441         LDKChannelDetails this_ptr_conv;
41442         this_ptr_conv.inner = untag_ptr(this_ptr);
41443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41445         this_ptr_conv.is_owned = false;
41446         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
41447         return ret_conv;
41448 }
41449
41450 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
41451         LDKChannelDetails this_ptr_conv;
41452         this_ptr_conv.inner = untag_ptr(this_ptr);
41453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41455         this_ptr_conv.is_owned = false;
41456         ChannelDetails_set_is_public(&this_ptr_conv, val);
41457 }
41458
41459 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
41460         LDKChannelDetails this_ptr_conv;
41461         this_ptr_conv.inner = untag_ptr(this_ptr);
41462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41464         this_ptr_conv.is_owned = false;
41465         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41466         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
41467         uint64_t ret_ref = tag_ptr(ret_copy, true);
41468         return ret_ref;
41469 }
41470
41471 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) {
41472         LDKChannelDetails this_ptr_conv;
41473         this_ptr_conv.inner = untag_ptr(this_ptr);
41474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41476         this_ptr_conv.is_owned = false;
41477         void* val_ptr = untag_ptr(val);
41478         CHECK_ACCESS(val_ptr);
41479         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41480         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41481         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
41482 }
41483
41484 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
41485         LDKChannelDetails this_ptr_conv;
41486         this_ptr_conv.inner = untag_ptr(this_ptr);
41487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41489         this_ptr_conv.is_owned = false;
41490         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41491         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
41492         uint64_t ret_ref = tag_ptr(ret_copy, true);
41493         return ret_ref;
41494 }
41495
41496 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) {
41497         LDKChannelDetails this_ptr_conv;
41498         this_ptr_conv.inner = untag_ptr(this_ptr);
41499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41501         this_ptr_conv.is_owned = false;
41502         void* val_ptr = untag_ptr(val);
41503         CHECK_ACCESS(val_ptr);
41504         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41505         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41506         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
41507 }
41508
41509 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
41510         LDKChannelDetails this_ptr_conv;
41511         this_ptr_conv.inner = untag_ptr(this_ptr);
41512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41514         this_ptr_conv.is_owned = false;
41515         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
41516         uint64_t ret_ref = 0;
41517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41519         return ret_ref;
41520 }
41521
41522 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
41523         LDKChannelDetails this_ptr_conv;
41524         this_ptr_conv.inner = untag_ptr(this_ptr);
41525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41527         this_ptr_conv.is_owned = false;
41528         LDKChannelConfig val_conv;
41529         val_conv.inner = untag_ptr(val);
41530         val_conv.is_owned = ptr_is_owned(val);
41531         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41532         val_conv = ChannelConfig_clone(&val_conv);
41533         ChannelDetails_set_config(&this_ptr_conv, val_conv);
41534 }
41535
41536 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
41537         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
41538         uint64_t ret_ref = 0;
41539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41541         return ret_ref;
41542 }
41543 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
41544         LDKChannelDetails arg_conv;
41545         arg_conv.inner = untag_ptr(arg);
41546         arg_conv.is_owned = ptr_is_owned(arg);
41547         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41548         arg_conv.is_owned = false;
41549         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
41550         return ret_conv;
41551 }
41552
41553 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
41554         LDKChannelDetails orig_conv;
41555         orig_conv.inner = untag_ptr(orig);
41556         orig_conv.is_owned = ptr_is_owned(orig);
41557         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41558         orig_conv.is_owned = false;
41559         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
41560         uint64_t ret_ref = 0;
41561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41563         return ret_ref;
41564 }
41565
41566 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
41567         LDKChannelDetails this_arg_conv;
41568         this_arg_conv.inner = untag_ptr(this_arg);
41569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41571         this_arg_conv.is_owned = false;
41572         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41573         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
41574         uint64_t ret_ref = tag_ptr(ret_copy, true);
41575         return ret_ref;
41576 }
41577
41578 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
41579         LDKChannelDetails this_arg_conv;
41580         this_arg_conv.inner = untag_ptr(this_arg);
41581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41583         this_arg_conv.is_owned = false;
41584         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41585         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
41586         uint64_t ret_ref = tag_ptr(ret_copy, true);
41587         return ret_ref;
41588 }
41589
41590 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_clone"))) TS_ChannelShutdownState_clone(uint64_t orig) {
41591         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
41592         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_clone(orig_conv));
41593         return ret_conv;
41594 }
41595
41596 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_not_shutting_down"))) TS_ChannelShutdownState_not_shutting_down() {
41597         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_not_shutting_down());
41598         return ret_conv;
41599 }
41600
41601 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_initiated"))) TS_ChannelShutdownState_shutdown_initiated() {
41602         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_initiated());
41603         return ret_conv;
41604 }
41605
41606 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_resolving_htlcs"))) TS_ChannelShutdownState_resolving_htlcs() {
41607         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_resolving_htlcs());
41608         return ret_conv;
41609 }
41610
41611 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_negotiating_closing_fee"))) TS_ChannelShutdownState_negotiating_closing_fee() {
41612         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_negotiating_closing_fee());
41613         return ret_conv;
41614 }
41615
41616 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_complete"))) TS_ChannelShutdownState_shutdown_complete() {
41617         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_complete());
41618         return ret_conv;
41619 }
41620
41621 jboolean  __attribute__((export_name("TS_ChannelShutdownState_eq"))) TS_ChannelShutdownState_eq(uint64_t a, uint64_t b) {
41622         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
41623         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
41624         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
41625         return ret_conv;
41626 }
41627
41628 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
41629         if (!ptr_is_owned(this_ptr)) return;
41630         void* this_ptr_ptr = untag_ptr(this_ptr);
41631         CHECK_ACCESS(this_ptr_ptr);
41632         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
41633         FREE(untag_ptr(this_ptr));
41634         RecentPaymentDetails_free(this_ptr_conv);
41635 }
41636
41637 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
41638         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41639         *ret_copy = RecentPaymentDetails_clone(arg);
41640         uint64_t ret_ref = tag_ptr(ret_copy, true);
41641         return ret_ref;
41642 }
41643 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
41644         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
41645         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
41646         return ret_conv;
41647 }
41648
41649 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
41650         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
41651         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41652         *ret_copy = RecentPaymentDetails_clone(orig_conv);
41653         uint64_t ret_ref = tag_ptr(ret_copy, true);
41654         return ret_ref;
41655 }
41656
41657 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_awaiting_invoice"))) TS_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
41658         LDKThirtyTwoBytes payment_id_ref;
41659         CHECK(payment_id->arr_len == 32);
41660         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41661         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41662         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
41663         uint64_t ret_ref = tag_ptr(ret_copy, true);
41664         return ret_ref;
41665 }
41666
41667 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
41668         LDKThirtyTwoBytes payment_id_ref;
41669         CHECK(payment_id->arr_len == 32);
41670         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41671         LDKThirtyTwoBytes payment_hash_ref;
41672         CHECK(payment_hash->arr_len == 32);
41673         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
41674         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41675         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
41676         uint64_t ret_ref = tag_ptr(ret_copy, true);
41677         return ret_ref;
41678 }
41679
41680 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_id, uint64_t payment_hash) {
41681         LDKThirtyTwoBytes payment_id_ref;
41682         CHECK(payment_id->arr_len == 32);
41683         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41684         void* payment_hash_ptr = untag_ptr(payment_hash);
41685         CHECK_ACCESS(payment_hash_ptr);
41686         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
41687         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
41688         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41689         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
41690         uint64_t ret_ref = tag_ptr(ret_copy, true);
41691         return ret_ref;
41692 }
41693
41694 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
41695         LDKThirtyTwoBytes payment_id_ref;
41696         CHECK(payment_id->arr_len == 32);
41697         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41698         LDKThirtyTwoBytes payment_hash_ref;
41699         CHECK(payment_hash->arr_len == 32);
41700         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
41701         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41702         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
41703         uint64_t ret_ref = tag_ptr(ret_copy, true);
41704         return ret_ref;
41705 }
41706
41707 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
41708         LDKPhantomRouteHints this_obj_conv;
41709         this_obj_conv.inner = untag_ptr(this_obj);
41710         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41712         PhantomRouteHints_free(this_obj_conv);
41713 }
41714
41715 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
41716         LDKPhantomRouteHints this_ptr_conv;
41717         this_ptr_conv.inner = untag_ptr(this_ptr);
41718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41720         this_ptr_conv.is_owned = false;
41721         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
41722         uint64_tArray ret_arr = NULL;
41723         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41724         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41725         for (size_t q = 0; q < ret_var.datalen; q++) {
41726                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
41727                 uint64_t ret_conv_16_ref = 0;
41728                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
41729                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
41730                 ret_arr_ptr[q] = ret_conv_16_ref;
41731         }
41732         
41733         FREE(ret_var.data);
41734         return ret_arr;
41735 }
41736
41737 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
41738         LDKPhantomRouteHints this_ptr_conv;
41739         this_ptr_conv.inner = untag_ptr(this_ptr);
41740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41742         this_ptr_conv.is_owned = false;
41743         LDKCVec_ChannelDetailsZ val_constr;
41744         val_constr.datalen = val->arr_len;
41745         if (val_constr.datalen > 0)
41746                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
41747         else
41748                 val_constr.data = NULL;
41749         uint64_t* val_vals = val->elems;
41750         for (size_t q = 0; q < val_constr.datalen; q++) {
41751                 uint64_t val_conv_16 = val_vals[q];
41752                 LDKChannelDetails val_conv_16_conv;
41753                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
41754                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
41755                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
41756                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
41757                 val_constr.data[q] = val_conv_16_conv;
41758         }
41759         FREE(val);
41760         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
41761 }
41762
41763 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
41764         LDKPhantomRouteHints this_ptr_conv;
41765         this_ptr_conv.inner = untag_ptr(this_ptr);
41766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41768         this_ptr_conv.is_owned = false;
41769         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
41770         return ret_conv;
41771 }
41772
41773 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
41774         LDKPhantomRouteHints this_ptr_conv;
41775         this_ptr_conv.inner = untag_ptr(this_ptr);
41776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41778         this_ptr_conv.is_owned = false;
41779         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
41780 }
41781
41782 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
41783         LDKPhantomRouteHints this_ptr_conv;
41784         this_ptr_conv.inner = untag_ptr(this_ptr);
41785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41787         this_ptr_conv.is_owned = false;
41788         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41789         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
41790         return ret_arr;
41791 }
41792
41793 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
41794         LDKPhantomRouteHints this_ptr_conv;
41795         this_ptr_conv.inner = untag_ptr(this_ptr);
41796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41798         this_ptr_conv.is_owned = false;
41799         LDKPublicKey val_ref;
41800         CHECK(val->arr_len == 33);
41801         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41802         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
41803 }
41804
41805 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) {
41806         LDKCVec_ChannelDetailsZ channels_arg_constr;
41807         channels_arg_constr.datalen = channels_arg->arr_len;
41808         if (channels_arg_constr.datalen > 0)
41809                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
41810         else
41811                 channels_arg_constr.data = NULL;
41812         uint64_t* channels_arg_vals = channels_arg->elems;
41813         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
41814                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
41815                 LDKChannelDetails channels_arg_conv_16_conv;
41816                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
41817                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
41818                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
41819                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
41820                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
41821         }
41822         FREE(channels_arg);
41823         LDKPublicKey real_node_pubkey_arg_ref;
41824         CHECK(real_node_pubkey_arg->arr_len == 33);
41825         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
41826         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
41827         uint64_t ret_ref = 0;
41828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41830         return ret_ref;
41831 }
41832
41833 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
41834         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
41835         uint64_t ret_ref = 0;
41836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41838         return ret_ref;
41839 }
41840 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
41841         LDKPhantomRouteHints arg_conv;
41842         arg_conv.inner = untag_ptr(arg);
41843         arg_conv.is_owned = ptr_is_owned(arg);
41844         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41845         arg_conv.is_owned = false;
41846         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
41847         return ret_conv;
41848 }
41849
41850 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
41851         LDKPhantomRouteHints orig_conv;
41852         orig_conv.inner = untag_ptr(orig);
41853         orig_conv.is_owned = ptr_is_owned(orig);
41854         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41855         orig_conv.is_owned = false;
41856         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
41857         uint64_t ret_ref = 0;
41858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41860         return ret_ref;
41861 }
41862
41863 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) {
41864         void* fee_est_ptr = untag_ptr(fee_est);
41865         CHECK_ACCESS(fee_est_ptr);
41866         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
41867         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
41868                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41869                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
41870         }
41871         void* chain_monitor_ptr = untag_ptr(chain_monitor);
41872         CHECK_ACCESS(chain_monitor_ptr);
41873         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
41874         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
41875                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41876                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
41877         }
41878         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
41879         CHECK_ACCESS(tx_broadcaster_ptr);
41880         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
41881         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41882                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41883                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
41884         }
41885         void* router_ptr = untag_ptr(router);
41886         CHECK_ACCESS(router_ptr);
41887         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
41888         if (router_conv.free == LDKRouter_JCalls_free) {
41889                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41890                 LDKRouter_JCalls_cloned(&router_conv);
41891         }
41892         void* logger_ptr = untag_ptr(logger);
41893         CHECK_ACCESS(logger_ptr);
41894         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41895         if (logger_conv.free == LDKLogger_JCalls_free) {
41896                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41897                 LDKLogger_JCalls_cloned(&logger_conv);
41898         }
41899         void* entropy_source_ptr = untag_ptr(entropy_source);
41900         CHECK_ACCESS(entropy_source_ptr);
41901         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
41902         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
41903                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41904                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
41905         }
41906         void* node_signer_ptr = untag_ptr(node_signer);
41907         CHECK_ACCESS(node_signer_ptr);
41908         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
41909         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
41910                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41911                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
41912         }
41913         void* signer_provider_ptr = untag_ptr(signer_provider);
41914         CHECK_ACCESS(signer_provider_ptr);
41915         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
41916         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
41917                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41918                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
41919         }
41920         LDKUserConfig config_conv;
41921         config_conv.inner = untag_ptr(config);
41922         config_conv.is_owned = ptr_is_owned(config);
41923         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
41924         config_conv = UserConfig_clone(&config_conv);
41925         LDKChainParameters params_conv;
41926         params_conv.inner = untag_ptr(params);
41927         params_conv.is_owned = ptr_is_owned(params);
41928         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
41929         params_conv = ChainParameters_clone(&params_conv);
41930         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);
41931         uint64_t ret_ref = 0;
41932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41934         return ret_ref;
41935 }
41936
41937 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
41938         LDKChannelManager this_arg_conv;
41939         this_arg_conv.inner = untag_ptr(this_arg);
41940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41942         this_arg_conv.is_owned = false;
41943         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
41944         uint64_t ret_ref = 0;
41945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41947         return ret_ref;
41948 }
41949
41950 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) {
41951         LDKChannelManager this_arg_conv;
41952         this_arg_conv.inner = untag_ptr(this_arg);
41953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41955         this_arg_conv.is_owned = false;
41956         LDKPublicKey their_network_key_ref;
41957         CHECK(their_network_key->arr_len == 33);
41958         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
41959         LDKU128 user_channel_id_ref;
41960         CHECK(user_channel_id->arr_len == 16);
41961         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
41962         LDKChannelId temporary_channel_id_conv;
41963         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
41964         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
41965         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
41966         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
41967         LDKUserConfig override_config_conv;
41968         override_config_conv.inner = untag_ptr(override_config);
41969         override_config_conv.is_owned = ptr_is_owned(override_config);
41970         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
41971         override_config_conv = UserConfig_clone(&override_config_conv);
41972         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
41973         *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);
41974         return tag_ptr(ret_conv, true);
41975 }
41976
41977 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
41978         LDKChannelManager this_arg_conv;
41979         this_arg_conv.inner = untag_ptr(this_arg);
41980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41982         this_arg_conv.is_owned = false;
41983         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
41984         uint64_tArray ret_arr = NULL;
41985         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41986         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41987         for (size_t q = 0; q < ret_var.datalen; q++) {
41988                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
41989                 uint64_t ret_conv_16_ref = 0;
41990                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
41991                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
41992                 ret_arr_ptr[q] = ret_conv_16_ref;
41993         }
41994         
41995         FREE(ret_var.data);
41996         return ret_arr;
41997 }
41998
41999 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
42000         LDKChannelManager this_arg_conv;
42001         this_arg_conv.inner = untag_ptr(this_arg);
42002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42004         this_arg_conv.is_owned = false;
42005         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
42006         uint64_tArray ret_arr = NULL;
42007         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42008         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42009         for (size_t q = 0; q < ret_var.datalen; q++) {
42010                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
42011                 uint64_t ret_conv_16_ref = 0;
42012                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
42013                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
42014                 ret_arr_ptr[q] = ret_conv_16_ref;
42015         }
42016         
42017         FREE(ret_var.data);
42018         return ret_arr;
42019 }
42020
42021 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) {
42022         LDKChannelManager this_arg_conv;
42023         this_arg_conv.inner = untag_ptr(this_arg);
42024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42026         this_arg_conv.is_owned = false;
42027         LDKPublicKey counterparty_node_id_ref;
42028         CHECK(counterparty_node_id->arr_len == 33);
42029         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42030         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
42031         uint64_tArray ret_arr = NULL;
42032         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42033         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42034         for (size_t q = 0; q < ret_var.datalen; q++) {
42035                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
42036                 uint64_t ret_conv_16_ref = 0;
42037                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
42038                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
42039                 ret_arr_ptr[q] = ret_conv_16_ref;
42040         }
42041         
42042         FREE(ret_var.data);
42043         return ret_arr;
42044 }
42045
42046 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
42047         LDKChannelManager this_arg_conv;
42048         this_arg_conv.inner = untag_ptr(this_arg);
42049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42051         this_arg_conv.is_owned = false;
42052         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
42053         uint64_tArray ret_arr = NULL;
42054         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42055         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42056         for (size_t w = 0; w < ret_var.datalen; w++) {
42057                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
42058                 *ret_conv_22_copy = ret_var.data[w];
42059                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
42060                 ret_arr_ptr[w] = ret_conv_22_ref;
42061         }
42062         
42063         FREE(ret_var.data);
42064         return ret_arr;
42065 }
42066
42067 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) {
42068         LDKChannelManager this_arg_conv;
42069         this_arg_conv.inner = untag_ptr(this_arg);
42070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42072         this_arg_conv.is_owned = false;
42073         LDKChannelId channel_id_conv;
42074         channel_id_conv.inner = untag_ptr(channel_id);
42075         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42076         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42077         channel_id_conv.is_owned = false;
42078         LDKPublicKey counterparty_node_id_ref;
42079         CHECK(counterparty_node_id->arr_len == 33);
42080         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42081         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42082         *ret_conv = ChannelManager_close_channel(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
42083         return tag_ptr(ret_conv, true);
42084 }
42085
42086 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) {
42087         LDKChannelManager this_arg_conv;
42088         this_arg_conv.inner = untag_ptr(this_arg);
42089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42091         this_arg_conv.is_owned = false;
42092         LDKChannelId channel_id_conv;
42093         channel_id_conv.inner = untag_ptr(channel_id);
42094         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42095         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42096         channel_id_conv.is_owned = false;
42097         LDKPublicKey counterparty_node_id_ref;
42098         CHECK(counterparty_node_id->arr_len == 33);
42099         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42100         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
42101         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
42102         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
42103         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
42104         LDKShutdownScript shutdown_script_conv;
42105         shutdown_script_conv.inner = untag_ptr(shutdown_script);
42106         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
42107         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
42108         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
42109         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42110         *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);
42111         return tag_ptr(ret_conv, true);
42112 }
42113
42114 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) {
42115         LDKChannelManager this_arg_conv;
42116         this_arg_conv.inner = untag_ptr(this_arg);
42117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42119         this_arg_conv.is_owned = false;
42120         LDKChannelId channel_id_conv;
42121         channel_id_conv.inner = untag_ptr(channel_id);
42122         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42123         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42124         channel_id_conv.is_owned = false;
42125         LDKPublicKey counterparty_node_id_ref;
42126         CHECK(counterparty_node_id->arr_len == 33);
42127         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42128         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42129         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
42130         return tag_ptr(ret_conv, true);
42131 }
42132
42133 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) {
42134         LDKChannelManager this_arg_conv;
42135         this_arg_conv.inner = untag_ptr(this_arg);
42136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42138         this_arg_conv.is_owned = false;
42139         LDKChannelId channel_id_conv;
42140         channel_id_conv.inner = untag_ptr(channel_id);
42141         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42142         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42143         channel_id_conv.is_owned = false;
42144         LDKPublicKey counterparty_node_id_ref;
42145         CHECK(counterparty_node_id->arr_len == 33);
42146         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42147         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42148         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
42149         return tag_ptr(ret_conv, true);
42150 }
42151
42152 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) {
42153         LDKChannelManager this_arg_conv;
42154         this_arg_conv.inner = untag_ptr(this_arg);
42155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42157         this_arg_conv.is_owned = false;
42158         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
42159 }
42160
42161 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) {
42162         LDKChannelManager this_arg_conv;
42163         this_arg_conv.inner = untag_ptr(this_arg);
42164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42166         this_arg_conv.is_owned = false;
42167         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
42168 }
42169
42170 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) {
42171         LDKChannelManager this_arg_conv;
42172         this_arg_conv.inner = untag_ptr(this_arg);
42173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42175         this_arg_conv.is_owned = false;
42176         LDKRoute route_conv;
42177         route_conv.inner = untag_ptr(route);
42178         route_conv.is_owned = ptr_is_owned(route);
42179         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
42180         route_conv.is_owned = false;
42181         LDKThirtyTwoBytes payment_hash_ref;
42182         CHECK(payment_hash->arr_len == 32);
42183         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42184         LDKRecipientOnionFields recipient_onion_conv;
42185         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42186         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42187         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42188         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42189         LDKThirtyTwoBytes payment_id_ref;
42190         CHECK(payment_id->arr_len == 32);
42191         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42192         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
42193         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
42194         return tag_ptr(ret_conv, true);
42195 }
42196
42197 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) {
42198         LDKChannelManager this_arg_conv;
42199         this_arg_conv.inner = untag_ptr(this_arg);
42200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42202         this_arg_conv.is_owned = false;
42203         LDKThirtyTwoBytes payment_hash_ref;
42204         CHECK(payment_hash->arr_len == 32);
42205         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42206         LDKRecipientOnionFields recipient_onion_conv;
42207         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42208         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42209         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42210         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42211         LDKThirtyTwoBytes payment_id_ref;
42212         CHECK(payment_id->arr_len == 32);
42213         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42214         LDKRouteParameters route_params_conv;
42215         route_params_conv.inner = untag_ptr(route_params);
42216         route_params_conv.is_owned = ptr_is_owned(route_params);
42217         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42218         route_params_conv = RouteParameters_clone(&route_params_conv);
42219         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42220         CHECK_ACCESS(retry_strategy_ptr);
42221         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42222         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42223         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
42224         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
42225         return tag_ptr(ret_conv, true);
42226 }
42227
42228 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
42229         LDKChannelManager this_arg_conv;
42230         this_arg_conv.inner = untag_ptr(this_arg);
42231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42233         this_arg_conv.is_owned = false;
42234         LDKThirtyTwoBytes payment_id_ref;
42235         CHECK(payment_id->arr_len == 32);
42236         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42237         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
42238 }
42239
42240 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) {
42241         LDKChannelManager this_arg_conv;
42242         this_arg_conv.inner = untag_ptr(this_arg);
42243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42245         this_arg_conv.is_owned = false;
42246         LDKRoute route_conv;
42247         route_conv.inner = untag_ptr(route);
42248         route_conv.is_owned = ptr_is_owned(route);
42249         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
42250         route_conv.is_owned = false;
42251         void* payment_preimage_ptr = untag_ptr(payment_preimage);
42252         CHECK_ACCESS(payment_preimage_ptr);
42253         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
42254         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
42255         LDKRecipientOnionFields recipient_onion_conv;
42256         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42257         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42258         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42259         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42260         LDKThirtyTwoBytes payment_id_ref;
42261         CHECK(payment_id->arr_len == 32);
42262         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42263         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
42264         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
42265         return tag_ptr(ret_conv, true);
42266 }
42267
42268 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) {
42269         LDKChannelManager this_arg_conv;
42270         this_arg_conv.inner = untag_ptr(this_arg);
42271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42273         this_arg_conv.is_owned = false;
42274         void* payment_preimage_ptr = untag_ptr(payment_preimage);
42275         CHECK_ACCESS(payment_preimage_ptr);
42276         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
42277         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
42278         LDKRecipientOnionFields recipient_onion_conv;
42279         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42280         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42281         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42282         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42283         LDKThirtyTwoBytes payment_id_ref;
42284         CHECK(payment_id->arr_len == 32);
42285         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42286         LDKRouteParameters route_params_conv;
42287         route_params_conv.inner = untag_ptr(route_params);
42288         route_params_conv.is_owned = ptr_is_owned(route_params);
42289         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42290         route_params_conv = RouteParameters_clone(&route_params_conv);
42291         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42292         CHECK_ACCESS(retry_strategy_ptr);
42293         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42294         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42295         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
42296         *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);
42297         return tag_ptr(ret_conv, true);
42298 }
42299
42300 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
42301         LDKChannelManager this_arg_conv;
42302         this_arg_conv.inner = untag_ptr(this_arg);
42303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42305         this_arg_conv.is_owned = false;
42306         LDKPath path_conv;
42307         path_conv.inner = untag_ptr(path);
42308         path_conv.is_owned = ptr_is_owned(path);
42309         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
42310         path_conv = Path_clone(&path_conv);
42311         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
42312         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
42313         return tag_ptr(ret_conv, true);
42314 }
42315
42316 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) {
42317         LDKChannelManager this_arg_conv;
42318         this_arg_conv.inner = untag_ptr(this_arg);
42319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42321         this_arg_conv.is_owned = false;
42322         LDKPublicKey node_id_ref;
42323         CHECK(node_id->arr_len == 33);
42324         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
42325         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
42326         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
42327         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
42328         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
42329         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
42330         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
42331         return tag_ptr(ret_conv, true);
42332 }
42333
42334 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) {
42335         LDKChannelManager this_arg_conv;
42336         this_arg_conv.inner = untag_ptr(this_arg);
42337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42339         this_arg_conv.is_owned = false;
42340         LDKRouteParameters route_params_conv;
42341         route_params_conv.inner = untag_ptr(route_params);
42342         route_params_conv.is_owned = ptr_is_owned(route_params);
42343         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42344         route_params_conv = RouteParameters_clone(&route_params_conv);
42345         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
42346         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
42347         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
42348         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
42349         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
42350         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
42351         return tag_ptr(ret_conv, true);
42352 }
42353
42354 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) {
42355         LDKChannelManager this_arg_conv;
42356         this_arg_conv.inner = untag_ptr(this_arg);
42357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42359         this_arg_conv.is_owned = false;
42360         LDKChannelId temporary_channel_id_conv;
42361         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42362         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42363         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42364         temporary_channel_id_conv.is_owned = false;
42365         LDKPublicKey counterparty_node_id_ref;
42366         CHECK(counterparty_node_id->arr_len == 33);
42367         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42368         LDKTransaction funding_transaction_ref;
42369         funding_transaction_ref.datalen = funding_transaction->arr_len;
42370         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
42371         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
42372         funding_transaction_ref.data_is_owned = true;
42373         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42374         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, funding_transaction_ref);
42375         return tag_ptr(ret_conv, true);
42376 }
42377
42378 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) {
42379         LDKChannelManager this_arg_conv;
42380         this_arg_conv.inner = untag_ptr(this_arg);
42381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42383         this_arg_conv.is_owned = false;
42384         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels_constr;
42385         temporary_channels_constr.datalen = temporary_channels->arr_len;
42386         if (temporary_channels_constr.datalen > 0)
42387                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
42388         else
42389                 temporary_channels_constr.data = NULL;
42390         uint64_t* temporary_channels_vals = temporary_channels->elems;
42391         for (size_t e = 0; e < temporary_channels_constr.datalen; e++) {
42392                 uint64_t temporary_channels_conv_30 = temporary_channels_vals[e];
42393                 void* temporary_channels_conv_30_ptr = untag_ptr(temporary_channels_conv_30);
42394                 CHECK_ACCESS(temporary_channels_conv_30_ptr);
42395                 LDKC2Tuple_ChannelIdPublicKeyZ temporary_channels_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(temporary_channels_conv_30_ptr);
42396                 temporary_channels_conv_30_conv = C2Tuple_ChannelIdPublicKeyZ_clone((LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(temporary_channels_conv_30));
42397                 temporary_channels_constr.data[e] = temporary_channels_conv_30_conv;
42398         }
42399         FREE(temporary_channels);
42400         LDKTransaction funding_transaction_ref;
42401         funding_transaction_ref.datalen = funding_transaction->arr_len;
42402         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
42403         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
42404         funding_transaction_ref.data_is_owned = true;
42405         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42406         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
42407         return tag_ptr(ret_conv, true);
42408 }
42409
42410 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) {
42411         LDKChannelManager this_arg_conv;
42412         this_arg_conv.inner = untag_ptr(this_arg);
42413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42415         this_arg_conv.is_owned = false;
42416         LDKPublicKey counterparty_node_id_ref;
42417         CHECK(counterparty_node_id->arr_len == 33);
42418         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42419         LDKCVec_ChannelIdZ channel_ids_constr;
42420         channel_ids_constr.datalen = channel_ids->arr_len;
42421         if (channel_ids_constr.datalen > 0)
42422                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
42423         else
42424                 channel_ids_constr.data = NULL;
42425         uint64_t* channel_ids_vals = channel_ids->elems;
42426         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
42427                 uint64_t channel_ids_conv_11 = channel_ids_vals[l];
42428                 LDKChannelId channel_ids_conv_11_conv;
42429                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
42430                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
42431                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
42432                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
42433                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
42434         }
42435         FREE(channel_ids);
42436         LDKChannelConfigUpdate config_update_conv;
42437         config_update_conv.inner = untag_ptr(config_update);
42438         config_update_conv.is_owned = ptr_is_owned(config_update);
42439         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
42440         config_update_conv.is_owned = false;
42441         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42442         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
42443         return tag_ptr(ret_conv, true);
42444 }
42445
42446 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) {
42447         LDKChannelManager this_arg_conv;
42448         this_arg_conv.inner = untag_ptr(this_arg);
42449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42451         this_arg_conv.is_owned = false;
42452         LDKPublicKey counterparty_node_id_ref;
42453         CHECK(counterparty_node_id->arr_len == 33);
42454         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42455         LDKCVec_ChannelIdZ channel_ids_constr;
42456         channel_ids_constr.datalen = channel_ids->arr_len;
42457         if (channel_ids_constr.datalen > 0)
42458                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
42459         else
42460                 channel_ids_constr.data = NULL;
42461         uint64_t* channel_ids_vals = channel_ids->elems;
42462         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
42463                 uint64_t channel_ids_conv_11 = channel_ids_vals[l];
42464                 LDKChannelId channel_ids_conv_11_conv;
42465                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
42466                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
42467                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
42468                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
42469                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
42470         }
42471         FREE(channel_ids);
42472         LDKChannelConfig config_conv;
42473         config_conv.inner = untag_ptr(config);
42474         config_conv.is_owned = ptr_is_owned(config);
42475         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
42476         config_conv.is_owned = false;
42477         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42478         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
42479         return tag_ptr(ret_conv, true);
42480 }
42481
42482 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) {
42483         LDKChannelManager this_arg_conv;
42484         this_arg_conv.inner = untag_ptr(this_arg);
42485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42487         this_arg_conv.is_owned = false;
42488         LDKThirtyTwoBytes intercept_id_ref;
42489         CHECK(intercept_id->arr_len == 32);
42490         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
42491         LDKChannelId next_hop_channel_id_conv;
42492         next_hop_channel_id_conv.inner = untag_ptr(next_hop_channel_id);
42493         next_hop_channel_id_conv.is_owned = ptr_is_owned(next_hop_channel_id);
42494         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_hop_channel_id_conv);
42495         next_hop_channel_id_conv.is_owned = false;
42496         LDKPublicKey next_node_id_ref;
42497         CHECK(next_node_id->arr_len == 33);
42498         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
42499         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42500         *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);
42501         return tag_ptr(ret_conv, true);
42502 }
42503
42504 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
42505         LDKChannelManager this_arg_conv;
42506         this_arg_conv.inner = untag_ptr(this_arg);
42507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42509         this_arg_conv.is_owned = false;
42510         LDKThirtyTwoBytes intercept_id_ref;
42511         CHECK(intercept_id->arr_len == 32);
42512         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
42513         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42514         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
42515         return tag_ptr(ret_conv, true);
42516 }
42517
42518 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
42519         LDKChannelManager this_arg_conv;
42520         this_arg_conv.inner = untag_ptr(this_arg);
42521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42523         this_arg_conv.is_owned = false;
42524         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
42525 }
42526
42527 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
42528         LDKChannelManager this_arg_conv;
42529         this_arg_conv.inner = untag_ptr(this_arg);
42530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42532         this_arg_conv.is_owned = false;
42533         ChannelManager_timer_tick_occurred(&this_arg_conv);
42534 }
42535
42536 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
42537         LDKChannelManager this_arg_conv;
42538         this_arg_conv.inner = untag_ptr(this_arg);
42539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42541         this_arg_conv.is_owned = false;
42542         uint8_t payment_hash_arr[32];
42543         CHECK(payment_hash->arr_len == 32);
42544         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
42545         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
42546         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
42547 }
42548
42549 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) {
42550         LDKChannelManager this_arg_conv;
42551         this_arg_conv.inner = untag_ptr(this_arg);
42552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42554         this_arg_conv.is_owned = false;
42555         uint8_t payment_hash_arr[32];
42556         CHECK(payment_hash->arr_len == 32);
42557         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
42558         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
42559         void* failure_code_ptr = untag_ptr(failure_code);
42560         CHECK_ACCESS(failure_code_ptr);
42561         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
42562         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
42563         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
42564 }
42565
42566 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
42567         LDKChannelManager this_arg_conv;
42568         this_arg_conv.inner = untag_ptr(this_arg);
42569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42571         this_arg_conv.is_owned = false;
42572         LDKThirtyTwoBytes payment_preimage_ref;
42573         CHECK(payment_preimage->arr_len == 32);
42574         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
42575         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
42576 }
42577
42578 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) {
42579         LDKChannelManager this_arg_conv;
42580         this_arg_conv.inner = untag_ptr(this_arg);
42581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42583         this_arg_conv.is_owned = false;
42584         LDKThirtyTwoBytes payment_preimage_ref;
42585         CHECK(payment_preimage->arr_len == 32);
42586         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
42587         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
42588 }
42589
42590 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
42591         LDKChannelManager this_arg_conv;
42592         this_arg_conv.inner = untag_ptr(this_arg);
42593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42595         this_arg_conv.is_owned = false;
42596         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42597         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
42598         return ret_arr;
42599 }
42600
42601 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) {
42602         LDKChannelManager this_arg_conv;
42603         this_arg_conv.inner = untag_ptr(this_arg);
42604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42606         this_arg_conv.is_owned = false;
42607         LDKChannelId temporary_channel_id_conv;
42608         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42609         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42610         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42611         temporary_channel_id_conv.is_owned = false;
42612         LDKPublicKey counterparty_node_id_ref;
42613         CHECK(counterparty_node_id->arr_len == 33);
42614         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42615         LDKU128 user_channel_id_ref;
42616         CHECK(user_channel_id->arr_len == 16);
42617         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
42618         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42619         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
42620         return tag_ptr(ret_conv, true);
42621 }
42622
42623 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) {
42624         LDKChannelManager this_arg_conv;
42625         this_arg_conv.inner = untag_ptr(this_arg);
42626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42628         this_arg_conv.is_owned = false;
42629         LDKChannelId temporary_channel_id_conv;
42630         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42631         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42632         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42633         temporary_channel_id_conv.is_owned = false;
42634         LDKPublicKey counterparty_node_id_ref;
42635         CHECK(counterparty_node_id->arr_len == 33);
42636         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42637         LDKU128 user_channel_id_ref;
42638         CHECK(user_channel_id->arr_len == 16);
42639         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
42640         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42641         *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);
42642         return tag_ptr(ret_conv, true);
42643 }
42644
42645 uint64_t  __attribute__((export_name("TS_ChannelManager_create_offer_builder"))) TS_ChannelManager_create_offer_builder(uint64_t this_arg) {
42646         LDKChannelManager this_arg_conv;
42647         this_arg_conv.inner = untag_ptr(this_arg);
42648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42650         this_arg_conv.is_owned = false;
42651         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
42652         *ret_conv = ChannelManager_create_offer_builder(&this_arg_conv);
42653         return tag_ptr(ret_conv, true);
42654 }
42655
42656 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) {
42657         LDKChannelManager this_arg_conv;
42658         this_arg_conv.inner = untag_ptr(this_arg);
42659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42661         this_arg_conv.is_owned = false;
42662         LDKThirtyTwoBytes payment_id_ref;
42663         CHECK(payment_id->arr_len == 32);
42664         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42665         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42666         CHECK_ACCESS(retry_strategy_ptr);
42667         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42668         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42669         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
42670         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
42671         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
42672         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
42673         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
42674         *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);
42675         return tag_ptr(ret_conv, true);
42676 }
42677
42678 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) {
42679         LDKChannelManager this_arg_conv;
42680         this_arg_conv.inner = untag_ptr(this_arg);
42681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42683         this_arg_conv.is_owned = false;
42684         LDKOffer offer_conv;
42685         offer_conv.inner = untag_ptr(offer);
42686         offer_conv.is_owned = ptr_is_owned(offer);
42687         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
42688         offer_conv.is_owned = false;
42689         void* quantity_ptr = untag_ptr(quantity);
42690         CHECK_ACCESS(quantity_ptr);
42691         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
42692         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
42693         void* amount_msats_ptr = untag_ptr(amount_msats);
42694         CHECK_ACCESS(amount_msats_ptr);
42695         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
42696         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
42697         void* payer_note_ptr = untag_ptr(payer_note);
42698         CHECK_ACCESS(payer_note_ptr);
42699         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
42700         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
42701         LDKThirtyTwoBytes payment_id_ref;
42702         CHECK(payment_id->arr_len == 32);
42703         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42704         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42705         CHECK_ACCESS(retry_strategy_ptr);
42706         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42707         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42708         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
42709         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
42710         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
42711         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
42712         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
42713         *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);
42714         return tag_ptr(ret_conv, true);
42715 }
42716
42717 uint64_t  __attribute__((export_name("TS_ChannelManager_request_refund_payment"))) TS_ChannelManager_request_refund_payment(uint64_t this_arg, uint64_t refund) {
42718         LDKChannelManager this_arg_conv;
42719         this_arg_conv.inner = untag_ptr(this_arg);
42720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42722         this_arg_conv.is_owned = false;
42723         LDKRefund refund_conv;
42724         refund_conv.inner = untag_ptr(refund);
42725         refund_conv.is_owned = ptr_is_owned(refund);
42726         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
42727         refund_conv.is_owned = false;
42728         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
42729         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
42730         return tag_ptr(ret_conv, true);
42731 }
42732
42733 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) {
42734         LDKChannelManager this_arg_conv;
42735         this_arg_conv.inner = untag_ptr(this_arg);
42736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42738         this_arg_conv.is_owned = false;
42739         void* min_value_msat_ptr = untag_ptr(min_value_msat);
42740         CHECK_ACCESS(min_value_msat_ptr);
42741         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
42742         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
42743         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
42744         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
42745         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
42746         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
42747         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
42748         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
42749         return tag_ptr(ret_conv, true);
42750 }
42751
42752 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) {
42753         LDKChannelManager this_arg_conv;
42754         this_arg_conv.inner = untag_ptr(this_arg);
42755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42757         this_arg_conv.is_owned = false;
42758         LDKThirtyTwoBytes payment_hash_ref;
42759         CHECK(payment_hash->arr_len == 32);
42760         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42761         void* min_value_msat_ptr = untag_ptr(min_value_msat);
42762         CHECK_ACCESS(min_value_msat_ptr);
42763         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
42764         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
42765         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
42766         CHECK_ACCESS(min_final_cltv_expiry_ptr);
42767         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
42768         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
42769         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
42770         *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);
42771         return tag_ptr(ret_conv, true);
42772 }
42773
42774 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) {
42775         LDKChannelManager this_arg_conv;
42776         this_arg_conv.inner = untag_ptr(this_arg);
42777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42779         this_arg_conv.is_owned = false;
42780         LDKThirtyTwoBytes payment_hash_ref;
42781         CHECK(payment_hash->arr_len == 32);
42782         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42783         LDKThirtyTwoBytes payment_secret_ref;
42784         CHECK(payment_secret->arr_len == 32);
42785         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
42786         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
42787         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
42788         return tag_ptr(ret_conv, true);
42789 }
42790
42791 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
42792         LDKChannelManager this_arg_conv;
42793         this_arg_conv.inner = untag_ptr(this_arg);
42794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42796         this_arg_conv.is_owned = false;
42797         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
42798         return ret_conv;
42799 }
42800
42801 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
42802         LDKChannelManager this_arg_conv;
42803         this_arg_conv.inner = untag_ptr(this_arg);
42804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42806         this_arg_conv.is_owned = false;
42807         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
42808         uint64_t ret_ref = 0;
42809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42811         return ret_ref;
42812 }
42813
42814 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
42815         LDKChannelManager this_arg_conv;
42816         this_arg_conv.inner = untag_ptr(this_arg);
42817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42819         this_arg_conv.is_owned = false;
42820         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
42821         return ret_conv;
42822 }
42823
42824 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
42825         LDKChannelManager this_arg_conv;
42826         this_arg_conv.inner = untag_ptr(this_arg);
42827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42829         this_arg_conv.is_owned = false;
42830         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
42831         uint64_t ret_ref = 0;
42832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42834         return ret_ref;
42835 }
42836
42837 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
42838         LDKChannelManager this_arg_conv;
42839         this_arg_conv.inner = untag_ptr(this_arg);
42840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42842         this_arg_conv.is_owned = false;
42843         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
42844         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
42845         return tag_ptr(ret_ret, true);
42846 }
42847
42848 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
42849         LDKChannelManager this_arg_conv;
42850         this_arg_conv.inner = untag_ptr(this_arg);
42851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42853         this_arg_conv.is_owned = false;
42854         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
42855         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
42856         return tag_ptr(ret_ret, true);
42857 }
42858
42859 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
42860         LDKChannelManager this_arg_conv;
42861         this_arg_conv.inner = untag_ptr(this_arg);
42862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42864         this_arg_conv.is_owned = false;
42865         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
42866         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
42867         return tag_ptr(ret_ret, true);
42868 }
42869
42870 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
42871         LDKChannelManager this_arg_conv;
42872         this_arg_conv.inner = untag_ptr(this_arg);
42873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42875         this_arg_conv.is_owned = false;
42876         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
42877         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
42878         return tag_ptr(ret_ret, true);
42879 }
42880
42881 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) {
42882         LDKChannelManager this_arg_conv;
42883         this_arg_conv.inner = untag_ptr(this_arg);
42884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42886         this_arg_conv.is_owned = false;
42887         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
42888         uint64_t ret_ref = 0;
42889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42891         return ret_ref;
42892 }
42893
42894 jboolean  __attribute__((export_name("TS_ChannelManager_get_and_clear_needs_persistence"))) TS_ChannelManager_get_and_clear_needs_persistence(uint64_t this_arg) {
42895         LDKChannelManager this_arg_conv;
42896         this_arg_conv.inner = untag_ptr(this_arg);
42897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42899         this_arg_conv.is_owned = false;
42900         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
42901         return ret_conv;
42902 }
42903
42904 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
42905         LDKChannelManager this_arg_conv;
42906         this_arg_conv.inner = untag_ptr(this_arg);
42907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42909         this_arg_conv.is_owned = false;
42910         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
42911         uint64_t ret_ref = 0;
42912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42914         return ret_ref;
42915 }
42916
42917 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
42918         LDKChannelManager this_arg_conv;
42919         this_arg_conv.inner = untag_ptr(this_arg);
42920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42922         this_arg_conv.is_owned = false;
42923         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
42924         uint64_t ret_ref = 0;
42925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42927         return ret_ref;
42928 }
42929
42930 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
42931         LDKChannelManager this_arg_conv;
42932         this_arg_conv.inner = untag_ptr(this_arg);
42933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42935         this_arg_conv.is_owned = false;
42936         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
42937         uint64_t ret_ref = 0;
42938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42940         return ret_ref;
42941 }
42942
42943 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
42944         LDKChannelManager this_arg_conv;
42945         this_arg_conv.inner = untag_ptr(this_arg);
42946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42948         this_arg_conv.is_owned = false;
42949         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
42950         uint64_t ret_ref = 0;
42951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42953         return ret_ref;
42954 }
42955
42956 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
42957         LDKChannelManager this_arg_conv;
42958         this_arg_conv.inner = untag_ptr(this_arg);
42959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42961         this_arg_conv.is_owned = false;
42962         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
42963         uint64_t ret_ref = 0;
42964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42966         return ret_ref;
42967 }
42968
42969 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
42970         LDKChannelManager this_arg_conv;
42971         this_arg_conv.inner = untag_ptr(this_arg);
42972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42974         this_arg_conv.is_owned = false;
42975         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
42976         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
42977         return tag_ptr(ret_ret, true);
42978 }
42979
42980 uint64_t  __attribute__((export_name("TS_ChannelManager_as_OffersMessageHandler"))) TS_ChannelManager_as_OffersMessageHandler(uint64_t this_arg) {
42981         LDKChannelManager this_arg_conv;
42982         this_arg_conv.inner = untag_ptr(this_arg);
42983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42985         this_arg_conv.is_owned = false;
42986         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
42987         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
42988         return tag_ptr(ret_ret, true);
42989 }
42990
42991 uint64_t  __attribute__((export_name("TS_ChannelManager_as_NodeIdLookUp"))) TS_ChannelManager_as_NodeIdLookUp(uint64_t this_arg) {
42992         LDKChannelManager this_arg_conv;
42993         this_arg_conv.inner = untag_ptr(this_arg);
42994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42996         this_arg_conv.is_owned = false;
42997         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
42998         *ret_ret = ChannelManager_as_NodeIdLookUp(&this_arg_conv);
42999         return tag_ptr(ret_ret, true);
43000 }
43001
43002 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t config) {
43003         LDKUserConfig config_conv;
43004         config_conv.inner = untag_ptr(config);
43005         config_conv.is_owned = ptr_is_owned(config);
43006         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
43007         config_conv.is_owned = false;
43008         LDKInitFeatures ret_var = provided_init_features(&config_conv);
43009         uint64_t ret_ref = 0;
43010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43012         return ret_ref;
43013 }
43014
43015 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
43016         LDKCounterpartyForwardingInfo obj_conv;
43017         obj_conv.inner = untag_ptr(obj);
43018         obj_conv.is_owned = ptr_is_owned(obj);
43019         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43020         obj_conv.is_owned = false;
43021         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
43022         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43023         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43024         CVec_u8Z_free(ret_var);
43025         return ret_arr;
43026 }
43027
43028 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
43029         LDKu8slice ser_ref;
43030         ser_ref.datalen = ser->arr_len;
43031         ser_ref.data = ser->elems;
43032         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
43033         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
43034         FREE(ser);
43035         return tag_ptr(ret_conv, true);
43036 }
43037
43038 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
43039         LDKChannelCounterparty obj_conv;
43040         obj_conv.inner = untag_ptr(obj);
43041         obj_conv.is_owned = ptr_is_owned(obj);
43042         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43043         obj_conv.is_owned = false;
43044         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
43045         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43046         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43047         CVec_u8Z_free(ret_var);
43048         return ret_arr;
43049 }
43050
43051 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
43052         LDKu8slice ser_ref;
43053         ser_ref.datalen = ser->arr_len;
43054         ser_ref.data = ser->elems;
43055         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
43056         *ret_conv = ChannelCounterparty_read(ser_ref);
43057         FREE(ser);
43058         return tag_ptr(ret_conv, true);
43059 }
43060
43061 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
43062         LDKChannelDetails obj_conv;
43063         obj_conv.inner = untag_ptr(obj);
43064         obj_conv.is_owned = ptr_is_owned(obj);
43065         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43066         obj_conv.is_owned = false;
43067         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
43068         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43069         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43070         CVec_u8Z_free(ret_var);
43071         return ret_arr;
43072 }
43073
43074 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
43075         LDKu8slice ser_ref;
43076         ser_ref.datalen = ser->arr_len;
43077         ser_ref.data = ser->elems;
43078         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
43079         *ret_conv = ChannelDetails_read(ser_ref);
43080         FREE(ser);
43081         return tag_ptr(ret_conv, true);
43082 }
43083
43084 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
43085         LDKPhantomRouteHints obj_conv;
43086         obj_conv.inner = untag_ptr(obj);
43087         obj_conv.is_owned = ptr_is_owned(obj);
43088         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43089         obj_conv.is_owned = false;
43090         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
43091         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43092         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43093         CVec_u8Z_free(ret_var);
43094         return ret_arr;
43095 }
43096
43097 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
43098         LDKu8slice ser_ref;
43099         ser_ref.datalen = ser->arr_len;
43100         ser_ref.data = ser->elems;
43101         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
43102         *ret_conv = PhantomRouteHints_read(ser_ref);
43103         FREE(ser);
43104         return tag_ptr(ret_conv, true);
43105 }
43106
43107 int8_tArray  __attribute__((export_name("TS_BlindedForward_write"))) TS_BlindedForward_write(uint64_t obj) {
43108         LDKBlindedForward obj_conv;
43109         obj_conv.inner = untag_ptr(obj);
43110         obj_conv.is_owned = ptr_is_owned(obj);
43111         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43112         obj_conv.is_owned = false;
43113         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
43114         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43115         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43116         CVec_u8Z_free(ret_var);
43117         return ret_arr;
43118 }
43119
43120 uint64_t  __attribute__((export_name("TS_BlindedForward_read"))) TS_BlindedForward_read(int8_tArray ser) {
43121         LDKu8slice ser_ref;
43122         ser_ref.datalen = ser->arr_len;
43123         ser_ref.data = ser->elems;
43124         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
43125         *ret_conv = BlindedForward_read(ser_ref);
43126         FREE(ser);
43127         return tag_ptr(ret_conv, true);
43128 }
43129
43130 int8_tArray  __attribute__((export_name("TS_PendingHTLCRouting_write"))) TS_PendingHTLCRouting_write(uint64_t obj) {
43131         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
43132         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
43133         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43134         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43135         CVec_u8Z_free(ret_var);
43136         return ret_arr;
43137 }
43138
43139 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_read"))) TS_PendingHTLCRouting_read(int8_tArray ser) {
43140         LDKu8slice ser_ref;
43141         ser_ref.datalen = ser->arr_len;
43142         ser_ref.data = ser->elems;
43143         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
43144         *ret_conv = PendingHTLCRouting_read(ser_ref);
43145         FREE(ser);
43146         return tag_ptr(ret_conv, true);
43147 }
43148
43149 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_write"))) TS_PendingHTLCInfo_write(uint64_t obj) {
43150         LDKPendingHTLCInfo obj_conv;
43151         obj_conv.inner = untag_ptr(obj);
43152         obj_conv.is_owned = ptr_is_owned(obj);
43153         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43154         obj_conv.is_owned = false;
43155         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
43156         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43157         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43158         CVec_u8Z_free(ret_var);
43159         return ret_arr;
43160 }
43161
43162 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_read"))) TS_PendingHTLCInfo_read(int8_tArray ser) {
43163         LDKu8slice ser_ref;
43164         ser_ref.datalen = ser->arr_len;
43165         ser_ref.data = ser->elems;
43166         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
43167         *ret_conv = PendingHTLCInfo_read(ser_ref);
43168         FREE(ser);
43169         return tag_ptr(ret_conv, true);
43170 }
43171
43172 int8_tArray  __attribute__((export_name("TS_BlindedFailure_write"))) TS_BlindedFailure_write(uint64_t obj) {
43173         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
43174         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
43175         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43176         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43177         CVec_u8Z_free(ret_var);
43178         return ret_arr;
43179 }
43180
43181 uint64_t  __attribute__((export_name("TS_BlindedFailure_read"))) TS_BlindedFailure_read(int8_tArray ser) {
43182         LDKu8slice ser_ref;
43183         ser_ref.datalen = ser->arr_len;
43184         ser_ref.data = ser->elems;
43185         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
43186         *ret_conv = BlindedFailure_read(ser_ref);
43187         FREE(ser);
43188         return tag_ptr(ret_conv, true);
43189 }
43190
43191 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
43192         LDKChannelManager obj_conv;
43193         obj_conv.inner = untag_ptr(obj);
43194         obj_conv.is_owned = ptr_is_owned(obj);
43195         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43196         obj_conv.is_owned = false;
43197         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
43198         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43199         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43200         CVec_u8Z_free(ret_var);
43201         return ret_arr;
43202 }
43203
43204 int8_tArray  __attribute__((export_name("TS_ChannelShutdownState_write"))) TS_ChannelShutdownState_write(uint64_t obj) {
43205         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
43206         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
43207         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43208         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43209         CVec_u8Z_free(ret_var);
43210         return ret_arr;
43211 }
43212
43213 uint64_t  __attribute__((export_name("TS_ChannelShutdownState_read"))) TS_ChannelShutdownState_read(int8_tArray ser) {
43214         LDKu8slice ser_ref;
43215         ser_ref.datalen = ser->arr_len;
43216         ser_ref.data = ser->elems;
43217         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
43218         *ret_conv = ChannelShutdownState_read(ser_ref);
43219         FREE(ser);
43220         return tag_ptr(ret_conv, true);
43221 }
43222
43223 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
43224         LDKChannelManagerReadArgs this_obj_conv;
43225         this_obj_conv.inner = untag_ptr(this_obj);
43226         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43228         ChannelManagerReadArgs_free(this_obj_conv);
43229 }
43230
43231 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
43232         LDKChannelManagerReadArgs this_ptr_conv;
43233         this_ptr_conv.inner = untag_ptr(this_ptr);
43234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43236         this_ptr_conv.is_owned = false;
43237         // WARNING: This object doesn't live past this scope, needs clone!
43238         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
43239         return ret_ret;
43240 }
43241
43242 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
43243         LDKChannelManagerReadArgs this_ptr_conv;
43244         this_ptr_conv.inner = untag_ptr(this_ptr);
43245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43247         this_ptr_conv.is_owned = false;
43248         void* val_ptr = untag_ptr(val);
43249         CHECK_ACCESS(val_ptr);
43250         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
43251         if (val_conv.free == LDKEntropySource_JCalls_free) {
43252                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43253                 LDKEntropySource_JCalls_cloned(&val_conv);
43254         }
43255         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
43256 }
43257
43258 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
43259         LDKChannelManagerReadArgs this_ptr_conv;
43260         this_ptr_conv.inner = untag_ptr(this_ptr);
43261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43263         this_ptr_conv.is_owned = false;
43264         // WARNING: This object doesn't live past this scope, needs clone!
43265         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
43266         return ret_ret;
43267 }
43268
43269 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
43270         LDKChannelManagerReadArgs this_ptr_conv;
43271         this_ptr_conv.inner = untag_ptr(this_ptr);
43272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43274         this_ptr_conv.is_owned = false;
43275         void* val_ptr = untag_ptr(val);
43276         CHECK_ACCESS(val_ptr);
43277         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
43278         if (val_conv.free == LDKNodeSigner_JCalls_free) {
43279                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43280                 LDKNodeSigner_JCalls_cloned(&val_conv);
43281         }
43282         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
43283 }
43284
43285 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
43286         LDKChannelManagerReadArgs this_ptr_conv;
43287         this_ptr_conv.inner = untag_ptr(this_ptr);
43288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43290         this_ptr_conv.is_owned = false;
43291         // WARNING: This object doesn't live past this scope, needs clone!
43292         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
43293         return ret_ret;
43294 }
43295
43296 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
43297         LDKChannelManagerReadArgs this_ptr_conv;
43298         this_ptr_conv.inner = untag_ptr(this_ptr);
43299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43301         this_ptr_conv.is_owned = false;
43302         void* val_ptr = untag_ptr(val);
43303         CHECK_ACCESS(val_ptr);
43304         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
43305         if (val_conv.free == LDKSignerProvider_JCalls_free) {
43306                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43307                 LDKSignerProvider_JCalls_cloned(&val_conv);
43308         }
43309         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
43310 }
43311
43312 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
43313         LDKChannelManagerReadArgs this_ptr_conv;
43314         this_ptr_conv.inner = untag_ptr(this_ptr);
43315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43317         this_ptr_conv.is_owned = false;
43318         // WARNING: This object doesn't live past this scope, needs clone!
43319         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
43320         return ret_ret;
43321 }
43322
43323 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
43324         LDKChannelManagerReadArgs this_ptr_conv;
43325         this_ptr_conv.inner = untag_ptr(this_ptr);
43326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43328         this_ptr_conv.is_owned = false;
43329         void* val_ptr = untag_ptr(val);
43330         CHECK_ACCESS(val_ptr);
43331         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
43332         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
43333                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43334                 LDKFeeEstimator_JCalls_cloned(&val_conv);
43335         }
43336         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
43337 }
43338
43339 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
43340         LDKChannelManagerReadArgs this_ptr_conv;
43341         this_ptr_conv.inner = untag_ptr(this_ptr);
43342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43344         this_ptr_conv.is_owned = false;
43345         // WARNING: This object doesn't live past this scope, needs clone!
43346         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
43347         return ret_ret;
43348 }
43349
43350 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
43351         LDKChannelManagerReadArgs this_ptr_conv;
43352         this_ptr_conv.inner = untag_ptr(this_ptr);
43353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43355         this_ptr_conv.is_owned = false;
43356         void* val_ptr = untag_ptr(val);
43357         CHECK_ACCESS(val_ptr);
43358         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
43359         if (val_conv.free == LDKWatch_JCalls_free) {
43360                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43361                 LDKWatch_JCalls_cloned(&val_conv);
43362         }
43363         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
43364 }
43365
43366 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
43367         LDKChannelManagerReadArgs this_ptr_conv;
43368         this_ptr_conv.inner = untag_ptr(this_ptr);
43369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43371         this_ptr_conv.is_owned = false;
43372         // WARNING: This object doesn't live past this scope, needs clone!
43373         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
43374         return ret_ret;
43375 }
43376
43377 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
43378         LDKChannelManagerReadArgs this_ptr_conv;
43379         this_ptr_conv.inner = untag_ptr(this_ptr);
43380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43382         this_ptr_conv.is_owned = false;
43383         void* val_ptr = untag_ptr(val);
43384         CHECK_ACCESS(val_ptr);
43385         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
43386         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
43387                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43388                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
43389         }
43390         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
43391 }
43392
43393 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
43394         LDKChannelManagerReadArgs this_ptr_conv;
43395         this_ptr_conv.inner = untag_ptr(this_ptr);
43396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43398         this_ptr_conv.is_owned = false;
43399         // WARNING: This object doesn't live past this scope, needs clone!
43400         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
43401         return ret_ret;
43402 }
43403
43404 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
43405         LDKChannelManagerReadArgs this_ptr_conv;
43406         this_ptr_conv.inner = untag_ptr(this_ptr);
43407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43409         this_ptr_conv.is_owned = false;
43410         void* val_ptr = untag_ptr(val);
43411         CHECK_ACCESS(val_ptr);
43412         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
43413         if (val_conv.free == LDKRouter_JCalls_free) {
43414                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43415                 LDKRouter_JCalls_cloned(&val_conv);
43416         }
43417         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
43418 }
43419
43420 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
43421         LDKChannelManagerReadArgs this_ptr_conv;
43422         this_ptr_conv.inner = untag_ptr(this_ptr);
43423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43425         this_ptr_conv.is_owned = false;
43426         // WARNING: This object doesn't live past this scope, needs clone!
43427         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
43428         return ret_ret;
43429 }
43430
43431 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
43432         LDKChannelManagerReadArgs this_ptr_conv;
43433         this_ptr_conv.inner = untag_ptr(this_ptr);
43434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43436         this_ptr_conv.is_owned = false;
43437         void* val_ptr = untag_ptr(val);
43438         CHECK_ACCESS(val_ptr);
43439         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
43440         if (val_conv.free == LDKLogger_JCalls_free) {
43441                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43442                 LDKLogger_JCalls_cloned(&val_conv);
43443         }
43444         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
43445 }
43446
43447 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
43448         LDKChannelManagerReadArgs this_ptr_conv;
43449         this_ptr_conv.inner = untag_ptr(this_ptr);
43450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43452         this_ptr_conv.is_owned = false;
43453         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
43454         uint64_t ret_ref = 0;
43455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43457         return ret_ref;
43458 }
43459
43460 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
43461         LDKChannelManagerReadArgs this_ptr_conv;
43462         this_ptr_conv.inner = untag_ptr(this_ptr);
43463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43465         this_ptr_conv.is_owned = false;
43466         LDKUserConfig val_conv;
43467         val_conv.inner = untag_ptr(val);
43468         val_conv.is_owned = ptr_is_owned(val);
43469         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43470         val_conv = UserConfig_clone(&val_conv);
43471         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
43472 }
43473
43474 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) {
43475         void* entropy_source_ptr = untag_ptr(entropy_source);
43476         CHECK_ACCESS(entropy_source_ptr);
43477         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
43478         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
43479                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43480                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
43481         }
43482         void* node_signer_ptr = untag_ptr(node_signer);
43483         CHECK_ACCESS(node_signer_ptr);
43484         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
43485         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
43486                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43487                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
43488         }
43489         void* signer_provider_ptr = untag_ptr(signer_provider);
43490         CHECK_ACCESS(signer_provider_ptr);
43491         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
43492         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
43493                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43494                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
43495         }
43496         void* fee_estimator_ptr = untag_ptr(fee_estimator);
43497         CHECK_ACCESS(fee_estimator_ptr);
43498         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
43499         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
43500                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43501                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
43502         }
43503         void* chain_monitor_ptr = untag_ptr(chain_monitor);
43504         CHECK_ACCESS(chain_monitor_ptr);
43505         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
43506         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
43507                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43508                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
43509         }
43510         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
43511         CHECK_ACCESS(tx_broadcaster_ptr);
43512         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
43513         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
43514                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43515                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
43516         }
43517         void* router_ptr = untag_ptr(router);
43518         CHECK_ACCESS(router_ptr);
43519         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
43520         if (router_conv.free == LDKRouter_JCalls_free) {
43521                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43522                 LDKRouter_JCalls_cloned(&router_conv);
43523         }
43524         void* logger_ptr = untag_ptr(logger);
43525         CHECK_ACCESS(logger_ptr);
43526         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43527         if (logger_conv.free == LDKLogger_JCalls_free) {
43528                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43529                 LDKLogger_JCalls_cloned(&logger_conv);
43530         }
43531         LDKUserConfig default_config_conv;
43532         default_config_conv.inner = untag_ptr(default_config);
43533         default_config_conv.is_owned = ptr_is_owned(default_config);
43534         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
43535         default_config_conv = UserConfig_clone(&default_config_conv);
43536         LDKCVec_ChannelMonitorZ channel_monitors_constr;
43537         channel_monitors_constr.datalen = channel_monitors->arr_len;
43538         if (channel_monitors_constr.datalen > 0)
43539                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
43540         else
43541                 channel_monitors_constr.data = NULL;
43542         uint64_t* channel_monitors_vals = channel_monitors->elems;
43543         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
43544                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
43545                 LDKChannelMonitor channel_monitors_conv_16_conv;
43546                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
43547                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
43548                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
43549                 channel_monitors_conv_16_conv.is_owned = false;
43550                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
43551         }
43552         FREE(channel_monitors);
43553         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);
43554         uint64_t ret_ref = 0;
43555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43557         return ret_ref;
43558 }
43559
43560 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
43561         LDKu8slice ser_ref;
43562         ser_ref.datalen = ser->arr_len;
43563         ser_ref.data = ser->elems;
43564         LDKChannelManagerReadArgs arg_conv;
43565         arg_conv.inner = untag_ptr(arg);
43566         arg_conv.is_owned = ptr_is_owned(arg);
43567         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43568         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
43569         
43570         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
43571         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
43572         FREE(ser);
43573         return tag_ptr(ret_conv, true);
43574 }
43575
43576 void  __attribute__((export_name("TS_DelayedPaymentBasepoint_free"))) TS_DelayedPaymentBasepoint_free(uint64_t this_obj) {
43577         LDKDelayedPaymentBasepoint this_obj_conv;
43578         this_obj_conv.inner = untag_ptr(this_obj);
43579         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43581         DelayedPaymentBasepoint_free(this_obj_conv);
43582 }
43583
43584 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_get_a"))) TS_DelayedPaymentBasepoint_get_a(uint64_t this_ptr) {
43585         LDKDelayedPaymentBasepoint this_ptr_conv;
43586         this_ptr_conv.inner = untag_ptr(this_ptr);
43587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43589         this_ptr_conv.is_owned = false;
43590         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43591         memcpy(ret_arr->elems, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
43592         return ret_arr;
43593 }
43594
43595 void  __attribute__((export_name("TS_DelayedPaymentBasepoint_set_a"))) TS_DelayedPaymentBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
43596         LDKDelayedPaymentBasepoint this_ptr_conv;
43597         this_ptr_conv.inner = untag_ptr(this_ptr);
43598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43600         this_ptr_conv.is_owned = false;
43601         LDKPublicKey val_ref;
43602         CHECK(val->arr_len == 33);
43603         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43604         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
43605 }
43606
43607 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_new"))) TS_DelayedPaymentBasepoint_new(int8_tArray a_arg) {
43608         LDKPublicKey a_arg_ref;
43609         CHECK(a_arg->arr_len == 33);
43610         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43611         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
43612         uint64_t ret_ref = 0;
43613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43615         return ret_ref;
43616 }
43617
43618 jboolean  __attribute__((export_name("TS_DelayedPaymentBasepoint_eq"))) TS_DelayedPaymentBasepoint_eq(uint64_t a, uint64_t b) {
43619         LDKDelayedPaymentBasepoint a_conv;
43620         a_conv.inner = untag_ptr(a);
43621         a_conv.is_owned = ptr_is_owned(a);
43622         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43623         a_conv.is_owned = false;
43624         LDKDelayedPaymentBasepoint b_conv;
43625         b_conv.inner = untag_ptr(b);
43626         b_conv.is_owned = ptr_is_owned(b);
43627         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43628         b_conv.is_owned = false;
43629         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
43630         return ret_conv;
43631 }
43632
43633 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
43634         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
43635         uint64_t ret_ref = 0;
43636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43638         return ret_ref;
43639 }
43640 int64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_clone_ptr"))) TS_DelayedPaymentBasepoint_clone_ptr(uint64_t arg) {
43641         LDKDelayedPaymentBasepoint arg_conv;
43642         arg_conv.inner = untag_ptr(arg);
43643         arg_conv.is_owned = ptr_is_owned(arg);
43644         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43645         arg_conv.is_owned = false;
43646         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
43647         return ret_conv;
43648 }
43649
43650 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_clone"))) TS_DelayedPaymentBasepoint_clone(uint64_t orig) {
43651         LDKDelayedPaymentBasepoint orig_conv;
43652         orig_conv.inner = untag_ptr(orig);
43653         orig_conv.is_owned = ptr_is_owned(orig);
43654         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43655         orig_conv.is_owned = false;
43656         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
43657         uint64_t ret_ref = 0;
43658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43660         return ret_ref;
43661 }
43662
43663 int64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_hash"))) TS_DelayedPaymentBasepoint_hash(uint64_t o) {
43664         LDKDelayedPaymentBasepoint o_conv;
43665         o_conv.inner = untag_ptr(o);
43666         o_conv.is_owned = ptr_is_owned(o);
43667         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43668         o_conv.is_owned = false;
43669         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
43670         return ret_conv;
43671 }
43672
43673 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_to_public_key"))) TS_DelayedPaymentBasepoint_to_public_key(uint64_t this_arg) {
43674         LDKDelayedPaymentBasepoint this_arg_conv;
43675         this_arg_conv.inner = untag_ptr(this_arg);
43676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43678         this_arg_conv.is_owned = false;
43679         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43680         memcpy(ret_arr->elems, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
43681         return ret_arr;
43682 }
43683
43684 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_derive_add_tweak"))) TS_DelayedPaymentBasepoint_derive_add_tweak(uint64_t this_arg, int8_tArray per_commitment_point) {
43685         LDKDelayedPaymentBasepoint this_arg_conv;
43686         this_arg_conv.inner = untag_ptr(this_arg);
43687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43689         this_arg_conv.is_owned = false;
43690         LDKPublicKey per_commitment_point_ref;
43691         CHECK(per_commitment_point->arr_len == 33);
43692         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43693         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43694         memcpy(ret_arr->elems, DelayedPaymentBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data, 32);
43695         return ret_arr;
43696 }
43697
43698 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_write"))) TS_DelayedPaymentBasepoint_write(uint64_t obj) {
43699         LDKDelayedPaymentBasepoint obj_conv;
43700         obj_conv.inner = untag_ptr(obj);
43701         obj_conv.is_owned = ptr_is_owned(obj);
43702         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43703         obj_conv.is_owned = false;
43704         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
43705         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43706         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43707         CVec_u8Z_free(ret_var);
43708         return ret_arr;
43709 }
43710
43711 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_read"))) TS_DelayedPaymentBasepoint_read(int8_tArray ser) {
43712         LDKu8slice ser_ref;
43713         ser_ref.datalen = ser->arr_len;
43714         ser_ref.data = ser->elems;
43715         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
43716         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
43717         FREE(ser);
43718         return tag_ptr(ret_conv, true);
43719 }
43720
43721 void  __attribute__((export_name("TS_DelayedPaymentKey_free"))) TS_DelayedPaymentKey_free(uint64_t this_obj) {
43722         LDKDelayedPaymentKey this_obj_conv;
43723         this_obj_conv.inner = untag_ptr(this_obj);
43724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43726         DelayedPaymentKey_free(this_obj_conv);
43727 }
43728
43729 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_get_a"))) TS_DelayedPaymentKey_get_a(uint64_t this_ptr) {
43730         LDKDelayedPaymentKey this_ptr_conv;
43731         this_ptr_conv.inner = untag_ptr(this_ptr);
43732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43734         this_ptr_conv.is_owned = false;
43735         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43736         memcpy(ret_arr->elems, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form, 33);
43737         return ret_arr;
43738 }
43739
43740 void  __attribute__((export_name("TS_DelayedPaymentKey_set_a"))) TS_DelayedPaymentKey_set_a(uint64_t this_ptr, int8_tArray val) {
43741         LDKDelayedPaymentKey this_ptr_conv;
43742         this_ptr_conv.inner = untag_ptr(this_ptr);
43743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43745         this_ptr_conv.is_owned = false;
43746         LDKPublicKey val_ref;
43747         CHECK(val->arr_len == 33);
43748         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43749         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
43750 }
43751
43752 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_new"))) TS_DelayedPaymentKey_new(int8_tArray a_arg) {
43753         LDKPublicKey a_arg_ref;
43754         CHECK(a_arg->arr_len == 33);
43755         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43756         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
43757         uint64_t ret_ref = 0;
43758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43760         return ret_ref;
43761 }
43762
43763 jboolean  __attribute__((export_name("TS_DelayedPaymentKey_eq"))) TS_DelayedPaymentKey_eq(uint64_t a, uint64_t b) {
43764         LDKDelayedPaymentKey a_conv;
43765         a_conv.inner = untag_ptr(a);
43766         a_conv.is_owned = ptr_is_owned(a);
43767         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43768         a_conv.is_owned = false;
43769         LDKDelayedPaymentKey b_conv;
43770         b_conv.inner = untag_ptr(b);
43771         b_conv.is_owned = ptr_is_owned(b);
43772         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43773         b_conv.is_owned = false;
43774         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
43775         return ret_conv;
43776 }
43777
43778 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
43779         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
43780         uint64_t ret_ref = 0;
43781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43783         return ret_ref;
43784 }
43785 int64_t  __attribute__((export_name("TS_DelayedPaymentKey_clone_ptr"))) TS_DelayedPaymentKey_clone_ptr(uint64_t arg) {
43786         LDKDelayedPaymentKey arg_conv;
43787         arg_conv.inner = untag_ptr(arg);
43788         arg_conv.is_owned = ptr_is_owned(arg);
43789         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43790         arg_conv.is_owned = false;
43791         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
43792         return ret_conv;
43793 }
43794
43795 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_clone"))) TS_DelayedPaymentKey_clone(uint64_t orig) {
43796         LDKDelayedPaymentKey orig_conv;
43797         orig_conv.inner = untag_ptr(orig);
43798         orig_conv.is_owned = ptr_is_owned(orig);
43799         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43800         orig_conv.is_owned = false;
43801         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
43802         uint64_t ret_ref = 0;
43803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43805         return ret_ref;
43806 }
43807
43808 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_from_basepoint"))) TS_DelayedPaymentKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
43809         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
43810         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
43811         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
43812         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
43813         countersignatory_basepoint_conv.is_owned = false;
43814         LDKPublicKey per_commitment_point_ref;
43815         CHECK(per_commitment_point->arr_len == 33);
43816         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43817         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
43818         uint64_t ret_ref = 0;
43819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43821         return ret_ref;
43822 }
43823
43824 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_from_secret_key"))) TS_DelayedPaymentKey_from_secret_key(int8_tArray sk) {
43825         uint8_t sk_arr[32];
43826         CHECK(sk->arr_len == 32);
43827         memcpy(sk_arr, sk->elems, 32); FREE(sk);
43828         uint8_t (*sk_ref)[32] = &sk_arr;
43829         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
43830         uint64_t ret_ref = 0;
43831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43833         return ret_ref;
43834 }
43835
43836 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_to_public_key"))) TS_DelayedPaymentKey_to_public_key(uint64_t this_arg) {
43837         LDKDelayedPaymentKey this_arg_conv;
43838         this_arg_conv.inner = untag_ptr(this_arg);
43839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43841         this_arg_conv.is_owned = false;
43842         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43843         memcpy(ret_arr->elems, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form, 33);
43844         return ret_arr;
43845 }
43846
43847 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_write"))) TS_DelayedPaymentKey_write(uint64_t obj) {
43848         LDKDelayedPaymentKey obj_conv;
43849         obj_conv.inner = untag_ptr(obj);
43850         obj_conv.is_owned = ptr_is_owned(obj);
43851         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43852         obj_conv.is_owned = false;
43853         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
43854         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43855         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43856         CVec_u8Z_free(ret_var);
43857         return ret_arr;
43858 }
43859
43860 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_read"))) TS_DelayedPaymentKey_read(int8_tArray ser) {
43861         LDKu8slice ser_ref;
43862         ser_ref.datalen = ser->arr_len;
43863         ser_ref.data = ser->elems;
43864         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
43865         *ret_conv = DelayedPaymentKey_read(ser_ref);
43866         FREE(ser);
43867         return tag_ptr(ret_conv, true);
43868 }
43869
43870 void  __attribute__((export_name("TS_HtlcBasepoint_free"))) TS_HtlcBasepoint_free(uint64_t this_obj) {
43871         LDKHtlcBasepoint this_obj_conv;
43872         this_obj_conv.inner = untag_ptr(this_obj);
43873         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43875         HtlcBasepoint_free(this_obj_conv);
43876 }
43877
43878 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_get_a"))) TS_HtlcBasepoint_get_a(uint64_t this_ptr) {
43879         LDKHtlcBasepoint this_ptr_conv;
43880         this_ptr_conv.inner = untag_ptr(this_ptr);
43881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43883         this_ptr_conv.is_owned = false;
43884         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43885         memcpy(ret_arr->elems, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
43886         return ret_arr;
43887 }
43888
43889 void  __attribute__((export_name("TS_HtlcBasepoint_set_a"))) TS_HtlcBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
43890         LDKHtlcBasepoint this_ptr_conv;
43891         this_ptr_conv.inner = untag_ptr(this_ptr);
43892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43894         this_ptr_conv.is_owned = false;
43895         LDKPublicKey val_ref;
43896         CHECK(val->arr_len == 33);
43897         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43898         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
43899 }
43900
43901 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_new"))) TS_HtlcBasepoint_new(int8_tArray a_arg) {
43902         LDKPublicKey a_arg_ref;
43903         CHECK(a_arg->arr_len == 33);
43904         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43905         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
43906         uint64_t ret_ref = 0;
43907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43909         return ret_ref;
43910 }
43911
43912 jboolean  __attribute__((export_name("TS_HtlcBasepoint_eq"))) TS_HtlcBasepoint_eq(uint64_t a, uint64_t b) {
43913         LDKHtlcBasepoint a_conv;
43914         a_conv.inner = untag_ptr(a);
43915         a_conv.is_owned = ptr_is_owned(a);
43916         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43917         a_conv.is_owned = false;
43918         LDKHtlcBasepoint b_conv;
43919         b_conv.inner = untag_ptr(b);
43920         b_conv.is_owned = ptr_is_owned(b);
43921         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43922         b_conv.is_owned = false;
43923         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
43924         return ret_conv;
43925 }
43926
43927 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
43928         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
43929         uint64_t ret_ref = 0;
43930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43932         return ret_ref;
43933 }
43934 int64_t  __attribute__((export_name("TS_HtlcBasepoint_clone_ptr"))) TS_HtlcBasepoint_clone_ptr(uint64_t arg) {
43935         LDKHtlcBasepoint arg_conv;
43936         arg_conv.inner = untag_ptr(arg);
43937         arg_conv.is_owned = ptr_is_owned(arg);
43938         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43939         arg_conv.is_owned = false;
43940         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
43941         return ret_conv;
43942 }
43943
43944 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_clone"))) TS_HtlcBasepoint_clone(uint64_t orig) {
43945         LDKHtlcBasepoint orig_conv;
43946         orig_conv.inner = untag_ptr(orig);
43947         orig_conv.is_owned = ptr_is_owned(orig);
43948         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43949         orig_conv.is_owned = false;
43950         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
43951         uint64_t ret_ref = 0;
43952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43954         return ret_ref;
43955 }
43956
43957 int64_t  __attribute__((export_name("TS_HtlcBasepoint_hash"))) TS_HtlcBasepoint_hash(uint64_t o) {
43958         LDKHtlcBasepoint o_conv;
43959         o_conv.inner = untag_ptr(o);
43960         o_conv.is_owned = ptr_is_owned(o);
43961         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43962         o_conv.is_owned = false;
43963         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
43964         return ret_conv;
43965 }
43966
43967 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_to_public_key"))) TS_HtlcBasepoint_to_public_key(uint64_t this_arg) {
43968         LDKHtlcBasepoint this_arg_conv;
43969         this_arg_conv.inner = untag_ptr(this_arg);
43970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43972         this_arg_conv.is_owned = false;
43973         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43974         memcpy(ret_arr->elems, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
43975         return ret_arr;
43976 }
43977
43978 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_derive_add_tweak"))) TS_HtlcBasepoint_derive_add_tweak(uint64_t this_arg, int8_tArray per_commitment_point) {
43979         LDKHtlcBasepoint this_arg_conv;
43980         this_arg_conv.inner = untag_ptr(this_arg);
43981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43983         this_arg_conv.is_owned = false;
43984         LDKPublicKey per_commitment_point_ref;
43985         CHECK(per_commitment_point->arr_len == 33);
43986         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43987         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43988         memcpy(ret_arr->elems, HtlcBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data, 32);
43989         return ret_arr;
43990 }
43991
43992 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_write"))) TS_HtlcBasepoint_write(uint64_t obj) {
43993         LDKHtlcBasepoint obj_conv;
43994         obj_conv.inner = untag_ptr(obj);
43995         obj_conv.is_owned = ptr_is_owned(obj);
43996         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43997         obj_conv.is_owned = false;
43998         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
43999         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44000         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44001         CVec_u8Z_free(ret_var);
44002         return ret_arr;
44003 }
44004
44005 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_read"))) TS_HtlcBasepoint_read(int8_tArray ser) {
44006         LDKu8slice ser_ref;
44007         ser_ref.datalen = ser->arr_len;
44008         ser_ref.data = ser->elems;
44009         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
44010         *ret_conv = HtlcBasepoint_read(ser_ref);
44011         FREE(ser);
44012         return tag_ptr(ret_conv, true);
44013 }
44014
44015 void  __attribute__((export_name("TS_HtlcKey_free"))) TS_HtlcKey_free(uint64_t this_obj) {
44016         LDKHtlcKey this_obj_conv;
44017         this_obj_conv.inner = untag_ptr(this_obj);
44018         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44020         HtlcKey_free(this_obj_conv);
44021 }
44022
44023 int8_tArray  __attribute__((export_name("TS_HtlcKey_get_a"))) TS_HtlcKey_get_a(uint64_t this_ptr) {
44024         LDKHtlcKey this_ptr_conv;
44025         this_ptr_conv.inner = untag_ptr(this_ptr);
44026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44028         this_ptr_conv.is_owned = false;
44029         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44030         memcpy(ret_arr->elems, HtlcKey_get_a(&this_ptr_conv).compressed_form, 33);
44031         return ret_arr;
44032 }
44033
44034 void  __attribute__((export_name("TS_HtlcKey_set_a"))) TS_HtlcKey_set_a(uint64_t this_ptr, int8_tArray val) {
44035         LDKHtlcKey this_ptr_conv;
44036         this_ptr_conv.inner = untag_ptr(this_ptr);
44037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44039         this_ptr_conv.is_owned = false;
44040         LDKPublicKey val_ref;
44041         CHECK(val->arr_len == 33);
44042         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44043         HtlcKey_set_a(&this_ptr_conv, val_ref);
44044 }
44045
44046 uint64_t  __attribute__((export_name("TS_HtlcKey_new"))) TS_HtlcKey_new(int8_tArray a_arg) {
44047         LDKPublicKey a_arg_ref;
44048         CHECK(a_arg->arr_len == 33);
44049         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44050         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
44051         uint64_t ret_ref = 0;
44052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44054         return ret_ref;
44055 }
44056
44057 jboolean  __attribute__((export_name("TS_HtlcKey_eq"))) TS_HtlcKey_eq(uint64_t a, uint64_t b) {
44058         LDKHtlcKey a_conv;
44059         a_conv.inner = untag_ptr(a);
44060         a_conv.is_owned = ptr_is_owned(a);
44061         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44062         a_conv.is_owned = false;
44063         LDKHtlcKey b_conv;
44064         b_conv.inner = untag_ptr(b);
44065         b_conv.is_owned = ptr_is_owned(b);
44066         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44067         b_conv.is_owned = false;
44068         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
44069         return ret_conv;
44070 }
44071
44072 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
44073         LDKHtlcKey ret_var = HtlcKey_clone(arg);
44074         uint64_t ret_ref = 0;
44075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44077         return ret_ref;
44078 }
44079 int64_t  __attribute__((export_name("TS_HtlcKey_clone_ptr"))) TS_HtlcKey_clone_ptr(uint64_t arg) {
44080         LDKHtlcKey arg_conv;
44081         arg_conv.inner = untag_ptr(arg);
44082         arg_conv.is_owned = ptr_is_owned(arg);
44083         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44084         arg_conv.is_owned = false;
44085         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
44086         return ret_conv;
44087 }
44088
44089 uint64_t  __attribute__((export_name("TS_HtlcKey_clone"))) TS_HtlcKey_clone(uint64_t orig) {
44090         LDKHtlcKey orig_conv;
44091         orig_conv.inner = untag_ptr(orig);
44092         orig_conv.is_owned = ptr_is_owned(orig);
44093         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44094         orig_conv.is_owned = false;
44095         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
44096         uint64_t ret_ref = 0;
44097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44099         return ret_ref;
44100 }
44101
44102 uint64_t  __attribute__((export_name("TS_HtlcKey_from_basepoint"))) TS_HtlcKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
44103         LDKHtlcBasepoint countersignatory_basepoint_conv;
44104         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
44105         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
44106         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
44107         countersignatory_basepoint_conv.is_owned = false;
44108         LDKPublicKey per_commitment_point_ref;
44109         CHECK(per_commitment_point->arr_len == 33);
44110         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44111         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
44112         uint64_t ret_ref = 0;
44113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44115         return ret_ref;
44116 }
44117
44118 uint64_t  __attribute__((export_name("TS_HtlcKey_from_secret_key"))) TS_HtlcKey_from_secret_key(int8_tArray sk) {
44119         uint8_t sk_arr[32];
44120         CHECK(sk->arr_len == 32);
44121         memcpy(sk_arr, sk->elems, 32); FREE(sk);
44122         uint8_t (*sk_ref)[32] = &sk_arr;
44123         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
44124         uint64_t ret_ref = 0;
44125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44127         return ret_ref;
44128 }
44129
44130 int8_tArray  __attribute__((export_name("TS_HtlcKey_to_public_key"))) TS_HtlcKey_to_public_key(uint64_t this_arg) {
44131         LDKHtlcKey this_arg_conv;
44132         this_arg_conv.inner = untag_ptr(this_arg);
44133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44135         this_arg_conv.is_owned = false;
44136         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44137         memcpy(ret_arr->elems, HtlcKey_to_public_key(&this_arg_conv).compressed_form, 33);
44138         return ret_arr;
44139 }
44140
44141 int8_tArray  __attribute__((export_name("TS_HtlcKey_write"))) TS_HtlcKey_write(uint64_t obj) {
44142         LDKHtlcKey obj_conv;
44143         obj_conv.inner = untag_ptr(obj);
44144         obj_conv.is_owned = ptr_is_owned(obj);
44145         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44146         obj_conv.is_owned = false;
44147         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
44148         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44149         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44150         CVec_u8Z_free(ret_var);
44151         return ret_arr;
44152 }
44153
44154 uint64_t  __attribute__((export_name("TS_HtlcKey_read"))) TS_HtlcKey_read(int8_tArray ser) {
44155         LDKu8slice ser_ref;
44156         ser_ref.datalen = ser->arr_len;
44157         ser_ref.data = ser->elems;
44158         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
44159         *ret_conv = HtlcKey_read(ser_ref);
44160         FREE(ser);
44161         return tag_ptr(ret_conv, true);
44162 }
44163
44164 int8_tArray  __attribute__((export_name("TS_add_public_key_tweak"))) TS_add_public_key_tweak(int8_tArray base_point, int8_tArray tweak) {
44165         LDKPublicKey base_point_ref;
44166         CHECK(base_point->arr_len == 33);
44167         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
44168         uint8_t tweak_arr[32];
44169         CHECK(tweak->arr_len == 32);
44170         memcpy(tweak_arr, tweak->elems, 32); FREE(tweak);
44171         uint8_t (*tweak_ref)[32] = &tweak_arr;
44172         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44173         memcpy(ret_arr->elems, add_public_key_tweak(base_point_ref, tweak_ref).compressed_form, 33);
44174         return ret_arr;
44175 }
44176
44177 void  __attribute__((export_name("TS_RevocationBasepoint_free"))) TS_RevocationBasepoint_free(uint64_t this_obj) {
44178         LDKRevocationBasepoint this_obj_conv;
44179         this_obj_conv.inner = untag_ptr(this_obj);
44180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44182         RevocationBasepoint_free(this_obj_conv);
44183 }
44184
44185 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_get_a"))) TS_RevocationBasepoint_get_a(uint64_t this_ptr) {
44186         LDKRevocationBasepoint this_ptr_conv;
44187         this_ptr_conv.inner = untag_ptr(this_ptr);
44188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44190         this_ptr_conv.is_owned = false;
44191         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44192         memcpy(ret_arr->elems, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
44193         return ret_arr;
44194 }
44195
44196 void  __attribute__((export_name("TS_RevocationBasepoint_set_a"))) TS_RevocationBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
44197         LDKRevocationBasepoint this_ptr_conv;
44198         this_ptr_conv.inner = untag_ptr(this_ptr);
44199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44201         this_ptr_conv.is_owned = false;
44202         LDKPublicKey val_ref;
44203         CHECK(val->arr_len == 33);
44204         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44205         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
44206 }
44207
44208 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_new"))) TS_RevocationBasepoint_new(int8_tArray a_arg) {
44209         LDKPublicKey a_arg_ref;
44210         CHECK(a_arg->arr_len == 33);
44211         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44212         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
44213         uint64_t ret_ref = 0;
44214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44216         return ret_ref;
44217 }
44218
44219 jboolean  __attribute__((export_name("TS_RevocationBasepoint_eq"))) TS_RevocationBasepoint_eq(uint64_t a, uint64_t b) {
44220         LDKRevocationBasepoint a_conv;
44221         a_conv.inner = untag_ptr(a);
44222         a_conv.is_owned = ptr_is_owned(a);
44223         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44224         a_conv.is_owned = false;
44225         LDKRevocationBasepoint b_conv;
44226         b_conv.inner = untag_ptr(b);
44227         b_conv.is_owned = ptr_is_owned(b);
44228         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44229         b_conv.is_owned = false;
44230         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
44231         return ret_conv;
44232 }
44233
44234 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
44235         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
44236         uint64_t ret_ref = 0;
44237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44239         return ret_ref;
44240 }
44241 int64_t  __attribute__((export_name("TS_RevocationBasepoint_clone_ptr"))) TS_RevocationBasepoint_clone_ptr(uint64_t arg) {
44242         LDKRevocationBasepoint arg_conv;
44243         arg_conv.inner = untag_ptr(arg);
44244         arg_conv.is_owned = ptr_is_owned(arg);
44245         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44246         arg_conv.is_owned = false;
44247         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
44248         return ret_conv;
44249 }
44250
44251 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_clone"))) TS_RevocationBasepoint_clone(uint64_t orig) {
44252         LDKRevocationBasepoint orig_conv;
44253         orig_conv.inner = untag_ptr(orig);
44254         orig_conv.is_owned = ptr_is_owned(orig);
44255         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44256         orig_conv.is_owned = false;
44257         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
44258         uint64_t ret_ref = 0;
44259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44261         return ret_ref;
44262 }
44263
44264 int64_t  __attribute__((export_name("TS_RevocationBasepoint_hash"))) TS_RevocationBasepoint_hash(uint64_t o) {
44265         LDKRevocationBasepoint o_conv;
44266         o_conv.inner = untag_ptr(o);
44267         o_conv.is_owned = ptr_is_owned(o);
44268         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44269         o_conv.is_owned = false;
44270         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
44271         return ret_conv;
44272 }
44273
44274 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_to_public_key"))) TS_RevocationBasepoint_to_public_key(uint64_t this_arg) {
44275         LDKRevocationBasepoint this_arg_conv;
44276         this_arg_conv.inner = untag_ptr(this_arg);
44277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44279         this_arg_conv.is_owned = false;
44280         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44281         memcpy(ret_arr->elems, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
44282         return ret_arr;
44283 }
44284
44285 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_write"))) TS_RevocationBasepoint_write(uint64_t obj) {
44286         LDKRevocationBasepoint obj_conv;
44287         obj_conv.inner = untag_ptr(obj);
44288         obj_conv.is_owned = ptr_is_owned(obj);
44289         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44290         obj_conv.is_owned = false;
44291         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
44292         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44293         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44294         CVec_u8Z_free(ret_var);
44295         return ret_arr;
44296 }
44297
44298 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_read"))) TS_RevocationBasepoint_read(int8_tArray ser) {
44299         LDKu8slice ser_ref;
44300         ser_ref.datalen = ser->arr_len;
44301         ser_ref.data = ser->elems;
44302         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
44303         *ret_conv = RevocationBasepoint_read(ser_ref);
44304         FREE(ser);
44305         return tag_ptr(ret_conv, true);
44306 }
44307
44308 void  __attribute__((export_name("TS_RevocationKey_free"))) TS_RevocationKey_free(uint64_t this_obj) {
44309         LDKRevocationKey this_obj_conv;
44310         this_obj_conv.inner = untag_ptr(this_obj);
44311         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44313         RevocationKey_free(this_obj_conv);
44314 }
44315
44316 int8_tArray  __attribute__((export_name("TS_RevocationKey_get_a"))) TS_RevocationKey_get_a(uint64_t this_ptr) {
44317         LDKRevocationKey this_ptr_conv;
44318         this_ptr_conv.inner = untag_ptr(this_ptr);
44319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44321         this_ptr_conv.is_owned = false;
44322         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44323         memcpy(ret_arr->elems, RevocationKey_get_a(&this_ptr_conv).compressed_form, 33);
44324         return ret_arr;
44325 }
44326
44327 void  __attribute__((export_name("TS_RevocationKey_set_a"))) TS_RevocationKey_set_a(uint64_t this_ptr, int8_tArray val) {
44328         LDKRevocationKey this_ptr_conv;
44329         this_ptr_conv.inner = untag_ptr(this_ptr);
44330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44332         this_ptr_conv.is_owned = false;
44333         LDKPublicKey val_ref;
44334         CHECK(val->arr_len == 33);
44335         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44336         RevocationKey_set_a(&this_ptr_conv, val_ref);
44337 }
44338
44339 uint64_t  __attribute__((export_name("TS_RevocationKey_new"))) TS_RevocationKey_new(int8_tArray a_arg) {
44340         LDKPublicKey a_arg_ref;
44341         CHECK(a_arg->arr_len == 33);
44342         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44343         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
44344         uint64_t ret_ref = 0;
44345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44347         return ret_ref;
44348 }
44349
44350 jboolean  __attribute__((export_name("TS_RevocationKey_eq"))) TS_RevocationKey_eq(uint64_t a, uint64_t b) {
44351         LDKRevocationKey a_conv;
44352         a_conv.inner = untag_ptr(a);
44353         a_conv.is_owned = ptr_is_owned(a);
44354         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44355         a_conv.is_owned = false;
44356         LDKRevocationKey b_conv;
44357         b_conv.inner = untag_ptr(b);
44358         b_conv.is_owned = ptr_is_owned(b);
44359         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44360         b_conv.is_owned = false;
44361         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
44362         return ret_conv;
44363 }
44364
44365 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
44366         LDKRevocationKey ret_var = RevocationKey_clone(arg);
44367         uint64_t ret_ref = 0;
44368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44370         return ret_ref;
44371 }
44372 int64_t  __attribute__((export_name("TS_RevocationKey_clone_ptr"))) TS_RevocationKey_clone_ptr(uint64_t arg) {
44373         LDKRevocationKey arg_conv;
44374         arg_conv.inner = untag_ptr(arg);
44375         arg_conv.is_owned = ptr_is_owned(arg);
44376         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44377         arg_conv.is_owned = false;
44378         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
44379         return ret_conv;
44380 }
44381
44382 uint64_t  __attribute__((export_name("TS_RevocationKey_clone"))) TS_RevocationKey_clone(uint64_t orig) {
44383         LDKRevocationKey orig_conv;
44384         orig_conv.inner = untag_ptr(orig);
44385         orig_conv.is_owned = ptr_is_owned(orig);
44386         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44387         orig_conv.is_owned = false;
44388         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
44389         uint64_t ret_ref = 0;
44390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44392         return ret_ref;
44393 }
44394
44395 int64_t  __attribute__((export_name("TS_RevocationKey_hash"))) TS_RevocationKey_hash(uint64_t o) {
44396         LDKRevocationKey o_conv;
44397         o_conv.inner = untag_ptr(o);
44398         o_conv.is_owned = ptr_is_owned(o);
44399         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44400         o_conv.is_owned = false;
44401         int64_t ret_conv = RevocationKey_hash(&o_conv);
44402         return ret_conv;
44403 }
44404
44405 uint64_t  __attribute__((export_name("TS_RevocationKey_from_basepoint"))) TS_RevocationKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
44406         LDKRevocationBasepoint countersignatory_basepoint_conv;
44407         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
44408         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
44409         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
44410         countersignatory_basepoint_conv.is_owned = false;
44411         LDKPublicKey per_commitment_point_ref;
44412         CHECK(per_commitment_point->arr_len == 33);
44413         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44414         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
44415         uint64_t ret_ref = 0;
44416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44418         return ret_ref;
44419 }
44420
44421 int8_tArray  __attribute__((export_name("TS_RevocationKey_to_public_key"))) TS_RevocationKey_to_public_key(uint64_t this_arg) {
44422         LDKRevocationKey this_arg_conv;
44423         this_arg_conv.inner = untag_ptr(this_arg);
44424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44426         this_arg_conv.is_owned = false;
44427         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44428         memcpy(ret_arr->elems, RevocationKey_to_public_key(&this_arg_conv).compressed_form, 33);
44429         return ret_arr;
44430 }
44431
44432 int8_tArray  __attribute__((export_name("TS_RevocationKey_write"))) TS_RevocationKey_write(uint64_t obj) {
44433         LDKRevocationKey obj_conv;
44434         obj_conv.inner = untag_ptr(obj);
44435         obj_conv.is_owned = ptr_is_owned(obj);
44436         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44437         obj_conv.is_owned = false;
44438         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
44439         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44440         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44441         CVec_u8Z_free(ret_var);
44442         return ret_arr;
44443 }
44444
44445 uint64_t  __attribute__((export_name("TS_RevocationKey_read"))) TS_RevocationKey_read(int8_tArray ser) {
44446         LDKu8slice ser_ref;
44447         ser_ref.datalen = ser->arr_len;
44448         ser_ref.data = ser->elems;
44449         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
44450         *ret_conv = RevocationKey_read(ser_ref);
44451         FREE(ser);
44452         return tag_ptr(ret_conv, true);
44453 }
44454
44455 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
44456         LDKExpandedKey this_obj_conv;
44457         this_obj_conv.inner = untag_ptr(this_obj);
44458         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44460         ExpandedKey_free(this_obj_conv);
44461 }
44462
44463 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
44464         uint8_t key_material_arr[32];
44465         CHECK(key_material->arr_len == 32);
44466         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
44467         uint8_t (*key_material_ref)[32] = &key_material_arr;
44468         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
44469         uint64_t ret_ref = 0;
44470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44472         return ret_ref;
44473 }
44474
44475 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) {
44476         LDKExpandedKey keys_conv;
44477         keys_conv.inner = untag_ptr(keys);
44478         keys_conv.is_owned = ptr_is_owned(keys);
44479         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
44480         keys_conv.is_owned = false;
44481         void* min_value_msat_ptr = untag_ptr(min_value_msat);
44482         CHECK_ACCESS(min_value_msat_ptr);
44483         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
44484         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
44485         void* entropy_source_ptr = untag_ptr(entropy_source);
44486         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
44487         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
44488         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
44489         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
44490         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
44491         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
44492         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
44493         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
44494         return tag_ptr(ret_conv, true);
44495 }
44496
44497 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) {
44498         LDKExpandedKey keys_conv;
44499         keys_conv.inner = untag_ptr(keys);
44500         keys_conv.is_owned = ptr_is_owned(keys);
44501         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
44502         keys_conv.is_owned = false;
44503         void* min_value_msat_ptr = untag_ptr(min_value_msat);
44504         CHECK_ACCESS(min_value_msat_ptr);
44505         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
44506         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
44507         LDKThirtyTwoBytes payment_hash_ref;
44508         CHECK(payment_hash->arr_len == 32);
44509         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
44510         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
44511         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
44512         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
44513         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
44514         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
44515         *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);
44516         return tag_ptr(ret_conv, true);
44517 }
44518
44519 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
44520         if (!ptr_is_owned(this_ptr)) return;
44521         void* this_ptr_ptr = untag_ptr(this_ptr);
44522         CHECK_ACCESS(this_ptr_ptr);
44523         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
44524         FREE(untag_ptr(this_ptr));
44525         DecodeError_free(this_ptr_conv);
44526 }
44527
44528 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
44529         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44530         *ret_copy = DecodeError_clone(arg);
44531         uint64_t ret_ref = tag_ptr(ret_copy, true);
44532         return ret_ref;
44533 }
44534 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
44535         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
44536         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
44537         return ret_conv;
44538 }
44539
44540 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
44541         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
44542         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44543         *ret_copy = DecodeError_clone(orig_conv);
44544         uint64_t ret_ref = tag_ptr(ret_copy, true);
44545         return ret_ref;
44546 }
44547
44548 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
44549         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44550         *ret_copy = DecodeError_unknown_version();
44551         uint64_t ret_ref = tag_ptr(ret_copy, true);
44552         return ret_ref;
44553 }
44554
44555 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
44556         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44557         *ret_copy = DecodeError_unknown_required_feature();
44558         uint64_t ret_ref = tag_ptr(ret_copy, true);
44559         return ret_ref;
44560 }
44561
44562 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
44563         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44564         *ret_copy = DecodeError_invalid_value();
44565         uint64_t ret_ref = tag_ptr(ret_copy, true);
44566         return ret_ref;
44567 }
44568
44569 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
44570         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44571         *ret_copy = DecodeError_short_read();
44572         uint64_t ret_ref = tag_ptr(ret_copy, true);
44573         return ret_ref;
44574 }
44575
44576 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
44577         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44578         *ret_copy = DecodeError_bad_length_descriptor();
44579         uint64_t ret_ref = tag_ptr(ret_copy, true);
44580         return ret_ref;
44581 }
44582
44583 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
44584         LDKIOError a_conv = LDKIOError_from_js(a);
44585         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44586         *ret_copy = DecodeError_io(a_conv);
44587         uint64_t ret_ref = tag_ptr(ret_copy, true);
44588         return ret_ref;
44589 }
44590
44591 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
44592         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44593         *ret_copy = DecodeError_unsupported_compression();
44594         uint64_t ret_ref = tag_ptr(ret_copy, true);
44595         return ret_ref;
44596 }
44597
44598 uint64_t  __attribute__((export_name("TS_DecodeError_dangerous_value"))) TS_DecodeError_dangerous_value() {
44599         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44600         *ret_copy = DecodeError_dangerous_value();
44601         uint64_t ret_ref = tag_ptr(ret_copy, true);
44602         return ret_ref;
44603 }
44604
44605 int64_t  __attribute__((export_name("TS_DecodeError_hash"))) TS_DecodeError_hash(uint64_t o) {
44606         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
44607         int64_t ret_conv = DecodeError_hash(o_conv);
44608         return ret_conv;
44609 }
44610
44611 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
44612         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
44613         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
44614         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
44615         return ret_conv;
44616 }
44617
44618 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
44619         LDKInit this_obj_conv;
44620         this_obj_conv.inner = untag_ptr(this_obj);
44621         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44623         Init_free(this_obj_conv);
44624 }
44625
44626 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
44627         LDKInit this_ptr_conv;
44628         this_ptr_conv.inner = untag_ptr(this_ptr);
44629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44631         this_ptr_conv.is_owned = false;
44632         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
44633         uint64_t ret_ref = 0;
44634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44636         return ret_ref;
44637 }
44638
44639 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
44640         LDKInit this_ptr_conv;
44641         this_ptr_conv.inner = untag_ptr(this_ptr);
44642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44644         this_ptr_conv.is_owned = false;
44645         LDKInitFeatures val_conv;
44646         val_conv.inner = untag_ptr(val);
44647         val_conv.is_owned = ptr_is_owned(val);
44648         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44649         val_conv = InitFeatures_clone(&val_conv);
44650         Init_set_features(&this_ptr_conv, val_conv);
44651 }
44652
44653 uint64_t  __attribute__((export_name("TS_Init_get_networks"))) TS_Init_get_networks(uint64_t this_ptr) {
44654         LDKInit this_ptr_conv;
44655         this_ptr_conv.inner = untag_ptr(this_ptr);
44656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44658         this_ptr_conv.is_owned = false;
44659         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
44660         *ret_copy = Init_get_networks(&this_ptr_conv);
44661         uint64_t ret_ref = tag_ptr(ret_copy, true);
44662         return ret_ref;
44663 }
44664
44665 void  __attribute__((export_name("TS_Init_set_networks"))) TS_Init_set_networks(uint64_t this_ptr, uint64_t val) {
44666         LDKInit this_ptr_conv;
44667         this_ptr_conv.inner = untag_ptr(this_ptr);
44668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44670         this_ptr_conv.is_owned = false;
44671         void* val_ptr = untag_ptr(val);
44672         CHECK_ACCESS(val_ptr);
44673         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
44674         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
44675         Init_set_networks(&this_ptr_conv, val_conv);
44676 }
44677
44678 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
44679         LDKInit this_ptr_conv;
44680         this_ptr_conv.inner = untag_ptr(this_ptr);
44681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44683         this_ptr_conv.is_owned = false;
44684         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
44685         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
44686         uint64_t ret_ref = tag_ptr(ret_copy, true);
44687         return ret_ref;
44688 }
44689
44690 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
44691         LDKInit this_ptr_conv;
44692         this_ptr_conv.inner = untag_ptr(this_ptr);
44693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44695         this_ptr_conv.is_owned = false;
44696         void* val_ptr = untag_ptr(val);
44697         CHECK_ACCESS(val_ptr);
44698         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
44699         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
44700         Init_set_remote_network_address(&this_ptr_conv, val_conv);
44701 }
44702
44703 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) {
44704         LDKInitFeatures features_arg_conv;
44705         features_arg_conv.inner = untag_ptr(features_arg);
44706         features_arg_conv.is_owned = ptr_is_owned(features_arg);
44707         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44708         features_arg_conv = InitFeatures_clone(&features_arg_conv);
44709         void* networks_arg_ptr = untag_ptr(networks_arg);
44710         CHECK_ACCESS(networks_arg_ptr);
44711         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
44712         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
44713         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
44714         CHECK_ACCESS(remote_network_address_arg_ptr);
44715         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
44716         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
44717         uint64_t ret_ref = 0;
44718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44720         return ret_ref;
44721 }
44722
44723 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
44724         LDKInit ret_var = Init_clone(arg);
44725         uint64_t ret_ref = 0;
44726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44728         return ret_ref;
44729 }
44730 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
44731         LDKInit arg_conv;
44732         arg_conv.inner = untag_ptr(arg);
44733         arg_conv.is_owned = ptr_is_owned(arg);
44734         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44735         arg_conv.is_owned = false;
44736         int64_t ret_conv = Init_clone_ptr(&arg_conv);
44737         return ret_conv;
44738 }
44739
44740 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
44741         LDKInit orig_conv;
44742         orig_conv.inner = untag_ptr(orig);
44743         orig_conv.is_owned = ptr_is_owned(orig);
44744         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44745         orig_conv.is_owned = false;
44746         LDKInit ret_var = Init_clone(&orig_conv);
44747         uint64_t ret_ref = 0;
44748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44750         return ret_ref;
44751 }
44752
44753 int64_t  __attribute__((export_name("TS_Init_hash"))) TS_Init_hash(uint64_t o) {
44754         LDKInit o_conv;
44755         o_conv.inner = untag_ptr(o);
44756         o_conv.is_owned = ptr_is_owned(o);
44757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44758         o_conv.is_owned = false;
44759         int64_t ret_conv = Init_hash(&o_conv);
44760         return ret_conv;
44761 }
44762
44763 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
44764         LDKInit a_conv;
44765         a_conv.inner = untag_ptr(a);
44766         a_conv.is_owned = ptr_is_owned(a);
44767         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44768         a_conv.is_owned = false;
44769         LDKInit b_conv;
44770         b_conv.inner = untag_ptr(b);
44771         b_conv.is_owned = ptr_is_owned(b);
44772         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44773         b_conv.is_owned = false;
44774         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
44775         return ret_conv;
44776 }
44777
44778 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
44779         LDKErrorMessage this_obj_conv;
44780         this_obj_conv.inner = untag_ptr(this_obj);
44781         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44783         ErrorMessage_free(this_obj_conv);
44784 }
44785
44786 uint64_t  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
44787         LDKErrorMessage this_ptr_conv;
44788         this_ptr_conv.inner = untag_ptr(this_ptr);
44789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44791         this_ptr_conv.is_owned = false;
44792         LDKChannelId ret_var = ErrorMessage_get_channel_id(&this_ptr_conv);
44793         uint64_t ret_ref = 0;
44794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44796         return ret_ref;
44797 }
44798
44799 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, uint64_t val) {
44800         LDKErrorMessage this_ptr_conv;
44801         this_ptr_conv.inner = untag_ptr(this_ptr);
44802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44804         this_ptr_conv.is_owned = false;
44805         LDKChannelId val_conv;
44806         val_conv.inner = untag_ptr(val);
44807         val_conv.is_owned = ptr_is_owned(val);
44808         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44809         val_conv = ChannelId_clone(&val_conv);
44810         ErrorMessage_set_channel_id(&this_ptr_conv, val_conv);
44811 }
44812
44813 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
44814         LDKErrorMessage this_ptr_conv;
44815         this_ptr_conv.inner = untag_ptr(this_ptr);
44816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44818         this_ptr_conv.is_owned = false;
44819         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
44820         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44821         Str_free(ret_str);
44822         return ret_conv;
44823 }
44824
44825 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
44826         LDKErrorMessage this_ptr_conv;
44827         this_ptr_conv.inner = untag_ptr(this_ptr);
44828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44830         this_ptr_conv.is_owned = false;
44831         LDKStr val_conv = str_ref_to_owned_c(val);
44832         ErrorMessage_set_data(&this_ptr_conv, val_conv);
44833 }
44834
44835 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(uint64_t channel_id_arg, jstring data_arg) {
44836         LDKChannelId channel_id_arg_conv;
44837         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
44838         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
44839         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
44840         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
44841         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
44842         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_conv, data_arg_conv);
44843         uint64_t ret_ref = 0;
44844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44846         return ret_ref;
44847 }
44848
44849 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
44850         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
44851         uint64_t ret_ref = 0;
44852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44854         return ret_ref;
44855 }
44856 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
44857         LDKErrorMessage arg_conv;
44858         arg_conv.inner = untag_ptr(arg);
44859         arg_conv.is_owned = ptr_is_owned(arg);
44860         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44861         arg_conv.is_owned = false;
44862         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
44863         return ret_conv;
44864 }
44865
44866 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
44867         LDKErrorMessage orig_conv;
44868         orig_conv.inner = untag_ptr(orig);
44869         orig_conv.is_owned = ptr_is_owned(orig);
44870         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44871         orig_conv.is_owned = false;
44872         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
44873         uint64_t ret_ref = 0;
44874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44876         return ret_ref;
44877 }
44878
44879 int64_t  __attribute__((export_name("TS_ErrorMessage_hash"))) TS_ErrorMessage_hash(uint64_t o) {
44880         LDKErrorMessage o_conv;
44881         o_conv.inner = untag_ptr(o);
44882         o_conv.is_owned = ptr_is_owned(o);
44883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44884         o_conv.is_owned = false;
44885         int64_t ret_conv = ErrorMessage_hash(&o_conv);
44886         return ret_conv;
44887 }
44888
44889 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
44890         LDKErrorMessage a_conv;
44891         a_conv.inner = untag_ptr(a);
44892         a_conv.is_owned = ptr_is_owned(a);
44893         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44894         a_conv.is_owned = false;
44895         LDKErrorMessage b_conv;
44896         b_conv.inner = untag_ptr(b);
44897         b_conv.is_owned = ptr_is_owned(b);
44898         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44899         b_conv.is_owned = false;
44900         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
44901         return ret_conv;
44902 }
44903
44904 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
44905         LDKWarningMessage this_obj_conv;
44906         this_obj_conv.inner = untag_ptr(this_obj);
44907         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44909         WarningMessage_free(this_obj_conv);
44910 }
44911
44912 uint64_t  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
44913         LDKWarningMessage this_ptr_conv;
44914         this_ptr_conv.inner = untag_ptr(this_ptr);
44915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44917         this_ptr_conv.is_owned = false;
44918         LDKChannelId ret_var = WarningMessage_get_channel_id(&this_ptr_conv);
44919         uint64_t ret_ref = 0;
44920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44922         return ret_ref;
44923 }
44924
44925 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, uint64_t val) {
44926         LDKWarningMessage this_ptr_conv;
44927         this_ptr_conv.inner = untag_ptr(this_ptr);
44928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44930         this_ptr_conv.is_owned = false;
44931         LDKChannelId val_conv;
44932         val_conv.inner = untag_ptr(val);
44933         val_conv.is_owned = ptr_is_owned(val);
44934         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44935         val_conv = ChannelId_clone(&val_conv);
44936         WarningMessage_set_channel_id(&this_ptr_conv, val_conv);
44937 }
44938
44939 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
44940         LDKWarningMessage this_ptr_conv;
44941         this_ptr_conv.inner = untag_ptr(this_ptr);
44942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44944         this_ptr_conv.is_owned = false;
44945         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
44946         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44947         Str_free(ret_str);
44948         return ret_conv;
44949 }
44950
44951 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
44952         LDKWarningMessage this_ptr_conv;
44953         this_ptr_conv.inner = untag_ptr(this_ptr);
44954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44956         this_ptr_conv.is_owned = false;
44957         LDKStr val_conv = str_ref_to_owned_c(val);
44958         WarningMessage_set_data(&this_ptr_conv, val_conv);
44959 }
44960
44961 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(uint64_t channel_id_arg, jstring data_arg) {
44962         LDKChannelId channel_id_arg_conv;
44963         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
44964         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
44965         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
44966         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
44967         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
44968         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_conv, data_arg_conv);
44969         uint64_t ret_ref = 0;
44970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44972         return ret_ref;
44973 }
44974
44975 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
44976         LDKWarningMessage ret_var = WarningMessage_clone(arg);
44977         uint64_t ret_ref = 0;
44978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44980         return ret_ref;
44981 }
44982 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
44983         LDKWarningMessage arg_conv;
44984         arg_conv.inner = untag_ptr(arg);
44985         arg_conv.is_owned = ptr_is_owned(arg);
44986         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44987         arg_conv.is_owned = false;
44988         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
44989         return ret_conv;
44990 }
44991
44992 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
44993         LDKWarningMessage orig_conv;
44994         orig_conv.inner = untag_ptr(orig);
44995         orig_conv.is_owned = ptr_is_owned(orig);
44996         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44997         orig_conv.is_owned = false;
44998         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
44999         uint64_t ret_ref = 0;
45000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45002         return ret_ref;
45003 }
45004
45005 int64_t  __attribute__((export_name("TS_WarningMessage_hash"))) TS_WarningMessage_hash(uint64_t o) {
45006         LDKWarningMessage o_conv;
45007         o_conv.inner = untag_ptr(o);
45008         o_conv.is_owned = ptr_is_owned(o);
45009         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45010         o_conv.is_owned = false;
45011         int64_t ret_conv = WarningMessage_hash(&o_conv);
45012         return ret_conv;
45013 }
45014
45015 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
45016         LDKWarningMessage a_conv;
45017         a_conv.inner = untag_ptr(a);
45018         a_conv.is_owned = ptr_is_owned(a);
45019         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45020         a_conv.is_owned = false;
45021         LDKWarningMessage b_conv;
45022         b_conv.inner = untag_ptr(b);
45023         b_conv.is_owned = ptr_is_owned(b);
45024         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45025         b_conv.is_owned = false;
45026         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
45027         return ret_conv;
45028 }
45029
45030 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
45031         LDKPing this_obj_conv;
45032         this_obj_conv.inner = untag_ptr(this_obj);
45033         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45035         Ping_free(this_obj_conv);
45036 }
45037
45038 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
45039         LDKPing this_ptr_conv;
45040         this_ptr_conv.inner = untag_ptr(this_ptr);
45041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45043         this_ptr_conv.is_owned = false;
45044         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
45045         return ret_conv;
45046 }
45047
45048 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
45049         LDKPing this_ptr_conv;
45050         this_ptr_conv.inner = untag_ptr(this_ptr);
45051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45053         this_ptr_conv.is_owned = false;
45054         Ping_set_ponglen(&this_ptr_conv, val);
45055 }
45056
45057 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
45058         LDKPing this_ptr_conv;
45059         this_ptr_conv.inner = untag_ptr(this_ptr);
45060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45062         this_ptr_conv.is_owned = false;
45063         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
45064         return ret_conv;
45065 }
45066
45067 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
45068         LDKPing this_ptr_conv;
45069         this_ptr_conv.inner = untag_ptr(this_ptr);
45070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45072         this_ptr_conv.is_owned = false;
45073         Ping_set_byteslen(&this_ptr_conv, val);
45074 }
45075
45076 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
45077         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
45078         uint64_t ret_ref = 0;
45079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45081         return ret_ref;
45082 }
45083
45084 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
45085         LDKPing ret_var = Ping_clone(arg);
45086         uint64_t ret_ref = 0;
45087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45089         return ret_ref;
45090 }
45091 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
45092         LDKPing arg_conv;
45093         arg_conv.inner = untag_ptr(arg);
45094         arg_conv.is_owned = ptr_is_owned(arg);
45095         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45096         arg_conv.is_owned = false;
45097         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
45098         return ret_conv;
45099 }
45100
45101 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
45102         LDKPing orig_conv;
45103         orig_conv.inner = untag_ptr(orig);
45104         orig_conv.is_owned = ptr_is_owned(orig);
45105         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45106         orig_conv.is_owned = false;
45107         LDKPing ret_var = Ping_clone(&orig_conv);
45108         uint64_t ret_ref = 0;
45109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45111         return ret_ref;
45112 }
45113
45114 int64_t  __attribute__((export_name("TS_Ping_hash"))) TS_Ping_hash(uint64_t o) {
45115         LDKPing o_conv;
45116         o_conv.inner = untag_ptr(o);
45117         o_conv.is_owned = ptr_is_owned(o);
45118         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45119         o_conv.is_owned = false;
45120         int64_t ret_conv = Ping_hash(&o_conv);
45121         return ret_conv;
45122 }
45123
45124 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
45125         LDKPing a_conv;
45126         a_conv.inner = untag_ptr(a);
45127         a_conv.is_owned = ptr_is_owned(a);
45128         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45129         a_conv.is_owned = false;
45130         LDKPing b_conv;
45131         b_conv.inner = untag_ptr(b);
45132         b_conv.is_owned = ptr_is_owned(b);
45133         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45134         b_conv.is_owned = false;
45135         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
45136         return ret_conv;
45137 }
45138
45139 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
45140         LDKPong this_obj_conv;
45141         this_obj_conv.inner = untag_ptr(this_obj);
45142         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45144         Pong_free(this_obj_conv);
45145 }
45146
45147 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
45148         LDKPong this_ptr_conv;
45149         this_ptr_conv.inner = untag_ptr(this_ptr);
45150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45152         this_ptr_conv.is_owned = false;
45153         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
45154         return ret_conv;
45155 }
45156
45157 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
45158         LDKPong this_ptr_conv;
45159         this_ptr_conv.inner = untag_ptr(this_ptr);
45160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45162         this_ptr_conv.is_owned = false;
45163         Pong_set_byteslen(&this_ptr_conv, val);
45164 }
45165
45166 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
45167         LDKPong ret_var = Pong_new(byteslen_arg);
45168         uint64_t ret_ref = 0;
45169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45171         return ret_ref;
45172 }
45173
45174 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
45175         LDKPong ret_var = Pong_clone(arg);
45176         uint64_t ret_ref = 0;
45177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45179         return ret_ref;
45180 }
45181 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
45182         LDKPong arg_conv;
45183         arg_conv.inner = untag_ptr(arg);
45184         arg_conv.is_owned = ptr_is_owned(arg);
45185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45186         arg_conv.is_owned = false;
45187         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
45188         return ret_conv;
45189 }
45190
45191 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
45192         LDKPong orig_conv;
45193         orig_conv.inner = untag_ptr(orig);
45194         orig_conv.is_owned = ptr_is_owned(orig);
45195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45196         orig_conv.is_owned = false;
45197         LDKPong ret_var = Pong_clone(&orig_conv);
45198         uint64_t ret_ref = 0;
45199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45201         return ret_ref;
45202 }
45203
45204 int64_t  __attribute__((export_name("TS_Pong_hash"))) TS_Pong_hash(uint64_t o) {
45205         LDKPong o_conv;
45206         o_conv.inner = untag_ptr(o);
45207         o_conv.is_owned = ptr_is_owned(o);
45208         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45209         o_conv.is_owned = false;
45210         int64_t ret_conv = Pong_hash(&o_conv);
45211         return ret_conv;
45212 }
45213
45214 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
45215         LDKPong a_conv;
45216         a_conv.inner = untag_ptr(a);
45217         a_conv.is_owned = ptr_is_owned(a);
45218         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45219         a_conv.is_owned = false;
45220         LDKPong b_conv;
45221         b_conv.inner = untag_ptr(b);
45222         b_conv.is_owned = ptr_is_owned(b);
45223         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45224         b_conv.is_owned = false;
45225         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
45226         return ret_conv;
45227 }
45228
45229 void  __attribute__((export_name("TS_CommonOpenChannelFields_free"))) TS_CommonOpenChannelFields_free(uint64_t this_obj) {
45230         LDKCommonOpenChannelFields this_obj_conv;
45231         this_obj_conv.inner = untag_ptr(this_obj);
45232         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45234         CommonOpenChannelFields_free(this_obj_conv);
45235 }
45236
45237 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_chain_hash"))) TS_CommonOpenChannelFields_get_chain_hash(uint64_t this_ptr) {
45238         LDKCommonOpenChannelFields this_ptr_conv;
45239         this_ptr_conv.inner = untag_ptr(this_ptr);
45240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45242         this_ptr_conv.is_owned = false;
45243         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45244         memcpy(ret_arr->elems, *CommonOpenChannelFields_get_chain_hash(&this_ptr_conv), 32);
45245         return ret_arr;
45246 }
45247
45248 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_chain_hash"))) TS_CommonOpenChannelFields_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
45249         LDKCommonOpenChannelFields this_ptr_conv;
45250         this_ptr_conv.inner = untag_ptr(this_ptr);
45251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45253         this_ptr_conv.is_owned = false;
45254         LDKThirtyTwoBytes val_ref;
45255         CHECK(val->arr_len == 32);
45256         memcpy(val_ref.data, val->elems, 32); FREE(val);
45257         CommonOpenChannelFields_set_chain_hash(&this_ptr_conv, val_ref);
45258 }
45259
45260 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_temporary_channel_id"))) TS_CommonOpenChannelFields_get_temporary_channel_id(uint64_t this_ptr) {
45261         LDKCommonOpenChannelFields this_ptr_conv;
45262         this_ptr_conv.inner = untag_ptr(this_ptr);
45263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45265         this_ptr_conv.is_owned = false;
45266         LDKChannelId ret_var = CommonOpenChannelFields_get_temporary_channel_id(&this_ptr_conv);
45267         uint64_t ret_ref = 0;
45268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45270         return ret_ref;
45271 }
45272
45273 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_temporary_channel_id"))) TS_CommonOpenChannelFields_set_temporary_channel_id(uint64_t this_ptr, uint64_t val) {
45274         LDKCommonOpenChannelFields this_ptr_conv;
45275         this_ptr_conv.inner = untag_ptr(this_ptr);
45276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45278         this_ptr_conv.is_owned = false;
45279         LDKChannelId val_conv;
45280         val_conv.inner = untag_ptr(val);
45281         val_conv.is_owned = ptr_is_owned(val);
45282         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45283         val_conv = ChannelId_clone(&val_conv);
45284         CommonOpenChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
45285 }
45286
45287 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_funding_satoshis"))) TS_CommonOpenChannelFields_get_funding_satoshis(uint64_t this_ptr) {
45288         LDKCommonOpenChannelFields this_ptr_conv;
45289         this_ptr_conv.inner = untag_ptr(this_ptr);
45290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45292         this_ptr_conv.is_owned = false;
45293         int64_t ret_conv = CommonOpenChannelFields_get_funding_satoshis(&this_ptr_conv);
45294         return ret_conv;
45295 }
45296
45297 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_funding_satoshis"))) TS_CommonOpenChannelFields_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
45298         LDKCommonOpenChannelFields this_ptr_conv;
45299         this_ptr_conv.inner = untag_ptr(this_ptr);
45300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45302         this_ptr_conv.is_owned = false;
45303         CommonOpenChannelFields_set_funding_satoshis(&this_ptr_conv, val);
45304 }
45305
45306 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_dust_limit_satoshis"))) TS_CommonOpenChannelFields_get_dust_limit_satoshis(uint64_t this_ptr) {
45307         LDKCommonOpenChannelFields this_ptr_conv;
45308         this_ptr_conv.inner = untag_ptr(this_ptr);
45309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45311         this_ptr_conv.is_owned = false;
45312         int64_t ret_conv = CommonOpenChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
45313         return ret_conv;
45314 }
45315
45316 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_dust_limit_satoshis"))) TS_CommonOpenChannelFields_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
45317         LDKCommonOpenChannelFields this_ptr_conv;
45318         this_ptr_conv.inner = untag_ptr(this_ptr);
45319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45321         this_ptr_conv.is_owned = false;
45322         CommonOpenChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
45323 }
45324
45325 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) {
45326         LDKCommonOpenChannelFields this_ptr_conv;
45327         this_ptr_conv.inner = untag_ptr(this_ptr);
45328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45330         this_ptr_conv.is_owned = false;
45331         int64_t ret_conv = CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
45332         return ret_conv;
45333 }
45334
45335 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) {
45336         LDKCommonOpenChannelFields this_ptr_conv;
45337         this_ptr_conv.inner = untag_ptr(this_ptr);
45338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45340         this_ptr_conv.is_owned = false;
45341         CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
45342 }
45343
45344 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_htlc_minimum_msat"))) TS_CommonOpenChannelFields_get_htlc_minimum_msat(uint64_t this_ptr) {
45345         LDKCommonOpenChannelFields this_ptr_conv;
45346         this_ptr_conv.inner = untag_ptr(this_ptr);
45347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45349         this_ptr_conv.is_owned = false;
45350         int64_t ret_conv = CommonOpenChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
45351         return ret_conv;
45352 }
45353
45354 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_htlc_minimum_msat"))) TS_CommonOpenChannelFields_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
45355         LDKCommonOpenChannelFields this_ptr_conv;
45356         this_ptr_conv.inner = untag_ptr(this_ptr);
45357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45359         this_ptr_conv.is_owned = false;
45360         CommonOpenChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
45361 }
45362
45363 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) {
45364         LDKCommonOpenChannelFields this_ptr_conv;
45365         this_ptr_conv.inner = untag_ptr(this_ptr);
45366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45368         this_ptr_conv.is_owned = false;
45369         int32_t ret_conv = CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
45370         return ret_conv;
45371 }
45372
45373 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) {
45374         LDKCommonOpenChannelFields this_ptr_conv;
45375         this_ptr_conv.inner = untag_ptr(this_ptr);
45376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45378         this_ptr_conv.is_owned = false;
45379         CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
45380 }
45381
45382 int16_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_to_self_delay"))) TS_CommonOpenChannelFields_get_to_self_delay(uint64_t this_ptr) {
45383         LDKCommonOpenChannelFields this_ptr_conv;
45384         this_ptr_conv.inner = untag_ptr(this_ptr);
45385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45387         this_ptr_conv.is_owned = false;
45388         int16_t ret_conv = CommonOpenChannelFields_get_to_self_delay(&this_ptr_conv);
45389         return ret_conv;
45390 }
45391
45392 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_to_self_delay"))) TS_CommonOpenChannelFields_set_to_self_delay(uint64_t this_ptr, int16_t val) {
45393         LDKCommonOpenChannelFields this_ptr_conv;
45394         this_ptr_conv.inner = untag_ptr(this_ptr);
45395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45397         this_ptr_conv.is_owned = false;
45398         CommonOpenChannelFields_set_to_self_delay(&this_ptr_conv, val);
45399 }
45400
45401 int16_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_max_accepted_htlcs"))) TS_CommonOpenChannelFields_get_max_accepted_htlcs(uint64_t this_ptr) {
45402         LDKCommonOpenChannelFields this_ptr_conv;
45403         this_ptr_conv.inner = untag_ptr(this_ptr);
45404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45406         this_ptr_conv.is_owned = false;
45407         int16_t ret_conv = CommonOpenChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
45408         return ret_conv;
45409 }
45410
45411 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_max_accepted_htlcs"))) TS_CommonOpenChannelFields_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
45412         LDKCommonOpenChannelFields this_ptr_conv;
45413         this_ptr_conv.inner = untag_ptr(this_ptr);
45414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45416         this_ptr_conv.is_owned = false;
45417         CommonOpenChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
45418 }
45419
45420 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_funding_pubkey"))) TS_CommonOpenChannelFields_get_funding_pubkey(uint64_t this_ptr) {
45421         LDKCommonOpenChannelFields this_ptr_conv;
45422         this_ptr_conv.inner = untag_ptr(this_ptr);
45423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45425         this_ptr_conv.is_owned = false;
45426         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45427         memcpy(ret_arr->elems, CommonOpenChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
45428         return ret_arr;
45429 }
45430
45431 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_funding_pubkey"))) TS_CommonOpenChannelFields_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
45432         LDKCommonOpenChannelFields this_ptr_conv;
45433         this_ptr_conv.inner = untag_ptr(this_ptr);
45434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45436         this_ptr_conv.is_owned = false;
45437         LDKPublicKey val_ref;
45438         CHECK(val->arr_len == 33);
45439         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45440         CommonOpenChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
45441 }
45442
45443 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_revocation_basepoint"))) TS_CommonOpenChannelFields_get_revocation_basepoint(uint64_t this_ptr) {
45444         LDKCommonOpenChannelFields this_ptr_conv;
45445         this_ptr_conv.inner = untag_ptr(this_ptr);
45446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45448         this_ptr_conv.is_owned = false;
45449         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45450         memcpy(ret_arr->elems, CommonOpenChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
45451         return ret_arr;
45452 }
45453
45454 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_revocation_basepoint"))) TS_CommonOpenChannelFields_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
45455         LDKCommonOpenChannelFields this_ptr_conv;
45456         this_ptr_conv.inner = untag_ptr(this_ptr);
45457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45459         this_ptr_conv.is_owned = false;
45460         LDKPublicKey val_ref;
45461         CHECK(val->arr_len == 33);
45462         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45463         CommonOpenChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
45464 }
45465
45466 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_payment_basepoint"))) TS_CommonOpenChannelFields_get_payment_basepoint(uint64_t this_ptr) {
45467         LDKCommonOpenChannelFields this_ptr_conv;
45468         this_ptr_conv.inner = untag_ptr(this_ptr);
45469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45471         this_ptr_conv.is_owned = false;
45472         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45473         memcpy(ret_arr->elems, CommonOpenChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
45474         return ret_arr;
45475 }
45476
45477 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_payment_basepoint"))) TS_CommonOpenChannelFields_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
45478         LDKCommonOpenChannelFields this_ptr_conv;
45479         this_ptr_conv.inner = untag_ptr(this_ptr);
45480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45482         this_ptr_conv.is_owned = false;
45483         LDKPublicKey val_ref;
45484         CHECK(val->arr_len == 33);
45485         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45486         CommonOpenChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
45487 }
45488
45489 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_delayed_payment_basepoint"))) TS_CommonOpenChannelFields_get_delayed_payment_basepoint(uint64_t this_ptr) {
45490         LDKCommonOpenChannelFields this_ptr_conv;
45491         this_ptr_conv.inner = untag_ptr(this_ptr);
45492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45494         this_ptr_conv.is_owned = false;
45495         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45496         memcpy(ret_arr->elems, CommonOpenChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
45497         return ret_arr;
45498 }
45499
45500 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_delayed_payment_basepoint"))) TS_CommonOpenChannelFields_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
45501         LDKCommonOpenChannelFields this_ptr_conv;
45502         this_ptr_conv.inner = untag_ptr(this_ptr);
45503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45505         this_ptr_conv.is_owned = false;
45506         LDKPublicKey val_ref;
45507         CHECK(val->arr_len == 33);
45508         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45509         CommonOpenChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
45510 }
45511
45512 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_htlc_basepoint"))) TS_CommonOpenChannelFields_get_htlc_basepoint(uint64_t this_ptr) {
45513         LDKCommonOpenChannelFields this_ptr_conv;
45514         this_ptr_conv.inner = untag_ptr(this_ptr);
45515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45517         this_ptr_conv.is_owned = false;
45518         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45519         memcpy(ret_arr->elems, CommonOpenChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
45520         return ret_arr;
45521 }
45522
45523 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_htlc_basepoint"))) TS_CommonOpenChannelFields_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
45524         LDKCommonOpenChannelFields this_ptr_conv;
45525         this_ptr_conv.inner = untag_ptr(this_ptr);
45526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45528         this_ptr_conv.is_owned = false;
45529         LDKPublicKey val_ref;
45530         CHECK(val->arr_len == 33);
45531         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45532         CommonOpenChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
45533 }
45534
45535 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_first_per_commitment_point"))) TS_CommonOpenChannelFields_get_first_per_commitment_point(uint64_t this_ptr) {
45536         LDKCommonOpenChannelFields this_ptr_conv;
45537         this_ptr_conv.inner = untag_ptr(this_ptr);
45538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45540         this_ptr_conv.is_owned = false;
45541         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45542         memcpy(ret_arr->elems, CommonOpenChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
45543         return ret_arr;
45544 }
45545
45546 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) {
45547         LDKCommonOpenChannelFields this_ptr_conv;
45548         this_ptr_conv.inner = untag_ptr(this_ptr);
45549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45551         this_ptr_conv.is_owned = false;
45552         LDKPublicKey val_ref;
45553         CHECK(val->arr_len == 33);
45554         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45555         CommonOpenChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
45556 }
45557
45558 int8_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_channel_flags"))) TS_CommonOpenChannelFields_get_channel_flags(uint64_t this_ptr) {
45559         LDKCommonOpenChannelFields this_ptr_conv;
45560         this_ptr_conv.inner = untag_ptr(this_ptr);
45561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45563         this_ptr_conv.is_owned = false;
45564         int8_t ret_conv = CommonOpenChannelFields_get_channel_flags(&this_ptr_conv);
45565         return ret_conv;
45566 }
45567
45568 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_channel_flags"))) TS_CommonOpenChannelFields_set_channel_flags(uint64_t this_ptr, int8_t val) {
45569         LDKCommonOpenChannelFields this_ptr_conv;
45570         this_ptr_conv.inner = untag_ptr(this_ptr);
45571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45573         this_ptr_conv.is_owned = false;
45574         CommonOpenChannelFields_set_channel_flags(&this_ptr_conv, val);
45575 }
45576
45577 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_shutdown_scriptpubkey"))) TS_CommonOpenChannelFields_get_shutdown_scriptpubkey(uint64_t this_ptr) {
45578         LDKCommonOpenChannelFields this_ptr_conv;
45579         this_ptr_conv.inner = untag_ptr(this_ptr);
45580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45582         this_ptr_conv.is_owned = false;
45583         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
45584         *ret_copy = CommonOpenChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
45585         uint64_t ret_ref = tag_ptr(ret_copy, true);
45586         return ret_ref;
45587 }
45588
45589 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_shutdown_scriptpubkey"))) TS_CommonOpenChannelFields_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
45590         LDKCommonOpenChannelFields this_ptr_conv;
45591         this_ptr_conv.inner = untag_ptr(this_ptr);
45592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45594         this_ptr_conv.is_owned = false;
45595         void* val_ptr = untag_ptr(val);
45596         CHECK_ACCESS(val_ptr);
45597         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
45598         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
45599         CommonOpenChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
45600 }
45601
45602 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_channel_type"))) TS_CommonOpenChannelFields_get_channel_type(uint64_t this_ptr) {
45603         LDKCommonOpenChannelFields this_ptr_conv;
45604         this_ptr_conv.inner = untag_ptr(this_ptr);
45605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45607         this_ptr_conv.is_owned = false;
45608         LDKChannelTypeFeatures ret_var = CommonOpenChannelFields_get_channel_type(&this_ptr_conv);
45609         uint64_t ret_ref = 0;
45610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45612         return ret_ref;
45613 }
45614
45615 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_channel_type"))) TS_CommonOpenChannelFields_set_channel_type(uint64_t this_ptr, uint64_t val) {
45616         LDKCommonOpenChannelFields this_ptr_conv;
45617         this_ptr_conv.inner = untag_ptr(this_ptr);
45618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45620         this_ptr_conv.is_owned = false;
45621         LDKChannelTypeFeatures val_conv;
45622         val_conv.inner = untag_ptr(val);
45623         val_conv.is_owned = ptr_is_owned(val);
45624         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45625         val_conv = ChannelTypeFeatures_clone(&val_conv);
45626         CommonOpenChannelFields_set_channel_type(&this_ptr_conv, val_conv);
45627 }
45628
45629 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) {
45630         LDKThirtyTwoBytes chain_hash_arg_ref;
45631         CHECK(chain_hash_arg->arr_len == 32);
45632         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
45633         LDKChannelId temporary_channel_id_arg_conv;
45634         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
45635         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
45636         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
45637         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
45638         LDKPublicKey funding_pubkey_arg_ref;
45639         CHECK(funding_pubkey_arg->arr_len == 33);
45640         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
45641         LDKPublicKey revocation_basepoint_arg_ref;
45642         CHECK(revocation_basepoint_arg->arr_len == 33);
45643         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
45644         LDKPublicKey payment_basepoint_arg_ref;
45645         CHECK(payment_basepoint_arg->arr_len == 33);
45646         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
45647         LDKPublicKey delayed_payment_basepoint_arg_ref;
45648         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
45649         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
45650         LDKPublicKey htlc_basepoint_arg_ref;
45651         CHECK(htlc_basepoint_arg->arr_len == 33);
45652         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
45653         LDKPublicKey first_per_commitment_point_arg_ref;
45654         CHECK(first_per_commitment_point_arg->arr_len == 33);
45655         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
45656         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
45657         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
45658         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
45659         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
45660         LDKChannelTypeFeatures channel_type_arg_conv;
45661         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
45662         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
45663         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
45664         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
45665         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);
45666         uint64_t ret_ref = 0;
45667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45669         return ret_ref;
45670 }
45671
45672 static inline uint64_t CommonOpenChannelFields_clone_ptr(LDKCommonOpenChannelFields *NONNULL_PTR arg) {
45673         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(arg);
45674         uint64_t ret_ref = 0;
45675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45677         return ret_ref;
45678 }
45679 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_clone_ptr"))) TS_CommonOpenChannelFields_clone_ptr(uint64_t arg) {
45680         LDKCommonOpenChannelFields arg_conv;
45681         arg_conv.inner = untag_ptr(arg);
45682         arg_conv.is_owned = ptr_is_owned(arg);
45683         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45684         arg_conv.is_owned = false;
45685         int64_t ret_conv = CommonOpenChannelFields_clone_ptr(&arg_conv);
45686         return ret_conv;
45687 }
45688
45689 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_clone"))) TS_CommonOpenChannelFields_clone(uint64_t orig) {
45690         LDKCommonOpenChannelFields orig_conv;
45691         orig_conv.inner = untag_ptr(orig);
45692         orig_conv.is_owned = ptr_is_owned(orig);
45693         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45694         orig_conv.is_owned = false;
45695         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(&orig_conv);
45696         uint64_t ret_ref = 0;
45697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45699         return ret_ref;
45700 }
45701
45702 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_hash"))) TS_CommonOpenChannelFields_hash(uint64_t o) {
45703         LDKCommonOpenChannelFields o_conv;
45704         o_conv.inner = untag_ptr(o);
45705         o_conv.is_owned = ptr_is_owned(o);
45706         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45707         o_conv.is_owned = false;
45708         int64_t ret_conv = CommonOpenChannelFields_hash(&o_conv);
45709         return ret_conv;
45710 }
45711
45712 jboolean  __attribute__((export_name("TS_CommonOpenChannelFields_eq"))) TS_CommonOpenChannelFields_eq(uint64_t a, uint64_t b) {
45713         LDKCommonOpenChannelFields a_conv;
45714         a_conv.inner = untag_ptr(a);
45715         a_conv.is_owned = ptr_is_owned(a);
45716         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45717         a_conv.is_owned = false;
45718         LDKCommonOpenChannelFields b_conv;
45719         b_conv.inner = untag_ptr(b);
45720         b_conv.is_owned = ptr_is_owned(b);
45721         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45722         b_conv.is_owned = false;
45723         jboolean ret_conv = CommonOpenChannelFields_eq(&a_conv, &b_conv);
45724         return ret_conv;
45725 }
45726
45727 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
45728         LDKOpenChannel this_obj_conv;
45729         this_obj_conv.inner = untag_ptr(this_obj);
45730         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45732         OpenChannel_free(this_obj_conv);
45733 }
45734
45735 uint64_t  __attribute__((export_name("TS_OpenChannel_get_common_fields"))) TS_OpenChannel_get_common_fields(uint64_t this_ptr) {
45736         LDKOpenChannel this_ptr_conv;
45737         this_ptr_conv.inner = untag_ptr(this_ptr);
45738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45740         this_ptr_conv.is_owned = false;
45741         LDKCommonOpenChannelFields ret_var = OpenChannel_get_common_fields(&this_ptr_conv);
45742         uint64_t ret_ref = 0;
45743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45745         return ret_ref;
45746 }
45747
45748 void  __attribute__((export_name("TS_OpenChannel_set_common_fields"))) TS_OpenChannel_set_common_fields(uint64_t this_ptr, uint64_t val) {
45749         LDKOpenChannel this_ptr_conv;
45750         this_ptr_conv.inner = untag_ptr(this_ptr);
45751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45753         this_ptr_conv.is_owned = false;
45754         LDKCommonOpenChannelFields val_conv;
45755         val_conv.inner = untag_ptr(val);
45756         val_conv.is_owned = ptr_is_owned(val);
45757         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45758         val_conv = CommonOpenChannelFields_clone(&val_conv);
45759         OpenChannel_set_common_fields(&this_ptr_conv, val_conv);
45760 }
45761
45762 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
45763         LDKOpenChannel this_ptr_conv;
45764         this_ptr_conv.inner = untag_ptr(this_ptr);
45765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45767         this_ptr_conv.is_owned = false;
45768         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
45769         return ret_conv;
45770 }
45771
45772 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
45773         LDKOpenChannel this_ptr_conv;
45774         this_ptr_conv.inner = untag_ptr(this_ptr);
45775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45777         this_ptr_conv.is_owned = false;
45778         OpenChannel_set_push_msat(&this_ptr_conv, val);
45779 }
45780
45781 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
45782         LDKOpenChannel this_ptr_conv;
45783         this_ptr_conv.inner = untag_ptr(this_ptr);
45784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45786         this_ptr_conv.is_owned = false;
45787         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
45788         return ret_conv;
45789 }
45790
45791 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
45792         LDKOpenChannel this_ptr_conv;
45793         this_ptr_conv.inner = untag_ptr(this_ptr);
45794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45796         this_ptr_conv.is_owned = false;
45797         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
45798 }
45799
45800 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) {
45801         LDKCommonOpenChannelFields common_fields_arg_conv;
45802         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
45803         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
45804         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
45805         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
45806         LDKOpenChannel ret_var = OpenChannel_new(common_fields_arg_conv, push_msat_arg, channel_reserve_satoshis_arg);
45807         uint64_t ret_ref = 0;
45808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45810         return ret_ref;
45811 }
45812
45813 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
45814         LDKOpenChannel ret_var = OpenChannel_clone(arg);
45815         uint64_t ret_ref = 0;
45816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45818         return ret_ref;
45819 }
45820 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
45821         LDKOpenChannel arg_conv;
45822         arg_conv.inner = untag_ptr(arg);
45823         arg_conv.is_owned = ptr_is_owned(arg);
45824         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45825         arg_conv.is_owned = false;
45826         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
45827         return ret_conv;
45828 }
45829
45830 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
45831         LDKOpenChannel orig_conv;
45832         orig_conv.inner = untag_ptr(orig);
45833         orig_conv.is_owned = ptr_is_owned(orig);
45834         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45835         orig_conv.is_owned = false;
45836         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
45837         uint64_t ret_ref = 0;
45838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45840         return ret_ref;
45841 }
45842
45843 int64_t  __attribute__((export_name("TS_OpenChannel_hash"))) TS_OpenChannel_hash(uint64_t o) {
45844         LDKOpenChannel o_conv;
45845         o_conv.inner = untag_ptr(o);
45846         o_conv.is_owned = ptr_is_owned(o);
45847         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45848         o_conv.is_owned = false;
45849         int64_t ret_conv = OpenChannel_hash(&o_conv);
45850         return ret_conv;
45851 }
45852
45853 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
45854         LDKOpenChannel a_conv;
45855         a_conv.inner = untag_ptr(a);
45856         a_conv.is_owned = ptr_is_owned(a);
45857         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45858         a_conv.is_owned = false;
45859         LDKOpenChannel b_conv;
45860         b_conv.inner = untag_ptr(b);
45861         b_conv.is_owned = ptr_is_owned(b);
45862         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45863         b_conv.is_owned = false;
45864         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
45865         return ret_conv;
45866 }
45867
45868 void  __attribute__((export_name("TS_OpenChannelV2_free"))) TS_OpenChannelV2_free(uint64_t this_obj) {
45869         LDKOpenChannelV2 this_obj_conv;
45870         this_obj_conv.inner = untag_ptr(this_obj);
45871         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45873         OpenChannelV2_free(this_obj_conv);
45874 }
45875
45876 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_common_fields"))) TS_OpenChannelV2_get_common_fields(uint64_t this_ptr) {
45877         LDKOpenChannelV2 this_ptr_conv;
45878         this_ptr_conv.inner = untag_ptr(this_ptr);
45879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45881         this_ptr_conv.is_owned = false;
45882         LDKCommonOpenChannelFields ret_var = OpenChannelV2_get_common_fields(&this_ptr_conv);
45883         uint64_t ret_ref = 0;
45884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45886         return ret_ref;
45887 }
45888
45889 void  __attribute__((export_name("TS_OpenChannelV2_set_common_fields"))) TS_OpenChannelV2_set_common_fields(uint64_t this_ptr, uint64_t val) {
45890         LDKOpenChannelV2 this_ptr_conv;
45891         this_ptr_conv.inner = untag_ptr(this_ptr);
45892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45894         this_ptr_conv.is_owned = false;
45895         LDKCommonOpenChannelFields val_conv;
45896         val_conv.inner = untag_ptr(val);
45897         val_conv.is_owned = ptr_is_owned(val);
45898         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45899         val_conv = CommonOpenChannelFields_clone(&val_conv);
45900         OpenChannelV2_set_common_fields(&this_ptr_conv, val_conv);
45901 }
45902
45903 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) {
45904         LDKOpenChannelV2 this_ptr_conv;
45905         this_ptr_conv.inner = untag_ptr(this_ptr);
45906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45908         this_ptr_conv.is_owned = false;
45909         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
45910         return ret_conv;
45911 }
45912
45913 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) {
45914         LDKOpenChannelV2 this_ptr_conv;
45915         this_ptr_conv.inner = untag_ptr(this_ptr);
45916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45918         this_ptr_conv.is_owned = false;
45919         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
45920 }
45921
45922 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_locktime"))) TS_OpenChannelV2_get_locktime(uint64_t this_ptr) {
45923         LDKOpenChannelV2 this_ptr_conv;
45924         this_ptr_conv.inner = untag_ptr(this_ptr);
45925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45927         this_ptr_conv.is_owned = false;
45928         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
45929         return ret_conv;
45930 }
45931
45932 void  __attribute__((export_name("TS_OpenChannelV2_set_locktime"))) TS_OpenChannelV2_set_locktime(uint64_t this_ptr, int32_t val) {
45933         LDKOpenChannelV2 this_ptr_conv;
45934         this_ptr_conv.inner = untag_ptr(this_ptr);
45935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45937         this_ptr_conv.is_owned = false;
45938         OpenChannelV2_set_locktime(&this_ptr_conv, val);
45939 }
45940
45941 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_second_per_commitment_point"))) TS_OpenChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
45942         LDKOpenChannelV2 this_ptr_conv;
45943         this_ptr_conv.inner = untag_ptr(this_ptr);
45944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45946         this_ptr_conv.is_owned = false;
45947         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45948         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
45949         return ret_arr;
45950 }
45951
45952 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) {
45953         LDKOpenChannelV2 this_ptr_conv;
45954         this_ptr_conv.inner = untag_ptr(this_ptr);
45955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45957         this_ptr_conv.is_owned = false;
45958         LDKPublicKey val_ref;
45959         CHECK(val->arr_len == 33);
45960         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45961         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
45962 }
45963
45964 uint32_t  __attribute__((export_name("TS_OpenChannelV2_get_require_confirmed_inputs"))) TS_OpenChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
45965         LDKOpenChannelV2 this_ptr_conv;
45966         this_ptr_conv.inner = untag_ptr(this_ptr);
45967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45969         this_ptr_conv.is_owned = false;
45970         uint32_t ret_conv = LDKCOption_NoneZ_to_js(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
45971         return ret_conv;
45972 }
45973
45974 void  __attribute__((export_name("TS_OpenChannelV2_set_require_confirmed_inputs"))) TS_OpenChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
45975         LDKOpenChannelV2 this_ptr_conv;
45976         this_ptr_conv.inner = untag_ptr(this_ptr);
45977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45979         this_ptr_conv.is_owned = false;
45980         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
45981         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
45982 }
45983
45984 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) {
45985         LDKCommonOpenChannelFields common_fields_arg_conv;
45986         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
45987         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
45988         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
45989         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
45990         LDKPublicKey second_per_commitment_point_arg_ref;
45991         CHECK(second_per_commitment_point_arg->arr_len == 33);
45992         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
45993         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
45994         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);
45995         uint64_t ret_ref = 0;
45996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45998         return ret_ref;
45999 }
46000
46001 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
46002         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
46003         uint64_t ret_ref = 0;
46004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46006         return ret_ref;
46007 }
46008 int64_t  __attribute__((export_name("TS_OpenChannelV2_clone_ptr"))) TS_OpenChannelV2_clone_ptr(uint64_t arg) {
46009         LDKOpenChannelV2 arg_conv;
46010         arg_conv.inner = untag_ptr(arg);
46011         arg_conv.is_owned = ptr_is_owned(arg);
46012         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46013         arg_conv.is_owned = false;
46014         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
46015         return ret_conv;
46016 }
46017
46018 uint64_t  __attribute__((export_name("TS_OpenChannelV2_clone"))) TS_OpenChannelV2_clone(uint64_t orig) {
46019         LDKOpenChannelV2 orig_conv;
46020         orig_conv.inner = untag_ptr(orig);
46021         orig_conv.is_owned = ptr_is_owned(orig);
46022         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46023         orig_conv.is_owned = false;
46024         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
46025         uint64_t ret_ref = 0;
46026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46028         return ret_ref;
46029 }
46030
46031 int64_t  __attribute__((export_name("TS_OpenChannelV2_hash"))) TS_OpenChannelV2_hash(uint64_t o) {
46032         LDKOpenChannelV2 o_conv;
46033         o_conv.inner = untag_ptr(o);
46034         o_conv.is_owned = ptr_is_owned(o);
46035         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46036         o_conv.is_owned = false;
46037         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
46038         return ret_conv;
46039 }
46040
46041 jboolean  __attribute__((export_name("TS_OpenChannelV2_eq"))) TS_OpenChannelV2_eq(uint64_t a, uint64_t b) {
46042         LDKOpenChannelV2 a_conv;
46043         a_conv.inner = untag_ptr(a);
46044         a_conv.is_owned = ptr_is_owned(a);
46045         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46046         a_conv.is_owned = false;
46047         LDKOpenChannelV2 b_conv;
46048         b_conv.inner = untag_ptr(b);
46049         b_conv.is_owned = ptr_is_owned(b);
46050         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46051         b_conv.is_owned = false;
46052         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
46053         return ret_conv;
46054 }
46055
46056 void  __attribute__((export_name("TS_CommonAcceptChannelFields_free"))) TS_CommonAcceptChannelFields_free(uint64_t this_obj) {
46057         LDKCommonAcceptChannelFields this_obj_conv;
46058         this_obj_conv.inner = untag_ptr(this_obj);
46059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46061         CommonAcceptChannelFields_free(this_obj_conv);
46062 }
46063
46064 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_temporary_channel_id"))) TS_CommonAcceptChannelFields_get_temporary_channel_id(uint64_t this_ptr) {
46065         LDKCommonAcceptChannelFields this_ptr_conv;
46066         this_ptr_conv.inner = untag_ptr(this_ptr);
46067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46069         this_ptr_conv.is_owned = false;
46070         LDKChannelId ret_var = CommonAcceptChannelFields_get_temporary_channel_id(&this_ptr_conv);
46071         uint64_t ret_ref = 0;
46072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46074         return ret_ref;
46075 }
46076
46077 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_temporary_channel_id"))) TS_CommonAcceptChannelFields_set_temporary_channel_id(uint64_t this_ptr, uint64_t val) {
46078         LDKCommonAcceptChannelFields this_ptr_conv;
46079         this_ptr_conv.inner = untag_ptr(this_ptr);
46080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46082         this_ptr_conv.is_owned = false;
46083         LDKChannelId val_conv;
46084         val_conv.inner = untag_ptr(val);
46085         val_conv.is_owned = ptr_is_owned(val);
46086         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46087         val_conv = ChannelId_clone(&val_conv);
46088         CommonAcceptChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
46089 }
46090
46091 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_dust_limit_satoshis"))) TS_CommonAcceptChannelFields_get_dust_limit_satoshis(uint64_t this_ptr) {
46092         LDKCommonAcceptChannelFields this_ptr_conv;
46093         this_ptr_conv.inner = untag_ptr(this_ptr);
46094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46096         this_ptr_conv.is_owned = false;
46097         int64_t ret_conv = CommonAcceptChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
46098         return ret_conv;
46099 }
46100
46101 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_dust_limit_satoshis"))) TS_CommonAcceptChannelFields_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
46102         LDKCommonAcceptChannelFields this_ptr_conv;
46103         this_ptr_conv.inner = untag_ptr(this_ptr);
46104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46106         this_ptr_conv.is_owned = false;
46107         CommonAcceptChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
46108 }
46109
46110 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) {
46111         LDKCommonAcceptChannelFields this_ptr_conv;
46112         this_ptr_conv.inner = untag_ptr(this_ptr);
46113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46115         this_ptr_conv.is_owned = false;
46116         int64_t ret_conv = CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
46117         return ret_conv;
46118 }
46119
46120 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) {
46121         LDKCommonAcceptChannelFields this_ptr_conv;
46122         this_ptr_conv.inner = untag_ptr(this_ptr);
46123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46125         this_ptr_conv.is_owned = false;
46126         CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
46127 }
46128
46129 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_htlc_minimum_msat"))) TS_CommonAcceptChannelFields_get_htlc_minimum_msat(uint64_t this_ptr) {
46130         LDKCommonAcceptChannelFields this_ptr_conv;
46131         this_ptr_conv.inner = untag_ptr(this_ptr);
46132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46134         this_ptr_conv.is_owned = false;
46135         int64_t ret_conv = CommonAcceptChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
46136         return ret_conv;
46137 }
46138
46139 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_htlc_minimum_msat"))) TS_CommonAcceptChannelFields_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
46140         LDKCommonAcceptChannelFields this_ptr_conv;
46141         this_ptr_conv.inner = untag_ptr(this_ptr);
46142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46144         this_ptr_conv.is_owned = false;
46145         CommonAcceptChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
46146 }
46147
46148 int32_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_minimum_depth"))) TS_CommonAcceptChannelFields_get_minimum_depth(uint64_t this_ptr) {
46149         LDKCommonAcceptChannelFields this_ptr_conv;
46150         this_ptr_conv.inner = untag_ptr(this_ptr);
46151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46153         this_ptr_conv.is_owned = false;
46154         int32_t ret_conv = CommonAcceptChannelFields_get_minimum_depth(&this_ptr_conv);
46155         return ret_conv;
46156 }
46157
46158 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_minimum_depth"))) TS_CommonAcceptChannelFields_set_minimum_depth(uint64_t this_ptr, int32_t val) {
46159         LDKCommonAcceptChannelFields this_ptr_conv;
46160         this_ptr_conv.inner = untag_ptr(this_ptr);
46161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46163         this_ptr_conv.is_owned = false;
46164         CommonAcceptChannelFields_set_minimum_depth(&this_ptr_conv, val);
46165 }
46166
46167 int16_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_to_self_delay"))) TS_CommonAcceptChannelFields_get_to_self_delay(uint64_t this_ptr) {
46168         LDKCommonAcceptChannelFields this_ptr_conv;
46169         this_ptr_conv.inner = untag_ptr(this_ptr);
46170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46172         this_ptr_conv.is_owned = false;
46173         int16_t ret_conv = CommonAcceptChannelFields_get_to_self_delay(&this_ptr_conv);
46174         return ret_conv;
46175 }
46176
46177 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_to_self_delay"))) TS_CommonAcceptChannelFields_set_to_self_delay(uint64_t this_ptr, int16_t val) {
46178         LDKCommonAcceptChannelFields this_ptr_conv;
46179         this_ptr_conv.inner = untag_ptr(this_ptr);
46180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46182         this_ptr_conv.is_owned = false;
46183         CommonAcceptChannelFields_set_to_self_delay(&this_ptr_conv, val);
46184 }
46185
46186 int16_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_max_accepted_htlcs"))) TS_CommonAcceptChannelFields_get_max_accepted_htlcs(uint64_t this_ptr) {
46187         LDKCommonAcceptChannelFields this_ptr_conv;
46188         this_ptr_conv.inner = untag_ptr(this_ptr);
46189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46191         this_ptr_conv.is_owned = false;
46192         int16_t ret_conv = CommonAcceptChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
46193         return ret_conv;
46194 }
46195
46196 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_max_accepted_htlcs"))) TS_CommonAcceptChannelFields_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
46197         LDKCommonAcceptChannelFields this_ptr_conv;
46198         this_ptr_conv.inner = untag_ptr(this_ptr);
46199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46201         this_ptr_conv.is_owned = false;
46202         CommonAcceptChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
46203 }
46204
46205 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_funding_pubkey"))) TS_CommonAcceptChannelFields_get_funding_pubkey(uint64_t this_ptr) {
46206         LDKCommonAcceptChannelFields this_ptr_conv;
46207         this_ptr_conv.inner = untag_ptr(this_ptr);
46208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46210         this_ptr_conv.is_owned = false;
46211         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46212         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
46213         return ret_arr;
46214 }
46215
46216 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_funding_pubkey"))) TS_CommonAcceptChannelFields_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
46217         LDKCommonAcceptChannelFields this_ptr_conv;
46218         this_ptr_conv.inner = untag_ptr(this_ptr);
46219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46221         this_ptr_conv.is_owned = false;
46222         LDKPublicKey val_ref;
46223         CHECK(val->arr_len == 33);
46224         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46225         CommonAcceptChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
46226 }
46227
46228 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_revocation_basepoint"))) TS_CommonAcceptChannelFields_get_revocation_basepoint(uint64_t this_ptr) {
46229         LDKCommonAcceptChannelFields this_ptr_conv;
46230         this_ptr_conv.inner = untag_ptr(this_ptr);
46231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46233         this_ptr_conv.is_owned = false;
46234         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46235         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
46236         return ret_arr;
46237 }
46238
46239 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_revocation_basepoint"))) TS_CommonAcceptChannelFields_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
46240         LDKCommonAcceptChannelFields this_ptr_conv;
46241         this_ptr_conv.inner = untag_ptr(this_ptr);
46242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46244         this_ptr_conv.is_owned = false;
46245         LDKPublicKey val_ref;
46246         CHECK(val->arr_len == 33);
46247         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46248         CommonAcceptChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
46249 }
46250
46251 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_payment_basepoint"))) TS_CommonAcceptChannelFields_get_payment_basepoint(uint64_t this_ptr) {
46252         LDKCommonAcceptChannelFields this_ptr_conv;
46253         this_ptr_conv.inner = untag_ptr(this_ptr);
46254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46256         this_ptr_conv.is_owned = false;
46257         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46258         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
46259         return ret_arr;
46260 }
46261
46262 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_payment_basepoint"))) TS_CommonAcceptChannelFields_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
46263         LDKCommonAcceptChannelFields this_ptr_conv;
46264         this_ptr_conv.inner = untag_ptr(this_ptr);
46265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46267         this_ptr_conv.is_owned = false;
46268         LDKPublicKey val_ref;
46269         CHECK(val->arr_len == 33);
46270         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46271         CommonAcceptChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
46272 }
46273
46274 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_delayed_payment_basepoint"))) TS_CommonAcceptChannelFields_get_delayed_payment_basepoint(uint64_t this_ptr) {
46275         LDKCommonAcceptChannelFields this_ptr_conv;
46276         this_ptr_conv.inner = untag_ptr(this_ptr);
46277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46279         this_ptr_conv.is_owned = false;
46280         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46281         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
46282         return ret_arr;
46283 }
46284
46285 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_delayed_payment_basepoint"))) TS_CommonAcceptChannelFields_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
46286         LDKCommonAcceptChannelFields this_ptr_conv;
46287         this_ptr_conv.inner = untag_ptr(this_ptr);
46288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46290         this_ptr_conv.is_owned = false;
46291         LDKPublicKey val_ref;
46292         CHECK(val->arr_len == 33);
46293         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46294         CommonAcceptChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
46295 }
46296
46297 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_htlc_basepoint"))) TS_CommonAcceptChannelFields_get_htlc_basepoint(uint64_t this_ptr) {
46298         LDKCommonAcceptChannelFields this_ptr_conv;
46299         this_ptr_conv.inner = untag_ptr(this_ptr);
46300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46302         this_ptr_conv.is_owned = false;
46303         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46304         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
46305         return ret_arr;
46306 }
46307
46308 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_htlc_basepoint"))) TS_CommonAcceptChannelFields_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
46309         LDKCommonAcceptChannelFields this_ptr_conv;
46310         this_ptr_conv.inner = untag_ptr(this_ptr);
46311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46313         this_ptr_conv.is_owned = false;
46314         LDKPublicKey val_ref;
46315         CHECK(val->arr_len == 33);
46316         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46317         CommonAcceptChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
46318 }
46319
46320 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_first_per_commitment_point"))) TS_CommonAcceptChannelFields_get_first_per_commitment_point(uint64_t this_ptr) {
46321         LDKCommonAcceptChannelFields this_ptr_conv;
46322         this_ptr_conv.inner = untag_ptr(this_ptr);
46323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46325         this_ptr_conv.is_owned = false;
46326         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46327         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
46328         return ret_arr;
46329 }
46330
46331 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) {
46332         LDKCommonAcceptChannelFields this_ptr_conv;
46333         this_ptr_conv.inner = untag_ptr(this_ptr);
46334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46336         this_ptr_conv.is_owned = false;
46337         LDKPublicKey val_ref;
46338         CHECK(val->arr_len == 33);
46339         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46340         CommonAcceptChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
46341 }
46342
46343 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_shutdown_scriptpubkey"))) TS_CommonAcceptChannelFields_get_shutdown_scriptpubkey(uint64_t this_ptr) {
46344         LDKCommonAcceptChannelFields this_ptr_conv;
46345         this_ptr_conv.inner = untag_ptr(this_ptr);
46346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46348         this_ptr_conv.is_owned = false;
46349         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
46350         *ret_copy = CommonAcceptChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
46351         uint64_t ret_ref = tag_ptr(ret_copy, true);
46352         return ret_ref;
46353 }
46354
46355 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_shutdown_scriptpubkey"))) TS_CommonAcceptChannelFields_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
46356         LDKCommonAcceptChannelFields this_ptr_conv;
46357         this_ptr_conv.inner = untag_ptr(this_ptr);
46358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46360         this_ptr_conv.is_owned = false;
46361         void* val_ptr = untag_ptr(val);
46362         CHECK_ACCESS(val_ptr);
46363         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
46364         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
46365         CommonAcceptChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
46366 }
46367
46368 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_channel_type"))) TS_CommonAcceptChannelFields_get_channel_type(uint64_t this_ptr) {
46369         LDKCommonAcceptChannelFields this_ptr_conv;
46370         this_ptr_conv.inner = untag_ptr(this_ptr);
46371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46373         this_ptr_conv.is_owned = false;
46374         LDKChannelTypeFeatures ret_var = CommonAcceptChannelFields_get_channel_type(&this_ptr_conv);
46375         uint64_t ret_ref = 0;
46376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46378         return ret_ref;
46379 }
46380
46381 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_channel_type"))) TS_CommonAcceptChannelFields_set_channel_type(uint64_t this_ptr, uint64_t val) {
46382         LDKCommonAcceptChannelFields this_ptr_conv;
46383         this_ptr_conv.inner = untag_ptr(this_ptr);
46384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46386         this_ptr_conv.is_owned = false;
46387         LDKChannelTypeFeatures val_conv;
46388         val_conv.inner = untag_ptr(val);
46389         val_conv.is_owned = ptr_is_owned(val);
46390         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46391         val_conv = ChannelTypeFeatures_clone(&val_conv);
46392         CommonAcceptChannelFields_set_channel_type(&this_ptr_conv, val_conv);
46393 }
46394
46395 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) {
46396         LDKChannelId temporary_channel_id_arg_conv;
46397         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
46398         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
46399         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
46400         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
46401         LDKPublicKey funding_pubkey_arg_ref;
46402         CHECK(funding_pubkey_arg->arr_len == 33);
46403         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
46404         LDKPublicKey revocation_basepoint_arg_ref;
46405         CHECK(revocation_basepoint_arg->arr_len == 33);
46406         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
46407         LDKPublicKey payment_basepoint_arg_ref;
46408         CHECK(payment_basepoint_arg->arr_len == 33);
46409         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
46410         LDKPublicKey delayed_payment_basepoint_arg_ref;
46411         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
46412         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
46413         LDKPublicKey htlc_basepoint_arg_ref;
46414         CHECK(htlc_basepoint_arg->arr_len == 33);
46415         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
46416         LDKPublicKey first_per_commitment_point_arg_ref;
46417         CHECK(first_per_commitment_point_arg->arr_len == 33);
46418         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
46419         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
46420         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
46421         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
46422         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
46423         LDKChannelTypeFeatures channel_type_arg_conv;
46424         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
46425         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
46426         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
46427         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
46428         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);
46429         uint64_t ret_ref = 0;
46430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46432         return ret_ref;
46433 }
46434
46435 static inline uint64_t CommonAcceptChannelFields_clone_ptr(LDKCommonAcceptChannelFields *NONNULL_PTR arg) {
46436         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(arg);
46437         uint64_t ret_ref = 0;
46438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46440         return ret_ref;
46441 }
46442 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_clone_ptr"))) TS_CommonAcceptChannelFields_clone_ptr(uint64_t arg) {
46443         LDKCommonAcceptChannelFields arg_conv;
46444         arg_conv.inner = untag_ptr(arg);
46445         arg_conv.is_owned = ptr_is_owned(arg);
46446         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46447         arg_conv.is_owned = false;
46448         int64_t ret_conv = CommonAcceptChannelFields_clone_ptr(&arg_conv);
46449         return ret_conv;
46450 }
46451
46452 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_clone"))) TS_CommonAcceptChannelFields_clone(uint64_t orig) {
46453         LDKCommonAcceptChannelFields orig_conv;
46454         orig_conv.inner = untag_ptr(orig);
46455         orig_conv.is_owned = ptr_is_owned(orig);
46456         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46457         orig_conv.is_owned = false;
46458         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(&orig_conv);
46459         uint64_t ret_ref = 0;
46460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46462         return ret_ref;
46463 }
46464
46465 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_hash"))) TS_CommonAcceptChannelFields_hash(uint64_t o) {
46466         LDKCommonAcceptChannelFields o_conv;
46467         o_conv.inner = untag_ptr(o);
46468         o_conv.is_owned = ptr_is_owned(o);
46469         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46470         o_conv.is_owned = false;
46471         int64_t ret_conv = CommonAcceptChannelFields_hash(&o_conv);
46472         return ret_conv;
46473 }
46474
46475 jboolean  __attribute__((export_name("TS_CommonAcceptChannelFields_eq"))) TS_CommonAcceptChannelFields_eq(uint64_t a, uint64_t b) {
46476         LDKCommonAcceptChannelFields a_conv;
46477         a_conv.inner = untag_ptr(a);
46478         a_conv.is_owned = ptr_is_owned(a);
46479         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46480         a_conv.is_owned = false;
46481         LDKCommonAcceptChannelFields b_conv;
46482         b_conv.inner = untag_ptr(b);
46483         b_conv.is_owned = ptr_is_owned(b);
46484         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46485         b_conv.is_owned = false;
46486         jboolean ret_conv = CommonAcceptChannelFields_eq(&a_conv, &b_conv);
46487         return ret_conv;
46488 }
46489
46490 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
46491         LDKAcceptChannel this_obj_conv;
46492         this_obj_conv.inner = untag_ptr(this_obj);
46493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46495         AcceptChannel_free(this_obj_conv);
46496 }
46497
46498 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_common_fields"))) TS_AcceptChannel_get_common_fields(uint64_t this_ptr) {
46499         LDKAcceptChannel this_ptr_conv;
46500         this_ptr_conv.inner = untag_ptr(this_ptr);
46501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46503         this_ptr_conv.is_owned = false;
46504         LDKCommonAcceptChannelFields ret_var = AcceptChannel_get_common_fields(&this_ptr_conv);
46505         uint64_t ret_ref = 0;
46506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46508         return ret_ref;
46509 }
46510
46511 void  __attribute__((export_name("TS_AcceptChannel_set_common_fields"))) TS_AcceptChannel_set_common_fields(uint64_t this_ptr, uint64_t val) {
46512         LDKAcceptChannel this_ptr_conv;
46513         this_ptr_conv.inner = untag_ptr(this_ptr);
46514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46516         this_ptr_conv.is_owned = false;
46517         LDKCommonAcceptChannelFields val_conv;
46518         val_conv.inner = untag_ptr(val);
46519         val_conv.is_owned = ptr_is_owned(val);
46520         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46521         val_conv = CommonAcceptChannelFields_clone(&val_conv);
46522         AcceptChannel_set_common_fields(&this_ptr_conv, val_conv);
46523 }
46524
46525 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
46526         LDKAcceptChannel this_ptr_conv;
46527         this_ptr_conv.inner = untag_ptr(this_ptr);
46528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46530         this_ptr_conv.is_owned = false;
46531         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
46532         return ret_conv;
46533 }
46534
46535 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
46536         LDKAcceptChannel this_ptr_conv;
46537         this_ptr_conv.inner = untag_ptr(this_ptr);
46538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46540         this_ptr_conv.is_owned = false;
46541         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
46542 }
46543
46544 uint64_t  __attribute__((export_name("TS_AcceptChannel_new"))) TS_AcceptChannel_new(uint64_t common_fields_arg, int64_t channel_reserve_satoshis_arg) {
46545         LDKCommonAcceptChannelFields common_fields_arg_conv;
46546         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
46547         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
46548         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
46549         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
46550         LDKAcceptChannel ret_var = AcceptChannel_new(common_fields_arg_conv, channel_reserve_satoshis_arg);
46551         uint64_t ret_ref = 0;
46552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46554         return ret_ref;
46555 }
46556
46557 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
46558         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
46559         uint64_t ret_ref = 0;
46560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46562         return ret_ref;
46563 }
46564 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
46565         LDKAcceptChannel arg_conv;
46566         arg_conv.inner = untag_ptr(arg);
46567         arg_conv.is_owned = ptr_is_owned(arg);
46568         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46569         arg_conv.is_owned = false;
46570         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
46571         return ret_conv;
46572 }
46573
46574 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
46575         LDKAcceptChannel orig_conv;
46576         orig_conv.inner = untag_ptr(orig);
46577         orig_conv.is_owned = ptr_is_owned(orig);
46578         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46579         orig_conv.is_owned = false;
46580         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
46581         uint64_t ret_ref = 0;
46582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46584         return ret_ref;
46585 }
46586
46587 int64_t  __attribute__((export_name("TS_AcceptChannel_hash"))) TS_AcceptChannel_hash(uint64_t o) {
46588         LDKAcceptChannel o_conv;
46589         o_conv.inner = untag_ptr(o);
46590         o_conv.is_owned = ptr_is_owned(o);
46591         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46592         o_conv.is_owned = false;
46593         int64_t ret_conv = AcceptChannel_hash(&o_conv);
46594         return ret_conv;
46595 }
46596
46597 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
46598         LDKAcceptChannel a_conv;
46599         a_conv.inner = untag_ptr(a);
46600         a_conv.is_owned = ptr_is_owned(a);
46601         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46602         a_conv.is_owned = false;
46603         LDKAcceptChannel b_conv;
46604         b_conv.inner = untag_ptr(b);
46605         b_conv.is_owned = ptr_is_owned(b);
46606         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46607         b_conv.is_owned = false;
46608         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
46609         return ret_conv;
46610 }
46611
46612 void  __attribute__((export_name("TS_AcceptChannelV2_free"))) TS_AcceptChannelV2_free(uint64_t this_obj) {
46613         LDKAcceptChannelV2 this_obj_conv;
46614         this_obj_conv.inner = untag_ptr(this_obj);
46615         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46617         AcceptChannelV2_free(this_obj_conv);
46618 }
46619
46620 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_common_fields"))) TS_AcceptChannelV2_get_common_fields(uint64_t this_ptr) {
46621         LDKAcceptChannelV2 this_ptr_conv;
46622         this_ptr_conv.inner = untag_ptr(this_ptr);
46623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46625         this_ptr_conv.is_owned = false;
46626         LDKCommonAcceptChannelFields ret_var = AcceptChannelV2_get_common_fields(&this_ptr_conv);
46627         uint64_t ret_ref = 0;
46628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46630         return ret_ref;
46631 }
46632
46633 void  __attribute__((export_name("TS_AcceptChannelV2_set_common_fields"))) TS_AcceptChannelV2_set_common_fields(uint64_t this_ptr, uint64_t val) {
46634         LDKAcceptChannelV2 this_ptr_conv;
46635         this_ptr_conv.inner = untag_ptr(this_ptr);
46636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46638         this_ptr_conv.is_owned = false;
46639         LDKCommonAcceptChannelFields val_conv;
46640         val_conv.inner = untag_ptr(val);
46641         val_conv.is_owned = ptr_is_owned(val);
46642         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46643         val_conv = CommonAcceptChannelFields_clone(&val_conv);
46644         AcceptChannelV2_set_common_fields(&this_ptr_conv, val_conv);
46645 }
46646
46647 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_funding_satoshis"))) TS_AcceptChannelV2_get_funding_satoshis(uint64_t this_ptr) {
46648         LDKAcceptChannelV2 this_ptr_conv;
46649         this_ptr_conv.inner = untag_ptr(this_ptr);
46650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46652         this_ptr_conv.is_owned = false;
46653         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
46654         return ret_conv;
46655 }
46656
46657 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_satoshis"))) TS_AcceptChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
46658         LDKAcceptChannelV2 this_ptr_conv;
46659         this_ptr_conv.inner = untag_ptr(this_ptr);
46660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46662         this_ptr_conv.is_owned = false;
46663         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
46664 }
46665
46666 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_second_per_commitment_point"))) TS_AcceptChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
46667         LDKAcceptChannelV2 this_ptr_conv;
46668         this_ptr_conv.inner = untag_ptr(this_ptr);
46669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46671         this_ptr_conv.is_owned = false;
46672         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46673         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
46674         return ret_arr;
46675 }
46676
46677 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) {
46678         LDKAcceptChannelV2 this_ptr_conv;
46679         this_ptr_conv.inner = untag_ptr(this_ptr);
46680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46682         this_ptr_conv.is_owned = false;
46683         LDKPublicKey val_ref;
46684         CHECK(val->arr_len == 33);
46685         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46686         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
46687 }
46688
46689 uint32_t  __attribute__((export_name("TS_AcceptChannelV2_get_require_confirmed_inputs"))) TS_AcceptChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
46690         LDKAcceptChannelV2 this_ptr_conv;
46691         this_ptr_conv.inner = untag_ptr(this_ptr);
46692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46694         this_ptr_conv.is_owned = false;
46695         uint32_t ret_conv = LDKCOption_NoneZ_to_js(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
46696         return ret_conv;
46697 }
46698
46699 void  __attribute__((export_name("TS_AcceptChannelV2_set_require_confirmed_inputs"))) TS_AcceptChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
46700         LDKAcceptChannelV2 this_ptr_conv;
46701         this_ptr_conv.inner = untag_ptr(this_ptr);
46702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46704         this_ptr_conv.is_owned = false;
46705         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
46706         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
46707 }
46708
46709 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) {
46710         LDKCommonAcceptChannelFields common_fields_arg_conv;
46711         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
46712         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
46713         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
46714         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
46715         LDKPublicKey second_per_commitment_point_arg_ref;
46716         CHECK(second_per_commitment_point_arg->arr_len == 33);
46717         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
46718         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
46719         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(common_fields_arg_conv, funding_satoshis_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
46720         uint64_t ret_ref = 0;
46721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46723         return ret_ref;
46724 }
46725
46726 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
46727         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
46728         uint64_t ret_ref = 0;
46729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46731         return ret_ref;
46732 }
46733 int64_t  __attribute__((export_name("TS_AcceptChannelV2_clone_ptr"))) TS_AcceptChannelV2_clone_ptr(uint64_t arg) {
46734         LDKAcceptChannelV2 arg_conv;
46735         arg_conv.inner = untag_ptr(arg);
46736         arg_conv.is_owned = ptr_is_owned(arg);
46737         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46738         arg_conv.is_owned = false;
46739         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
46740         return ret_conv;
46741 }
46742
46743 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_clone"))) TS_AcceptChannelV2_clone(uint64_t orig) {
46744         LDKAcceptChannelV2 orig_conv;
46745         orig_conv.inner = untag_ptr(orig);
46746         orig_conv.is_owned = ptr_is_owned(orig);
46747         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46748         orig_conv.is_owned = false;
46749         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
46750         uint64_t ret_ref = 0;
46751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46753         return ret_ref;
46754 }
46755
46756 int64_t  __attribute__((export_name("TS_AcceptChannelV2_hash"))) TS_AcceptChannelV2_hash(uint64_t o) {
46757         LDKAcceptChannelV2 o_conv;
46758         o_conv.inner = untag_ptr(o);
46759         o_conv.is_owned = ptr_is_owned(o);
46760         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46761         o_conv.is_owned = false;
46762         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
46763         return ret_conv;
46764 }
46765
46766 jboolean  __attribute__((export_name("TS_AcceptChannelV2_eq"))) TS_AcceptChannelV2_eq(uint64_t a, uint64_t b) {
46767         LDKAcceptChannelV2 a_conv;
46768         a_conv.inner = untag_ptr(a);
46769         a_conv.is_owned = ptr_is_owned(a);
46770         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46771         a_conv.is_owned = false;
46772         LDKAcceptChannelV2 b_conv;
46773         b_conv.inner = untag_ptr(b);
46774         b_conv.is_owned = ptr_is_owned(b);
46775         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46776         b_conv.is_owned = false;
46777         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
46778         return ret_conv;
46779 }
46780
46781 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
46782         LDKFundingCreated this_obj_conv;
46783         this_obj_conv.inner = untag_ptr(this_obj);
46784         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46786         FundingCreated_free(this_obj_conv);
46787 }
46788
46789 uint64_t  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
46790         LDKFundingCreated this_ptr_conv;
46791         this_ptr_conv.inner = untag_ptr(this_ptr);
46792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46794         this_ptr_conv.is_owned = false;
46795         LDKChannelId ret_var = FundingCreated_get_temporary_channel_id(&this_ptr_conv);
46796         uint64_t ret_ref = 0;
46797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46799         return ret_ref;
46800 }
46801
46802 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, uint64_t val) {
46803         LDKFundingCreated this_ptr_conv;
46804         this_ptr_conv.inner = untag_ptr(this_ptr);
46805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46807         this_ptr_conv.is_owned = false;
46808         LDKChannelId val_conv;
46809         val_conv.inner = untag_ptr(val);
46810         val_conv.is_owned = ptr_is_owned(val);
46811         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46812         val_conv = ChannelId_clone(&val_conv);
46813         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_conv);
46814 }
46815
46816 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
46817         LDKFundingCreated this_ptr_conv;
46818         this_ptr_conv.inner = untag_ptr(this_ptr);
46819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46821         this_ptr_conv.is_owned = false;
46822         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46823         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
46824         return ret_arr;
46825 }
46826
46827 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
46828         LDKFundingCreated this_ptr_conv;
46829         this_ptr_conv.inner = untag_ptr(this_ptr);
46830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46832         this_ptr_conv.is_owned = false;
46833         LDKThirtyTwoBytes val_ref;
46834         CHECK(val->arr_len == 32);
46835         memcpy(val_ref.data, val->elems, 32); FREE(val);
46836         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
46837 }
46838
46839 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
46840         LDKFundingCreated this_ptr_conv;
46841         this_ptr_conv.inner = untag_ptr(this_ptr);
46842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46844         this_ptr_conv.is_owned = false;
46845         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
46846         return ret_conv;
46847 }
46848
46849 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
46850         LDKFundingCreated this_ptr_conv;
46851         this_ptr_conv.inner = untag_ptr(this_ptr);
46852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46854         this_ptr_conv.is_owned = false;
46855         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
46856 }
46857
46858 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
46859         LDKFundingCreated this_ptr_conv;
46860         this_ptr_conv.inner = untag_ptr(this_ptr);
46861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46863         this_ptr_conv.is_owned = false;
46864         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46865         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
46866         return ret_arr;
46867 }
46868
46869 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
46870         LDKFundingCreated this_ptr_conv;
46871         this_ptr_conv.inner = untag_ptr(this_ptr);
46872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46874         this_ptr_conv.is_owned = false;
46875         LDKECDSASignature val_ref;
46876         CHECK(val->arr_len == 64);
46877         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
46878         FundingCreated_set_signature(&this_ptr_conv, val_ref);
46879 }
46880
46881 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) {
46882         LDKChannelId temporary_channel_id_arg_conv;
46883         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
46884         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
46885         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
46886         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
46887         LDKThirtyTwoBytes funding_txid_arg_ref;
46888         CHECK(funding_txid_arg->arr_len == 32);
46889         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
46890         LDKECDSASignature signature_arg_ref;
46891         CHECK(signature_arg->arr_len == 64);
46892         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
46893         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
46894         uint64_t ret_ref = 0;
46895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46897         return ret_ref;
46898 }
46899
46900 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
46901         LDKFundingCreated ret_var = FundingCreated_clone(arg);
46902         uint64_t ret_ref = 0;
46903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46905         return ret_ref;
46906 }
46907 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
46908         LDKFundingCreated arg_conv;
46909         arg_conv.inner = untag_ptr(arg);
46910         arg_conv.is_owned = ptr_is_owned(arg);
46911         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46912         arg_conv.is_owned = false;
46913         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
46914         return ret_conv;
46915 }
46916
46917 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
46918         LDKFundingCreated orig_conv;
46919         orig_conv.inner = untag_ptr(orig);
46920         orig_conv.is_owned = ptr_is_owned(orig);
46921         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46922         orig_conv.is_owned = false;
46923         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
46924         uint64_t ret_ref = 0;
46925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46927         return ret_ref;
46928 }
46929
46930 int64_t  __attribute__((export_name("TS_FundingCreated_hash"))) TS_FundingCreated_hash(uint64_t o) {
46931         LDKFundingCreated o_conv;
46932         o_conv.inner = untag_ptr(o);
46933         o_conv.is_owned = ptr_is_owned(o);
46934         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46935         o_conv.is_owned = false;
46936         int64_t ret_conv = FundingCreated_hash(&o_conv);
46937         return ret_conv;
46938 }
46939
46940 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
46941         LDKFundingCreated a_conv;
46942         a_conv.inner = untag_ptr(a);
46943         a_conv.is_owned = ptr_is_owned(a);
46944         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46945         a_conv.is_owned = false;
46946         LDKFundingCreated b_conv;
46947         b_conv.inner = untag_ptr(b);
46948         b_conv.is_owned = ptr_is_owned(b);
46949         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46950         b_conv.is_owned = false;
46951         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
46952         return ret_conv;
46953 }
46954
46955 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
46956         LDKFundingSigned this_obj_conv;
46957         this_obj_conv.inner = untag_ptr(this_obj);
46958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46960         FundingSigned_free(this_obj_conv);
46961 }
46962
46963 uint64_t  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
46964         LDKFundingSigned this_ptr_conv;
46965         this_ptr_conv.inner = untag_ptr(this_ptr);
46966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46968         this_ptr_conv.is_owned = false;
46969         LDKChannelId ret_var = FundingSigned_get_channel_id(&this_ptr_conv);
46970         uint64_t ret_ref = 0;
46971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46973         return ret_ref;
46974 }
46975
46976 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, uint64_t val) {
46977         LDKFundingSigned this_ptr_conv;
46978         this_ptr_conv.inner = untag_ptr(this_ptr);
46979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46981         this_ptr_conv.is_owned = false;
46982         LDKChannelId val_conv;
46983         val_conv.inner = untag_ptr(val);
46984         val_conv.is_owned = ptr_is_owned(val);
46985         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46986         val_conv = ChannelId_clone(&val_conv);
46987         FundingSigned_set_channel_id(&this_ptr_conv, val_conv);
46988 }
46989
46990 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
46991         LDKFundingSigned this_ptr_conv;
46992         this_ptr_conv.inner = untag_ptr(this_ptr);
46993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46995         this_ptr_conv.is_owned = false;
46996         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46997         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
46998         return ret_arr;
46999 }
47000
47001 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
47002         LDKFundingSigned this_ptr_conv;
47003         this_ptr_conv.inner = untag_ptr(this_ptr);
47004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47006         this_ptr_conv.is_owned = false;
47007         LDKECDSASignature val_ref;
47008         CHECK(val->arr_len == 64);
47009         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47010         FundingSigned_set_signature(&this_ptr_conv, val_ref);
47011 }
47012
47013 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(uint64_t channel_id_arg, int8_tArray signature_arg) {
47014         LDKChannelId channel_id_arg_conv;
47015         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47016         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47017         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47018         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47019         LDKECDSASignature signature_arg_ref;
47020         CHECK(signature_arg->arr_len == 64);
47021         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
47022         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_conv, signature_arg_ref);
47023         uint64_t ret_ref = 0;
47024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47026         return ret_ref;
47027 }
47028
47029 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
47030         LDKFundingSigned ret_var = FundingSigned_clone(arg);
47031         uint64_t ret_ref = 0;
47032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47034         return ret_ref;
47035 }
47036 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
47037         LDKFundingSigned arg_conv;
47038         arg_conv.inner = untag_ptr(arg);
47039         arg_conv.is_owned = ptr_is_owned(arg);
47040         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47041         arg_conv.is_owned = false;
47042         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
47043         return ret_conv;
47044 }
47045
47046 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
47047         LDKFundingSigned orig_conv;
47048         orig_conv.inner = untag_ptr(orig);
47049         orig_conv.is_owned = ptr_is_owned(orig);
47050         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47051         orig_conv.is_owned = false;
47052         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
47053         uint64_t ret_ref = 0;
47054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47056         return ret_ref;
47057 }
47058
47059 int64_t  __attribute__((export_name("TS_FundingSigned_hash"))) TS_FundingSigned_hash(uint64_t o) {
47060         LDKFundingSigned o_conv;
47061         o_conv.inner = untag_ptr(o);
47062         o_conv.is_owned = ptr_is_owned(o);
47063         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47064         o_conv.is_owned = false;
47065         int64_t ret_conv = FundingSigned_hash(&o_conv);
47066         return ret_conv;
47067 }
47068
47069 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
47070         LDKFundingSigned a_conv;
47071         a_conv.inner = untag_ptr(a);
47072         a_conv.is_owned = ptr_is_owned(a);
47073         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47074         a_conv.is_owned = false;
47075         LDKFundingSigned b_conv;
47076         b_conv.inner = untag_ptr(b);
47077         b_conv.is_owned = ptr_is_owned(b);
47078         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47079         b_conv.is_owned = false;
47080         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
47081         return ret_conv;
47082 }
47083
47084 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
47085         LDKChannelReady this_obj_conv;
47086         this_obj_conv.inner = untag_ptr(this_obj);
47087         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47089         ChannelReady_free(this_obj_conv);
47090 }
47091
47092 uint64_t  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
47093         LDKChannelReady this_ptr_conv;
47094         this_ptr_conv.inner = untag_ptr(this_ptr);
47095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47097         this_ptr_conv.is_owned = false;
47098         LDKChannelId ret_var = ChannelReady_get_channel_id(&this_ptr_conv);
47099         uint64_t ret_ref = 0;
47100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47102         return ret_ref;
47103 }
47104
47105 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, uint64_t val) {
47106         LDKChannelReady this_ptr_conv;
47107         this_ptr_conv.inner = untag_ptr(this_ptr);
47108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47110         this_ptr_conv.is_owned = false;
47111         LDKChannelId val_conv;
47112         val_conv.inner = untag_ptr(val);
47113         val_conv.is_owned = ptr_is_owned(val);
47114         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47115         val_conv = ChannelId_clone(&val_conv);
47116         ChannelReady_set_channel_id(&this_ptr_conv, val_conv);
47117 }
47118
47119 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
47120         LDKChannelReady this_ptr_conv;
47121         this_ptr_conv.inner = untag_ptr(this_ptr);
47122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47124         this_ptr_conv.is_owned = false;
47125         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47126         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47127         return ret_arr;
47128 }
47129
47130 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) {
47131         LDKChannelReady this_ptr_conv;
47132         this_ptr_conv.inner = untag_ptr(this_ptr);
47133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47135         this_ptr_conv.is_owned = false;
47136         LDKPublicKey val_ref;
47137         CHECK(val->arr_len == 33);
47138         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47139         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
47140 }
47141
47142 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
47143         LDKChannelReady this_ptr_conv;
47144         this_ptr_conv.inner = untag_ptr(this_ptr);
47145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47147         this_ptr_conv.is_owned = false;
47148         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47149         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
47150         uint64_t ret_ref = tag_ptr(ret_copy, true);
47151         return ret_ref;
47152 }
47153
47154 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) {
47155         LDKChannelReady this_ptr_conv;
47156         this_ptr_conv.inner = untag_ptr(this_ptr);
47157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47159         this_ptr_conv.is_owned = false;
47160         void* val_ptr = untag_ptr(val);
47161         CHECK_ACCESS(val_ptr);
47162         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47163         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47164         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
47165 }
47166
47167 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) {
47168         LDKChannelId channel_id_arg_conv;
47169         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47170         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47171         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47172         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47173         LDKPublicKey next_per_commitment_point_arg_ref;
47174         CHECK(next_per_commitment_point_arg->arr_len == 33);
47175         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
47176         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
47177         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
47178         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
47179         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
47180         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_conv, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
47181         uint64_t ret_ref = 0;
47182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47184         return ret_ref;
47185 }
47186
47187 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
47188         LDKChannelReady ret_var = ChannelReady_clone(arg);
47189         uint64_t ret_ref = 0;
47190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47192         return ret_ref;
47193 }
47194 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
47195         LDKChannelReady arg_conv;
47196         arg_conv.inner = untag_ptr(arg);
47197         arg_conv.is_owned = ptr_is_owned(arg);
47198         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47199         arg_conv.is_owned = false;
47200         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
47201         return ret_conv;
47202 }
47203
47204 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
47205         LDKChannelReady orig_conv;
47206         orig_conv.inner = untag_ptr(orig);
47207         orig_conv.is_owned = ptr_is_owned(orig);
47208         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47209         orig_conv.is_owned = false;
47210         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
47211         uint64_t ret_ref = 0;
47212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47214         return ret_ref;
47215 }
47216
47217 int64_t  __attribute__((export_name("TS_ChannelReady_hash"))) TS_ChannelReady_hash(uint64_t o) {
47218         LDKChannelReady o_conv;
47219         o_conv.inner = untag_ptr(o);
47220         o_conv.is_owned = ptr_is_owned(o);
47221         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47222         o_conv.is_owned = false;
47223         int64_t ret_conv = ChannelReady_hash(&o_conv);
47224         return ret_conv;
47225 }
47226
47227 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
47228         LDKChannelReady a_conv;
47229         a_conv.inner = untag_ptr(a);
47230         a_conv.is_owned = ptr_is_owned(a);
47231         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47232         a_conv.is_owned = false;
47233         LDKChannelReady b_conv;
47234         b_conv.inner = untag_ptr(b);
47235         b_conv.is_owned = ptr_is_owned(b);
47236         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47237         b_conv.is_owned = false;
47238         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
47239         return ret_conv;
47240 }
47241
47242 void  __attribute__((export_name("TS_Stfu_free"))) TS_Stfu_free(uint64_t this_obj) {
47243         LDKStfu this_obj_conv;
47244         this_obj_conv.inner = untag_ptr(this_obj);
47245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47247         Stfu_free(this_obj_conv);
47248 }
47249
47250 uint64_t  __attribute__((export_name("TS_Stfu_get_channel_id"))) TS_Stfu_get_channel_id(uint64_t this_ptr) {
47251         LDKStfu this_ptr_conv;
47252         this_ptr_conv.inner = untag_ptr(this_ptr);
47253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47255         this_ptr_conv.is_owned = false;
47256         LDKChannelId ret_var = Stfu_get_channel_id(&this_ptr_conv);
47257         uint64_t ret_ref = 0;
47258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47260         return ret_ref;
47261 }
47262
47263 void  __attribute__((export_name("TS_Stfu_set_channel_id"))) TS_Stfu_set_channel_id(uint64_t this_ptr, uint64_t val) {
47264         LDKStfu this_ptr_conv;
47265         this_ptr_conv.inner = untag_ptr(this_ptr);
47266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47268         this_ptr_conv.is_owned = false;
47269         LDKChannelId val_conv;
47270         val_conv.inner = untag_ptr(val);
47271         val_conv.is_owned = ptr_is_owned(val);
47272         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47273         val_conv = ChannelId_clone(&val_conv);
47274         Stfu_set_channel_id(&this_ptr_conv, val_conv);
47275 }
47276
47277 int8_t  __attribute__((export_name("TS_Stfu_get_initiator"))) TS_Stfu_get_initiator(uint64_t this_ptr) {
47278         LDKStfu this_ptr_conv;
47279         this_ptr_conv.inner = untag_ptr(this_ptr);
47280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47282         this_ptr_conv.is_owned = false;
47283         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
47284         return ret_conv;
47285 }
47286
47287 void  __attribute__((export_name("TS_Stfu_set_initiator"))) TS_Stfu_set_initiator(uint64_t this_ptr, int8_t val) {
47288         LDKStfu this_ptr_conv;
47289         this_ptr_conv.inner = untag_ptr(this_ptr);
47290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47292         this_ptr_conv.is_owned = false;
47293         Stfu_set_initiator(&this_ptr_conv, val);
47294 }
47295
47296 uint64_t  __attribute__((export_name("TS_Stfu_new"))) TS_Stfu_new(uint64_t channel_id_arg, int8_t initiator_arg) {
47297         LDKChannelId channel_id_arg_conv;
47298         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47299         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47300         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47301         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47302         LDKStfu ret_var = Stfu_new(channel_id_arg_conv, initiator_arg);
47303         uint64_t ret_ref = 0;
47304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47306         return ret_ref;
47307 }
47308
47309 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
47310         LDKStfu ret_var = Stfu_clone(arg);
47311         uint64_t ret_ref = 0;
47312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47314         return ret_ref;
47315 }
47316 int64_t  __attribute__((export_name("TS_Stfu_clone_ptr"))) TS_Stfu_clone_ptr(uint64_t arg) {
47317         LDKStfu arg_conv;
47318         arg_conv.inner = untag_ptr(arg);
47319         arg_conv.is_owned = ptr_is_owned(arg);
47320         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47321         arg_conv.is_owned = false;
47322         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
47323         return ret_conv;
47324 }
47325
47326 uint64_t  __attribute__((export_name("TS_Stfu_clone"))) TS_Stfu_clone(uint64_t orig) {
47327         LDKStfu orig_conv;
47328         orig_conv.inner = untag_ptr(orig);
47329         orig_conv.is_owned = ptr_is_owned(orig);
47330         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47331         orig_conv.is_owned = false;
47332         LDKStfu ret_var = Stfu_clone(&orig_conv);
47333         uint64_t ret_ref = 0;
47334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47336         return ret_ref;
47337 }
47338
47339 jboolean  __attribute__((export_name("TS_Stfu_eq"))) TS_Stfu_eq(uint64_t a, uint64_t b) {
47340         LDKStfu a_conv;
47341         a_conv.inner = untag_ptr(a);
47342         a_conv.is_owned = ptr_is_owned(a);
47343         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47344         a_conv.is_owned = false;
47345         LDKStfu b_conv;
47346         b_conv.inner = untag_ptr(b);
47347         b_conv.is_owned = ptr_is_owned(b);
47348         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47349         b_conv.is_owned = false;
47350         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
47351         return ret_conv;
47352 }
47353
47354 void  __attribute__((export_name("TS_Splice_free"))) TS_Splice_free(uint64_t this_obj) {
47355         LDKSplice this_obj_conv;
47356         this_obj_conv.inner = untag_ptr(this_obj);
47357         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47359         Splice_free(this_obj_conv);
47360 }
47361
47362 uint64_t  __attribute__((export_name("TS_Splice_get_channel_id"))) TS_Splice_get_channel_id(uint64_t this_ptr) {
47363         LDKSplice this_ptr_conv;
47364         this_ptr_conv.inner = untag_ptr(this_ptr);
47365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47367         this_ptr_conv.is_owned = false;
47368         LDKChannelId ret_var = Splice_get_channel_id(&this_ptr_conv);
47369         uint64_t ret_ref = 0;
47370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47372         return ret_ref;
47373 }
47374
47375 void  __attribute__((export_name("TS_Splice_set_channel_id"))) TS_Splice_set_channel_id(uint64_t this_ptr, uint64_t val) {
47376         LDKSplice this_ptr_conv;
47377         this_ptr_conv.inner = untag_ptr(this_ptr);
47378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47380         this_ptr_conv.is_owned = false;
47381         LDKChannelId val_conv;
47382         val_conv.inner = untag_ptr(val);
47383         val_conv.is_owned = ptr_is_owned(val);
47384         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47385         val_conv = ChannelId_clone(&val_conv);
47386         Splice_set_channel_id(&this_ptr_conv, val_conv);
47387 }
47388
47389 int8_tArray  __attribute__((export_name("TS_Splice_get_chain_hash"))) TS_Splice_get_chain_hash(uint64_t this_ptr) {
47390         LDKSplice this_ptr_conv;
47391         this_ptr_conv.inner = untag_ptr(this_ptr);
47392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47394         this_ptr_conv.is_owned = false;
47395         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47396         memcpy(ret_arr->elems, *Splice_get_chain_hash(&this_ptr_conv), 32);
47397         return ret_arr;
47398 }
47399
47400 void  __attribute__((export_name("TS_Splice_set_chain_hash"))) TS_Splice_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
47401         LDKSplice this_ptr_conv;
47402         this_ptr_conv.inner = untag_ptr(this_ptr);
47403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47405         this_ptr_conv.is_owned = false;
47406         LDKThirtyTwoBytes val_ref;
47407         CHECK(val->arr_len == 32);
47408         memcpy(val_ref.data, val->elems, 32); FREE(val);
47409         Splice_set_chain_hash(&this_ptr_conv, val_ref);
47410 }
47411
47412 int64_t  __attribute__((export_name("TS_Splice_get_relative_satoshis"))) TS_Splice_get_relative_satoshis(uint64_t this_ptr) {
47413         LDKSplice this_ptr_conv;
47414         this_ptr_conv.inner = untag_ptr(this_ptr);
47415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47417         this_ptr_conv.is_owned = false;
47418         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
47419         return ret_conv;
47420 }
47421
47422 void  __attribute__((export_name("TS_Splice_set_relative_satoshis"))) TS_Splice_set_relative_satoshis(uint64_t this_ptr, int64_t val) {
47423         LDKSplice this_ptr_conv;
47424         this_ptr_conv.inner = untag_ptr(this_ptr);
47425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47427         this_ptr_conv.is_owned = false;
47428         Splice_set_relative_satoshis(&this_ptr_conv, val);
47429 }
47430
47431 int32_t  __attribute__((export_name("TS_Splice_get_funding_feerate_perkw"))) TS_Splice_get_funding_feerate_perkw(uint64_t this_ptr) {
47432         LDKSplice this_ptr_conv;
47433         this_ptr_conv.inner = untag_ptr(this_ptr);
47434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47436         this_ptr_conv.is_owned = false;
47437         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
47438         return ret_conv;
47439 }
47440
47441 void  __attribute__((export_name("TS_Splice_set_funding_feerate_perkw"))) TS_Splice_set_funding_feerate_perkw(uint64_t this_ptr, int32_t val) {
47442         LDKSplice this_ptr_conv;
47443         this_ptr_conv.inner = untag_ptr(this_ptr);
47444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47446         this_ptr_conv.is_owned = false;
47447         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
47448 }
47449
47450 int32_t  __attribute__((export_name("TS_Splice_get_locktime"))) TS_Splice_get_locktime(uint64_t this_ptr) {
47451         LDKSplice this_ptr_conv;
47452         this_ptr_conv.inner = untag_ptr(this_ptr);
47453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47455         this_ptr_conv.is_owned = false;
47456         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
47457         return ret_conv;
47458 }
47459
47460 void  __attribute__((export_name("TS_Splice_set_locktime"))) TS_Splice_set_locktime(uint64_t this_ptr, int32_t val) {
47461         LDKSplice this_ptr_conv;
47462         this_ptr_conv.inner = untag_ptr(this_ptr);
47463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47465         this_ptr_conv.is_owned = false;
47466         Splice_set_locktime(&this_ptr_conv, val);
47467 }
47468
47469 int8_tArray  __attribute__((export_name("TS_Splice_get_funding_pubkey"))) TS_Splice_get_funding_pubkey(uint64_t this_ptr) {
47470         LDKSplice this_ptr_conv;
47471         this_ptr_conv.inner = untag_ptr(this_ptr);
47472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47474         this_ptr_conv.is_owned = false;
47475         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47476         memcpy(ret_arr->elems, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
47477         return ret_arr;
47478 }
47479
47480 void  __attribute__((export_name("TS_Splice_set_funding_pubkey"))) TS_Splice_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
47481         LDKSplice this_ptr_conv;
47482         this_ptr_conv.inner = untag_ptr(this_ptr);
47483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47485         this_ptr_conv.is_owned = false;
47486         LDKPublicKey val_ref;
47487         CHECK(val->arr_len == 33);
47488         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47489         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
47490 }
47491
47492 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) {
47493         LDKChannelId channel_id_arg_conv;
47494         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47495         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47496         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47497         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47498         LDKThirtyTwoBytes chain_hash_arg_ref;
47499         CHECK(chain_hash_arg->arr_len == 32);
47500         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
47501         LDKPublicKey funding_pubkey_arg_ref;
47502         CHECK(funding_pubkey_arg->arr_len == 33);
47503         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
47504         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);
47505         uint64_t ret_ref = 0;
47506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47508         return ret_ref;
47509 }
47510
47511 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
47512         LDKSplice ret_var = Splice_clone(arg);
47513         uint64_t ret_ref = 0;
47514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47516         return ret_ref;
47517 }
47518 int64_t  __attribute__((export_name("TS_Splice_clone_ptr"))) TS_Splice_clone_ptr(uint64_t arg) {
47519         LDKSplice arg_conv;
47520         arg_conv.inner = untag_ptr(arg);
47521         arg_conv.is_owned = ptr_is_owned(arg);
47522         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47523         arg_conv.is_owned = false;
47524         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
47525         return ret_conv;
47526 }
47527
47528 uint64_t  __attribute__((export_name("TS_Splice_clone"))) TS_Splice_clone(uint64_t orig) {
47529         LDKSplice orig_conv;
47530         orig_conv.inner = untag_ptr(orig);
47531         orig_conv.is_owned = ptr_is_owned(orig);
47532         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47533         orig_conv.is_owned = false;
47534         LDKSplice ret_var = Splice_clone(&orig_conv);
47535         uint64_t ret_ref = 0;
47536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47538         return ret_ref;
47539 }
47540
47541 jboolean  __attribute__((export_name("TS_Splice_eq"))) TS_Splice_eq(uint64_t a, uint64_t b) {
47542         LDKSplice a_conv;
47543         a_conv.inner = untag_ptr(a);
47544         a_conv.is_owned = ptr_is_owned(a);
47545         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47546         a_conv.is_owned = false;
47547         LDKSplice b_conv;
47548         b_conv.inner = untag_ptr(b);
47549         b_conv.is_owned = ptr_is_owned(b);
47550         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47551         b_conv.is_owned = false;
47552         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
47553         return ret_conv;
47554 }
47555
47556 void  __attribute__((export_name("TS_SpliceAck_free"))) TS_SpliceAck_free(uint64_t this_obj) {
47557         LDKSpliceAck this_obj_conv;
47558         this_obj_conv.inner = untag_ptr(this_obj);
47559         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47561         SpliceAck_free(this_obj_conv);
47562 }
47563
47564 uint64_t  __attribute__((export_name("TS_SpliceAck_get_channel_id"))) TS_SpliceAck_get_channel_id(uint64_t this_ptr) {
47565         LDKSpliceAck this_ptr_conv;
47566         this_ptr_conv.inner = untag_ptr(this_ptr);
47567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47569         this_ptr_conv.is_owned = false;
47570         LDKChannelId ret_var = SpliceAck_get_channel_id(&this_ptr_conv);
47571         uint64_t ret_ref = 0;
47572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47574         return ret_ref;
47575 }
47576
47577 void  __attribute__((export_name("TS_SpliceAck_set_channel_id"))) TS_SpliceAck_set_channel_id(uint64_t this_ptr, uint64_t val) {
47578         LDKSpliceAck this_ptr_conv;
47579         this_ptr_conv.inner = untag_ptr(this_ptr);
47580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47582         this_ptr_conv.is_owned = false;
47583         LDKChannelId val_conv;
47584         val_conv.inner = untag_ptr(val);
47585         val_conv.is_owned = ptr_is_owned(val);
47586         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47587         val_conv = ChannelId_clone(&val_conv);
47588         SpliceAck_set_channel_id(&this_ptr_conv, val_conv);
47589 }
47590
47591 int8_tArray  __attribute__((export_name("TS_SpliceAck_get_chain_hash"))) TS_SpliceAck_get_chain_hash(uint64_t this_ptr) {
47592         LDKSpliceAck this_ptr_conv;
47593         this_ptr_conv.inner = untag_ptr(this_ptr);
47594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47596         this_ptr_conv.is_owned = false;
47597         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47598         memcpy(ret_arr->elems, *SpliceAck_get_chain_hash(&this_ptr_conv), 32);
47599         return ret_arr;
47600 }
47601
47602 void  __attribute__((export_name("TS_SpliceAck_set_chain_hash"))) TS_SpliceAck_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
47603         LDKSpliceAck this_ptr_conv;
47604         this_ptr_conv.inner = untag_ptr(this_ptr);
47605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47607         this_ptr_conv.is_owned = false;
47608         LDKThirtyTwoBytes val_ref;
47609         CHECK(val->arr_len == 32);
47610         memcpy(val_ref.data, val->elems, 32); FREE(val);
47611         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
47612 }
47613
47614 int64_t  __attribute__((export_name("TS_SpliceAck_get_relative_satoshis"))) TS_SpliceAck_get_relative_satoshis(uint64_t this_ptr) {
47615         LDKSpliceAck this_ptr_conv;
47616         this_ptr_conv.inner = untag_ptr(this_ptr);
47617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47619         this_ptr_conv.is_owned = false;
47620         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
47621         return ret_conv;
47622 }
47623
47624 void  __attribute__((export_name("TS_SpliceAck_set_relative_satoshis"))) TS_SpliceAck_set_relative_satoshis(uint64_t this_ptr, int64_t val) {
47625         LDKSpliceAck this_ptr_conv;
47626         this_ptr_conv.inner = untag_ptr(this_ptr);
47627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47629         this_ptr_conv.is_owned = false;
47630         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
47631 }
47632
47633 int8_tArray  __attribute__((export_name("TS_SpliceAck_get_funding_pubkey"))) TS_SpliceAck_get_funding_pubkey(uint64_t this_ptr) {
47634         LDKSpliceAck this_ptr_conv;
47635         this_ptr_conv.inner = untag_ptr(this_ptr);
47636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47638         this_ptr_conv.is_owned = false;
47639         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47640         memcpy(ret_arr->elems, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
47641         return ret_arr;
47642 }
47643
47644 void  __attribute__((export_name("TS_SpliceAck_set_funding_pubkey"))) TS_SpliceAck_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
47645         LDKSpliceAck this_ptr_conv;
47646         this_ptr_conv.inner = untag_ptr(this_ptr);
47647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47649         this_ptr_conv.is_owned = false;
47650         LDKPublicKey val_ref;
47651         CHECK(val->arr_len == 33);
47652         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47653         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
47654 }
47655
47656 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) {
47657         LDKChannelId channel_id_arg_conv;
47658         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47659         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47660         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47661         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47662         LDKThirtyTwoBytes chain_hash_arg_ref;
47663         CHECK(chain_hash_arg->arr_len == 32);
47664         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
47665         LDKPublicKey funding_pubkey_arg_ref;
47666         CHECK(funding_pubkey_arg->arr_len == 33);
47667         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
47668         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
47669         uint64_t ret_ref = 0;
47670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47672         return ret_ref;
47673 }
47674
47675 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
47676         LDKSpliceAck ret_var = SpliceAck_clone(arg);
47677         uint64_t ret_ref = 0;
47678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47680         return ret_ref;
47681 }
47682 int64_t  __attribute__((export_name("TS_SpliceAck_clone_ptr"))) TS_SpliceAck_clone_ptr(uint64_t arg) {
47683         LDKSpliceAck arg_conv;
47684         arg_conv.inner = untag_ptr(arg);
47685         arg_conv.is_owned = ptr_is_owned(arg);
47686         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47687         arg_conv.is_owned = false;
47688         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
47689         return ret_conv;
47690 }
47691
47692 uint64_t  __attribute__((export_name("TS_SpliceAck_clone"))) TS_SpliceAck_clone(uint64_t orig) {
47693         LDKSpliceAck orig_conv;
47694         orig_conv.inner = untag_ptr(orig);
47695         orig_conv.is_owned = ptr_is_owned(orig);
47696         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47697         orig_conv.is_owned = false;
47698         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
47699         uint64_t ret_ref = 0;
47700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47702         return ret_ref;
47703 }
47704
47705 jboolean  __attribute__((export_name("TS_SpliceAck_eq"))) TS_SpliceAck_eq(uint64_t a, uint64_t b) {
47706         LDKSpliceAck a_conv;
47707         a_conv.inner = untag_ptr(a);
47708         a_conv.is_owned = ptr_is_owned(a);
47709         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47710         a_conv.is_owned = false;
47711         LDKSpliceAck b_conv;
47712         b_conv.inner = untag_ptr(b);
47713         b_conv.is_owned = ptr_is_owned(b);
47714         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47715         b_conv.is_owned = false;
47716         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
47717         return ret_conv;
47718 }
47719
47720 void  __attribute__((export_name("TS_SpliceLocked_free"))) TS_SpliceLocked_free(uint64_t this_obj) {
47721         LDKSpliceLocked this_obj_conv;
47722         this_obj_conv.inner = untag_ptr(this_obj);
47723         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47725         SpliceLocked_free(this_obj_conv);
47726 }
47727
47728 uint64_t  __attribute__((export_name("TS_SpliceLocked_get_channel_id"))) TS_SpliceLocked_get_channel_id(uint64_t this_ptr) {
47729         LDKSpliceLocked this_ptr_conv;
47730         this_ptr_conv.inner = untag_ptr(this_ptr);
47731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47733         this_ptr_conv.is_owned = false;
47734         LDKChannelId ret_var = SpliceLocked_get_channel_id(&this_ptr_conv);
47735         uint64_t ret_ref = 0;
47736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47738         return ret_ref;
47739 }
47740
47741 void  __attribute__((export_name("TS_SpliceLocked_set_channel_id"))) TS_SpliceLocked_set_channel_id(uint64_t this_ptr, uint64_t val) {
47742         LDKSpliceLocked this_ptr_conv;
47743         this_ptr_conv.inner = untag_ptr(this_ptr);
47744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47746         this_ptr_conv.is_owned = false;
47747         LDKChannelId val_conv;
47748         val_conv.inner = untag_ptr(val);
47749         val_conv.is_owned = ptr_is_owned(val);
47750         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47751         val_conv = ChannelId_clone(&val_conv);
47752         SpliceLocked_set_channel_id(&this_ptr_conv, val_conv);
47753 }
47754
47755 uint64_t  __attribute__((export_name("TS_SpliceLocked_new"))) TS_SpliceLocked_new(uint64_t channel_id_arg) {
47756         LDKChannelId channel_id_arg_conv;
47757         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47758         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47759         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47760         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47761         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_conv);
47762         uint64_t ret_ref = 0;
47763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47765         return ret_ref;
47766 }
47767
47768 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
47769         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
47770         uint64_t ret_ref = 0;
47771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47773         return ret_ref;
47774 }
47775 int64_t  __attribute__((export_name("TS_SpliceLocked_clone_ptr"))) TS_SpliceLocked_clone_ptr(uint64_t arg) {
47776         LDKSpliceLocked arg_conv;
47777         arg_conv.inner = untag_ptr(arg);
47778         arg_conv.is_owned = ptr_is_owned(arg);
47779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47780         arg_conv.is_owned = false;
47781         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
47782         return ret_conv;
47783 }
47784
47785 uint64_t  __attribute__((export_name("TS_SpliceLocked_clone"))) TS_SpliceLocked_clone(uint64_t orig) {
47786         LDKSpliceLocked orig_conv;
47787         orig_conv.inner = untag_ptr(orig);
47788         orig_conv.is_owned = ptr_is_owned(orig);
47789         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47790         orig_conv.is_owned = false;
47791         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
47792         uint64_t ret_ref = 0;
47793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47795         return ret_ref;
47796 }
47797
47798 jboolean  __attribute__((export_name("TS_SpliceLocked_eq"))) TS_SpliceLocked_eq(uint64_t a, uint64_t b) {
47799         LDKSpliceLocked a_conv;
47800         a_conv.inner = untag_ptr(a);
47801         a_conv.is_owned = ptr_is_owned(a);
47802         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47803         a_conv.is_owned = false;
47804         LDKSpliceLocked b_conv;
47805         b_conv.inner = untag_ptr(b);
47806         b_conv.is_owned = ptr_is_owned(b);
47807         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47808         b_conv.is_owned = false;
47809         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
47810         return ret_conv;
47811 }
47812
47813 void  __attribute__((export_name("TS_TxAddInput_free"))) TS_TxAddInput_free(uint64_t this_obj) {
47814         LDKTxAddInput this_obj_conv;
47815         this_obj_conv.inner = untag_ptr(this_obj);
47816         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47818         TxAddInput_free(this_obj_conv);
47819 }
47820
47821 uint64_t  __attribute__((export_name("TS_TxAddInput_get_channel_id"))) TS_TxAddInput_get_channel_id(uint64_t this_ptr) {
47822         LDKTxAddInput this_ptr_conv;
47823         this_ptr_conv.inner = untag_ptr(this_ptr);
47824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47826         this_ptr_conv.is_owned = false;
47827         LDKChannelId ret_var = TxAddInput_get_channel_id(&this_ptr_conv);
47828         uint64_t ret_ref = 0;
47829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47831         return ret_ref;
47832 }
47833
47834 void  __attribute__((export_name("TS_TxAddInput_set_channel_id"))) TS_TxAddInput_set_channel_id(uint64_t this_ptr, uint64_t val) {
47835         LDKTxAddInput this_ptr_conv;
47836         this_ptr_conv.inner = untag_ptr(this_ptr);
47837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47839         this_ptr_conv.is_owned = false;
47840         LDKChannelId val_conv;
47841         val_conv.inner = untag_ptr(val);
47842         val_conv.is_owned = ptr_is_owned(val);
47843         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47844         val_conv = ChannelId_clone(&val_conv);
47845         TxAddInput_set_channel_id(&this_ptr_conv, val_conv);
47846 }
47847
47848 int64_t  __attribute__((export_name("TS_TxAddInput_get_serial_id"))) TS_TxAddInput_get_serial_id(uint64_t this_ptr) {
47849         LDKTxAddInput this_ptr_conv;
47850         this_ptr_conv.inner = untag_ptr(this_ptr);
47851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47853         this_ptr_conv.is_owned = false;
47854         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
47855         return ret_conv;
47856 }
47857
47858 void  __attribute__((export_name("TS_TxAddInput_set_serial_id"))) TS_TxAddInput_set_serial_id(uint64_t this_ptr, int64_t val) {
47859         LDKTxAddInput this_ptr_conv;
47860         this_ptr_conv.inner = untag_ptr(this_ptr);
47861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47863         this_ptr_conv.is_owned = false;
47864         TxAddInput_set_serial_id(&this_ptr_conv, val);
47865 }
47866
47867 uint64_t  __attribute__((export_name("TS_TxAddInput_get_prevtx"))) TS_TxAddInput_get_prevtx(uint64_t this_ptr) {
47868         LDKTxAddInput this_ptr_conv;
47869         this_ptr_conv.inner = untag_ptr(this_ptr);
47870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47872         this_ptr_conv.is_owned = false;
47873         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
47874         uint64_t ret_ref = 0;
47875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47877         return ret_ref;
47878 }
47879
47880 void  __attribute__((export_name("TS_TxAddInput_set_prevtx"))) TS_TxAddInput_set_prevtx(uint64_t this_ptr, uint64_t val) {
47881         LDKTxAddInput this_ptr_conv;
47882         this_ptr_conv.inner = untag_ptr(this_ptr);
47883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47885         this_ptr_conv.is_owned = false;
47886         LDKTransactionU16LenLimited val_conv;
47887         val_conv.inner = untag_ptr(val);
47888         val_conv.is_owned = ptr_is_owned(val);
47889         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47890         val_conv = TransactionU16LenLimited_clone(&val_conv);
47891         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
47892 }
47893
47894 int32_t  __attribute__((export_name("TS_TxAddInput_get_prevtx_out"))) TS_TxAddInput_get_prevtx_out(uint64_t this_ptr) {
47895         LDKTxAddInput this_ptr_conv;
47896         this_ptr_conv.inner = untag_ptr(this_ptr);
47897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47899         this_ptr_conv.is_owned = false;
47900         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
47901         return ret_conv;
47902 }
47903
47904 void  __attribute__((export_name("TS_TxAddInput_set_prevtx_out"))) TS_TxAddInput_set_prevtx_out(uint64_t this_ptr, int32_t val) {
47905         LDKTxAddInput this_ptr_conv;
47906         this_ptr_conv.inner = untag_ptr(this_ptr);
47907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47909         this_ptr_conv.is_owned = false;
47910         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
47911 }
47912
47913 int32_t  __attribute__((export_name("TS_TxAddInput_get_sequence"))) TS_TxAddInput_get_sequence(uint64_t this_ptr) {
47914         LDKTxAddInput this_ptr_conv;
47915         this_ptr_conv.inner = untag_ptr(this_ptr);
47916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47918         this_ptr_conv.is_owned = false;
47919         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
47920         return ret_conv;
47921 }
47922
47923 void  __attribute__((export_name("TS_TxAddInput_set_sequence"))) TS_TxAddInput_set_sequence(uint64_t this_ptr, int32_t val) {
47924         LDKTxAddInput this_ptr_conv;
47925         this_ptr_conv.inner = untag_ptr(this_ptr);
47926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47928         this_ptr_conv.is_owned = false;
47929         TxAddInput_set_sequence(&this_ptr_conv, val);
47930 }
47931
47932 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) {
47933         LDKChannelId channel_id_arg_conv;
47934         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47935         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47936         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47937         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47938         LDKTransactionU16LenLimited prevtx_arg_conv;
47939         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
47940         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
47941         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
47942         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
47943         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_conv, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
47944         uint64_t ret_ref = 0;
47945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47947         return ret_ref;
47948 }
47949
47950 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
47951         LDKTxAddInput ret_var = TxAddInput_clone(arg);
47952         uint64_t ret_ref = 0;
47953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47955         return ret_ref;
47956 }
47957 int64_t  __attribute__((export_name("TS_TxAddInput_clone_ptr"))) TS_TxAddInput_clone_ptr(uint64_t arg) {
47958         LDKTxAddInput arg_conv;
47959         arg_conv.inner = untag_ptr(arg);
47960         arg_conv.is_owned = ptr_is_owned(arg);
47961         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47962         arg_conv.is_owned = false;
47963         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
47964         return ret_conv;
47965 }
47966
47967 uint64_t  __attribute__((export_name("TS_TxAddInput_clone"))) TS_TxAddInput_clone(uint64_t orig) {
47968         LDKTxAddInput orig_conv;
47969         orig_conv.inner = untag_ptr(orig);
47970         orig_conv.is_owned = ptr_is_owned(orig);
47971         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47972         orig_conv.is_owned = false;
47973         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
47974         uint64_t ret_ref = 0;
47975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47977         return ret_ref;
47978 }
47979
47980 int64_t  __attribute__((export_name("TS_TxAddInput_hash"))) TS_TxAddInput_hash(uint64_t o) {
47981         LDKTxAddInput o_conv;
47982         o_conv.inner = untag_ptr(o);
47983         o_conv.is_owned = ptr_is_owned(o);
47984         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47985         o_conv.is_owned = false;
47986         int64_t ret_conv = TxAddInput_hash(&o_conv);
47987         return ret_conv;
47988 }
47989
47990 jboolean  __attribute__((export_name("TS_TxAddInput_eq"))) TS_TxAddInput_eq(uint64_t a, uint64_t b) {
47991         LDKTxAddInput a_conv;
47992         a_conv.inner = untag_ptr(a);
47993         a_conv.is_owned = ptr_is_owned(a);
47994         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47995         a_conv.is_owned = false;
47996         LDKTxAddInput b_conv;
47997         b_conv.inner = untag_ptr(b);
47998         b_conv.is_owned = ptr_is_owned(b);
47999         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48000         b_conv.is_owned = false;
48001         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
48002         return ret_conv;
48003 }
48004
48005 void  __attribute__((export_name("TS_TxAddOutput_free"))) TS_TxAddOutput_free(uint64_t this_obj) {
48006         LDKTxAddOutput this_obj_conv;
48007         this_obj_conv.inner = untag_ptr(this_obj);
48008         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48010         TxAddOutput_free(this_obj_conv);
48011 }
48012
48013 uint64_t  __attribute__((export_name("TS_TxAddOutput_get_channel_id"))) TS_TxAddOutput_get_channel_id(uint64_t this_ptr) {
48014         LDKTxAddOutput this_ptr_conv;
48015         this_ptr_conv.inner = untag_ptr(this_ptr);
48016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48018         this_ptr_conv.is_owned = false;
48019         LDKChannelId ret_var = TxAddOutput_get_channel_id(&this_ptr_conv);
48020         uint64_t ret_ref = 0;
48021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48023         return ret_ref;
48024 }
48025
48026 void  __attribute__((export_name("TS_TxAddOutput_set_channel_id"))) TS_TxAddOutput_set_channel_id(uint64_t this_ptr, uint64_t val) {
48027         LDKTxAddOutput this_ptr_conv;
48028         this_ptr_conv.inner = untag_ptr(this_ptr);
48029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48031         this_ptr_conv.is_owned = false;
48032         LDKChannelId val_conv;
48033         val_conv.inner = untag_ptr(val);
48034         val_conv.is_owned = ptr_is_owned(val);
48035         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48036         val_conv = ChannelId_clone(&val_conv);
48037         TxAddOutput_set_channel_id(&this_ptr_conv, val_conv);
48038 }
48039
48040 int64_t  __attribute__((export_name("TS_TxAddOutput_get_serial_id"))) TS_TxAddOutput_get_serial_id(uint64_t this_ptr) {
48041         LDKTxAddOutput this_ptr_conv;
48042         this_ptr_conv.inner = untag_ptr(this_ptr);
48043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48045         this_ptr_conv.is_owned = false;
48046         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
48047         return ret_conv;
48048 }
48049
48050 void  __attribute__((export_name("TS_TxAddOutput_set_serial_id"))) TS_TxAddOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
48051         LDKTxAddOutput this_ptr_conv;
48052         this_ptr_conv.inner = untag_ptr(this_ptr);
48053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48055         this_ptr_conv.is_owned = false;
48056         TxAddOutput_set_serial_id(&this_ptr_conv, val);
48057 }
48058
48059 int64_t  __attribute__((export_name("TS_TxAddOutput_get_sats"))) TS_TxAddOutput_get_sats(uint64_t this_ptr) {
48060         LDKTxAddOutput this_ptr_conv;
48061         this_ptr_conv.inner = untag_ptr(this_ptr);
48062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48064         this_ptr_conv.is_owned = false;
48065         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
48066         return ret_conv;
48067 }
48068
48069 void  __attribute__((export_name("TS_TxAddOutput_set_sats"))) TS_TxAddOutput_set_sats(uint64_t this_ptr, int64_t val) {
48070         LDKTxAddOutput this_ptr_conv;
48071         this_ptr_conv.inner = untag_ptr(this_ptr);
48072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48074         this_ptr_conv.is_owned = false;
48075         TxAddOutput_set_sats(&this_ptr_conv, val);
48076 }
48077
48078 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_script"))) TS_TxAddOutput_get_script(uint64_t this_ptr) {
48079         LDKTxAddOutput this_ptr_conv;
48080         this_ptr_conv.inner = untag_ptr(this_ptr);
48081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48083         this_ptr_conv.is_owned = false;
48084         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
48085         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48086         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48087         CVec_u8Z_free(ret_var);
48088         return ret_arr;
48089 }
48090
48091 void  __attribute__((export_name("TS_TxAddOutput_set_script"))) TS_TxAddOutput_set_script(uint64_t this_ptr, int8_tArray val) {
48092         LDKTxAddOutput this_ptr_conv;
48093         this_ptr_conv.inner = untag_ptr(this_ptr);
48094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48096         this_ptr_conv.is_owned = false;
48097         LDKCVec_u8Z val_ref;
48098         val_ref.datalen = val->arr_len;
48099         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48100         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
48101         TxAddOutput_set_script(&this_ptr_conv, val_ref);
48102 }
48103
48104 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) {
48105         LDKChannelId channel_id_arg_conv;
48106         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48107         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48108         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48109         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48110         LDKCVec_u8Z script_arg_ref;
48111         script_arg_ref.datalen = script_arg->arr_len;
48112         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48113         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
48114         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_conv, serial_id_arg, sats_arg, script_arg_ref);
48115         uint64_t ret_ref = 0;
48116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48118         return ret_ref;
48119 }
48120
48121 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
48122         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
48123         uint64_t ret_ref = 0;
48124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48126         return ret_ref;
48127 }
48128 int64_t  __attribute__((export_name("TS_TxAddOutput_clone_ptr"))) TS_TxAddOutput_clone_ptr(uint64_t arg) {
48129         LDKTxAddOutput arg_conv;
48130         arg_conv.inner = untag_ptr(arg);
48131         arg_conv.is_owned = ptr_is_owned(arg);
48132         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48133         arg_conv.is_owned = false;
48134         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
48135         return ret_conv;
48136 }
48137
48138 uint64_t  __attribute__((export_name("TS_TxAddOutput_clone"))) TS_TxAddOutput_clone(uint64_t orig) {
48139         LDKTxAddOutput orig_conv;
48140         orig_conv.inner = untag_ptr(orig);
48141         orig_conv.is_owned = ptr_is_owned(orig);
48142         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48143         orig_conv.is_owned = false;
48144         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
48145         uint64_t ret_ref = 0;
48146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48148         return ret_ref;
48149 }
48150
48151 int64_t  __attribute__((export_name("TS_TxAddOutput_hash"))) TS_TxAddOutput_hash(uint64_t o) {
48152         LDKTxAddOutput o_conv;
48153         o_conv.inner = untag_ptr(o);
48154         o_conv.is_owned = ptr_is_owned(o);
48155         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48156         o_conv.is_owned = false;
48157         int64_t ret_conv = TxAddOutput_hash(&o_conv);
48158         return ret_conv;
48159 }
48160
48161 jboolean  __attribute__((export_name("TS_TxAddOutput_eq"))) TS_TxAddOutput_eq(uint64_t a, uint64_t b) {
48162         LDKTxAddOutput a_conv;
48163         a_conv.inner = untag_ptr(a);
48164         a_conv.is_owned = ptr_is_owned(a);
48165         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48166         a_conv.is_owned = false;
48167         LDKTxAddOutput b_conv;
48168         b_conv.inner = untag_ptr(b);
48169         b_conv.is_owned = ptr_is_owned(b);
48170         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48171         b_conv.is_owned = false;
48172         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
48173         return ret_conv;
48174 }
48175
48176 void  __attribute__((export_name("TS_TxRemoveInput_free"))) TS_TxRemoveInput_free(uint64_t this_obj) {
48177         LDKTxRemoveInput this_obj_conv;
48178         this_obj_conv.inner = untag_ptr(this_obj);
48179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48181         TxRemoveInput_free(this_obj_conv);
48182 }
48183
48184 uint64_t  __attribute__((export_name("TS_TxRemoveInput_get_channel_id"))) TS_TxRemoveInput_get_channel_id(uint64_t this_ptr) {
48185         LDKTxRemoveInput this_ptr_conv;
48186         this_ptr_conv.inner = untag_ptr(this_ptr);
48187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48189         this_ptr_conv.is_owned = false;
48190         LDKChannelId ret_var = TxRemoveInput_get_channel_id(&this_ptr_conv);
48191         uint64_t ret_ref = 0;
48192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48194         return ret_ref;
48195 }
48196
48197 void  __attribute__((export_name("TS_TxRemoveInput_set_channel_id"))) TS_TxRemoveInput_set_channel_id(uint64_t this_ptr, uint64_t val) {
48198         LDKTxRemoveInput this_ptr_conv;
48199         this_ptr_conv.inner = untag_ptr(this_ptr);
48200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48202         this_ptr_conv.is_owned = false;
48203         LDKChannelId val_conv;
48204         val_conv.inner = untag_ptr(val);
48205         val_conv.is_owned = ptr_is_owned(val);
48206         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48207         val_conv = ChannelId_clone(&val_conv);
48208         TxRemoveInput_set_channel_id(&this_ptr_conv, val_conv);
48209 }
48210
48211 int64_t  __attribute__((export_name("TS_TxRemoveInput_get_serial_id"))) TS_TxRemoveInput_get_serial_id(uint64_t this_ptr) {
48212         LDKTxRemoveInput this_ptr_conv;
48213         this_ptr_conv.inner = untag_ptr(this_ptr);
48214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48216         this_ptr_conv.is_owned = false;
48217         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
48218         return ret_conv;
48219 }
48220
48221 void  __attribute__((export_name("TS_TxRemoveInput_set_serial_id"))) TS_TxRemoveInput_set_serial_id(uint64_t this_ptr, int64_t val) {
48222         LDKTxRemoveInput this_ptr_conv;
48223         this_ptr_conv.inner = untag_ptr(this_ptr);
48224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48226         this_ptr_conv.is_owned = false;
48227         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
48228 }
48229
48230 uint64_t  __attribute__((export_name("TS_TxRemoveInput_new"))) TS_TxRemoveInput_new(uint64_t channel_id_arg, int64_t serial_id_arg) {
48231         LDKChannelId channel_id_arg_conv;
48232         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48233         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48234         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48235         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48236         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_conv, serial_id_arg);
48237         uint64_t ret_ref = 0;
48238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48240         return ret_ref;
48241 }
48242
48243 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
48244         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
48245         uint64_t ret_ref = 0;
48246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48248         return ret_ref;
48249 }
48250 int64_t  __attribute__((export_name("TS_TxRemoveInput_clone_ptr"))) TS_TxRemoveInput_clone_ptr(uint64_t arg) {
48251         LDKTxRemoveInput arg_conv;
48252         arg_conv.inner = untag_ptr(arg);
48253         arg_conv.is_owned = ptr_is_owned(arg);
48254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48255         arg_conv.is_owned = false;
48256         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
48257         return ret_conv;
48258 }
48259
48260 uint64_t  __attribute__((export_name("TS_TxRemoveInput_clone"))) TS_TxRemoveInput_clone(uint64_t orig) {
48261         LDKTxRemoveInput orig_conv;
48262         orig_conv.inner = untag_ptr(orig);
48263         orig_conv.is_owned = ptr_is_owned(orig);
48264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48265         orig_conv.is_owned = false;
48266         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
48267         uint64_t ret_ref = 0;
48268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48270         return ret_ref;
48271 }
48272
48273 int64_t  __attribute__((export_name("TS_TxRemoveInput_hash"))) TS_TxRemoveInput_hash(uint64_t o) {
48274         LDKTxRemoveInput o_conv;
48275         o_conv.inner = untag_ptr(o);
48276         o_conv.is_owned = ptr_is_owned(o);
48277         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48278         o_conv.is_owned = false;
48279         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
48280         return ret_conv;
48281 }
48282
48283 jboolean  __attribute__((export_name("TS_TxRemoveInput_eq"))) TS_TxRemoveInput_eq(uint64_t a, uint64_t b) {
48284         LDKTxRemoveInput a_conv;
48285         a_conv.inner = untag_ptr(a);
48286         a_conv.is_owned = ptr_is_owned(a);
48287         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48288         a_conv.is_owned = false;
48289         LDKTxRemoveInput b_conv;
48290         b_conv.inner = untag_ptr(b);
48291         b_conv.is_owned = ptr_is_owned(b);
48292         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48293         b_conv.is_owned = false;
48294         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
48295         return ret_conv;
48296 }
48297
48298 void  __attribute__((export_name("TS_TxRemoveOutput_free"))) TS_TxRemoveOutput_free(uint64_t this_obj) {
48299         LDKTxRemoveOutput this_obj_conv;
48300         this_obj_conv.inner = untag_ptr(this_obj);
48301         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48303         TxRemoveOutput_free(this_obj_conv);
48304 }
48305
48306 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_get_channel_id"))) TS_TxRemoveOutput_get_channel_id(uint64_t this_ptr) {
48307         LDKTxRemoveOutput this_ptr_conv;
48308         this_ptr_conv.inner = untag_ptr(this_ptr);
48309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48311         this_ptr_conv.is_owned = false;
48312         LDKChannelId ret_var = TxRemoveOutput_get_channel_id(&this_ptr_conv);
48313         uint64_t ret_ref = 0;
48314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48316         return ret_ref;
48317 }
48318
48319 void  __attribute__((export_name("TS_TxRemoveOutput_set_channel_id"))) TS_TxRemoveOutput_set_channel_id(uint64_t this_ptr, uint64_t val) {
48320         LDKTxRemoveOutput this_ptr_conv;
48321         this_ptr_conv.inner = untag_ptr(this_ptr);
48322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48324         this_ptr_conv.is_owned = false;
48325         LDKChannelId val_conv;
48326         val_conv.inner = untag_ptr(val);
48327         val_conv.is_owned = ptr_is_owned(val);
48328         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48329         val_conv = ChannelId_clone(&val_conv);
48330         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_conv);
48331 }
48332
48333 int64_t  __attribute__((export_name("TS_TxRemoveOutput_get_serial_id"))) TS_TxRemoveOutput_get_serial_id(uint64_t this_ptr) {
48334         LDKTxRemoveOutput this_ptr_conv;
48335         this_ptr_conv.inner = untag_ptr(this_ptr);
48336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48338         this_ptr_conv.is_owned = false;
48339         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
48340         return ret_conv;
48341 }
48342
48343 void  __attribute__((export_name("TS_TxRemoveOutput_set_serial_id"))) TS_TxRemoveOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
48344         LDKTxRemoveOutput this_ptr_conv;
48345         this_ptr_conv.inner = untag_ptr(this_ptr);
48346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48348         this_ptr_conv.is_owned = false;
48349         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
48350 }
48351
48352 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_new"))) TS_TxRemoveOutput_new(uint64_t channel_id_arg, int64_t serial_id_arg) {
48353         LDKChannelId channel_id_arg_conv;
48354         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48355         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48356         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48357         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48358         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_conv, serial_id_arg);
48359         uint64_t ret_ref = 0;
48360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48362         return ret_ref;
48363 }
48364
48365 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
48366         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
48367         uint64_t ret_ref = 0;
48368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48370         return ret_ref;
48371 }
48372 int64_t  __attribute__((export_name("TS_TxRemoveOutput_clone_ptr"))) TS_TxRemoveOutput_clone_ptr(uint64_t arg) {
48373         LDKTxRemoveOutput arg_conv;
48374         arg_conv.inner = untag_ptr(arg);
48375         arg_conv.is_owned = ptr_is_owned(arg);
48376         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48377         arg_conv.is_owned = false;
48378         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
48379         return ret_conv;
48380 }
48381
48382 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_clone"))) TS_TxRemoveOutput_clone(uint64_t orig) {
48383         LDKTxRemoveOutput orig_conv;
48384         orig_conv.inner = untag_ptr(orig);
48385         orig_conv.is_owned = ptr_is_owned(orig);
48386         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48387         orig_conv.is_owned = false;
48388         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
48389         uint64_t ret_ref = 0;
48390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48392         return ret_ref;
48393 }
48394
48395 int64_t  __attribute__((export_name("TS_TxRemoveOutput_hash"))) TS_TxRemoveOutput_hash(uint64_t o) {
48396         LDKTxRemoveOutput o_conv;
48397         o_conv.inner = untag_ptr(o);
48398         o_conv.is_owned = ptr_is_owned(o);
48399         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48400         o_conv.is_owned = false;
48401         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
48402         return ret_conv;
48403 }
48404
48405 jboolean  __attribute__((export_name("TS_TxRemoveOutput_eq"))) TS_TxRemoveOutput_eq(uint64_t a, uint64_t b) {
48406         LDKTxRemoveOutput a_conv;
48407         a_conv.inner = untag_ptr(a);
48408         a_conv.is_owned = ptr_is_owned(a);
48409         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48410         a_conv.is_owned = false;
48411         LDKTxRemoveOutput b_conv;
48412         b_conv.inner = untag_ptr(b);
48413         b_conv.is_owned = ptr_is_owned(b);
48414         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48415         b_conv.is_owned = false;
48416         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
48417         return ret_conv;
48418 }
48419
48420 void  __attribute__((export_name("TS_TxComplete_free"))) TS_TxComplete_free(uint64_t this_obj) {
48421         LDKTxComplete this_obj_conv;
48422         this_obj_conv.inner = untag_ptr(this_obj);
48423         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48425         TxComplete_free(this_obj_conv);
48426 }
48427
48428 uint64_t  __attribute__((export_name("TS_TxComplete_get_channel_id"))) TS_TxComplete_get_channel_id(uint64_t this_ptr) {
48429         LDKTxComplete this_ptr_conv;
48430         this_ptr_conv.inner = untag_ptr(this_ptr);
48431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48433         this_ptr_conv.is_owned = false;
48434         LDKChannelId ret_var = TxComplete_get_channel_id(&this_ptr_conv);
48435         uint64_t ret_ref = 0;
48436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48438         return ret_ref;
48439 }
48440
48441 void  __attribute__((export_name("TS_TxComplete_set_channel_id"))) TS_TxComplete_set_channel_id(uint64_t this_ptr, uint64_t val) {
48442         LDKTxComplete this_ptr_conv;
48443         this_ptr_conv.inner = untag_ptr(this_ptr);
48444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48446         this_ptr_conv.is_owned = false;
48447         LDKChannelId val_conv;
48448         val_conv.inner = untag_ptr(val);
48449         val_conv.is_owned = ptr_is_owned(val);
48450         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48451         val_conv = ChannelId_clone(&val_conv);
48452         TxComplete_set_channel_id(&this_ptr_conv, val_conv);
48453 }
48454
48455 uint64_t  __attribute__((export_name("TS_TxComplete_new"))) TS_TxComplete_new(uint64_t channel_id_arg) {
48456         LDKChannelId channel_id_arg_conv;
48457         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48458         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48459         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48460         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48461         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_conv);
48462         uint64_t ret_ref = 0;
48463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48465         return ret_ref;
48466 }
48467
48468 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
48469         LDKTxComplete ret_var = TxComplete_clone(arg);
48470         uint64_t ret_ref = 0;
48471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48473         return ret_ref;
48474 }
48475 int64_t  __attribute__((export_name("TS_TxComplete_clone_ptr"))) TS_TxComplete_clone_ptr(uint64_t arg) {
48476         LDKTxComplete arg_conv;
48477         arg_conv.inner = untag_ptr(arg);
48478         arg_conv.is_owned = ptr_is_owned(arg);
48479         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48480         arg_conv.is_owned = false;
48481         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
48482         return ret_conv;
48483 }
48484
48485 uint64_t  __attribute__((export_name("TS_TxComplete_clone"))) TS_TxComplete_clone(uint64_t orig) {
48486         LDKTxComplete orig_conv;
48487         orig_conv.inner = untag_ptr(orig);
48488         orig_conv.is_owned = ptr_is_owned(orig);
48489         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48490         orig_conv.is_owned = false;
48491         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
48492         uint64_t ret_ref = 0;
48493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48495         return ret_ref;
48496 }
48497
48498 int64_t  __attribute__((export_name("TS_TxComplete_hash"))) TS_TxComplete_hash(uint64_t o) {
48499         LDKTxComplete o_conv;
48500         o_conv.inner = untag_ptr(o);
48501         o_conv.is_owned = ptr_is_owned(o);
48502         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48503         o_conv.is_owned = false;
48504         int64_t ret_conv = TxComplete_hash(&o_conv);
48505         return ret_conv;
48506 }
48507
48508 jboolean  __attribute__((export_name("TS_TxComplete_eq"))) TS_TxComplete_eq(uint64_t a, uint64_t b) {
48509         LDKTxComplete a_conv;
48510         a_conv.inner = untag_ptr(a);
48511         a_conv.is_owned = ptr_is_owned(a);
48512         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48513         a_conv.is_owned = false;
48514         LDKTxComplete b_conv;
48515         b_conv.inner = untag_ptr(b);
48516         b_conv.is_owned = ptr_is_owned(b);
48517         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48518         b_conv.is_owned = false;
48519         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
48520         return ret_conv;
48521 }
48522
48523 void  __attribute__((export_name("TS_TxSignatures_free"))) TS_TxSignatures_free(uint64_t this_obj) {
48524         LDKTxSignatures this_obj_conv;
48525         this_obj_conv.inner = untag_ptr(this_obj);
48526         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48528         TxSignatures_free(this_obj_conv);
48529 }
48530
48531 uint64_t  __attribute__((export_name("TS_TxSignatures_get_channel_id"))) TS_TxSignatures_get_channel_id(uint64_t this_ptr) {
48532         LDKTxSignatures this_ptr_conv;
48533         this_ptr_conv.inner = untag_ptr(this_ptr);
48534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48536         this_ptr_conv.is_owned = false;
48537         LDKChannelId ret_var = TxSignatures_get_channel_id(&this_ptr_conv);
48538         uint64_t ret_ref = 0;
48539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48541         return ret_ref;
48542 }
48543
48544 void  __attribute__((export_name("TS_TxSignatures_set_channel_id"))) TS_TxSignatures_set_channel_id(uint64_t this_ptr, uint64_t val) {
48545         LDKTxSignatures this_ptr_conv;
48546         this_ptr_conv.inner = untag_ptr(this_ptr);
48547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48549         this_ptr_conv.is_owned = false;
48550         LDKChannelId val_conv;
48551         val_conv.inner = untag_ptr(val);
48552         val_conv.is_owned = ptr_is_owned(val);
48553         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48554         val_conv = ChannelId_clone(&val_conv);
48555         TxSignatures_set_channel_id(&this_ptr_conv, val_conv);
48556 }
48557
48558 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_tx_hash"))) TS_TxSignatures_get_tx_hash(uint64_t this_ptr) {
48559         LDKTxSignatures this_ptr_conv;
48560         this_ptr_conv.inner = untag_ptr(this_ptr);
48561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48563         this_ptr_conv.is_owned = false;
48564         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48565         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
48566         return ret_arr;
48567 }
48568
48569 void  __attribute__((export_name("TS_TxSignatures_set_tx_hash"))) TS_TxSignatures_set_tx_hash(uint64_t this_ptr, int8_tArray val) {
48570         LDKTxSignatures this_ptr_conv;
48571         this_ptr_conv.inner = untag_ptr(this_ptr);
48572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48574         this_ptr_conv.is_owned = false;
48575         LDKThirtyTwoBytes val_ref;
48576         CHECK(val->arr_len == 32);
48577         memcpy(val_ref.data, val->elems, 32); FREE(val);
48578         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
48579 }
48580
48581 ptrArray  __attribute__((export_name("TS_TxSignatures_get_witnesses"))) TS_TxSignatures_get_witnesses(uint64_t this_ptr) {
48582         LDKTxSignatures this_ptr_conv;
48583         this_ptr_conv.inner = untag_ptr(this_ptr);
48584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48586         this_ptr_conv.is_owned = false;
48587         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
48588         ptrArray ret_arr = NULL;
48589         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
48590         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
48591         for (size_t m = 0; m < ret_var.datalen; m++) {
48592                 LDKWitness ret_conv_12_var = ret_var.data[m];
48593                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
48594                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
48595                 Witness_free(ret_conv_12_var);
48596                 ret_arr_ptr[m] = ret_conv_12_arr;
48597         }
48598         
48599         FREE(ret_var.data);
48600         return ret_arr;
48601 }
48602
48603 void  __attribute__((export_name("TS_TxSignatures_set_witnesses"))) TS_TxSignatures_set_witnesses(uint64_t this_ptr, ptrArray val) {
48604         LDKTxSignatures this_ptr_conv;
48605         this_ptr_conv.inner = untag_ptr(this_ptr);
48606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48608         this_ptr_conv.is_owned = false;
48609         LDKCVec_WitnessZ val_constr;
48610         val_constr.datalen = val->arr_len;
48611         if (val_constr.datalen > 0)
48612                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
48613         else
48614                 val_constr.data = NULL;
48615         int8_tArray* val_vals = (void*) val->elems;
48616         for (size_t m = 0; m < val_constr.datalen; m++) {
48617                 int8_tArray val_conv_12 = val_vals[m];
48618                 LDKWitness val_conv_12_ref;
48619                 val_conv_12_ref.datalen = val_conv_12->arr_len;
48620                 val_conv_12_ref.data = MALLOC(val_conv_12_ref.datalen, "LDKWitness Bytes");
48621                 memcpy(val_conv_12_ref.data, val_conv_12->elems, val_conv_12_ref.datalen); FREE(val_conv_12);
48622                 val_conv_12_ref.data_is_owned = true;
48623                 val_constr.data[m] = val_conv_12_ref;
48624         }
48625         FREE(val);
48626         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
48627 }
48628
48629 uint64_t  __attribute__((export_name("TS_TxSignatures_get_funding_outpoint_sig"))) TS_TxSignatures_get_funding_outpoint_sig(uint64_t this_ptr) {
48630         LDKTxSignatures this_ptr_conv;
48631         this_ptr_conv.inner = untag_ptr(this_ptr);
48632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48634         this_ptr_conv.is_owned = false;
48635         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
48636         *ret_copy = TxSignatures_get_funding_outpoint_sig(&this_ptr_conv);
48637         uint64_t ret_ref = tag_ptr(ret_copy, true);
48638         return ret_ref;
48639 }
48640
48641 void  __attribute__((export_name("TS_TxSignatures_set_funding_outpoint_sig"))) TS_TxSignatures_set_funding_outpoint_sig(uint64_t this_ptr, uint64_t val) {
48642         LDKTxSignatures this_ptr_conv;
48643         this_ptr_conv.inner = untag_ptr(this_ptr);
48644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48646         this_ptr_conv.is_owned = false;
48647         void* val_ptr = untag_ptr(val);
48648         CHECK_ACCESS(val_ptr);
48649         LDKCOption_ECDSASignatureZ val_conv = *(LDKCOption_ECDSASignatureZ*)(val_ptr);
48650         val_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(val));
48651         TxSignatures_set_funding_outpoint_sig(&this_ptr_conv, val_conv);
48652 }
48653
48654 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) {
48655         LDKChannelId channel_id_arg_conv;
48656         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48657         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48658         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48659         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48660         LDKThirtyTwoBytes tx_hash_arg_ref;
48661         CHECK(tx_hash_arg->arr_len == 32);
48662         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
48663         LDKCVec_WitnessZ witnesses_arg_constr;
48664         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
48665         if (witnesses_arg_constr.datalen > 0)
48666                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
48667         else
48668                 witnesses_arg_constr.data = NULL;
48669         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
48670         for (size_t m = 0; m < witnesses_arg_constr.datalen; m++) {
48671                 int8_tArray witnesses_arg_conv_12 = witnesses_arg_vals[m];
48672                 LDKWitness witnesses_arg_conv_12_ref;
48673                 witnesses_arg_conv_12_ref.datalen = witnesses_arg_conv_12->arr_len;
48674                 witnesses_arg_conv_12_ref.data = MALLOC(witnesses_arg_conv_12_ref.datalen, "LDKWitness Bytes");
48675                 memcpy(witnesses_arg_conv_12_ref.data, witnesses_arg_conv_12->elems, witnesses_arg_conv_12_ref.datalen); FREE(witnesses_arg_conv_12);
48676                 witnesses_arg_conv_12_ref.data_is_owned = true;
48677                 witnesses_arg_constr.data[m] = witnesses_arg_conv_12_ref;
48678         }
48679         FREE(witnesses_arg);
48680         void* funding_outpoint_sig_arg_ptr = untag_ptr(funding_outpoint_sig_arg);
48681         CHECK_ACCESS(funding_outpoint_sig_arg_ptr);
48682         LDKCOption_ECDSASignatureZ funding_outpoint_sig_arg_conv = *(LDKCOption_ECDSASignatureZ*)(funding_outpoint_sig_arg_ptr);
48683         funding_outpoint_sig_arg_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(funding_outpoint_sig_arg));
48684         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_conv, tx_hash_arg_ref, witnesses_arg_constr, funding_outpoint_sig_arg_conv);
48685         uint64_t ret_ref = 0;
48686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48688         return ret_ref;
48689 }
48690
48691 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
48692         LDKTxSignatures ret_var = TxSignatures_clone(arg);
48693         uint64_t ret_ref = 0;
48694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48696         return ret_ref;
48697 }
48698 int64_t  __attribute__((export_name("TS_TxSignatures_clone_ptr"))) TS_TxSignatures_clone_ptr(uint64_t arg) {
48699         LDKTxSignatures arg_conv;
48700         arg_conv.inner = untag_ptr(arg);
48701         arg_conv.is_owned = ptr_is_owned(arg);
48702         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48703         arg_conv.is_owned = false;
48704         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
48705         return ret_conv;
48706 }
48707
48708 uint64_t  __attribute__((export_name("TS_TxSignatures_clone"))) TS_TxSignatures_clone(uint64_t orig) {
48709         LDKTxSignatures orig_conv;
48710         orig_conv.inner = untag_ptr(orig);
48711         orig_conv.is_owned = ptr_is_owned(orig);
48712         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48713         orig_conv.is_owned = false;
48714         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
48715         uint64_t ret_ref = 0;
48716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48718         return ret_ref;
48719 }
48720
48721 int64_t  __attribute__((export_name("TS_TxSignatures_hash"))) TS_TxSignatures_hash(uint64_t o) {
48722         LDKTxSignatures o_conv;
48723         o_conv.inner = untag_ptr(o);
48724         o_conv.is_owned = ptr_is_owned(o);
48725         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48726         o_conv.is_owned = false;
48727         int64_t ret_conv = TxSignatures_hash(&o_conv);
48728         return ret_conv;
48729 }
48730
48731 jboolean  __attribute__((export_name("TS_TxSignatures_eq"))) TS_TxSignatures_eq(uint64_t a, uint64_t b) {
48732         LDKTxSignatures a_conv;
48733         a_conv.inner = untag_ptr(a);
48734         a_conv.is_owned = ptr_is_owned(a);
48735         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48736         a_conv.is_owned = false;
48737         LDKTxSignatures b_conv;
48738         b_conv.inner = untag_ptr(b);
48739         b_conv.is_owned = ptr_is_owned(b);
48740         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48741         b_conv.is_owned = false;
48742         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
48743         return ret_conv;
48744 }
48745
48746 void  __attribute__((export_name("TS_TxInitRbf_free"))) TS_TxInitRbf_free(uint64_t this_obj) {
48747         LDKTxInitRbf this_obj_conv;
48748         this_obj_conv.inner = untag_ptr(this_obj);
48749         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48751         TxInitRbf_free(this_obj_conv);
48752 }
48753
48754 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_channel_id"))) TS_TxInitRbf_get_channel_id(uint64_t this_ptr) {
48755         LDKTxInitRbf this_ptr_conv;
48756         this_ptr_conv.inner = untag_ptr(this_ptr);
48757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48759         this_ptr_conv.is_owned = false;
48760         LDKChannelId ret_var = TxInitRbf_get_channel_id(&this_ptr_conv);
48761         uint64_t ret_ref = 0;
48762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48764         return ret_ref;
48765 }
48766
48767 void  __attribute__((export_name("TS_TxInitRbf_set_channel_id"))) TS_TxInitRbf_set_channel_id(uint64_t this_ptr, uint64_t val) {
48768         LDKTxInitRbf this_ptr_conv;
48769         this_ptr_conv.inner = untag_ptr(this_ptr);
48770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48772         this_ptr_conv.is_owned = false;
48773         LDKChannelId val_conv;
48774         val_conv.inner = untag_ptr(val);
48775         val_conv.is_owned = ptr_is_owned(val);
48776         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48777         val_conv = ChannelId_clone(&val_conv);
48778         TxInitRbf_set_channel_id(&this_ptr_conv, val_conv);
48779 }
48780
48781 int32_t  __attribute__((export_name("TS_TxInitRbf_get_locktime"))) TS_TxInitRbf_get_locktime(uint64_t this_ptr) {
48782         LDKTxInitRbf this_ptr_conv;
48783         this_ptr_conv.inner = untag_ptr(this_ptr);
48784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48786         this_ptr_conv.is_owned = false;
48787         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
48788         return ret_conv;
48789 }
48790
48791 void  __attribute__((export_name("TS_TxInitRbf_set_locktime"))) TS_TxInitRbf_set_locktime(uint64_t this_ptr, int32_t val) {
48792         LDKTxInitRbf this_ptr_conv;
48793         this_ptr_conv.inner = untag_ptr(this_ptr);
48794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48796         this_ptr_conv.is_owned = false;
48797         TxInitRbf_set_locktime(&this_ptr_conv, val);
48798 }
48799
48800 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) {
48801         LDKTxInitRbf this_ptr_conv;
48802         this_ptr_conv.inner = untag_ptr(this_ptr);
48803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48805         this_ptr_conv.is_owned = false;
48806         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
48807         return ret_conv;
48808 }
48809
48810 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) {
48811         LDKTxInitRbf this_ptr_conv;
48812         this_ptr_conv.inner = untag_ptr(this_ptr);
48813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48815         this_ptr_conv.is_owned = false;
48816         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
48817 }
48818
48819 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_funding_output_contribution"))) TS_TxInitRbf_get_funding_output_contribution(uint64_t this_ptr) {
48820         LDKTxInitRbf this_ptr_conv;
48821         this_ptr_conv.inner = untag_ptr(this_ptr);
48822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48824         this_ptr_conv.is_owned = false;
48825         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
48826         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
48827         uint64_t ret_ref = tag_ptr(ret_copy, true);
48828         return ret_ref;
48829 }
48830
48831 void  __attribute__((export_name("TS_TxInitRbf_set_funding_output_contribution"))) TS_TxInitRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
48832         LDKTxInitRbf this_ptr_conv;
48833         this_ptr_conv.inner = untag_ptr(this_ptr);
48834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48836         this_ptr_conv.is_owned = false;
48837         void* val_ptr = untag_ptr(val);
48838         CHECK_ACCESS(val_ptr);
48839         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
48840         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
48841         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
48842 }
48843
48844 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) {
48845         LDKChannelId channel_id_arg_conv;
48846         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48847         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48848         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48849         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48850         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
48851         CHECK_ACCESS(funding_output_contribution_arg_ptr);
48852         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
48853         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
48854         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_conv, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
48855         uint64_t ret_ref = 0;
48856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48858         return ret_ref;
48859 }
48860
48861 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
48862         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
48863         uint64_t ret_ref = 0;
48864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48866         return ret_ref;
48867 }
48868 int64_t  __attribute__((export_name("TS_TxInitRbf_clone_ptr"))) TS_TxInitRbf_clone_ptr(uint64_t arg) {
48869         LDKTxInitRbf arg_conv;
48870         arg_conv.inner = untag_ptr(arg);
48871         arg_conv.is_owned = ptr_is_owned(arg);
48872         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48873         arg_conv.is_owned = false;
48874         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
48875         return ret_conv;
48876 }
48877
48878 uint64_t  __attribute__((export_name("TS_TxInitRbf_clone"))) TS_TxInitRbf_clone(uint64_t orig) {
48879         LDKTxInitRbf orig_conv;
48880         orig_conv.inner = untag_ptr(orig);
48881         orig_conv.is_owned = ptr_is_owned(orig);
48882         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48883         orig_conv.is_owned = false;
48884         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
48885         uint64_t ret_ref = 0;
48886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48888         return ret_ref;
48889 }
48890
48891 int64_t  __attribute__((export_name("TS_TxInitRbf_hash"))) TS_TxInitRbf_hash(uint64_t o) {
48892         LDKTxInitRbf o_conv;
48893         o_conv.inner = untag_ptr(o);
48894         o_conv.is_owned = ptr_is_owned(o);
48895         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48896         o_conv.is_owned = false;
48897         int64_t ret_conv = TxInitRbf_hash(&o_conv);
48898         return ret_conv;
48899 }
48900
48901 jboolean  __attribute__((export_name("TS_TxInitRbf_eq"))) TS_TxInitRbf_eq(uint64_t a, uint64_t b) {
48902         LDKTxInitRbf a_conv;
48903         a_conv.inner = untag_ptr(a);
48904         a_conv.is_owned = ptr_is_owned(a);
48905         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48906         a_conv.is_owned = false;
48907         LDKTxInitRbf b_conv;
48908         b_conv.inner = untag_ptr(b);
48909         b_conv.is_owned = ptr_is_owned(b);
48910         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48911         b_conv.is_owned = false;
48912         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
48913         return ret_conv;
48914 }
48915
48916 void  __attribute__((export_name("TS_TxAckRbf_free"))) TS_TxAckRbf_free(uint64_t this_obj) {
48917         LDKTxAckRbf this_obj_conv;
48918         this_obj_conv.inner = untag_ptr(this_obj);
48919         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48921         TxAckRbf_free(this_obj_conv);
48922 }
48923
48924 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_channel_id"))) TS_TxAckRbf_get_channel_id(uint64_t this_ptr) {
48925         LDKTxAckRbf this_ptr_conv;
48926         this_ptr_conv.inner = untag_ptr(this_ptr);
48927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48929         this_ptr_conv.is_owned = false;
48930         LDKChannelId ret_var = TxAckRbf_get_channel_id(&this_ptr_conv);
48931         uint64_t ret_ref = 0;
48932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48934         return ret_ref;
48935 }
48936
48937 void  __attribute__((export_name("TS_TxAckRbf_set_channel_id"))) TS_TxAckRbf_set_channel_id(uint64_t this_ptr, uint64_t val) {
48938         LDKTxAckRbf this_ptr_conv;
48939         this_ptr_conv.inner = untag_ptr(this_ptr);
48940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48942         this_ptr_conv.is_owned = false;
48943         LDKChannelId val_conv;
48944         val_conv.inner = untag_ptr(val);
48945         val_conv.is_owned = ptr_is_owned(val);
48946         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48947         val_conv = ChannelId_clone(&val_conv);
48948         TxAckRbf_set_channel_id(&this_ptr_conv, val_conv);
48949 }
48950
48951 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_funding_output_contribution"))) TS_TxAckRbf_get_funding_output_contribution(uint64_t this_ptr) {
48952         LDKTxAckRbf this_ptr_conv;
48953         this_ptr_conv.inner = untag_ptr(this_ptr);
48954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48956         this_ptr_conv.is_owned = false;
48957         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
48958         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
48959         uint64_t ret_ref = tag_ptr(ret_copy, true);
48960         return ret_ref;
48961 }
48962
48963 void  __attribute__((export_name("TS_TxAckRbf_set_funding_output_contribution"))) TS_TxAckRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
48964         LDKTxAckRbf this_ptr_conv;
48965         this_ptr_conv.inner = untag_ptr(this_ptr);
48966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48968         this_ptr_conv.is_owned = false;
48969         void* val_ptr = untag_ptr(val);
48970         CHECK_ACCESS(val_ptr);
48971         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
48972         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
48973         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
48974 }
48975
48976 uint64_t  __attribute__((export_name("TS_TxAckRbf_new"))) TS_TxAckRbf_new(uint64_t channel_id_arg, uint64_t funding_output_contribution_arg) {
48977         LDKChannelId channel_id_arg_conv;
48978         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48979         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48980         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48981         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48982         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
48983         CHECK_ACCESS(funding_output_contribution_arg_ptr);
48984         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
48985         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
48986         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_conv, funding_output_contribution_arg_conv);
48987         uint64_t ret_ref = 0;
48988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48990         return ret_ref;
48991 }
48992
48993 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
48994         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
48995         uint64_t ret_ref = 0;
48996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48998         return ret_ref;
48999 }
49000 int64_t  __attribute__((export_name("TS_TxAckRbf_clone_ptr"))) TS_TxAckRbf_clone_ptr(uint64_t arg) {
49001         LDKTxAckRbf arg_conv;
49002         arg_conv.inner = untag_ptr(arg);
49003         arg_conv.is_owned = ptr_is_owned(arg);
49004         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49005         arg_conv.is_owned = false;
49006         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
49007         return ret_conv;
49008 }
49009
49010 uint64_t  __attribute__((export_name("TS_TxAckRbf_clone"))) TS_TxAckRbf_clone(uint64_t orig) {
49011         LDKTxAckRbf orig_conv;
49012         orig_conv.inner = untag_ptr(orig);
49013         orig_conv.is_owned = ptr_is_owned(orig);
49014         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49015         orig_conv.is_owned = false;
49016         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
49017         uint64_t ret_ref = 0;
49018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49020         return ret_ref;
49021 }
49022
49023 int64_t  __attribute__((export_name("TS_TxAckRbf_hash"))) TS_TxAckRbf_hash(uint64_t o) {
49024         LDKTxAckRbf o_conv;
49025         o_conv.inner = untag_ptr(o);
49026         o_conv.is_owned = ptr_is_owned(o);
49027         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49028         o_conv.is_owned = false;
49029         int64_t ret_conv = TxAckRbf_hash(&o_conv);
49030         return ret_conv;
49031 }
49032
49033 jboolean  __attribute__((export_name("TS_TxAckRbf_eq"))) TS_TxAckRbf_eq(uint64_t a, uint64_t b) {
49034         LDKTxAckRbf a_conv;
49035         a_conv.inner = untag_ptr(a);
49036         a_conv.is_owned = ptr_is_owned(a);
49037         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49038         a_conv.is_owned = false;
49039         LDKTxAckRbf b_conv;
49040         b_conv.inner = untag_ptr(b);
49041         b_conv.is_owned = ptr_is_owned(b);
49042         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49043         b_conv.is_owned = false;
49044         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
49045         return ret_conv;
49046 }
49047
49048 void  __attribute__((export_name("TS_TxAbort_free"))) TS_TxAbort_free(uint64_t this_obj) {
49049         LDKTxAbort this_obj_conv;
49050         this_obj_conv.inner = untag_ptr(this_obj);
49051         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49053         TxAbort_free(this_obj_conv);
49054 }
49055
49056 uint64_t  __attribute__((export_name("TS_TxAbort_get_channel_id"))) TS_TxAbort_get_channel_id(uint64_t this_ptr) {
49057         LDKTxAbort this_ptr_conv;
49058         this_ptr_conv.inner = untag_ptr(this_ptr);
49059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49061         this_ptr_conv.is_owned = false;
49062         LDKChannelId ret_var = TxAbort_get_channel_id(&this_ptr_conv);
49063         uint64_t ret_ref = 0;
49064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49066         return ret_ref;
49067 }
49068
49069 void  __attribute__((export_name("TS_TxAbort_set_channel_id"))) TS_TxAbort_set_channel_id(uint64_t this_ptr, uint64_t val) {
49070         LDKTxAbort this_ptr_conv;
49071         this_ptr_conv.inner = untag_ptr(this_ptr);
49072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49074         this_ptr_conv.is_owned = false;
49075         LDKChannelId val_conv;
49076         val_conv.inner = untag_ptr(val);
49077         val_conv.is_owned = ptr_is_owned(val);
49078         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49079         val_conv = ChannelId_clone(&val_conv);
49080         TxAbort_set_channel_id(&this_ptr_conv, val_conv);
49081 }
49082
49083 int8_tArray  __attribute__((export_name("TS_TxAbort_get_data"))) TS_TxAbort_get_data(uint64_t this_ptr) {
49084         LDKTxAbort this_ptr_conv;
49085         this_ptr_conv.inner = untag_ptr(this_ptr);
49086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49088         this_ptr_conv.is_owned = false;
49089         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
49090         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49091         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49092         CVec_u8Z_free(ret_var);
49093         return ret_arr;
49094 }
49095
49096 void  __attribute__((export_name("TS_TxAbort_set_data"))) TS_TxAbort_set_data(uint64_t this_ptr, int8_tArray val) {
49097         LDKTxAbort this_ptr_conv;
49098         this_ptr_conv.inner = untag_ptr(this_ptr);
49099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49101         this_ptr_conv.is_owned = false;
49102         LDKCVec_u8Z val_ref;
49103         val_ref.datalen = val->arr_len;
49104         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49105         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49106         TxAbort_set_data(&this_ptr_conv, val_ref);
49107 }
49108
49109 uint64_t  __attribute__((export_name("TS_TxAbort_new"))) TS_TxAbort_new(uint64_t channel_id_arg, int8_tArray data_arg) {
49110         LDKChannelId channel_id_arg_conv;
49111         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49112         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49113         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49114         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49115         LDKCVec_u8Z data_arg_ref;
49116         data_arg_ref.datalen = data_arg->arr_len;
49117         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49118         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
49119         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_conv, data_arg_ref);
49120         uint64_t ret_ref = 0;
49121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49123         return ret_ref;
49124 }
49125
49126 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
49127         LDKTxAbort ret_var = TxAbort_clone(arg);
49128         uint64_t ret_ref = 0;
49129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49131         return ret_ref;
49132 }
49133 int64_t  __attribute__((export_name("TS_TxAbort_clone_ptr"))) TS_TxAbort_clone_ptr(uint64_t arg) {
49134         LDKTxAbort arg_conv;
49135         arg_conv.inner = untag_ptr(arg);
49136         arg_conv.is_owned = ptr_is_owned(arg);
49137         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49138         arg_conv.is_owned = false;
49139         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
49140         return ret_conv;
49141 }
49142
49143 uint64_t  __attribute__((export_name("TS_TxAbort_clone"))) TS_TxAbort_clone(uint64_t orig) {
49144         LDKTxAbort orig_conv;
49145         orig_conv.inner = untag_ptr(orig);
49146         orig_conv.is_owned = ptr_is_owned(orig);
49147         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49148         orig_conv.is_owned = false;
49149         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
49150         uint64_t ret_ref = 0;
49151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49153         return ret_ref;
49154 }
49155
49156 int64_t  __attribute__((export_name("TS_TxAbort_hash"))) TS_TxAbort_hash(uint64_t o) {
49157         LDKTxAbort o_conv;
49158         o_conv.inner = untag_ptr(o);
49159         o_conv.is_owned = ptr_is_owned(o);
49160         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49161         o_conv.is_owned = false;
49162         int64_t ret_conv = TxAbort_hash(&o_conv);
49163         return ret_conv;
49164 }
49165
49166 jboolean  __attribute__((export_name("TS_TxAbort_eq"))) TS_TxAbort_eq(uint64_t a, uint64_t b) {
49167         LDKTxAbort a_conv;
49168         a_conv.inner = untag_ptr(a);
49169         a_conv.is_owned = ptr_is_owned(a);
49170         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49171         a_conv.is_owned = false;
49172         LDKTxAbort b_conv;
49173         b_conv.inner = untag_ptr(b);
49174         b_conv.is_owned = ptr_is_owned(b);
49175         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49176         b_conv.is_owned = false;
49177         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
49178         return ret_conv;
49179 }
49180
49181 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
49182         LDKShutdown this_obj_conv;
49183         this_obj_conv.inner = untag_ptr(this_obj);
49184         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49186         Shutdown_free(this_obj_conv);
49187 }
49188
49189 uint64_t  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
49190         LDKShutdown this_ptr_conv;
49191         this_ptr_conv.inner = untag_ptr(this_ptr);
49192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49194         this_ptr_conv.is_owned = false;
49195         LDKChannelId ret_var = Shutdown_get_channel_id(&this_ptr_conv);
49196         uint64_t ret_ref = 0;
49197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49199         return ret_ref;
49200 }
49201
49202 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, uint64_t val) {
49203         LDKShutdown this_ptr_conv;
49204         this_ptr_conv.inner = untag_ptr(this_ptr);
49205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49207         this_ptr_conv.is_owned = false;
49208         LDKChannelId val_conv;
49209         val_conv.inner = untag_ptr(val);
49210         val_conv.is_owned = ptr_is_owned(val);
49211         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49212         val_conv = ChannelId_clone(&val_conv);
49213         Shutdown_set_channel_id(&this_ptr_conv, val_conv);
49214 }
49215
49216 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
49217         LDKShutdown this_ptr_conv;
49218         this_ptr_conv.inner = untag_ptr(this_ptr);
49219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49221         this_ptr_conv.is_owned = false;
49222         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
49223         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49224         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49225         CVec_u8Z_free(ret_var);
49226         return ret_arr;
49227 }
49228
49229 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
49230         LDKShutdown this_ptr_conv;
49231         this_ptr_conv.inner = untag_ptr(this_ptr);
49232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49234         this_ptr_conv.is_owned = false;
49235         LDKCVec_u8Z val_ref;
49236         val_ref.datalen = val->arr_len;
49237         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49238         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49239         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
49240 }
49241
49242 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(uint64_t channel_id_arg, int8_tArray scriptpubkey_arg) {
49243         LDKChannelId channel_id_arg_conv;
49244         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49245         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49246         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49247         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49248         LDKCVec_u8Z scriptpubkey_arg_ref;
49249         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
49250         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49251         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
49252         LDKShutdown ret_var = Shutdown_new(channel_id_arg_conv, scriptpubkey_arg_ref);
49253         uint64_t ret_ref = 0;
49254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49256         return ret_ref;
49257 }
49258
49259 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
49260         LDKShutdown ret_var = Shutdown_clone(arg);
49261         uint64_t ret_ref = 0;
49262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49264         return ret_ref;
49265 }
49266 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
49267         LDKShutdown arg_conv;
49268         arg_conv.inner = untag_ptr(arg);
49269         arg_conv.is_owned = ptr_is_owned(arg);
49270         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49271         arg_conv.is_owned = false;
49272         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
49273         return ret_conv;
49274 }
49275
49276 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
49277         LDKShutdown orig_conv;
49278         orig_conv.inner = untag_ptr(orig);
49279         orig_conv.is_owned = ptr_is_owned(orig);
49280         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49281         orig_conv.is_owned = false;
49282         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
49283         uint64_t ret_ref = 0;
49284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49286         return ret_ref;
49287 }
49288
49289 int64_t  __attribute__((export_name("TS_Shutdown_hash"))) TS_Shutdown_hash(uint64_t o) {
49290         LDKShutdown o_conv;
49291         o_conv.inner = untag_ptr(o);
49292         o_conv.is_owned = ptr_is_owned(o);
49293         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49294         o_conv.is_owned = false;
49295         int64_t ret_conv = Shutdown_hash(&o_conv);
49296         return ret_conv;
49297 }
49298
49299 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
49300         LDKShutdown a_conv;
49301         a_conv.inner = untag_ptr(a);
49302         a_conv.is_owned = ptr_is_owned(a);
49303         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49304         a_conv.is_owned = false;
49305         LDKShutdown b_conv;
49306         b_conv.inner = untag_ptr(b);
49307         b_conv.is_owned = ptr_is_owned(b);
49308         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49309         b_conv.is_owned = false;
49310         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
49311         return ret_conv;
49312 }
49313
49314 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
49315         LDKClosingSignedFeeRange this_obj_conv;
49316         this_obj_conv.inner = untag_ptr(this_obj);
49317         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49319         ClosingSignedFeeRange_free(this_obj_conv);
49320 }
49321
49322 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
49323         LDKClosingSignedFeeRange this_ptr_conv;
49324         this_ptr_conv.inner = untag_ptr(this_ptr);
49325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49327         this_ptr_conv.is_owned = false;
49328         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
49329         return ret_conv;
49330 }
49331
49332 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
49333         LDKClosingSignedFeeRange this_ptr_conv;
49334         this_ptr_conv.inner = untag_ptr(this_ptr);
49335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49337         this_ptr_conv.is_owned = false;
49338         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
49339 }
49340
49341 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
49342         LDKClosingSignedFeeRange this_ptr_conv;
49343         this_ptr_conv.inner = untag_ptr(this_ptr);
49344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49346         this_ptr_conv.is_owned = false;
49347         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
49348         return ret_conv;
49349 }
49350
49351 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
49352         LDKClosingSignedFeeRange this_ptr_conv;
49353         this_ptr_conv.inner = untag_ptr(this_ptr);
49354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49356         this_ptr_conv.is_owned = false;
49357         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
49358 }
49359
49360 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
49361         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
49362         uint64_t ret_ref = 0;
49363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49365         return ret_ref;
49366 }
49367
49368 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
49369         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
49370         uint64_t ret_ref = 0;
49371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49373         return ret_ref;
49374 }
49375 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
49376         LDKClosingSignedFeeRange arg_conv;
49377         arg_conv.inner = untag_ptr(arg);
49378         arg_conv.is_owned = ptr_is_owned(arg);
49379         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49380         arg_conv.is_owned = false;
49381         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
49382         return ret_conv;
49383 }
49384
49385 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
49386         LDKClosingSignedFeeRange orig_conv;
49387         orig_conv.inner = untag_ptr(orig);
49388         orig_conv.is_owned = ptr_is_owned(orig);
49389         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49390         orig_conv.is_owned = false;
49391         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
49392         uint64_t ret_ref = 0;
49393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49395         return ret_ref;
49396 }
49397
49398 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_hash"))) TS_ClosingSignedFeeRange_hash(uint64_t o) {
49399         LDKClosingSignedFeeRange o_conv;
49400         o_conv.inner = untag_ptr(o);
49401         o_conv.is_owned = ptr_is_owned(o);
49402         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49403         o_conv.is_owned = false;
49404         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
49405         return ret_conv;
49406 }
49407
49408 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
49409         LDKClosingSignedFeeRange a_conv;
49410         a_conv.inner = untag_ptr(a);
49411         a_conv.is_owned = ptr_is_owned(a);
49412         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49413         a_conv.is_owned = false;
49414         LDKClosingSignedFeeRange b_conv;
49415         b_conv.inner = untag_ptr(b);
49416         b_conv.is_owned = ptr_is_owned(b);
49417         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49418         b_conv.is_owned = false;
49419         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
49420         return ret_conv;
49421 }
49422
49423 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
49424         LDKClosingSigned this_obj_conv;
49425         this_obj_conv.inner = untag_ptr(this_obj);
49426         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49428         ClosingSigned_free(this_obj_conv);
49429 }
49430
49431 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
49432         LDKClosingSigned this_ptr_conv;
49433         this_ptr_conv.inner = untag_ptr(this_ptr);
49434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49436         this_ptr_conv.is_owned = false;
49437         LDKChannelId ret_var = ClosingSigned_get_channel_id(&this_ptr_conv);
49438         uint64_t ret_ref = 0;
49439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49441         return ret_ref;
49442 }
49443
49444 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, uint64_t val) {
49445         LDKClosingSigned this_ptr_conv;
49446         this_ptr_conv.inner = untag_ptr(this_ptr);
49447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49449         this_ptr_conv.is_owned = false;
49450         LDKChannelId val_conv;
49451         val_conv.inner = untag_ptr(val);
49452         val_conv.is_owned = ptr_is_owned(val);
49453         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49454         val_conv = ChannelId_clone(&val_conv);
49455         ClosingSigned_set_channel_id(&this_ptr_conv, val_conv);
49456 }
49457
49458 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
49459         LDKClosingSigned this_ptr_conv;
49460         this_ptr_conv.inner = untag_ptr(this_ptr);
49461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49463         this_ptr_conv.is_owned = false;
49464         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
49465         return ret_conv;
49466 }
49467
49468 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
49469         LDKClosingSigned this_ptr_conv;
49470         this_ptr_conv.inner = untag_ptr(this_ptr);
49471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49473         this_ptr_conv.is_owned = false;
49474         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
49475 }
49476
49477 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
49478         LDKClosingSigned this_ptr_conv;
49479         this_ptr_conv.inner = untag_ptr(this_ptr);
49480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49482         this_ptr_conv.is_owned = false;
49483         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
49484         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
49485         return ret_arr;
49486 }
49487
49488 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
49489         LDKClosingSigned this_ptr_conv;
49490         this_ptr_conv.inner = untag_ptr(this_ptr);
49491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49493         this_ptr_conv.is_owned = false;
49494         LDKECDSASignature val_ref;
49495         CHECK(val->arr_len == 64);
49496         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
49497         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
49498 }
49499
49500 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
49501         LDKClosingSigned this_ptr_conv;
49502         this_ptr_conv.inner = untag_ptr(this_ptr);
49503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49505         this_ptr_conv.is_owned = false;
49506         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
49507         uint64_t ret_ref = 0;
49508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49510         return ret_ref;
49511 }
49512
49513 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
49514         LDKClosingSigned this_ptr_conv;
49515         this_ptr_conv.inner = untag_ptr(this_ptr);
49516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49518         this_ptr_conv.is_owned = false;
49519         LDKClosingSignedFeeRange val_conv;
49520         val_conv.inner = untag_ptr(val);
49521         val_conv.is_owned = ptr_is_owned(val);
49522         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49523         val_conv = ClosingSignedFeeRange_clone(&val_conv);
49524         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
49525 }
49526
49527 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) {
49528         LDKChannelId channel_id_arg_conv;
49529         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49530         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49531         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49532         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49533         LDKECDSASignature signature_arg_ref;
49534         CHECK(signature_arg->arr_len == 64);
49535         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
49536         LDKClosingSignedFeeRange fee_range_arg_conv;
49537         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
49538         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
49539         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
49540         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
49541         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_conv, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
49542         uint64_t ret_ref = 0;
49543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49545         return ret_ref;
49546 }
49547
49548 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
49549         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
49550         uint64_t ret_ref = 0;
49551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49553         return ret_ref;
49554 }
49555 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
49556         LDKClosingSigned arg_conv;
49557         arg_conv.inner = untag_ptr(arg);
49558         arg_conv.is_owned = ptr_is_owned(arg);
49559         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49560         arg_conv.is_owned = false;
49561         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
49562         return ret_conv;
49563 }
49564
49565 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
49566         LDKClosingSigned orig_conv;
49567         orig_conv.inner = untag_ptr(orig);
49568         orig_conv.is_owned = ptr_is_owned(orig);
49569         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49570         orig_conv.is_owned = false;
49571         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
49572         uint64_t ret_ref = 0;
49573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49575         return ret_ref;
49576 }
49577
49578 int64_t  __attribute__((export_name("TS_ClosingSigned_hash"))) TS_ClosingSigned_hash(uint64_t o) {
49579         LDKClosingSigned o_conv;
49580         o_conv.inner = untag_ptr(o);
49581         o_conv.is_owned = ptr_is_owned(o);
49582         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49583         o_conv.is_owned = false;
49584         int64_t ret_conv = ClosingSigned_hash(&o_conv);
49585         return ret_conv;
49586 }
49587
49588 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
49589         LDKClosingSigned a_conv;
49590         a_conv.inner = untag_ptr(a);
49591         a_conv.is_owned = ptr_is_owned(a);
49592         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49593         a_conv.is_owned = false;
49594         LDKClosingSigned b_conv;
49595         b_conv.inner = untag_ptr(b);
49596         b_conv.is_owned = ptr_is_owned(b);
49597         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49598         b_conv.is_owned = false;
49599         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
49600         return ret_conv;
49601 }
49602
49603 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
49604         LDKUpdateAddHTLC this_obj_conv;
49605         this_obj_conv.inner = untag_ptr(this_obj);
49606         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49608         UpdateAddHTLC_free(this_obj_conv);
49609 }
49610
49611 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
49612         LDKUpdateAddHTLC this_ptr_conv;
49613         this_ptr_conv.inner = untag_ptr(this_ptr);
49614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49616         this_ptr_conv.is_owned = false;
49617         LDKChannelId ret_var = UpdateAddHTLC_get_channel_id(&this_ptr_conv);
49618         uint64_t ret_ref = 0;
49619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49621         return ret_ref;
49622 }
49623
49624 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
49625         LDKUpdateAddHTLC this_ptr_conv;
49626         this_ptr_conv.inner = untag_ptr(this_ptr);
49627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49629         this_ptr_conv.is_owned = false;
49630         LDKChannelId val_conv;
49631         val_conv.inner = untag_ptr(val);
49632         val_conv.is_owned = ptr_is_owned(val);
49633         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49634         val_conv = ChannelId_clone(&val_conv);
49635         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_conv);
49636 }
49637
49638 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
49639         LDKUpdateAddHTLC this_ptr_conv;
49640         this_ptr_conv.inner = untag_ptr(this_ptr);
49641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49643         this_ptr_conv.is_owned = false;
49644         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
49645         return ret_conv;
49646 }
49647
49648 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
49649         LDKUpdateAddHTLC this_ptr_conv;
49650         this_ptr_conv.inner = untag_ptr(this_ptr);
49651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49653         this_ptr_conv.is_owned = false;
49654         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
49655 }
49656
49657 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
49658         LDKUpdateAddHTLC this_ptr_conv;
49659         this_ptr_conv.inner = untag_ptr(this_ptr);
49660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49662         this_ptr_conv.is_owned = false;
49663         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
49664         return ret_conv;
49665 }
49666
49667 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
49668         LDKUpdateAddHTLC this_ptr_conv;
49669         this_ptr_conv.inner = untag_ptr(this_ptr);
49670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49672         this_ptr_conv.is_owned = false;
49673         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
49674 }
49675
49676 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
49677         LDKUpdateAddHTLC this_ptr_conv;
49678         this_ptr_conv.inner = untag_ptr(this_ptr);
49679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49681         this_ptr_conv.is_owned = false;
49682         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49683         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
49684         return ret_arr;
49685 }
49686
49687 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
49688         LDKUpdateAddHTLC this_ptr_conv;
49689         this_ptr_conv.inner = untag_ptr(this_ptr);
49690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49692         this_ptr_conv.is_owned = false;
49693         LDKThirtyTwoBytes val_ref;
49694         CHECK(val->arr_len == 32);
49695         memcpy(val_ref.data, val->elems, 32); FREE(val);
49696         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
49697 }
49698
49699 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
49700         LDKUpdateAddHTLC this_ptr_conv;
49701         this_ptr_conv.inner = untag_ptr(this_ptr);
49702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49704         this_ptr_conv.is_owned = false;
49705         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
49706         return ret_conv;
49707 }
49708
49709 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
49710         LDKUpdateAddHTLC this_ptr_conv;
49711         this_ptr_conv.inner = untag_ptr(this_ptr);
49712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49714         this_ptr_conv.is_owned = false;
49715         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
49716 }
49717
49718 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_skimmed_fee_msat"))) TS_UpdateAddHTLC_get_skimmed_fee_msat(uint64_t this_ptr) {
49719         LDKUpdateAddHTLC this_ptr_conv;
49720         this_ptr_conv.inner = untag_ptr(this_ptr);
49721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49723         this_ptr_conv.is_owned = false;
49724         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49725         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
49726         uint64_t ret_ref = tag_ptr(ret_copy, true);
49727         return ret_ref;
49728 }
49729
49730 void  __attribute__((export_name("TS_UpdateAddHTLC_set_skimmed_fee_msat"))) TS_UpdateAddHTLC_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
49731         LDKUpdateAddHTLC this_ptr_conv;
49732         this_ptr_conv.inner = untag_ptr(this_ptr);
49733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49735         this_ptr_conv.is_owned = false;
49736         void* val_ptr = untag_ptr(val);
49737         CHECK_ACCESS(val_ptr);
49738         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
49739         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
49740         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
49741 }
49742
49743 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_onion_routing_packet"))) TS_UpdateAddHTLC_get_onion_routing_packet(uint64_t this_ptr) {
49744         LDKUpdateAddHTLC this_ptr_conv;
49745         this_ptr_conv.inner = untag_ptr(this_ptr);
49746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49748         this_ptr_conv.is_owned = false;
49749         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
49750         uint64_t ret_ref = 0;
49751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49753         return ret_ref;
49754 }
49755
49756 void  __attribute__((export_name("TS_UpdateAddHTLC_set_onion_routing_packet"))) TS_UpdateAddHTLC_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
49757         LDKUpdateAddHTLC this_ptr_conv;
49758         this_ptr_conv.inner = untag_ptr(this_ptr);
49759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49761         this_ptr_conv.is_owned = false;
49762         LDKOnionPacket val_conv;
49763         val_conv.inner = untag_ptr(val);
49764         val_conv.is_owned = ptr_is_owned(val);
49765         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49766         val_conv = OnionPacket_clone(&val_conv);
49767         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
49768 }
49769
49770 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_blinding_point"))) TS_UpdateAddHTLC_get_blinding_point(uint64_t this_ptr) {
49771         LDKUpdateAddHTLC this_ptr_conv;
49772         this_ptr_conv.inner = untag_ptr(this_ptr);
49773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49775         this_ptr_conv.is_owned = false;
49776         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49777         memcpy(ret_arr->elems, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form, 33);
49778         return ret_arr;
49779 }
49780
49781 void  __attribute__((export_name("TS_UpdateAddHTLC_set_blinding_point"))) TS_UpdateAddHTLC_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
49782         LDKUpdateAddHTLC this_ptr_conv;
49783         this_ptr_conv.inner = untag_ptr(this_ptr);
49784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49786         this_ptr_conv.is_owned = false;
49787         LDKPublicKey val_ref;
49788         CHECK(val->arr_len == 33);
49789         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
49790         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
49791 }
49792
49793 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) {
49794         LDKChannelId channel_id_arg_conv;
49795         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49796         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49797         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49798         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49799         LDKThirtyTwoBytes payment_hash_arg_ref;
49800         CHECK(payment_hash_arg->arr_len == 32);
49801         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
49802         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
49803         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
49804         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
49805         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
49806         LDKOnionPacket onion_routing_packet_arg_conv;
49807         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
49808         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
49809         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
49810         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
49811         LDKPublicKey blinding_point_arg_ref;
49812         CHECK(blinding_point_arg->arr_len == 33);
49813         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
49814         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);
49815         uint64_t ret_ref = 0;
49816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49818         return ret_ref;
49819 }
49820
49821 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
49822         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
49823         uint64_t ret_ref = 0;
49824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49826         return ret_ref;
49827 }
49828 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
49829         LDKUpdateAddHTLC arg_conv;
49830         arg_conv.inner = untag_ptr(arg);
49831         arg_conv.is_owned = ptr_is_owned(arg);
49832         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49833         arg_conv.is_owned = false;
49834         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
49835         return ret_conv;
49836 }
49837
49838 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
49839         LDKUpdateAddHTLC orig_conv;
49840         orig_conv.inner = untag_ptr(orig);
49841         orig_conv.is_owned = ptr_is_owned(orig);
49842         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49843         orig_conv.is_owned = false;
49844         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
49845         uint64_t ret_ref = 0;
49846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49848         return ret_ref;
49849 }
49850
49851 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_hash"))) TS_UpdateAddHTLC_hash(uint64_t o) {
49852         LDKUpdateAddHTLC o_conv;
49853         o_conv.inner = untag_ptr(o);
49854         o_conv.is_owned = ptr_is_owned(o);
49855         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49856         o_conv.is_owned = false;
49857         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
49858         return ret_conv;
49859 }
49860
49861 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
49862         LDKUpdateAddHTLC a_conv;
49863         a_conv.inner = untag_ptr(a);
49864         a_conv.is_owned = ptr_is_owned(a);
49865         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49866         a_conv.is_owned = false;
49867         LDKUpdateAddHTLC b_conv;
49868         b_conv.inner = untag_ptr(b);
49869         b_conv.is_owned = ptr_is_owned(b);
49870         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49871         b_conv.is_owned = false;
49872         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
49873         return ret_conv;
49874 }
49875
49876 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
49877         LDKOnionMessage this_obj_conv;
49878         this_obj_conv.inner = untag_ptr(this_obj);
49879         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49881         OnionMessage_free(this_obj_conv);
49882 }
49883
49884 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
49885         LDKOnionMessage this_ptr_conv;
49886         this_ptr_conv.inner = untag_ptr(this_ptr);
49887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49889         this_ptr_conv.is_owned = false;
49890         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49891         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
49892         return ret_arr;
49893 }
49894
49895 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
49896         LDKOnionMessage this_ptr_conv;
49897         this_ptr_conv.inner = untag_ptr(this_ptr);
49898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49900         this_ptr_conv.is_owned = false;
49901         LDKPublicKey val_ref;
49902         CHECK(val->arr_len == 33);
49903         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
49904         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
49905 }
49906
49907 uint64_t  __attribute__((export_name("TS_OnionMessage_get_onion_routing_packet"))) TS_OnionMessage_get_onion_routing_packet(uint64_t this_ptr) {
49908         LDKOnionMessage this_ptr_conv;
49909         this_ptr_conv.inner = untag_ptr(this_ptr);
49910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49912         this_ptr_conv.is_owned = false;
49913         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
49914         uint64_t ret_ref = 0;
49915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49917         return ret_ref;
49918 }
49919
49920 void  __attribute__((export_name("TS_OnionMessage_set_onion_routing_packet"))) TS_OnionMessage_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
49921         LDKOnionMessage this_ptr_conv;
49922         this_ptr_conv.inner = untag_ptr(this_ptr);
49923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49925         this_ptr_conv.is_owned = false;
49926         LDKPacket val_conv;
49927         val_conv.inner = untag_ptr(val);
49928         val_conv.is_owned = ptr_is_owned(val);
49929         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49930         val_conv = Packet_clone(&val_conv);
49931         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
49932 }
49933
49934 uint64_t  __attribute__((export_name("TS_OnionMessage_new"))) TS_OnionMessage_new(int8_tArray blinding_point_arg, uint64_t onion_routing_packet_arg) {
49935         LDKPublicKey blinding_point_arg_ref;
49936         CHECK(blinding_point_arg->arr_len == 33);
49937         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
49938         LDKPacket onion_routing_packet_arg_conv;
49939         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
49940         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
49941         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
49942         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
49943         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
49944         uint64_t ret_ref = 0;
49945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49947         return ret_ref;
49948 }
49949
49950 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
49951         LDKOnionMessage ret_var = OnionMessage_clone(arg);
49952         uint64_t ret_ref = 0;
49953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49955         return ret_ref;
49956 }
49957 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
49958         LDKOnionMessage arg_conv;
49959         arg_conv.inner = untag_ptr(arg);
49960         arg_conv.is_owned = ptr_is_owned(arg);
49961         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49962         arg_conv.is_owned = false;
49963         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
49964         return ret_conv;
49965 }
49966
49967 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
49968         LDKOnionMessage orig_conv;
49969         orig_conv.inner = untag_ptr(orig);
49970         orig_conv.is_owned = ptr_is_owned(orig);
49971         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49972         orig_conv.is_owned = false;
49973         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
49974         uint64_t ret_ref = 0;
49975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49977         return ret_ref;
49978 }
49979
49980 int64_t  __attribute__((export_name("TS_OnionMessage_hash"))) TS_OnionMessage_hash(uint64_t o) {
49981         LDKOnionMessage o_conv;
49982         o_conv.inner = untag_ptr(o);
49983         o_conv.is_owned = ptr_is_owned(o);
49984         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49985         o_conv.is_owned = false;
49986         int64_t ret_conv = OnionMessage_hash(&o_conv);
49987         return ret_conv;
49988 }
49989
49990 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
49991         LDKOnionMessage a_conv;
49992         a_conv.inner = untag_ptr(a);
49993         a_conv.is_owned = ptr_is_owned(a);
49994         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49995         a_conv.is_owned = false;
49996         LDKOnionMessage b_conv;
49997         b_conv.inner = untag_ptr(b);
49998         b_conv.is_owned = ptr_is_owned(b);
49999         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50000         b_conv.is_owned = false;
50001         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
50002         return ret_conv;
50003 }
50004
50005 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
50006         LDKUpdateFulfillHTLC this_obj_conv;
50007         this_obj_conv.inner = untag_ptr(this_obj);
50008         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50010         UpdateFulfillHTLC_free(this_obj_conv);
50011 }
50012
50013 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
50014         LDKUpdateFulfillHTLC this_ptr_conv;
50015         this_ptr_conv.inner = untag_ptr(this_ptr);
50016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50018         this_ptr_conv.is_owned = false;
50019         LDKChannelId ret_var = UpdateFulfillHTLC_get_channel_id(&this_ptr_conv);
50020         uint64_t ret_ref = 0;
50021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50023         return ret_ref;
50024 }
50025
50026 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
50027         LDKUpdateFulfillHTLC this_ptr_conv;
50028         this_ptr_conv.inner = untag_ptr(this_ptr);
50029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50031         this_ptr_conv.is_owned = false;
50032         LDKChannelId val_conv;
50033         val_conv.inner = untag_ptr(val);
50034         val_conv.is_owned = ptr_is_owned(val);
50035         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50036         val_conv = ChannelId_clone(&val_conv);
50037         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_conv);
50038 }
50039
50040 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
50041         LDKUpdateFulfillHTLC this_ptr_conv;
50042         this_ptr_conv.inner = untag_ptr(this_ptr);
50043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50045         this_ptr_conv.is_owned = false;
50046         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
50047         return ret_conv;
50048 }
50049
50050 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
50051         LDKUpdateFulfillHTLC this_ptr_conv;
50052         this_ptr_conv.inner = untag_ptr(this_ptr);
50053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50055         this_ptr_conv.is_owned = false;
50056         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
50057 }
50058
50059 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
50060         LDKUpdateFulfillHTLC this_ptr_conv;
50061         this_ptr_conv.inner = untag_ptr(this_ptr);
50062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50064         this_ptr_conv.is_owned = false;
50065         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50066         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
50067         return ret_arr;
50068 }
50069
50070 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
50071         LDKUpdateFulfillHTLC this_ptr_conv;
50072         this_ptr_conv.inner = untag_ptr(this_ptr);
50073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50075         this_ptr_conv.is_owned = false;
50076         LDKThirtyTwoBytes val_ref;
50077         CHECK(val->arr_len == 32);
50078         memcpy(val_ref.data, val->elems, 32); FREE(val);
50079         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
50080 }
50081
50082 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) {
50083         LDKChannelId channel_id_arg_conv;
50084         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50085         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50086         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50087         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50088         LDKThirtyTwoBytes payment_preimage_arg_ref;
50089         CHECK(payment_preimage_arg->arr_len == 32);
50090         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
50091         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_conv, htlc_id_arg, payment_preimage_arg_ref);
50092         uint64_t ret_ref = 0;
50093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50095         return ret_ref;
50096 }
50097
50098 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
50099         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
50100         uint64_t ret_ref = 0;
50101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50103         return ret_ref;
50104 }
50105 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
50106         LDKUpdateFulfillHTLC arg_conv;
50107         arg_conv.inner = untag_ptr(arg);
50108         arg_conv.is_owned = ptr_is_owned(arg);
50109         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50110         arg_conv.is_owned = false;
50111         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
50112         return ret_conv;
50113 }
50114
50115 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
50116         LDKUpdateFulfillHTLC orig_conv;
50117         orig_conv.inner = untag_ptr(orig);
50118         orig_conv.is_owned = ptr_is_owned(orig);
50119         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50120         orig_conv.is_owned = false;
50121         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
50122         uint64_t ret_ref = 0;
50123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50125         return ret_ref;
50126 }
50127
50128 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_hash"))) TS_UpdateFulfillHTLC_hash(uint64_t o) {
50129         LDKUpdateFulfillHTLC o_conv;
50130         o_conv.inner = untag_ptr(o);
50131         o_conv.is_owned = ptr_is_owned(o);
50132         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50133         o_conv.is_owned = false;
50134         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
50135         return ret_conv;
50136 }
50137
50138 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
50139         LDKUpdateFulfillHTLC a_conv;
50140         a_conv.inner = untag_ptr(a);
50141         a_conv.is_owned = ptr_is_owned(a);
50142         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50143         a_conv.is_owned = false;
50144         LDKUpdateFulfillHTLC b_conv;
50145         b_conv.inner = untag_ptr(b);
50146         b_conv.is_owned = ptr_is_owned(b);
50147         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50148         b_conv.is_owned = false;
50149         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
50150         return ret_conv;
50151 }
50152
50153 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
50154         LDKUpdateFailHTLC this_obj_conv;
50155         this_obj_conv.inner = untag_ptr(this_obj);
50156         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50158         UpdateFailHTLC_free(this_obj_conv);
50159 }
50160
50161 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
50162         LDKUpdateFailHTLC this_ptr_conv;
50163         this_ptr_conv.inner = untag_ptr(this_ptr);
50164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50166         this_ptr_conv.is_owned = false;
50167         LDKChannelId ret_var = UpdateFailHTLC_get_channel_id(&this_ptr_conv);
50168         uint64_t ret_ref = 0;
50169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50171         return ret_ref;
50172 }
50173
50174 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
50175         LDKUpdateFailHTLC this_ptr_conv;
50176         this_ptr_conv.inner = untag_ptr(this_ptr);
50177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50179         this_ptr_conv.is_owned = false;
50180         LDKChannelId val_conv;
50181         val_conv.inner = untag_ptr(val);
50182         val_conv.is_owned = ptr_is_owned(val);
50183         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50184         val_conv = ChannelId_clone(&val_conv);
50185         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_conv);
50186 }
50187
50188 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
50189         LDKUpdateFailHTLC this_ptr_conv;
50190         this_ptr_conv.inner = untag_ptr(this_ptr);
50191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50193         this_ptr_conv.is_owned = false;
50194         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
50195         return ret_conv;
50196 }
50197
50198 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
50199         LDKUpdateFailHTLC this_ptr_conv;
50200         this_ptr_conv.inner = untag_ptr(this_ptr);
50201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50203         this_ptr_conv.is_owned = false;
50204         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
50205 }
50206
50207 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
50208         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
50209         uint64_t ret_ref = 0;
50210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50212         return ret_ref;
50213 }
50214 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
50215         LDKUpdateFailHTLC arg_conv;
50216         arg_conv.inner = untag_ptr(arg);
50217         arg_conv.is_owned = ptr_is_owned(arg);
50218         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50219         arg_conv.is_owned = false;
50220         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
50221         return ret_conv;
50222 }
50223
50224 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
50225         LDKUpdateFailHTLC orig_conv;
50226         orig_conv.inner = untag_ptr(orig);
50227         orig_conv.is_owned = ptr_is_owned(orig);
50228         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50229         orig_conv.is_owned = false;
50230         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
50231         uint64_t ret_ref = 0;
50232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50234         return ret_ref;
50235 }
50236
50237 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_hash"))) TS_UpdateFailHTLC_hash(uint64_t o) {
50238         LDKUpdateFailHTLC o_conv;
50239         o_conv.inner = untag_ptr(o);
50240         o_conv.is_owned = ptr_is_owned(o);
50241         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50242         o_conv.is_owned = false;
50243         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
50244         return ret_conv;
50245 }
50246
50247 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
50248         LDKUpdateFailHTLC a_conv;
50249         a_conv.inner = untag_ptr(a);
50250         a_conv.is_owned = ptr_is_owned(a);
50251         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50252         a_conv.is_owned = false;
50253         LDKUpdateFailHTLC b_conv;
50254         b_conv.inner = untag_ptr(b);
50255         b_conv.is_owned = ptr_is_owned(b);
50256         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50257         b_conv.is_owned = false;
50258         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
50259         return ret_conv;
50260 }
50261
50262 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
50263         LDKUpdateFailMalformedHTLC this_obj_conv;
50264         this_obj_conv.inner = untag_ptr(this_obj);
50265         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50267         UpdateFailMalformedHTLC_free(this_obj_conv);
50268 }
50269
50270 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
50271         LDKUpdateFailMalformedHTLC this_ptr_conv;
50272         this_ptr_conv.inner = untag_ptr(this_ptr);
50273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50275         this_ptr_conv.is_owned = false;
50276         LDKChannelId ret_var = UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv);
50277         uint64_t ret_ref = 0;
50278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50280         return ret_ref;
50281 }
50282
50283 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
50284         LDKUpdateFailMalformedHTLC this_ptr_conv;
50285         this_ptr_conv.inner = untag_ptr(this_ptr);
50286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50288         this_ptr_conv.is_owned = false;
50289         LDKChannelId val_conv;
50290         val_conv.inner = untag_ptr(val);
50291         val_conv.is_owned = ptr_is_owned(val);
50292         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50293         val_conv = ChannelId_clone(&val_conv);
50294         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_conv);
50295 }
50296
50297 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
50298         LDKUpdateFailMalformedHTLC this_ptr_conv;
50299         this_ptr_conv.inner = untag_ptr(this_ptr);
50300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50302         this_ptr_conv.is_owned = false;
50303         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
50304         return ret_conv;
50305 }
50306
50307 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
50308         LDKUpdateFailMalformedHTLC this_ptr_conv;
50309         this_ptr_conv.inner = untag_ptr(this_ptr);
50310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50312         this_ptr_conv.is_owned = false;
50313         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
50314 }
50315
50316 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
50317         LDKUpdateFailMalformedHTLC this_ptr_conv;
50318         this_ptr_conv.inner = untag_ptr(this_ptr);
50319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50321         this_ptr_conv.is_owned = false;
50322         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
50323         return ret_conv;
50324 }
50325
50326 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
50327         LDKUpdateFailMalformedHTLC this_ptr_conv;
50328         this_ptr_conv.inner = untag_ptr(this_ptr);
50329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50331         this_ptr_conv.is_owned = false;
50332         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
50333 }
50334
50335 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
50336         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
50337         uint64_t ret_ref = 0;
50338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50340         return ret_ref;
50341 }
50342 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
50343         LDKUpdateFailMalformedHTLC arg_conv;
50344         arg_conv.inner = untag_ptr(arg);
50345         arg_conv.is_owned = ptr_is_owned(arg);
50346         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50347         arg_conv.is_owned = false;
50348         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
50349         return ret_conv;
50350 }
50351
50352 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
50353         LDKUpdateFailMalformedHTLC orig_conv;
50354         orig_conv.inner = untag_ptr(orig);
50355         orig_conv.is_owned = ptr_is_owned(orig);
50356         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50357         orig_conv.is_owned = false;
50358         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
50359         uint64_t ret_ref = 0;
50360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50362         return ret_ref;
50363 }
50364
50365 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_hash"))) TS_UpdateFailMalformedHTLC_hash(uint64_t o) {
50366         LDKUpdateFailMalformedHTLC o_conv;
50367         o_conv.inner = untag_ptr(o);
50368         o_conv.is_owned = ptr_is_owned(o);
50369         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50370         o_conv.is_owned = false;
50371         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
50372         return ret_conv;
50373 }
50374
50375 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
50376         LDKUpdateFailMalformedHTLC a_conv;
50377         a_conv.inner = untag_ptr(a);
50378         a_conv.is_owned = ptr_is_owned(a);
50379         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50380         a_conv.is_owned = false;
50381         LDKUpdateFailMalformedHTLC b_conv;
50382         b_conv.inner = untag_ptr(b);
50383         b_conv.is_owned = ptr_is_owned(b);
50384         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50385         b_conv.is_owned = false;
50386         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
50387         return ret_conv;
50388 }
50389
50390 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
50391         LDKCommitmentSigned this_obj_conv;
50392         this_obj_conv.inner = untag_ptr(this_obj);
50393         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50395         CommitmentSigned_free(this_obj_conv);
50396 }
50397
50398 uint64_t  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
50399         LDKCommitmentSigned this_ptr_conv;
50400         this_ptr_conv.inner = untag_ptr(this_ptr);
50401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50403         this_ptr_conv.is_owned = false;
50404         LDKChannelId ret_var = CommitmentSigned_get_channel_id(&this_ptr_conv);
50405         uint64_t ret_ref = 0;
50406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50408         return ret_ref;
50409 }
50410
50411 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, uint64_t val) {
50412         LDKCommitmentSigned this_ptr_conv;
50413         this_ptr_conv.inner = untag_ptr(this_ptr);
50414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50416         this_ptr_conv.is_owned = false;
50417         LDKChannelId val_conv;
50418         val_conv.inner = untag_ptr(val);
50419         val_conv.is_owned = ptr_is_owned(val);
50420         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50421         val_conv = ChannelId_clone(&val_conv);
50422         CommitmentSigned_set_channel_id(&this_ptr_conv, val_conv);
50423 }
50424
50425 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
50426         LDKCommitmentSigned this_ptr_conv;
50427         this_ptr_conv.inner = untag_ptr(this_ptr);
50428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50430         this_ptr_conv.is_owned = false;
50431         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
50432         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
50433         return ret_arr;
50434 }
50435
50436 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
50437         LDKCommitmentSigned this_ptr_conv;
50438         this_ptr_conv.inner = untag_ptr(this_ptr);
50439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50441         this_ptr_conv.is_owned = false;
50442         LDKECDSASignature val_ref;
50443         CHECK(val->arr_len == 64);
50444         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
50445         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
50446 }
50447
50448 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
50449         LDKCommitmentSigned this_ptr_conv;
50450         this_ptr_conv.inner = untag_ptr(this_ptr);
50451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50453         this_ptr_conv.is_owned = false;
50454         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
50455         ptrArray ret_arr = NULL;
50456         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
50457         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
50458         for (size_t m = 0; m < ret_var.datalen; m++) {
50459                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
50460                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
50461                 ret_arr_ptr[m] = ret_conv_12_arr;
50462         }
50463         
50464         FREE(ret_var.data);
50465         return ret_arr;
50466 }
50467
50468 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
50469         LDKCommitmentSigned this_ptr_conv;
50470         this_ptr_conv.inner = untag_ptr(this_ptr);
50471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50473         this_ptr_conv.is_owned = false;
50474         LDKCVec_ECDSASignatureZ val_constr;
50475         val_constr.datalen = val->arr_len;
50476         if (val_constr.datalen > 0)
50477                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
50478         else
50479                 val_constr.data = NULL;
50480         int8_tArray* val_vals = (void*) val->elems;
50481         for (size_t m = 0; m < val_constr.datalen; m++) {
50482                 int8_tArray val_conv_12 = val_vals[m];
50483                 LDKECDSASignature val_conv_12_ref;
50484                 CHECK(val_conv_12->arr_len == 64);
50485                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
50486                 val_constr.data[m] = val_conv_12_ref;
50487         }
50488         FREE(val);
50489         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
50490 }
50491
50492 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(uint64_t channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
50493         LDKChannelId channel_id_arg_conv;
50494         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50495         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50496         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50497         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50498         LDKECDSASignature signature_arg_ref;
50499         CHECK(signature_arg->arr_len == 64);
50500         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
50501         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
50502         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
50503         if (htlc_signatures_arg_constr.datalen > 0)
50504                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
50505         else
50506                 htlc_signatures_arg_constr.data = NULL;
50507         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
50508         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
50509                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
50510                 LDKECDSASignature htlc_signatures_arg_conv_12_ref;
50511                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
50512                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
50513                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
50514         }
50515         FREE(htlc_signatures_arg);
50516         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_conv, signature_arg_ref, htlc_signatures_arg_constr);
50517         uint64_t ret_ref = 0;
50518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50520         return ret_ref;
50521 }
50522
50523 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
50524         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
50525         uint64_t ret_ref = 0;
50526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50528         return ret_ref;
50529 }
50530 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
50531         LDKCommitmentSigned arg_conv;
50532         arg_conv.inner = untag_ptr(arg);
50533         arg_conv.is_owned = ptr_is_owned(arg);
50534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50535         arg_conv.is_owned = false;
50536         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
50537         return ret_conv;
50538 }
50539
50540 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
50541         LDKCommitmentSigned orig_conv;
50542         orig_conv.inner = untag_ptr(orig);
50543         orig_conv.is_owned = ptr_is_owned(orig);
50544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50545         orig_conv.is_owned = false;
50546         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
50547         uint64_t ret_ref = 0;
50548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50550         return ret_ref;
50551 }
50552
50553 int64_t  __attribute__((export_name("TS_CommitmentSigned_hash"))) TS_CommitmentSigned_hash(uint64_t o) {
50554         LDKCommitmentSigned o_conv;
50555         o_conv.inner = untag_ptr(o);
50556         o_conv.is_owned = ptr_is_owned(o);
50557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50558         o_conv.is_owned = false;
50559         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
50560         return ret_conv;
50561 }
50562
50563 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
50564         LDKCommitmentSigned a_conv;
50565         a_conv.inner = untag_ptr(a);
50566         a_conv.is_owned = ptr_is_owned(a);
50567         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50568         a_conv.is_owned = false;
50569         LDKCommitmentSigned b_conv;
50570         b_conv.inner = untag_ptr(b);
50571         b_conv.is_owned = ptr_is_owned(b);
50572         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50573         b_conv.is_owned = false;
50574         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
50575         return ret_conv;
50576 }
50577
50578 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
50579         LDKRevokeAndACK this_obj_conv;
50580         this_obj_conv.inner = untag_ptr(this_obj);
50581         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50583         RevokeAndACK_free(this_obj_conv);
50584 }
50585
50586 uint64_t  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
50587         LDKRevokeAndACK this_ptr_conv;
50588         this_ptr_conv.inner = untag_ptr(this_ptr);
50589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50591         this_ptr_conv.is_owned = false;
50592         LDKChannelId ret_var = RevokeAndACK_get_channel_id(&this_ptr_conv);
50593         uint64_t ret_ref = 0;
50594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50596         return ret_ref;
50597 }
50598
50599 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, uint64_t val) {
50600         LDKRevokeAndACK this_ptr_conv;
50601         this_ptr_conv.inner = untag_ptr(this_ptr);
50602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50604         this_ptr_conv.is_owned = false;
50605         LDKChannelId val_conv;
50606         val_conv.inner = untag_ptr(val);
50607         val_conv.is_owned = ptr_is_owned(val);
50608         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50609         val_conv = ChannelId_clone(&val_conv);
50610         RevokeAndACK_set_channel_id(&this_ptr_conv, val_conv);
50611 }
50612
50613 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
50614         LDKRevokeAndACK this_ptr_conv;
50615         this_ptr_conv.inner = untag_ptr(this_ptr);
50616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50618         this_ptr_conv.is_owned = false;
50619         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50620         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
50621         return ret_arr;
50622 }
50623
50624 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
50625         LDKRevokeAndACK this_ptr_conv;
50626         this_ptr_conv.inner = untag_ptr(this_ptr);
50627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50629         this_ptr_conv.is_owned = false;
50630         LDKThirtyTwoBytes val_ref;
50631         CHECK(val->arr_len == 32);
50632         memcpy(val_ref.data, val->elems, 32); FREE(val);
50633         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
50634 }
50635
50636 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
50637         LDKRevokeAndACK this_ptr_conv;
50638         this_ptr_conv.inner = untag_ptr(this_ptr);
50639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50641         this_ptr_conv.is_owned = false;
50642         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
50643         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
50644         return ret_arr;
50645 }
50646
50647 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) {
50648         LDKRevokeAndACK this_ptr_conv;
50649         this_ptr_conv.inner = untag_ptr(this_ptr);
50650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50652         this_ptr_conv.is_owned = false;
50653         LDKPublicKey val_ref;
50654         CHECK(val->arr_len == 33);
50655         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
50656         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
50657 }
50658
50659 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) {
50660         LDKChannelId channel_id_arg_conv;
50661         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50662         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50663         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50664         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50665         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
50666         CHECK(per_commitment_secret_arg->arr_len == 32);
50667         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
50668         LDKPublicKey next_per_commitment_point_arg_ref;
50669         CHECK(next_per_commitment_point_arg->arr_len == 33);
50670         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
50671         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_conv, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
50672         uint64_t ret_ref = 0;
50673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50675         return ret_ref;
50676 }
50677
50678 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
50679         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
50680         uint64_t ret_ref = 0;
50681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50683         return ret_ref;
50684 }
50685 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
50686         LDKRevokeAndACK arg_conv;
50687         arg_conv.inner = untag_ptr(arg);
50688         arg_conv.is_owned = ptr_is_owned(arg);
50689         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50690         arg_conv.is_owned = false;
50691         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
50692         return ret_conv;
50693 }
50694
50695 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
50696         LDKRevokeAndACK orig_conv;
50697         orig_conv.inner = untag_ptr(orig);
50698         orig_conv.is_owned = ptr_is_owned(orig);
50699         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50700         orig_conv.is_owned = false;
50701         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
50702         uint64_t ret_ref = 0;
50703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50705         return ret_ref;
50706 }
50707
50708 int64_t  __attribute__((export_name("TS_RevokeAndACK_hash"))) TS_RevokeAndACK_hash(uint64_t o) {
50709         LDKRevokeAndACK o_conv;
50710         o_conv.inner = untag_ptr(o);
50711         o_conv.is_owned = ptr_is_owned(o);
50712         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50713         o_conv.is_owned = false;
50714         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
50715         return ret_conv;
50716 }
50717
50718 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
50719         LDKRevokeAndACK a_conv;
50720         a_conv.inner = untag_ptr(a);
50721         a_conv.is_owned = ptr_is_owned(a);
50722         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50723         a_conv.is_owned = false;
50724         LDKRevokeAndACK b_conv;
50725         b_conv.inner = untag_ptr(b);
50726         b_conv.is_owned = ptr_is_owned(b);
50727         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50728         b_conv.is_owned = false;
50729         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
50730         return ret_conv;
50731 }
50732
50733 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
50734         LDKUpdateFee this_obj_conv;
50735         this_obj_conv.inner = untag_ptr(this_obj);
50736         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50738         UpdateFee_free(this_obj_conv);
50739 }
50740
50741 uint64_t  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
50742         LDKUpdateFee this_ptr_conv;
50743         this_ptr_conv.inner = untag_ptr(this_ptr);
50744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50746         this_ptr_conv.is_owned = false;
50747         LDKChannelId ret_var = UpdateFee_get_channel_id(&this_ptr_conv);
50748         uint64_t ret_ref = 0;
50749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50751         return ret_ref;
50752 }
50753
50754 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, uint64_t val) {
50755         LDKUpdateFee this_ptr_conv;
50756         this_ptr_conv.inner = untag_ptr(this_ptr);
50757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50759         this_ptr_conv.is_owned = false;
50760         LDKChannelId val_conv;
50761         val_conv.inner = untag_ptr(val);
50762         val_conv.is_owned = ptr_is_owned(val);
50763         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50764         val_conv = ChannelId_clone(&val_conv);
50765         UpdateFee_set_channel_id(&this_ptr_conv, val_conv);
50766 }
50767
50768 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
50769         LDKUpdateFee this_ptr_conv;
50770         this_ptr_conv.inner = untag_ptr(this_ptr);
50771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50773         this_ptr_conv.is_owned = false;
50774         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
50775         return ret_conv;
50776 }
50777
50778 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
50779         LDKUpdateFee this_ptr_conv;
50780         this_ptr_conv.inner = untag_ptr(this_ptr);
50781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50783         this_ptr_conv.is_owned = false;
50784         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
50785 }
50786
50787 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(uint64_t channel_id_arg, int32_t feerate_per_kw_arg) {
50788         LDKChannelId channel_id_arg_conv;
50789         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50790         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50791         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50792         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50793         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_conv, feerate_per_kw_arg);
50794         uint64_t ret_ref = 0;
50795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50797         return ret_ref;
50798 }
50799
50800 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
50801         LDKUpdateFee ret_var = UpdateFee_clone(arg);
50802         uint64_t ret_ref = 0;
50803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50805         return ret_ref;
50806 }
50807 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
50808         LDKUpdateFee arg_conv;
50809         arg_conv.inner = untag_ptr(arg);
50810         arg_conv.is_owned = ptr_is_owned(arg);
50811         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50812         arg_conv.is_owned = false;
50813         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
50814         return ret_conv;
50815 }
50816
50817 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
50818         LDKUpdateFee orig_conv;
50819         orig_conv.inner = untag_ptr(orig);
50820         orig_conv.is_owned = ptr_is_owned(orig);
50821         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50822         orig_conv.is_owned = false;
50823         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
50824         uint64_t ret_ref = 0;
50825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50827         return ret_ref;
50828 }
50829
50830 int64_t  __attribute__((export_name("TS_UpdateFee_hash"))) TS_UpdateFee_hash(uint64_t o) {
50831         LDKUpdateFee o_conv;
50832         o_conv.inner = untag_ptr(o);
50833         o_conv.is_owned = ptr_is_owned(o);
50834         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50835         o_conv.is_owned = false;
50836         int64_t ret_conv = UpdateFee_hash(&o_conv);
50837         return ret_conv;
50838 }
50839
50840 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
50841         LDKUpdateFee a_conv;
50842         a_conv.inner = untag_ptr(a);
50843         a_conv.is_owned = ptr_is_owned(a);
50844         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50845         a_conv.is_owned = false;
50846         LDKUpdateFee b_conv;
50847         b_conv.inner = untag_ptr(b);
50848         b_conv.is_owned = ptr_is_owned(b);
50849         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50850         b_conv.is_owned = false;
50851         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
50852         return ret_conv;
50853 }
50854
50855 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
50856         LDKChannelReestablish this_obj_conv;
50857         this_obj_conv.inner = untag_ptr(this_obj);
50858         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50860         ChannelReestablish_free(this_obj_conv);
50861 }
50862
50863 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
50864         LDKChannelReestablish this_ptr_conv;
50865         this_ptr_conv.inner = untag_ptr(this_ptr);
50866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50868         this_ptr_conv.is_owned = false;
50869         LDKChannelId ret_var = ChannelReestablish_get_channel_id(&this_ptr_conv);
50870         uint64_t ret_ref = 0;
50871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50873         return ret_ref;
50874 }
50875
50876 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, uint64_t val) {
50877         LDKChannelReestablish this_ptr_conv;
50878         this_ptr_conv.inner = untag_ptr(this_ptr);
50879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50881         this_ptr_conv.is_owned = false;
50882         LDKChannelId val_conv;
50883         val_conv.inner = untag_ptr(val);
50884         val_conv.is_owned = ptr_is_owned(val);
50885         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50886         val_conv = ChannelId_clone(&val_conv);
50887         ChannelReestablish_set_channel_id(&this_ptr_conv, val_conv);
50888 }
50889
50890 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
50891         LDKChannelReestablish this_ptr_conv;
50892         this_ptr_conv.inner = untag_ptr(this_ptr);
50893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50895         this_ptr_conv.is_owned = false;
50896         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
50897         return ret_conv;
50898 }
50899
50900 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) {
50901         LDKChannelReestablish this_ptr_conv;
50902         this_ptr_conv.inner = untag_ptr(this_ptr);
50903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50905         this_ptr_conv.is_owned = false;
50906         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
50907 }
50908
50909 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
50910         LDKChannelReestablish this_ptr_conv;
50911         this_ptr_conv.inner = untag_ptr(this_ptr);
50912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50914         this_ptr_conv.is_owned = false;
50915         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
50916         return ret_conv;
50917 }
50918
50919 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) {
50920         LDKChannelReestablish this_ptr_conv;
50921         this_ptr_conv.inner = untag_ptr(this_ptr);
50922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50924         this_ptr_conv.is_owned = false;
50925         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
50926 }
50927
50928 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) {
50929         LDKChannelReestablish this_ptr_conv;
50930         this_ptr_conv.inner = untag_ptr(this_ptr);
50931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50933         this_ptr_conv.is_owned = false;
50934         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50935         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
50936         return ret_arr;
50937 }
50938
50939 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) {
50940         LDKChannelReestablish this_ptr_conv;
50941         this_ptr_conv.inner = untag_ptr(this_ptr);
50942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50944         this_ptr_conv.is_owned = false;
50945         LDKThirtyTwoBytes val_ref;
50946         CHECK(val->arr_len == 32);
50947         memcpy(val_ref.data, val->elems, 32); FREE(val);
50948         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
50949 }
50950
50951 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) {
50952         LDKChannelReestablish this_ptr_conv;
50953         this_ptr_conv.inner = untag_ptr(this_ptr);
50954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50956         this_ptr_conv.is_owned = false;
50957         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
50958         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
50959         return ret_arr;
50960 }
50961
50962 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) {
50963         LDKChannelReestablish this_ptr_conv;
50964         this_ptr_conv.inner = untag_ptr(this_ptr);
50965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50967         this_ptr_conv.is_owned = false;
50968         LDKPublicKey val_ref;
50969         CHECK(val->arr_len == 33);
50970         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
50971         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
50972 }
50973
50974 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_funding_txid"))) TS_ChannelReestablish_get_next_funding_txid(uint64_t this_ptr) {
50975         LDKChannelReestablish this_ptr_conv;
50976         this_ptr_conv.inner = untag_ptr(this_ptr);
50977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50979         this_ptr_conv.is_owned = false;
50980         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
50981         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
50982         uint64_t ret_ref = tag_ptr(ret_copy, true);
50983         return ret_ref;
50984 }
50985
50986 void  __attribute__((export_name("TS_ChannelReestablish_set_next_funding_txid"))) TS_ChannelReestablish_set_next_funding_txid(uint64_t this_ptr, uint64_t val) {
50987         LDKChannelReestablish this_ptr_conv;
50988         this_ptr_conv.inner = untag_ptr(this_ptr);
50989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50991         this_ptr_conv.is_owned = false;
50992         void* val_ptr = untag_ptr(val);
50993         CHECK_ACCESS(val_ptr);
50994         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
50995         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
50996         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
50997 }
50998
50999 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) {
51000         LDKChannelId channel_id_arg_conv;
51001         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51002         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51003         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51004         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51005         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
51006         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
51007         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
51008         LDKPublicKey my_current_per_commitment_point_arg_ref;
51009         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
51010         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);
51011         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
51012         CHECK_ACCESS(next_funding_txid_arg_ptr);
51013         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
51014         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
51015         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);
51016         uint64_t ret_ref = 0;
51017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51019         return ret_ref;
51020 }
51021
51022 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
51023         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
51024         uint64_t ret_ref = 0;
51025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51027         return ret_ref;
51028 }
51029 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
51030         LDKChannelReestablish arg_conv;
51031         arg_conv.inner = untag_ptr(arg);
51032         arg_conv.is_owned = ptr_is_owned(arg);
51033         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51034         arg_conv.is_owned = false;
51035         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
51036         return ret_conv;
51037 }
51038
51039 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
51040         LDKChannelReestablish orig_conv;
51041         orig_conv.inner = untag_ptr(orig);
51042         orig_conv.is_owned = ptr_is_owned(orig);
51043         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51044         orig_conv.is_owned = false;
51045         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
51046         uint64_t ret_ref = 0;
51047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51049         return ret_ref;
51050 }
51051
51052 int64_t  __attribute__((export_name("TS_ChannelReestablish_hash"))) TS_ChannelReestablish_hash(uint64_t o) {
51053         LDKChannelReestablish o_conv;
51054         o_conv.inner = untag_ptr(o);
51055         o_conv.is_owned = ptr_is_owned(o);
51056         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51057         o_conv.is_owned = false;
51058         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
51059         return ret_conv;
51060 }
51061
51062 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
51063         LDKChannelReestablish a_conv;
51064         a_conv.inner = untag_ptr(a);
51065         a_conv.is_owned = ptr_is_owned(a);
51066         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51067         a_conv.is_owned = false;
51068         LDKChannelReestablish b_conv;
51069         b_conv.inner = untag_ptr(b);
51070         b_conv.is_owned = ptr_is_owned(b);
51071         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51072         b_conv.is_owned = false;
51073         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
51074         return ret_conv;
51075 }
51076
51077 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
51078         LDKAnnouncementSignatures this_obj_conv;
51079         this_obj_conv.inner = untag_ptr(this_obj);
51080         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51082         AnnouncementSignatures_free(this_obj_conv);
51083 }
51084
51085 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
51086         LDKAnnouncementSignatures this_ptr_conv;
51087         this_ptr_conv.inner = untag_ptr(this_ptr);
51088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51090         this_ptr_conv.is_owned = false;
51091         LDKChannelId ret_var = AnnouncementSignatures_get_channel_id(&this_ptr_conv);
51092         uint64_t ret_ref = 0;
51093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51095         return ret_ref;
51096 }
51097
51098 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, uint64_t val) {
51099         LDKAnnouncementSignatures this_ptr_conv;
51100         this_ptr_conv.inner = untag_ptr(this_ptr);
51101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51103         this_ptr_conv.is_owned = false;
51104         LDKChannelId val_conv;
51105         val_conv.inner = untag_ptr(val);
51106         val_conv.is_owned = ptr_is_owned(val);
51107         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51108         val_conv = ChannelId_clone(&val_conv);
51109         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_conv);
51110 }
51111
51112 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
51113         LDKAnnouncementSignatures this_ptr_conv;
51114         this_ptr_conv.inner = untag_ptr(this_ptr);
51115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51117         this_ptr_conv.is_owned = false;
51118         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
51119         return ret_conv;
51120 }
51121
51122 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
51123         LDKAnnouncementSignatures this_ptr_conv;
51124         this_ptr_conv.inner = untag_ptr(this_ptr);
51125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51127         this_ptr_conv.is_owned = false;
51128         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
51129 }
51130
51131 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
51132         LDKAnnouncementSignatures this_ptr_conv;
51133         this_ptr_conv.inner = untag_ptr(this_ptr);
51134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51136         this_ptr_conv.is_owned = false;
51137         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
51138         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
51139         return ret_arr;
51140 }
51141
51142 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
51143         LDKAnnouncementSignatures this_ptr_conv;
51144         this_ptr_conv.inner = untag_ptr(this_ptr);
51145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51147         this_ptr_conv.is_owned = false;
51148         LDKECDSASignature val_ref;
51149         CHECK(val->arr_len == 64);
51150         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
51151         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
51152 }
51153
51154 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
51155         LDKAnnouncementSignatures this_ptr_conv;
51156         this_ptr_conv.inner = untag_ptr(this_ptr);
51157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51159         this_ptr_conv.is_owned = false;
51160         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
51161         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
51162         return ret_arr;
51163 }
51164
51165 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
51166         LDKAnnouncementSignatures this_ptr_conv;
51167         this_ptr_conv.inner = untag_ptr(this_ptr);
51168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51170         this_ptr_conv.is_owned = false;
51171         LDKECDSASignature val_ref;
51172         CHECK(val->arr_len == 64);
51173         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
51174         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
51175 }
51176
51177 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) {
51178         LDKChannelId channel_id_arg_conv;
51179         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51180         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51181         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51182         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51183         LDKECDSASignature node_signature_arg_ref;
51184         CHECK(node_signature_arg->arr_len == 64);
51185         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
51186         LDKECDSASignature bitcoin_signature_arg_ref;
51187         CHECK(bitcoin_signature_arg->arr_len == 64);
51188         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
51189         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_conv, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
51190         uint64_t ret_ref = 0;
51191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51193         return ret_ref;
51194 }
51195
51196 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
51197         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
51198         uint64_t ret_ref = 0;
51199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51201         return ret_ref;
51202 }
51203 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
51204         LDKAnnouncementSignatures arg_conv;
51205         arg_conv.inner = untag_ptr(arg);
51206         arg_conv.is_owned = ptr_is_owned(arg);
51207         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51208         arg_conv.is_owned = false;
51209         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
51210         return ret_conv;
51211 }
51212
51213 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
51214         LDKAnnouncementSignatures orig_conv;
51215         orig_conv.inner = untag_ptr(orig);
51216         orig_conv.is_owned = ptr_is_owned(orig);
51217         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51218         orig_conv.is_owned = false;
51219         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
51220         uint64_t ret_ref = 0;
51221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51223         return ret_ref;
51224 }
51225
51226 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_hash"))) TS_AnnouncementSignatures_hash(uint64_t o) {
51227         LDKAnnouncementSignatures o_conv;
51228         o_conv.inner = untag_ptr(o);
51229         o_conv.is_owned = ptr_is_owned(o);
51230         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51231         o_conv.is_owned = false;
51232         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
51233         return ret_conv;
51234 }
51235
51236 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
51237         LDKAnnouncementSignatures a_conv;
51238         a_conv.inner = untag_ptr(a);
51239         a_conv.is_owned = ptr_is_owned(a);
51240         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51241         a_conv.is_owned = false;
51242         LDKAnnouncementSignatures b_conv;
51243         b_conv.inner = untag_ptr(b);
51244         b_conv.is_owned = ptr_is_owned(b);
51245         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51246         b_conv.is_owned = false;
51247         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
51248         return ret_conv;
51249 }
51250
51251 void  __attribute__((export_name("TS_SocketAddress_free"))) TS_SocketAddress_free(uint64_t this_ptr) {
51252         if (!ptr_is_owned(this_ptr)) return;
51253         void* this_ptr_ptr = untag_ptr(this_ptr);
51254         CHECK_ACCESS(this_ptr_ptr);
51255         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
51256         FREE(untag_ptr(this_ptr));
51257         SocketAddress_free(this_ptr_conv);
51258 }
51259
51260 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
51261         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51262         *ret_copy = SocketAddress_clone(arg);
51263         uint64_t ret_ref = tag_ptr(ret_copy, true);
51264         return ret_ref;
51265 }
51266 int64_t  __attribute__((export_name("TS_SocketAddress_clone_ptr"))) TS_SocketAddress_clone_ptr(uint64_t arg) {
51267         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
51268         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
51269         return ret_conv;
51270 }
51271
51272 uint64_t  __attribute__((export_name("TS_SocketAddress_clone"))) TS_SocketAddress_clone(uint64_t orig) {
51273         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
51274         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51275         *ret_copy = SocketAddress_clone(orig_conv);
51276         uint64_t ret_ref = tag_ptr(ret_copy, true);
51277         return ret_ref;
51278 }
51279
51280 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v4"))) TS_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
51281         LDKFourBytes addr_ref;
51282         CHECK(addr->arr_len == 4);
51283         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
51284         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51285         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
51286         uint64_t ret_ref = tag_ptr(ret_copy, true);
51287         return ret_ref;
51288 }
51289
51290 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v6"))) TS_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
51291         LDKSixteenBytes addr_ref;
51292         CHECK(addr->arr_len == 16);
51293         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
51294         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51295         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
51296         uint64_t ret_ref = tag_ptr(ret_copy, true);
51297         return ret_ref;
51298 }
51299
51300 uint64_t  __attribute__((export_name("TS_SocketAddress_onion_v2"))) TS_SocketAddress_onion_v2(int8_tArray a) {
51301         LDKTwelveBytes a_ref;
51302         CHECK(a->arr_len == 12);
51303         memcpy(a_ref.data, a->elems, 12); FREE(a);
51304         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51305         *ret_copy = SocketAddress_onion_v2(a_ref);
51306         uint64_t ret_ref = tag_ptr(ret_copy, true);
51307         return ret_ref;
51308 }
51309
51310 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) {
51311         LDKThirtyTwoBytes ed25519_pubkey_ref;
51312         CHECK(ed25519_pubkey->arr_len == 32);
51313         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
51314         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51315         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
51316         uint64_t ret_ref = tag_ptr(ret_copy, true);
51317         return ret_ref;
51318 }
51319
51320 uint64_t  __attribute__((export_name("TS_SocketAddress_hostname"))) TS_SocketAddress_hostname(uint64_t hostname, int16_t port) {
51321         LDKHostname hostname_conv;
51322         hostname_conv.inner = untag_ptr(hostname);
51323         hostname_conv.is_owned = ptr_is_owned(hostname);
51324         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
51325         hostname_conv = Hostname_clone(&hostname_conv);
51326         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51327         *ret_copy = SocketAddress_hostname(hostname_conv, port);
51328         uint64_t ret_ref = tag_ptr(ret_copy, true);
51329         return ret_ref;
51330 }
51331
51332 int64_t  __attribute__((export_name("TS_SocketAddress_hash"))) TS_SocketAddress_hash(uint64_t o) {
51333         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
51334         int64_t ret_conv = SocketAddress_hash(o_conv);
51335         return ret_conv;
51336 }
51337
51338 jboolean  __attribute__((export_name("TS_SocketAddress_eq"))) TS_SocketAddress_eq(uint64_t a, uint64_t b) {
51339         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
51340         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
51341         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
51342         return ret_conv;
51343 }
51344
51345 int8_tArray  __attribute__((export_name("TS_SocketAddress_write"))) TS_SocketAddress_write(uint64_t obj) {
51346         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
51347         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
51348         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51349         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51350         CVec_u8Z_free(ret_var);
51351         return ret_arr;
51352 }
51353
51354 uint64_t  __attribute__((export_name("TS_SocketAddress_read"))) TS_SocketAddress_read(int8_tArray ser) {
51355         LDKu8slice ser_ref;
51356         ser_ref.datalen = ser->arr_len;
51357         ser_ref.data = ser->elems;
51358         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
51359         *ret_conv = SocketAddress_read(ser_ref);
51360         FREE(ser);
51361         return tag_ptr(ret_conv, true);
51362 }
51363
51364 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_clone"))) TS_SocketAddressParseError_clone(uint64_t orig) {
51365         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
51366         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_clone(orig_conv));
51367         return ret_conv;
51368 }
51369
51370 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_socket_addr_parse"))) TS_SocketAddressParseError_socket_addr_parse() {
51371         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_socket_addr_parse());
51372         return ret_conv;
51373 }
51374
51375 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_input"))) TS_SocketAddressParseError_invalid_input() {
51376         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_input());
51377         return ret_conv;
51378 }
51379
51380 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_port"))) TS_SocketAddressParseError_invalid_port() {
51381         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_port());
51382         return ret_conv;
51383 }
51384
51385 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_onion_v3"))) TS_SocketAddressParseError_invalid_onion_v3() {
51386         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_onion_v3());
51387         return ret_conv;
51388 }
51389
51390 int64_t  __attribute__((export_name("TS_SocketAddressParseError_hash"))) TS_SocketAddressParseError_hash(uint64_t o) {
51391         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
51392         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
51393         return ret_conv;
51394 }
51395
51396 jboolean  __attribute__((export_name("TS_SocketAddressParseError_eq"))) TS_SocketAddressParseError_eq(uint64_t a, uint64_t b) {
51397         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
51398         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
51399         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
51400         return ret_conv;
51401 }
51402
51403 uint64_t  __attribute__((export_name("TS_parse_onion_address"))) TS_parse_onion_address(jstring host, int16_t port) {
51404         LDKStr host_conv = str_ref_to_owned_c(host);
51405         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
51406         *ret_conv = parse_onion_address(host_conv, port);
51407         return tag_ptr(ret_conv, true);
51408 }
51409
51410 jstring  __attribute__((export_name("TS_SocketAddress_to_str"))) TS_SocketAddress_to_str(uint64_t o) {
51411         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
51412         LDKStr ret_str = SocketAddress_to_str(o_conv);
51413         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
51414         Str_free(ret_str);
51415         return ret_conv;
51416 }
51417
51418 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
51419         if (!ptr_is_owned(this_ptr)) return;
51420         void* this_ptr_ptr = untag_ptr(this_ptr);
51421         CHECK_ACCESS(this_ptr_ptr);
51422         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
51423         FREE(untag_ptr(this_ptr));
51424         UnsignedGossipMessage_free(this_ptr_conv);
51425 }
51426
51427 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
51428         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51429         *ret_copy = UnsignedGossipMessage_clone(arg);
51430         uint64_t ret_ref = tag_ptr(ret_copy, true);
51431         return ret_ref;
51432 }
51433 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
51434         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
51435         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
51436         return ret_conv;
51437 }
51438
51439 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
51440         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
51441         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51442         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
51443         uint64_t ret_ref = tag_ptr(ret_copy, true);
51444         return ret_ref;
51445 }
51446
51447 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
51448         LDKUnsignedChannelAnnouncement a_conv;
51449         a_conv.inner = untag_ptr(a);
51450         a_conv.is_owned = ptr_is_owned(a);
51451         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51452         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
51453         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51454         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
51455         uint64_t ret_ref = tag_ptr(ret_copy, true);
51456         return ret_ref;
51457 }
51458
51459 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
51460         LDKUnsignedChannelUpdate a_conv;
51461         a_conv.inner = untag_ptr(a);
51462         a_conv.is_owned = ptr_is_owned(a);
51463         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51464         a_conv = UnsignedChannelUpdate_clone(&a_conv);
51465         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51466         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
51467         uint64_t ret_ref = tag_ptr(ret_copy, true);
51468         return ret_ref;
51469 }
51470
51471 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
51472         LDKUnsignedNodeAnnouncement a_conv;
51473         a_conv.inner = untag_ptr(a);
51474         a_conv.is_owned = ptr_is_owned(a);
51475         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51476         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
51477         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51478         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
51479         uint64_t ret_ref = tag_ptr(ret_copy, true);
51480         return ret_ref;
51481 }
51482
51483 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
51484         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
51485         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
51486         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51487         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51488         CVec_u8Z_free(ret_var);
51489         return ret_arr;
51490 }
51491
51492 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
51493         LDKUnsignedNodeAnnouncement this_obj_conv;
51494         this_obj_conv.inner = untag_ptr(this_obj);
51495         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51497         UnsignedNodeAnnouncement_free(this_obj_conv);
51498 }
51499
51500 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
51501         LDKUnsignedNodeAnnouncement this_ptr_conv;
51502         this_ptr_conv.inner = untag_ptr(this_ptr);
51503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51505         this_ptr_conv.is_owned = false;
51506         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
51507         uint64_t ret_ref = 0;
51508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51510         return ret_ref;
51511 }
51512
51513 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
51514         LDKUnsignedNodeAnnouncement this_ptr_conv;
51515         this_ptr_conv.inner = untag_ptr(this_ptr);
51516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51518         this_ptr_conv.is_owned = false;
51519         LDKNodeFeatures val_conv;
51520         val_conv.inner = untag_ptr(val);
51521         val_conv.is_owned = ptr_is_owned(val);
51522         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51523         val_conv = NodeFeatures_clone(&val_conv);
51524         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
51525 }
51526
51527 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
51528         LDKUnsignedNodeAnnouncement this_ptr_conv;
51529         this_ptr_conv.inner = untag_ptr(this_ptr);
51530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51532         this_ptr_conv.is_owned = false;
51533         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
51534         return ret_conv;
51535 }
51536
51537 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
51538         LDKUnsignedNodeAnnouncement this_ptr_conv;
51539         this_ptr_conv.inner = untag_ptr(this_ptr);
51540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51542         this_ptr_conv.is_owned = false;
51543         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
51544 }
51545
51546 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
51547         LDKUnsignedNodeAnnouncement this_ptr_conv;
51548         this_ptr_conv.inner = untag_ptr(this_ptr);
51549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51551         this_ptr_conv.is_owned = false;
51552         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
51553         uint64_t ret_ref = 0;
51554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51556         return ret_ref;
51557 }
51558
51559 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
51560         LDKUnsignedNodeAnnouncement this_ptr_conv;
51561         this_ptr_conv.inner = untag_ptr(this_ptr);
51562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51564         this_ptr_conv.is_owned = false;
51565         LDKNodeId val_conv;
51566         val_conv.inner = untag_ptr(val);
51567         val_conv.is_owned = ptr_is_owned(val);
51568         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51569         val_conv = NodeId_clone(&val_conv);
51570         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
51571 }
51572
51573 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
51574         LDKUnsignedNodeAnnouncement this_ptr_conv;
51575         this_ptr_conv.inner = untag_ptr(this_ptr);
51576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51578         this_ptr_conv.is_owned = false;
51579         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
51580         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
51581         return ret_arr;
51582 }
51583
51584 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
51585         LDKUnsignedNodeAnnouncement this_ptr_conv;
51586         this_ptr_conv.inner = untag_ptr(this_ptr);
51587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51589         this_ptr_conv.is_owned = false;
51590         LDKThreeBytes val_ref;
51591         CHECK(val->arr_len == 3);
51592         memcpy(val_ref.data, val->elems, 3); FREE(val);
51593         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
51594 }
51595
51596 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
51597         LDKUnsignedNodeAnnouncement this_ptr_conv;
51598         this_ptr_conv.inner = untag_ptr(this_ptr);
51599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51601         this_ptr_conv.is_owned = false;
51602         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
51603         uint64_t ret_ref = 0;
51604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51606         return ret_ref;
51607 }
51608
51609 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
51610         LDKUnsignedNodeAnnouncement this_ptr_conv;
51611         this_ptr_conv.inner = untag_ptr(this_ptr);
51612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51614         this_ptr_conv.is_owned = false;
51615         LDKNodeAlias val_conv;
51616         val_conv.inner = untag_ptr(val);
51617         val_conv.is_owned = ptr_is_owned(val);
51618         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51619         val_conv = NodeAlias_clone(&val_conv);
51620         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
51621 }
51622
51623 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
51624         LDKUnsignedNodeAnnouncement this_ptr_conv;
51625         this_ptr_conv.inner = untag_ptr(this_ptr);
51626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51628         this_ptr_conv.is_owned = false;
51629         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
51630         uint64_tArray ret_arr = NULL;
51631         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
51632         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
51633         for (size_t p = 0; p < ret_var.datalen; p++) {
51634                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51635                 *ret_conv_15_copy = ret_var.data[p];
51636                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
51637                 ret_arr_ptr[p] = ret_conv_15_ref;
51638         }
51639         
51640         FREE(ret_var.data);
51641         return ret_arr;
51642 }
51643
51644 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
51645         LDKUnsignedNodeAnnouncement this_ptr_conv;
51646         this_ptr_conv.inner = untag_ptr(this_ptr);
51647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51649         this_ptr_conv.is_owned = false;
51650         LDKCVec_SocketAddressZ val_constr;
51651         val_constr.datalen = val->arr_len;
51652         if (val_constr.datalen > 0)
51653                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
51654         else
51655                 val_constr.data = NULL;
51656         uint64_t* val_vals = val->elems;
51657         for (size_t p = 0; p < val_constr.datalen; p++) {
51658                 uint64_t val_conv_15 = val_vals[p];
51659                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
51660                 CHECK_ACCESS(val_conv_15_ptr);
51661                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
51662                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
51663                 val_constr.data[p] = val_conv_15_conv;
51664         }
51665         FREE(val);
51666         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
51667 }
51668
51669 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_excess_address_data"))) TS_UnsignedNodeAnnouncement_get_excess_address_data(uint64_t this_ptr) {
51670         LDKUnsignedNodeAnnouncement this_ptr_conv;
51671         this_ptr_conv.inner = untag_ptr(this_ptr);
51672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51674         this_ptr_conv.is_owned = false;
51675         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_address_data(&this_ptr_conv);
51676         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51677         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51678         CVec_u8Z_free(ret_var);
51679         return ret_arr;
51680 }
51681
51682 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_excess_address_data"))) TS_UnsignedNodeAnnouncement_set_excess_address_data(uint64_t this_ptr, int8_tArray val) {
51683         LDKUnsignedNodeAnnouncement this_ptr_conv;
51684         this_ptr_conv.inner = untag_ptr(this_ptr);
51685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51687         this_ptr_conv.is_owned = false;
51688         LDKCVec_u8Z val_ref;
51689         val_ref.datalen = val->arr_len;
51690         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
51691         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
51692         UnsignedNodeAnnouncement_set_excess_address_data(&this_ptr_conv, val_ref);
51693 }
51694
51695 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_excess_data"))) TS_UnsignedNodeAnnouncement_get_excess_data(uint64_t this_ptr) {
51696         LDKUnsignedNodeAnnouncement this_ptr_conv;
51697         this_ptr_conv.inner = untag_ptr(this_ptr);
51698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51700         this_ptr_conv.is_owned = false;
51701         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_data(&this_ptr_conv);
51702         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51703         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51704         CVec_u8Z_free(ret_var);
51705         return ret_arr;
51706 }
51707
51708 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_excess_data"))) TS_UnsignedNodeAnnouncement_set_excess_data(uint64_t this_ptr, int8_tArray val) {
51709         LDKUnsignedNodeAnnouncement this_ptr_conv;
51710         this_ptr_conv.inner = untag_ptr(this_ptr);
51711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51713         this_ptr_conv.is_owned = false;
51714         LDKCVec_u8Z val_ref;
51715         val_ref.datalen = val->arr_len;
51716         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
51717         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
51718         UnsignedNodeAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
51719 }
51720
51721 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) {
51722         LDKNodeFeatures features_arg_conv;
51723         features_arg_conv.inner = untag_ptr(features_arg);
51724         features_arg_conv.is_owned = ptr_is_owned(features_arg);
51725         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
51726         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
51727         LDKNodeId node_id_arg_conv;
51728         node_id_arg_conv.inner = untag_ptr(node_id_arg);
51729         node_id_arg_conv.is_owned = ptr_is_owned(node_id_arg);
51730         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_arg_conv);
51731         node_id_arg_conv = NodeId_clone(&node_id_arg_conv);
51732         LDKThreeBytes rgb_arg_ref;
51733         CHECK(rgb_arg->arr_len == 3);
51734         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
51735         LDKNodeAlias alias_arg_conv;
51736         alias_arg_conv.inner = untag_ptr(alias_arg);
51737         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
51738         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
51739         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
51740         LDKCVec_SocketAddressZ addresses_arg_constr;
51741         addresses_arg_constr.datalen = addresses_arg->arr_len;
51742         if (addresses_arg_constr.datalen > 0)
51743                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
51744         else
51745                 addresses_arg_constr.data = NULL;
51746         uint64_t* addresses_arg_vals = addresses_arg->elems;
51747         for (size_t p = 0; p < addresses_arg_constr.datalen; p++) {
51748                 uint64_t addresses_arg_conv_15 = addresses_arg_vals[p];
51749                 void* addresses_arg_conv_15_ptr = untag_ptr(addresses_arg_conv_15);
51750                 CHECK_ACCESS(addresses_arg_conv_15_ptr);
51751                 LDKSocketAddress addresses_arg_conv_15_conv = *(LDKSocketAddress*)(addresses_arg_conv_15_ptr);
51752                 addresses_arg_constr.data[p] = addresses_arg_conv_15_conv;
51753         }
51754         FREE(addresses_arg);
51755         LDKCVec_u8Z excess_address_data_arg_ref;
51756         excess_address_data_arg_ref.datalen = excess_address_data_arg->arr_len;
51757         excess_address_data_arg_ref.data = MALLOC(excess_address_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
51758         memcpy(excess_address_data_arg_ref.data, excess_address_data_arg->elems, excess_address_data_arg_ref.datalen); FREE(excess_address_data_arg);
51759         LDKCVec_u8Z excess_data_arg_ref;
51760         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
51761         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
51762         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
51763         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);
51764         uint64_t ret_ref = 0;
51765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51767         return ret_ref;
51768 }
51769
51770 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
51771         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
51772         uint64_t ret_ref = 0;
51773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51775         return ret_ref;
51776 }
51777 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
51778         LDKUnsignedNodeAnnouncement arg_conv;
51779         arg_conv.inner = untag_ptr(arg);
51780         arg_conv.is_owned = ptr_is_owned(arg);
51781         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51782         arg_conv.is_owned = false;
51783         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
51784         return ret_conv;
51785 }
51786
51787 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
51788         LDKUnsignedNodeAnnouncement orig_conv;
51789         orig_conv.inner = untag_ptr(orig);
51790         orig_conv.is_owned = ptr_is_owned(orig);
51791         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51792         orig_conv.is_owned = false;
51793         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
51794         uint64_t ret_ref = 0;
51795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51797         return ret_ref;
51798 }
51799
51800 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_hash"))) TS_UnsignedNodeAnnouncement_hash(uint64_t o) {
51801         LDKUnsignedNodeAnnouncement o_conv;
51802         o_conv.inner = untag_ptr(o);
51803         o_conv.is_owned = ptr_is_owned(o);
51804         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51805         o_conv.is_owned = false;
51806         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
51807         return ret_conv;
51808 }
51809
51810 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
51811         LDKUnsignedNodeAnnouncement a_conv;
51812         a_conv.inner = untag_ptr(a);
51813         a_conv.is_owned = ptr_is_owned(a);
51814         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51815         a_conv.is_owned = false;
51816         LDKUnsignedNodeAnnouncement b_conv;
51817         b_conv.inner = untag_ptr(b);
51818         b_conv.is_owned = ptr_is_owned(b);
51819         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51820         b_conv.is_owned = false;
51821         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
51822         return ret_conv;
51823 }
51824
51825 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
51826         LDKNodeAnnouncement this_obj_conv;
51827         this_obj_conv.inner = untag_ptr(this_obj);
51828         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51830         NodeAnnouncement_free(this_obj_conv);
51831 }
51832
51833 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
51834         LDKNodeAnnouncement this_ptr_conv;
51835         this_ptr_conv.inner = untag_ptr(this_ptr);
51836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51838         this_ptr_conv.is_owned = false;
51839         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
51840         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
51841         return ret_arr;
51842 }
51843
51844 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
51845         LDKNodeAnnouncement this_ptr_conv;
51846         this_ptr_conv.inner = untag_ptr(this_ptr);
51847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51849         this_ptr_conv.is_owned = false;
51850         LDKECDSASignature val_ref;
51851         CHECK(val->arr_len == 64);
51852         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
51853         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
51854 }
51855
51856 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
51857         LDKNodeAnnouncement this_ptr_conv;
51858         this_ptr_conv.inner = untag_ptr(this_ptr);
51859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51861         this_ptr_conv.is_owned = false;
51862         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
51863         uint64_t ret_ref = 0;
51864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51866         return ret_ref;
51867 }
51868
51869 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
51870         LDKNodeAnnouncement this_ptr_conv;
51871         this_ptr_conv.inner = untag_ptr(this_ptr);
51872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51874         this_ptr_conv.is_owned = false;
51875         LDKUnsignedNodeAnnouncement val_conv;
51876         val_conv.inner = untag_ptr(val);
51877         val_conv.is_owned = ptr_is_owned(val);
51878         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51879         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
51880         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
51881 }
51882
51883 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
51884         LDKECDSASignature signature_arg_ref;
51885         CHECK(signature_arg->arr_len == 64);
51886         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
51887         LDKUnsignedNodeAnnouncement contents_arg_conv;
51888         contents_arg_conv.inner = untag_ptr(contents_arg);
51889         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
51890         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
51891         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
51892         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
51893         uint64_t ret_ref = 0;
51894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51896         return ret_ref;
51897 }
51898
51899 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
51900         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
51901         uint64_t ret_ref = 0;
51902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51904         return ret_ref;
51905 }
51906 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
51907         LDKNodeAnnouncement arg_conv;
51908         arg_conv.inner = untag_ptr(arg);
51909         arg_conv.is_owned = ptr_is_owned(arg);
51910         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51911         arg_conv.is_owned = false;
51912         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
51913         return ret_conv;
51914 }
51915
51916 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
51917         LDKNodeAnnouncement orig_conv;
51918         orig_conv.inner = untag_ptr(orig);
51919         orig_conv.is_owned = ptr_is_owned(orig);
51920         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51921         orig_conv.is_owned = false;
51922         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
51923         uint64_t ret_ref = 0;
51924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51926         return ret_ref;
51927 }
51928
51929 int64_t  __attribute__((export_name("TS_NodeAnnouncement_hash"))) TS_NodeAnnouncement_hash(uint64_t o) {
51930         LDKNodeAnnouncement o_conv;
51931         o_conv.inner = untag_ptr(o);
51932         o_conv.is_owned = ptr_is_owned(o);
51933         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51934         o_conv.is_owned = false;
51935         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
51936         return ret_conv;
51937 }
51938
51939 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
51940         LDKNodeAnnouncement a_conv;
51941         a_conv.inner = untag_ptr(a);
51942         a_conv.is_owned = ptr_is_owned(a);
51943         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51944         a_conv.is_owned = false;
51945         LDKNodeAnnouncement b_conv;
51946         b_conv.inner = untag_ptr(b);
51947         b_conv.is_owned = ptr_is_owned(b);
51948         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51949         b_conv.is_owned = false;
51950         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
51951         return ret_conv;
51952 }
51953
51954 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
51955         LDKUnsignedChannelAnnouncement this_obj_conv;
51956         this_obj_conv.inner = untag_ptr(this_obj);
51957         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51959         UnsignedChannelAnnouncement_free(this_obj_conv);
51960 }
51961
51962 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
51963         LDKUnsignedChannelAnnouncement this_ptr_conv;
51964         this_ptr_conv.inner = untag_ptr(this_ptr);
51965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51967         this_ptr_conv.is_owned = false;
51968         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
51969         uint64_t ret_ref = 0;
51970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51972         return ret_ref;
51973 }
51974
51975 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
51976         LDKUnsignedChannelAnnouncement this_ptr_conv;
51977         this_ptr_conv.inner = untag_ptr(this_ptr);
51978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51980         this_ptr_conv.is_owned = false;
51981         LDKChannelFeatures val_conv;
51982         val_conv.inner = untag_ptr(val);
51983         val_conv.is_owned = ptr_is_owned(val);
51984         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51985         val_conv = ChannelFeatures_clone(&val_conv);
51986         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
51987 }
51988
51989 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
51990         LDKUnsignedChannelAnnouncement this_ptr_conv;
51991         this_ptr_conv.inner = untag_ptr(this_ptr);
51992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51994         this_ptr_conv.is_owned = false;
51995         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
51996         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
51997         return ret_arr;
51998 }
51999
52000 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
52001         LDKUnsignedChannelAnnouncement this_ptr_conv;
52002         this_ptr_conv.inner = untag_ptr(this_ptr);
52003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52005         this_ptr_conv.is_owned = false;
52006         LDKThirtyTwoBytes val_ref;
52007         CHECK(val->arr_len == 32);
52008         memcpy(val_ref.data, val->elems, 32); FREE(val);
52009         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
52010 }
52011
52012 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
52013         LDKUnsignedChannelAnnouncement this_ptr_conv;
52014         this_ptr_conv.inner = untag_ptr(this_ptr);
52015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52017         this_ptr_conv.is_owned = false;
52018         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
52019         return ret_conv;
52020 }
52021
52022 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
52023         LDKUnsignedChannelAnnouncement this_ptr_conv;
52024         this_ptr_conv.inner = untag_ptr(this_ptr);
52025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52027         this_ptr_conv.is_owned = false;
52028         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
52029 }
52030
52031 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
52032         LDKUnsignedChannelAnnouncement this_ptr_conv;
52033         this_ptr_conv.inner = untag_ptr(this_ptr);
52034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52036         this_ptr_conv.is_owned = false;
52037         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
52038         uint64_t ret_ref = 0;
52039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52041         return ret_ref;
52042 }
52043
52044 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
52045         LDKUnsignedChannelAnnouncement this_ptr_conv;
52046         this_ptr_conv.inner = untag_ptr(this_ptr);
52047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52049         this_ptr_conv.is_owned = false;
52050         LDKNodeId val_conv;
52051         val_conv.inner = untag_ptr(val);
52052         val_conv.is_owned = ptr_is_owned(val);
52053         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52054         val_conv = NodeId_clone(&val_conv);
52055         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
52056 }
52057
52058 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
52059         LDKUnsignedChannelAnnouncement this_ptr_conv;
52060         this_ptr_conv.inner = untag_ptr(this_ptr);
52061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52063         this_ptr_conv.is_owned = false;
52064         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
52065         uint64_t ret_ref = 0;
52066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52068         return ret_ref;
52069 }
52070
52071 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
52072         LDKUnsignedChannelAnnouncement this_ptr_conv;
52073         this_ptr_conv.inner = untag_ptr(this_ptr);
52074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52076         this_ptr_conv.is_owned = false;
52077         LDKNodeId val_conv;
52078         val_conv.inner = untag_ptr(val);
52079         val_conv.is_owned = ptr_is_owned(val);
52080         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52081         val_conv = NodeId_clone(&val_conv);
52082         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
52083 }
52084
52085 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
52086         LDKUnsignedChannelAnnouncement this_ptr_conv;
52087         this_ptr_conv.inner = untag_ptr(this_ptr);
52088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52090         this_ptr_conv.is_owned = false;
52091         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
52092         uint64_t ret_ref = 0;
52093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52095         return ret_ref;
52096 }
52097
52098 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
52099         LDKUnsignedChannelAnnouncement this_ptr_conv;
52100         this_ptr_conv.inner = untag_ptr(this_ptr);
52101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52103         this_ptr_conv.is_owned = false;
52104         LDKNodeId val_conv;
52105         val_conv.inner = untag_ptr(val);
52106         val_conv.is_owned = ptr_is_owned(val);
52107         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52108         val_conv = NodeId_clone(&val_conv);
52109         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
52110 }
52111
52112 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
52113         LDKUnsignedChannelAnnouncement this_ptr_conv;
52114         this_ptr_conv.inner = untag_ptr(this_ptr);
52115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52117         this_ptr_conv.is_owned = false;
52118         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
52119         uint64_t ret_ref = 0;
52120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52122         return ret_ref;
52123 }
52124
52125 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
52126         LDKUnsignedChannelAnnouncement this_ptr_conv;
52127         this_ptr_conv.inner = untag_ptr(this_ptr);
52128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52130         this_ptr_conv.is_owned = false;
52131         LDKNodeId val_conv;
52132         val_conv.inner = untag_ptr(val);
52133         val_conv.is_owned = ptr_is_owned(val);
52134         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52135         val_conv = NodeId_clone(&val_conv);
52136         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
52137 }
52138
52139 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_excess_data"))) TS_UnsignedChannelAnnouncement_get_excess_data(uint64_t this_ptr) {
52140         LDKUnsignedChannelAnnouncement this_ptr_conv;
52141         this_ptr_conv.inner = untag_ptr(this_ptr);
52142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52144         this_ptr_conv.is_owned = false;
52145         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
52146         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52147         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52148         CVec_u8Z_free(ret_var);
52149         return ret_arr;
52150 }
52151
52152 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_excess_data"))) TS_UnsignedChannelAnnouncement_set_excess_data(uint64_t this_ptr, int8_tArray val) {
52153         LDKUnsignedChannelAnnouncement this_ptr_conv;
52154         this_ptr_conv.inner = untag_ptr(this_ptr);
52155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52157         this_ptr_conv.is_owned = false;
52158         LDKCVec_u8Z val_ref;
52159         val_ref.datalen = val->arr_len;
52160         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
52161         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
52162         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
52163 }
52164
52165 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) {
52166         LDKChannelFeatures features_arg_conv;
52167         features_arg_conv.inner = untag_ptr(features_arg);
52168         features_arg_conv.is_owned = ptr_is_owned(features_arg);
52169         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
52170         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
52171         LDKThirtyTwoBytes chain_hash_arg_ref;
52172         CHECK(chain_hash_arg->arr_len == 32);
52173         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
52174         LDKNodeId node_id_1_arg_conv;
52175         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
52176         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
52177         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
52178         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
52179         LDKNodeId node_id_2_arg_conv;
52180         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
52181         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
52182         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
52183         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
52184         LDKNodeId bitcoin_key_1_arg_conv;
52185         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
52186         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
52187         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
52188         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
52189         LDKNodeId bitcoin_key_2_arg_conv;
52190         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
52191         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
52192         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
52193         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
52194         LDKCVec_u8Z excess_data_arg_ref;
52195         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
52196         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
52197         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
52198         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);
52199         uint64_t ret_ref = 0;
52200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52202         return ret_ref;
52203 }
52204
52205 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
52206         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
52207         uint64_t ret_ref = 0;
52208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52210         return ret_ref;
52211 }
52212 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
52213         LDKUnsignedChannelAnnouncement arg_conv;
52214         arg_conv.inner = untag_ptr(arg);
52215         arg_conv.is_owned = ptr_is_owned(arg);
52216         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52217         arg_conv.is_owned = false;
52218         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
52219         return ret_conv;
52220 }
52221
52222 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
52223         LDKUnsignedChannelAnnouncement orig_conv;
52224         orig_conv.inner = untag_ptr(orig);
52225         orig_conv.is_owned = ptr_is_owned(orig);
52226         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52227         orig_conv.is_owned = false;
52228         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
52229         uint64_t ret_ref = 0;
52230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52232         return ret_ref;
52233 }
52234
52235 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_hash"))) TS_UnsignedChannelAnnouncement_hash(uint64_t o) {
52236         LDKUnsignedChannelAnnouncement o_conv;
52237         o_conv.inner = untag_ptr(o);
52238         o_conv.is_owned = ptr_is_owned(o);
52239         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52240         o_conv.is_owned = false;
52241         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
52242         return ret_conv;
52243 }
52244
52245 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
52246         LDKUnsignedChannelAnnouncement a_conv;
52247         a_conv.inner = untag_ptr(a);
52248         a_conv.is_owned = ptr_is_owned(a);
52249         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52250         a_conv.is_owned = false;
52251         LDKUnsignedChannelAnnouncement b_conv;
52252         b_conv.inner = untag_ptr(b);
52253         b_conv.is_owned = ptr_is_owned(b);
52254         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52255         b_conv.is_owned = false;
52256         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
52257         return ret_conv;
52258 }
52259
52260 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
52261         LDKChannelAnnouncement this_obj_conv;
52262         this_obj_conv.inner = untag_ptr(this_obj);
52263         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52265         ChannelAnnouncement_free(this_obj_conv);
52266 }
52267
52268 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
52269         LDKChannelAnnouncement this_ptr_conv;
52270         this_ptr_conv.inner = untag_ptr(this_ptr);
52271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52273         this_ptr_conv.is_owned = false;
52274         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52275         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
52276         return ret_arr;
52277 }
52278
52279 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
52280         LDKChannelAnnouncement this_ptr_conv;
52281         this_ptr_conv.inner = untag_ptr(this_ptr);
52282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52284         this_ptr_conv.is_owned = false;
52285         LDKECDSASignature val_ref;
52286         CHECK(val->arr_len == 64);
52287         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52288         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
52289 }
52290
52291 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
52292         LDKChannelAnnouncement this_ptr_conv;
52293         this_ptr_conv.inner = untag_ptr(this_ptr);
52294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52296         this_ptr_conv.is_owned = false;
52297         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52298         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
52299         return ret_arr;
52300 }
52301
52302 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
52303         LDKChannelAnnouncement this_ptr_conv;
52304         this_ptr_conv.inner = untag_ptr(this_ptr);
52305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52307         this_ptr_conv.is_owned = false;
52308         LDKECDSASignature val_ref;
52309         CHECK(val->arr_len == 64);
52310         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52311         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
52312 }
52313
52314 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
52315         LDKChannelAnnouncement this_ptr_conv;
52316         this_ptr_conv.inner = untag_ptr(this_ptr);
52317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52319         this_ptr_conv.is_owned = false;
52320         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52321         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
52322         return ret_arr;
52323 }
52324
52325 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
52326         LDKChannelAnnouncement this_ptr_conv;
52327         this_ptr_conv.inner = untag_ptr(this_ptr);
52328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52330         this_ptr_conv.is_owned = false;
52331         LDKECDSASignature val_ref;
52332         CHECK(val->arr_len == 64);
52333         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52334         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
52335 }
52336
52337 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
52338         LDKChannelAnnouncement this_ptr_conv;
52339         this_ptr_conv.inner = untag_ptr(this_ptr);
52340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52342         this_ptr_conv.is_owned = false;
52343         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52344         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
52345         return ret_arr;
52346 }
52347
52348 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
52349         LDKChannelAnnouncement this_ptr_conv;
52350         this_ptr_conv.inner = untag_ptr(this_ptr);
52351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52353         this_ptr_conv.is_owned = false;
52354         LDKECDSASignature val_ref;
52355         CHECK(val->arr_len == 64);
52356         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52357         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
52358 }
52359
52360 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
52361         LDKChannelAnnouncement this_ptr_conv;
52362         this_ptr_conv.inner = untag_ptr(this_ptr);
52363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52365         this_ptr_conv.is_owned = false;
52366         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
52367         uint64_t ret_ref = 0;
52368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52370         return ret_ref;
52371 }
52372
52373 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
52374         LDKChannelAnnouncement this_ptr_conv;
52375         this_ptr_conv.inner = untag_ptr(this_ptr);
52376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52378         this_ptr_conv.is_owned = false;
52379         LDKUnsignedChannelAnnouncement val_conv;
52380         val_conv.inner = untag_ptr(val);
52381         val_conv.is_owned = ptr_is_owned(val);
52382         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52383         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
52384         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
52385 }
52386
52387 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) {
52388         LDKECDSASignature node_signature_1_arg_ref;
52389         CHECK(node_signature_1_arg->arr_len == 64);
52390         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
52391         LDKECDSASignature node_signature_2_arg_ref;
52392         CHECK(node_signature_2_arg->arr_len == 64);
52393         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
52394         LDKECDSASignature bitcoin_signature_1_arg_ref;
52395         CHECK(bitcoin_signature_1_arg->arr_len == 64);
52396         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
52397         LDKECDSASignature bitcoin_signature_2_arg_ref;
52398         CHECK(bitcoin_signature_2_arg->arr_len == 64);
52399         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
52400         LDKUnsignedChannelAnnouncement contents_arg_conv;
52401         contents_arg_conv.inner = untag_ptr(contents_arg);
52402         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
52403         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
52404         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
52405         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);
52406         uint64_t ret_ref = 0;
52407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52409         return ret_ref;
52410 }
52411
52412 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
52413         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
52414         uint64_t ret_ref = 0;
52415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52417         return ret_ref;
52418 }
52419 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
52420         LDKChannelAnnouncement arg_conv;
52421         arg_conv.inner = untag_ptr(arg);
52422         arg_conv.is_owned = ptr_is_owned(arg);
52423         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52424         arg_conv.is_owned = false;
52425         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
52426         return ret_conv;
52427 }
52428
52429 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
52430         LDKChannelAnnouncement orig_conv;
52431         orig_conv.inner = untag_ptr(orig);
52432         orig_conv.is_owned = ptr_is_owned(orig);
52433         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52434         orig_conv.is_owned = false;
52435         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
52436         uint64_t ret_ref = 0;
52437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52439         return ret_ref;
52440 }
52441
52442 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_hash"))) TS_ChannelAnnouncement_hash(uint64_t o) {
52443         LDKChannelAnnouncement o_conv;
52444         o_conv.inner = untag_ptr(o);
52445         o_conv.is_owned = ptr_is_owned(o);
52446         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52447         o_conv.is_owned = false;
52448         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
52449         return ret_conv;
52450 }
52451
52452 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
52453         LDKChannelAnnouncement a_conv;
52454         a_conv.inner = untag_ptr(a);
52455         a_conv.is_owned = ptr_is_owned(a);
52456         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52457         a_conv.is_owned = false;
52458         LDKChannelAnnouncement b_conv;
52459         b_conv.inner = untag_ptr(b);
52460         b_conv.is_owned = ptr_is_owned(b);
52461         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52462         b_conv.is_owned = false;
52463         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
52464         return ret_conv;
52465 }
52466
52467 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
52468         LDKUnsignedChannelUpdate this_obj_conv;
52469         this_obj_conv.inner = untag_ptr(this_obj);
52470         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52472         UnsignedChannelUpdate_free(this_obj_conv);
52473 }
52474
52475 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
52476         LDKUnsignedChannelUpdate this_ptr_conv;
52477         this_ptr_conv.inner = untag_ptr(this_ptr);
52478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52480         this_ptr_conv.is_owned = false;
52481         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52482         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
52483         return ret_arr;
52484 }
52485
52486 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
52487         LDKUnsignedChannelUpdate this_ptr_conv;
52488         this_ptr_conv.inner = untag_ptr(this_ptr);
52489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52491         this_ptr_conv.is_owned = false;
52492         LDKThirtyTwoBytes val_ref;
52493         CHECK(val->arr_len == 32);
52494         memcpy(val_ref.data, val->elems, 32); FREE(val);
52495         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
52496 }
52497
52498 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
52499         LDKUnsignedChannelUpdate this_ptr_conv;
52500         this_ptr_conv.inner = untag_ptr(this_ptr);
52501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52503         this_ptr_conv.is_owned = false;
52504         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
52505         return ret_conv;
52506 }
52507
52508 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
52509         LDKUnsignedChannelUpdate this_ptr_conv;
52510         this_ptr_conv.inner = untag_ptr(this_ptr);
52511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52513         this_ptr_conv.is_owned = false;
52514         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
52515 }
52516
52517 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
52518         LDKUnsignedChannelUpdate this_ptr_conv;
52519         this_ptr_conv.inner = untag_ptr(this_ptr);
52520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52522         this_ptr_conv.is_owned = false;
52523         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
52524         return ret_conv;
52525 }
52526
52527 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
52528         LDKUnsignedChannelUpdate this_ptr_conv;
52529         this_ptr_conv.inner = untag_ptr(this_ptr);
52530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52532         this_ptr_conv.is_owned = false;
52533         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
52534 }
52535
52536 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
52537         LDKUnsignedChannelUpdate this_ptr_conv;
52538         this_ptr_conv.inner = untag_ptr(this_ptr);
52539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52541         this_ptr_conv.is_owned = false;
52542         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
52543         return ret_conv;
52544 }
52545
52546 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
52547         LDKUnsignedChannelUpdate this_ptr_conv;
52548         this_ptr_conv.inner = untag_ptr(this_ptr);
52549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52551         this_ptr_conv.is_owned = false;
52552         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
52553 }
52554
52555 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
52556         LDKUnsignedChannelUpdate this_ptr_conv;
52557         this_ptr_conv.inner = untag_ptr(this_ptr);
52558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52560         this_ptr_conv.is_owned = false;
52561         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
52562         return ret_conv;
52563 }
52564
52565 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
52566         LDKUnsignedChannelUpdate this_ptr_conv;
52567         this_ptr_conv.inner = untag_ptr(this_ptr);
52568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52570         this_ptr_conv.is_owned = false;
52571         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
52572 }
52573
52574 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
52575         LDKUnsignedChannelUpdate this_ptr_conv;
52576         this_ptr_conv.inner = untag_ptr(this_ptr);
52577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52579         this_ptr_conv.is_owned = false;
52580         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
52581         return ret_conv;
52582 }
52583
52584 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
52585         LDKUnsignedChannelUpdate this_ptr_conv;
52586         this_ptr_conv.inner = untag_ptr(this_ptr);
52587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52589         this_ptr_conv.is_owned = false;
52590         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
52591 }
52592
52593 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
52594         LDKUnsignedChannelUpdate this_ptr_conv;
52595         this_ptr_conv.inner = untag_ptr(this_ptr);
52596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52598         this_ptr_conv.is_owned = false;
52599         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
52600         return ret_conv;
52601 }
52602
52603 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
52604         LDKUnsignedChannelUpdate this_ptr_conv;
52605         this_ptr_conv.inner = untag_ptr(this_ptr);
52606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52608         this_ptr_conv.is_owned = false;
52609         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
52610 }
52611
52612 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
52613         LDKUnsignedChannelUpdate this_ptr_conv;
52614         this_ptr_conv.inner = untag_ptr(this_ptr);
52615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52617         this_ptr_conv.is_owned = false;
52618         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
52619         return ret_conv;
52620 }
52621
52622 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
52623         LDKUnsignedChannelUpdate this_ptr_conv;
52624         this_ptr_conv.inner = untag_ptr(this_ptr);
52625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52627         this_ptr_conv.is_owned = false;
52628         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
52629 }
52630
52631 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
52632         LDKUnsignedChannelUpdate this_ptr_conv;
52633         this_ptr_conv.inner = untag_ptr(this_ptr);
52634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52636         this_ptr_conv.is_owned = false;
52637         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
52638         return ret_conv;
52639 }
52640
52641 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
52642         LDKUnsignedChannelUpdate this_ptr_conv;
52643         this_ptr_conv.inner = untag_ptr(this_ptr);
52644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52646         this_ptr_conv.is_owned = false;
52647         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
52648 }
52649
52650 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
52651         LDKUnsignedChannelUpdate this_ptr_conv;
52652         this_ptr_conv.inner = untag_ptr(this_ptr);
52653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52655         this_ptr_conv.is_owned = false;
52656         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
52657         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52658         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52659         CVec_u8Z_free(ret_var);
52660         return ret_arr;
52661 }
52662
52663 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
52664         LDKUnsignedChannelUpdate this_ptr_conv;
52665         this_ptr_conv.inner = untag_ptr(this_ptr);
52666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52668         this_ptr_conv.is_owned = false;
52669         LDKCVec_u8Z val_ref;
52670         val_ref.datalen = val->arr_len;
52671         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
52672         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
52673         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
52674 }
52675
52676 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) {
52677         LDKThirtyTwoBytes chain_hash_arg_ref;
52678         CHECK(chain_hash_arg->arr_len == 32);
52679         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
52680         LDKCVec_u8Z excess_data_arg_ref;
52681         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
52682         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
52683         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
52684         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);
52685         uint64_t ret_ref = 0;
52686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52688         return ret_ref;
52689 }
52690
52691 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
52692         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
52693         uint64_t ret_ref = 0;
52694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52696         return ret_ref;
52697 }
52698 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
52699         LDKUnsignedChannelUpdate arg_conv;
52700         arg_conv.inner = untag_ptr(arg);
52701         arg_conv.is_owned = ptr_is_owned(arg);
52702         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52703         arg_conv.is_owned = false;
52704         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
52705         return ret_conv;
52706 }
52707
52708 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
52709         LDKUnsignedChannelUpdate orig_conv;
52710         orig_conv.inner = untag_ptr(orig);
52711         orig_conv.is_owned = ptr_is_owned(orig);
52712         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52713         orig_conv.is_owned = false;
52714         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
52715         uint64_t ret_ref = 0;
52716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52718         return ret_ref;
52719 }
52720
52721 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_hash"))) TS_UnsignedChannelUpdate_hash(uint64_t o) {
52722         LDKUnsignedChannelUpdate o_conv;
52723         o_conv.inner = untag_ptr(o);
52724         o_conv.is_owned = ptr_is_owned(o);
52725         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52726         o_conv.is_owned = false;
52727         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
52728         return ret_conv;
52729 }
52730
52731 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
52732         LDKUnsignedChannelUpdate a_conv;
52733         a_conv.inner = untag_ptr(a);
52734         a_conv.is_owned = ptr_is_owned(a);
52735         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52736         a_conv.is_owned = false;
52737         LDKUnsignedChannelUpdate b_conv;
52738         b_conv.inner = untag_ptr(b);
52739         b_conv.is_owned = ptr_is_owned(b);
52740         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52741         b_conv.is_owned = false;
52742         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
52743         return ret_conv;
52744 }
52745
52746 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
52747         LDKChannelUpdate this_obj_conv;
52748         this_obj_conv.inner = untag_ptr(this_obj);
52749         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52751         ChannelUpdate_free(this_obj_conv);
52752 }
52753
52754 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
52755         LDKChannelUpdate this_ptr_conv;
52756         this_ptr_conv.inner = untag_ptr(this_ptr);
52757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52759         this_ptr_conv.is_owned = false;
52760         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52761         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
52762         return ret_arr;
52763 }
52764
52765 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
52766         LDKChannelUpdate this_ptr_conv;
52767         this_ptr_conv.inner = untag_ptr(this_ptr);
52768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52770         this_ptr_conv.is_owned = false;
52771         LDKECDSASignature val_ref;
52772         CHECK(val->arr_len == 64);
52773         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52774         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
52775 }
52776
52777 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
52778         LDKChannelUpdate this_ptr_conv;
52779         this_ptr_conv.inner = untag_ptr(this_ptr);
52780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52782         this_ptr_conv.is_owned = false;
52783         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
52784         uint64_t ret_ref = 0;
52785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52787         return ret_ref;
52788 }
52789
52790 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
52791         LDKChannelUpdate this_ptr_conv;
52792         this_ptr_conv.inner = untag_ptr(this_ptr);
52793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52795         this_ptr_conv.is_owned = false;
52796         LDKUnsignedChannelUpdate val_conv;
52797         val_conv.inner = untag_ptr(val);
52798         val_conv.is_owned = ptr_is_owned(val);
52799         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52800         val_conv = UnsignedChannelUpdate_clone(&val_conv);
52801         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
52802 }
52803
52804 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
52805         LDKECDSASignature signature_arg_ref;
52806         CHECK(signature_arg->arr_len == 64);
52807         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
52808         LDKUnsignedChannelUpdate contents_arg_conv;
52809         contents_arg_conv.inner = untag_ptr(contents_arg);
52810         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
52811         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
52812         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
52813         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
52814         uint64_t ret_ref = 0;
52815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52817         return ret_ref;
52818 }
52819
52820 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
52821         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
52822         uint64_t ret_ref = 0;
52823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52825         return ret_ref;
52826 }
52827 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
52828         LDKChannelUpdate arg_conv;
52829         arg_conv.inner = untag_ptr(arg);
52830         arg_conv.is_owned = ptr_is_owned(arg);
52831         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52832         arg_conv.is_owned = false;
52833         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
52834         return ret_conv;
52835 }
52836
52837 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
52838         LDKChannelUpdate orig_conv;
52839         orig_conv.inner = untag_ptr(orig);
52840         orig_conv.is_owned = ptr_is_owned(orig);
52841         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52842         orig_conv.is_owned = false;
52843         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
52844         uint64_t ret_ref = 0;
52845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52847         return ret_ref;
52848 }
52849
52850 int64_t  __attribute__((export_name("TS_ChannelUpdate_hash"))) TS_ChannelUpdate_hash(uint64_t o) {
52851         LDKChannelUpdate o_conv;
52852         o_conv.inner = untag_ptr(o);
52853         o_conv.is_owned = ptr_is_owned(o);
52854         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52855         o_conv.is_owned = false;
52856         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
52857         return ret_conv;
52858 }
52859
52860 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
52861         LDKChannelUpdate a_conv;
52862         a_conv.inner = untag_ptr(a);
52863         a_conv.is_owned = ptr_is_owned(a);
52864         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52865         a_conv.is_owned = false;
52866         LDKChannelUpdate b_conv;
52867         b_conv.inner = untag_ptr(b);
52868         b_conv.is_owned = ptr_is_owned(b);
52869         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52870         b_conv.is_owned = false;
52871         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
52872         return ret_conv;
52873 }
52874
52875 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
52876         LDKQueryChannelRange this_obj_conv;
52877         this_obj_conv.inner = untag_ptr(this_obj);
52878         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52880         QueryChannelRange_free(this_obj_conv);
52881 }
52882
52883 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
52884         LDKQueryChannelRange this_ptr_conv;
52885         this_ptr_conv.inner = untag_ptr(this_ptr);
52886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52888         this_ptr_conv.is_owned = false;
52889         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52890         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
52891         return ret_arr;
52892 }
52893
52894 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
52895         LDKQueryChannelRange this_ptr_conv;
52896         this_ptr_conv.inner = untag_ptr(this_ptr);
52897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52899         this_ptr_conv.is_owned = false;
52900         LDKThirtyTwoBytes val_ref;
52901         CHECK(val->arr_len == 32);
52902         memcpy(val_ref.data, val->elems, 32); FREE(val);
52903         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
52904 }
52905
52906 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
52907         LDKQueryChannelRange this_ptr_conv;
52908         this_ptr_conv.inner = untag_ptr(this_ptr);
52909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52911         this_ptr_conv.is_owned = false;
52912         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
52913         return ret_conv;
52914 }
52915
52916 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
52917         LDKQueryChannelRange this_ptr_conv;
52918         this_ptr_conv.inner = untag_ptr(this_ptr);
52919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52921         this_ptr_conv.is_owned = false;
52922         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
52923 }
52924
52925 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
52926         LDKQueryChannelRange this_ptr_conv;
52927         this_ptr_conv.inner = untag_ptr(this_ptr);
52928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52930         this_ptr_conv.is_owned = false;
52931         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
52932         return ret_conv;
52933 }
52934
52935 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
52936         LDKQueryChannelRange this_ptr_conv;
52937         this_ptr_conv.inner = untag_ptr(this_ptr);
52938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52940         this_ptr_conv.is_owned = false;
52941         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
52942 }
52943
52944 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) {
52945         LDKThirtyTwoBytes chain_hash_arg_ref;
52946         CHECK(chain_hash_arg->arr_len == 32);
52947         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
52948         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
52949         uint64_t ret_ref = 0;
52950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52952         return ret_ref;
52953 }
52954
52955 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
52956         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
52957         uint64_t ret_ref = 0;
52958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52960         return ret_ref;
52961 }
52962 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
52963         LDKQueryChannelRange arg_conv;
52964         arg_conv.inner = untag_ptr(arg);
52965         arg_conv.is_owned = ptr_is_owned(arg);
52966         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52967         arg_conv.is_owned = false;
52968         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
52969         return ret_conv;
52970 }
52971
52972 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
52973         LDKQueryChannelRange orig_conv;
52974         orig_conv.inner = untag_ptr(orig);
52975         orig_conv.is_owned = ptr_is_owned(orig);
52976         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52977         orig_conv.is_owned = false;
52978         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
52979         uint64_t ret_ref = 0;
52980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52982         return ret_ref;
52983 }
52984
52985 int64_t  __attribute__((export_name("TS_QueryChannelRange_hash"))) TS_QueryChannelRange_hash(uint64_t o) {
52986         LDKQueryChannelRange o_conv;
52987         o_conv.inner = untag_ptr(o);
52988         o_conv.is_owned = ptr_is_owned(o);
52989         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52990         o_conv.is_owned = false;
52991         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
52992         return ret_conv;
52993 }
52994
52995 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
52996         LDKQueryChannelRange a_conv;
52997         a_conv.inner = untag_ptr(a);
52998         a_conv.is_owned = ptr_is_owned(a);
52999         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53000         a_conv.is_owned = false;
53001         LDKQueryChannelRange b_conv;
53002         b_conv.inner = untag_ptr(b);
53003         b_conv.is_owned = ptr_is_owned(b);
53004         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53005         b_conv.is_owned = false;
53006         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
53007         return ret_conv;
53008 }
53009
53010 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
53011         LDKReplyChannelRange this_obj_conv;
53012         this_obj_conv.inner = untag_ptr(this_obj);
53013         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53015         ReplyChannelRange_free(this_obj_conv);
53016 }
53017
53018 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
53019         LDKReplyChannelRange this_ptr_conv;
53020         this_ptr_conv.inner = untag_ptr(this_ptr);
53021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53023         this_ptr_conv.is_owned = false;
53024         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53025         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
53026         return ret_arr;
53027 }
53028
53029 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
53030         LDKReplyChannelRange this_ptr_conv;
53031         this_ptr_conv.inner = untag_ptr(this_ptr);
53032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53034         this_ptr_conv.is_owned = false;
53035         LDKThirtyTwoBytes val_ref;
53036         CHECK(val->arr_len == 32);
53037         memcpy(val_ref.data, val->elems, 32); FREE(val);
53038         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
53039 }
53040
53041 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
53042         LDKReplyChannelRange this_ptr_conv;
53043         this_ptr_conv.inner = untag_ptr(this_ptr);
53044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53046         this_ptr_conv.is_owned = false;
53047         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
53048         return ret_conv;
53049 }
53050
53051 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
53052         LDKReplyChannelRange this_ptr_conv;
53053         this_ptr_conv.inner = untag_ptr(this_ptr);
53054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53056         this_ptr_conv.is_owned = false;
53057         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
53058 }
53059
53060 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
53061         LDKReplyChannelRange this_ptr_conv;
53062         this_ptr_conv.inner = untag_ptr(this_ptr);
53063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53065         this_ptr_conv.is_owned = false;
53066         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
53067         return ret_conv;
53068 }
53069
53070 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
53071         LDKReplyChannelRange this_ptr_conv;
53072         this_ptr_conv.inner = untag_ptr(this_ptr);
53073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53075         this_ptr_conv.is_owned = false;
53076         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
53077 }
53078
53079 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
53080         LDKReplyChannelRange this_ptr_conv;
53081         this_ptr_conv.inner = untag_ptr(this_ptr);
53082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53084         this_ptr_conv.is_owned = false;
53085         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
53086         return ret_conv;
53087 }
53088
53089 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
53090         LDKReplyChannelRange this_ptr_conv;
53091         this_ptr_conv.inner = untag_ptr(this_ptr);
53092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53094         this_ptr_conv.is_owned = false;
53095         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
53096 }
53097
53098 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
53099         LDKReplyChannelRange this_ptr_conv;
53100         this_ptr_conv.inner = untag_ptr(this_ptr);
53101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53103         this_ptr_conv.is_owned = false;
53104         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
53105         int64_tArray ret_arr = NULL;
53106         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
53107         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
53108         for (size_t i = 0; i < ret_var.datalen; i++) {
53109                 int64_t ret_conv_8_conv = ret_var.data[i];
53110                 ret_arr_ptr[i] = ret_conv_8_conv;
53111         }
53112         
53113         FREE(ret_var.data);
53114         return ret_arr;
53115 }
53116
53117 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
53118         LDKReplyChannelRange this_ptr_conv;
53119         this_ptr_conv.inner = untag_ptr(this_ptr);
53120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53122         this_ptr_conv.is_owned = false;
53123         LDKCVec_u64Z val_constr;
53124         val_constr.datalen = val->arr_len;
53125         if (val_constr.datalen > 0)
53126                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53127         else
53128                 val_constr.data = NULL;
53129         int64_t* val_vals = val->elems;
53130         for (size_t i = 0; i < val_constr.datalen; i++) {
53131                 int64_t val_conv_8 = val_vals[i];
53132                 val_constr.data[i] = val_conv_8;
53133         }
53134         FREE(val);
53135         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
53136 }
53137
53138 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) {
53139         LDKThirtyTwoBytes chain_hash_arg_ref;
53140         CHECK(chain_hash_arg->arr_len == 32);
53141         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53142         LDKCVec_u64Z short_channel_ids_arg_constr;
53143         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
53144         if (short_channel_ids_arg_constr.datalen > 0)
53145                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53146         else
53147                 short_channel_ids_arg_constr.data = NULL;
53148         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
53149         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
53150                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
53151                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
53152         }
53153         FREE(short_channel_ids_arg);
53154         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
53155         uint64_t ret_ref = 0;
53156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53158         return ret_ref;
53159 }
53160
53161 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
53162         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
53163         uint64_t ret_ref = 0;
53164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53166         return ret_ref;
53167 }
53168 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
53169         LDKReplyChannelRange arg_conv;
53170         arg_conv.inner = untag_ptr(arg);
53171         arg_conv.is_owned = ptr_is_owned(arg);
53172         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53173         arg_conv.is_owned = false;
53174         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
53175         return ret_conv;
53176 }
53177
53178 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
53179         LDKReplyChannelRange orig_conv;
53180         orig_conv.inner = untag_ptr(orig);
53181         orig_conv.is_owned = ptr_is_owned(orig);
53182         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53183         orig_conv.is_owned = false;
53184         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
53185         uint64_t ret_ref = 0;
53186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53188         return ret_ref;
53189 }
53190
53191 int64_t  __attribute__((export_name("TS_ReplyChannelRange_hash"))) TS_ReplyChannelRange_hash(uint64_t o) {
53192         LDKReplyChannelRange o_conv;
53193         o_conv.inner = untag_ptr(o);
53194         o_conv.is_owned = ptr_is_owned(o);
53195         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53196         o_conv.is_owned = false;
53197         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
53198         return ret_conv;
53199 }
53200
53201 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
53202         LDKReplyChannelRange a_conv;
53203         a_conv.inner = untag_ptr(a);
53204         a_conv.is_owned = ptr_is_owned(a);
53205         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53206         a_conv.is_owned = false;
53207         LDKReplyChannelRange b_conv;
53208         b_conv.inner = untag_ptr(b);
53209         b_conv.is_owned = ptr_is_owned(b);
53210         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53211         b_conv.is_owned = false;
53212         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
53213         return ret_conv;
53214 }
53215
53216 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
53217         LDKQueryShortChannelIds this_obj_conv;
53218         this_obj_conv.inner = untag_ptr(this_obj);
53219         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53221         QueryShortChannelIds_free(this_obj_conv);
53222 }
53223
53224 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
53225         LDKQueryShortChannelIds this_ptr_conv;
53226         this_ptr_conv.inner = untag_ptr(this_ptr);
53227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53229         this_ptr_conv.is_owned = false;
53230         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53231         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
53232         return ret_arr;
53233 }
53234
53235 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
53236         LDKQueryShortChannelIds this_ptr_conv;
53237         this_ptr_conv.inner = untag_ptr(this_ptr);
53238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53240         this_ptr_conv.is_owned = false;
53241         LDKThirtyTwoBytes val_ref;
53242         CHECK(val->arr_len == 32);
53243         memcpy(val_ref.data, val->elems, 32); FREE(val);
53244         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
53245 }
53246
53247 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
53248         LDKQueryShortChannelIds this_ptr_conv;
53249         this_ptr_conv.inner = untag_ptr(this_ptr);
53250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53252         this_ptr_conv.is_owned = false;
53253         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
53254         int64_tArray ret_arr = NULL;
53255         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
53256         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
53257         for (size_t i = 0; i < ret_var.datalen; i++) {
53258                 int64_t ret_conv_8_conv = ret_var.data[i];
53259                 ret_arr_ptr[i] = ret_conv_8_conv;
53260         }
53261         
53262         FREE(ret_var.data);
53263         return ret_arr;
53264 }
53265
53266 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
53267         LDKQueryShortChannelIds this_ptr_conv;
53268         this_ptr_conv.inner = untag_ptr(this_ptr);
53269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53271         this_ptr_conv.is_owned = false;
53272         LDKCVec_u64Z val_constr;
53273         val_constr.datalen = val->arr_len;
53274         if (val_constr.datalen > 0)
53275                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53276         else
53277                 val_constr.data = NULL;
53278         int64_t* val_vals = val->elems;
53279         for (size_t i = 0; i < val_constr.datalen; i++) {
53280                 int64_t val_conv_8 = val_vals[i];
53281                 val_constr.data[i] = val_conv_8;
53282         }
53283         FREE(val);
53284         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
53285 }
53286
53287 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
53288         LDKThirtyTwoBytes chain_hash_arg_ref;
53289         CHECK(chain_hash_arg->arr_len == 32);
53290         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53291         LDKCVec_u64Z short_channel_ids_arg_constr;
53292         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
53293         if (short_channel_ids_arg_constr.datalen > 0)
53294                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53295         else
53296                 short_channel_ids_arg_constr.data = NULL;
53297         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
53298         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
53299                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
53300                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
53301         }
53302         FREE(short_channel_ids_arg);
53303         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
53304         uint64_t ret_ref = 0;
53305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53307         return ret_ref;
53308 }
53309
53310 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
53311         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
53312         uint64_t ret_ref = 0;
53313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53315         return ret_ref;
53316 }
53317 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
53318         LDKQueryShortChannelIds arg_conv;
53319         arg_conv.inner = untag_ptr(arg);
53320         arg_conv.is_owned = ptr_is_owned(arg);
53321         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53322         arg_conv.is_owned = false;
53323         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
53324         return ret_conv;
53325 }
53326
53327 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
53328         LDKQueryShortChannelIds orig_conv;
53329         orig_conv.inner = untag_ptr(orig);
53330         orig_conv.is_owned = ptr_is_owned(orig);
53331         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53332         orig_conv.is_owned = false;
53333         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
53334         uint64_t ret_ref = 0;
53335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53337         return ret_ref;
53338 }
53339
53340 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_hash"))) TS_QueryShortChannelIds_hash(uint64_t o) {
53341         LDKQueryShortChannelIds o_conv;
53342         o_conv.inner = untag_ptr(o);
53343         o_conv.is_owned = ptr_is_owned(o);
53344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53345         o_conv.is_owned = false;
53346         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
53347         return ret_conv;
53348 }
53349
53350 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
53351         LDKQueryShortChannelIds a_conv;
53352         a_conv.inner = untag_ptr(a);
53353         a_conv.is_owned = ptr_is_owned(a);
53354         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53355         a_conv.is_owned = false;
53356         LDKQueryShortChannelIds b_conv;
53357         b_conv.inner = untag_ptr(b);
53358         b_conv.is_owned = ptr_is_owned(b);
53359         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53360         b_conv.is_owned = false;
53361         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
53362         return ret_conv;
53363 }
53364
53365 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
53366         LDKReplyShortChannelIdsEnd this_obj_conv;
53367         this_obj_conv.inner = untag_ptr(this_obj);
53368         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53370         ReplyShortChannelIdsEnd_free(this_obj_conv);
53371 }
53372
53373 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
53374         LDKReplyShortChannelIdsEnd this_ptr_conv;
53375         this_ptr_conv.inner = untag_ptr(this_ptr);
53376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53378         this_ptr_conv.is_owned = false;
53379         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53380         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
53381         return ret_arr;
53382 }
53383
53384 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
53385         LDKReplyShortChannelIdsEnd this_ptr_conv;
53386         this_ptr_conv.inner = untag_ptr(this_ptr);
53387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53389         this_ptr_conv.is_owned = false;
53390         LDKThirtyTwoBytes val_ref;
53391         CHECK(val->arr_len == 32);
53392         memcpy(val_ref.data, val->elems, 32); FREE(val);
53393         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
53394 }
53395
53396 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
53397         LDKReplyShortChannelIdsEnd this_ptr_conv;
53398         this_ptr_conv.inner = untag_ptr(this_ptr);
53399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53401         this_ptr_conv.is_owned = false;
53402         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
53403         return ret_conv;
53404 }
53405
53406 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
53407         LDKReplyShortChannelIdsEnd this_ptr_conv;
53408         this_ptr_conv.inner = untag_ptr(this_ptr);
53409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53411         this_ptr_conv.is_owned = false;
53412         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
53413 }
53414
53415 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
53416         LDKThirtyTwoBytes chain_hash_arg_ref;
53417         CHECK(chain_hash_arg->arr_len == 32);
53418         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53419         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
53420         uint64_t ret_ref = 0;
53421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53423         return ret_ref;
53424 }
53425
53426 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
53427         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
53428         uint64_t ret_ref = 0;
53429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53431         return ret_ref;
53432 }
53433 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
53434         LDKReplyShortChannelIdsEnd arg_conv;
53435         arg_conv.inner = untag_ptr(arg);
53436         arg_conv.is_owned = ptr_is_owned(arg);
53437         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53438         arg_conv.is_owned = false;
53439         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
53440         return ret_conv;
53441 }
53442
53443 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
53444         LDKReplyShortChannelIdsEnd orig_conv;
53445         orig_conv.inner = untag_ptr(orig);
53446         orig_conv.is_owned = ptr_is_owned(orig);
53447         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53448         orig_conv.is_owned = false;
53449         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
53450         uint64_t ret_ref = 0;
53451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53453         return ret_ref;
53454 }
53455
53456 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_hash"))) TS_ReplyShortChannelIdsEnd_hash(uint64_t o) {
53457         LDKReplyShortChannelIdsEnd o_conv;
53458         o_conv.inner = untag_ptr(o);
53459         o_conv.is_owned = ptr_is_owned(o);
53460         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53461         o_conv.is_owned = false;
53462         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
53463         return ret_conv;
53464 }
53465
53466 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
53467         LDKReplyShortChannelIdsEnd a_conv;
53468         a_conv.inner = untag_ptr(a);
53469         a_conv.is_owned = ptr_is_owned(a);
53470         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53471         a_conv.is_owned = false;
53472         LDKReplyShortChannelIdsEnd b_conv;
53473         b_conv.inner = untag_ptr(b);
53474         b_conv.is_owned = ptr_is_owned(b);
53475         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53476         b_conv.is_owned = false;
53477         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
53478         return ret_conv;
53479 }
53480
53481 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
53482         LDKGossipTimestampFilter this_obj_conv;
53483         this_obj_conv.inner = untag_ptr(this_obj);
53484         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53486         GossipTimestampFilter_free(this_obj_conv);
53487 }
53488
53489 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
53490         LDKGossipTimestampFilter this_ptr_conv;
53491         this_ptr_conv.inner = untag_ptr(this_ptr);
53492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53494         this_ptr_conv.is_owned = false;
53495         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53496         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
53497         return ret_arr;
53498 }
53499
53500 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
53501         LDKGossipTimestampFilter this_ptr_conv;
53502         this_ptr_conv.inner = untag_ptr(this_ptr);
53503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53505         this_ptr_conv.is_owned = false;
53506         LDKThirtyTwoBytes val_ref;
53507         CHECK(val->arr_len == 32);
53508         memcpy(val_ref.data, val->elems, 32); FREE(val);
53509         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
53510 }
53511
53512 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
53513         LDKGossipTimestampFilter this_ptr_conv;
53514         this_ptr_conv.inner = untag_ptr(this_ptr);
53515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53517         this_ptr_conv.is_owned = false;
53518         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
53519         return ret_conv;
53520 }
53521
53522 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
53523         LDKGossipTimestampFilter this_ptr_conv;
53524         this_ptr_conv.inner = untag_ptr(this_ptr);
53525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53527         this_ptr_conv.is_owned = false;
53528         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
53529 }
53530
53531 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
53532         LDKGossipTimestampFilter this_ptr_conv;
53533         this_ptr_conv.inner = untag_ptr(this_ptr);
53534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53536         this_ptr_conv.is_owned = false;
53537         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
53538         return ret_conv;
53539 }
53540
53541 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
53542         LDKGossipTimestampFilter this_ptr_conv;
53543         this_ptr_conv.inner = untag_ptr(this_ptr);
53544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53546         this_ptr_conv.is_owned = false;
53547         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
53548 }
53549
53550 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) {
53551         LDKThirtyTwoBytes chain_hash_arg_ref;
53552         CHECK(chain_hash_arg->arr_len == 32);
53553         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53554         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
53555         uint64_t ret_ref = 0;
53556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53558         return ret_ref;
53559 }
53560
53561 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
53562         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
53563         uint64_t ret_ref = 0;
53564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53566         return ret_ref;
53567 }
53568 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
53569         LDKGossipTimestampFilter arg_conv;
53570         arg_conv.inner = untag_ptr(arg);
53571         arg_conv.is_owned = ptr_is_owned(arg);
53572         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53573         arg_conv.is_owned = false;
53574         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
53575         return ret_conv;
53576 }
53577
53578 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
53579         LDKGossipTimestampFilter orig_conv;
53580         orig_conv.inner = untag_ptr(orig);
53581         orig_conv.is_owned = ptr_is_owned(orig);
53582         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53583         orig_conv.is_owned = false;
53584         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
53585         uint64_t ret_ref = 0;
53586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53588         return ret_ref;
53589 }
53590
53591 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_hash"))) TS_GossipTimestampFilter_hash(uint64_t o) {
53592         LDKGossipTimestampFilter o_conv;
53593         o_conv.inner = untag_ptr(o);
53594         o_conv.is_owned = ptr_is_owned(o);
53595         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53596         o_conv.is_owned = false;
53597         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
53598         return ret_conv;
53599 }
53600
53601 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
53602         LDKGossipTimestampFilter a_conv;
53603         a_conv.inner = untag_ptr(a);
53604         a_conv.is_owned = ptr_is_owned(a);
53605         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53606         a_conv.is_owned = false;
53607         LDKGossipTimestampFilter b_conv;
53608         b_conv.inner = untag_ptr(b);
53609         b_conv.is_owned = ptr_is_owned(b);
53610         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53611         b_conv.is_owned = false;
53612         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
53613         return ret_conv;
53614 }
53615
53616 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
53617         if (!ptr_is_owned(this_ptr)) return;
53618         void* this_ptr_ptr = untag_ptr(this_ptr);
53619         CHECK_ACCESS(this_ptr_ptr);
53620         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
53621         FREE(untag_ptr(this_ptr));
53622         ErrorAction_free(this_ptr_conv);
53623 }
53624
53625 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
53626         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53627         *ret_copy = ErrorAction_clone(arg);
53628         uint64_t ret_ref = tag_ptr(ret_copy, true);
53629         return ret_ref;
53630 }
53631 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
53632         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
53633         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
53634         return ret_conv;
53635 }
53636
53637 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
53638         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
53639         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53640         *ret_copy = ErrorAction_clone(orig_conv);
53641         uint64_t ret_ref = tag_ptr(ret_copy, true);
53642         return ret_ref;
53643 }
53644
53645 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
53646         LDKErrorMessage msg_conv;
53647         msg_conv.inner = untag_ptr(msg);
53648         msg_conv.is_owned = ptr_is_owned(msg);
53649         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53650         msg_conv = ErrorMessage_clone(&msg_conv);
53651         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53652         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
53653         uint64_t ret_ref = tag_ptr(ret_copy, true);
53654         return ret_ref;
53655 }
53656
53657 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer_with_warning"))) TS_ErrorAction_disconnect_peer_with_warning(uint64_t msg) {
53658         LDKWarningMessage msg_conv;
53659         msg_conv.inner = untag_ptr(msg);
53660         msg_conv.is_owned = ptr_is_owned(msg);
53661         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53662         msg_conv = WarningMessage_clone(&msg_conv);
53663         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53664         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
53665         uint64_t ret_ref = tag_ptr(ret_copy, true);
53666         return ret_ref;
53667 }
53668
53669 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
53670         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53671         *ret_copy = ErrorAction_ignore_error();
53672         uint64_t ret_ref = tag_ptr(ret_copy, true);
53673         return ret_ref;
53674 }
53675
53676 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
53677         LDKLevel a_conv = LDKLevel_from_js(a);
53678         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53679         *ret_copy = ErrorAction_ignore_and_log(a_conv);
53680         uint64_t ret_ref = tag_ptr(ret_copy, true);
53681         return ret_ref;
53682 }
53683
53684 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
53685         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53686         *ret_copy = ErrorAction_ignore_duplicate_gossip();
53687         uint64_t ret_ref = tag_ptr(ret_copy, true);
53688         return ret_ref;
53689 }
53690
53691 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
53692         LDKErrorMessage msg_conv;
53693         msg_conv.inner = untag_ptr(msg);
53694         msg_conv.is_owned = ptr_is_owned(msg);
53695         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53696         msg_conv = ErrorMessage_clone(&msg_conv);
53697         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53698         *ret_copy = ErrorAction_send_error_message(msg_conv);
53699         uint64_t ret_ref = tag_ptr(ret_copy, true);
53700         return ret_ref;
53701 }
53702
53703 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
53704         LDKWarningMessage msg_conv;
53705         msg_conv.inner = untag_ptr(msg);
53706         msg_conv.is_owned = ptr_is_owned(msg);
53707         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53708         msg_conv = WarningMessage_clone(&msg_conv);
53709         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
53710         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53711         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
53712         uint64_t ret_ref = tag_ptr(ret_copy, true);
53713         return ret_ref;
53714 }
53715
53716 int64_t  __attribute__((export_name("TS_ErrorAction_hash"))) TS_ErrorAction_hash(uint64_t o) {
53717         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
53718         int64_t ret_conv = ErrorAction_hash(o_conv);
53719         return ret_conv;
53720 }
53721
53722 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
53723         LDKLightningError this_obj_conv;
53724         this_obj_conv.inner = untag_ptr(this_obj);
53725         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53727         LightningError_free(this_obj_conv);
53728 }
53729
53730 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
53731         LDKLightningError this_ptr_conv;
53732         this_ptr_conv.inner = untag_ptr(this_ptr);
53733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53735         this_ptr_conv.is_owned = false;
53736         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
53737         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53738         Str_free(ret_str);
53739         return ret_conv;
53740 }
53741
53742 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
53743         LDKLightningError this_ptr_conv;
53744         this_ptr_conv.inner = untag_ptr(this_ptr);
53745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53747         this_ptr_conv.is_owned = false;
53748         LDKStr val_conv = str_ref_to_owned_c(val);
53749         LightningError_set_err(&this_ptr_conv, val_conv);
53750 }
53751
53752 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
53753         LDKLightningError this_ptr_conv;
53754         this_ptr_conv.inner = untag_ptr(this_ptr);
53755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53757         this_ptr_conv.is_owned = false;
53758         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53759         *ret_copy = LightningError_get_action(&this_ptr_conv);
53760         uint64_t ret_ref = tag_ptr(ret_copy, true);
53761         return ret_ref;
53762 }
53763
53764 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
53765         LDKLightningError this_ptr_conv;
53766         this_ptr_conv.inner = untag_ptr(this_ptr);
53767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53769         this_ptr_conv.is_owned = false;
53770         void* val_ptr = untag_ptr(val);
53771         CHECK_ACCESS(val_ptr);
53772         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
53773         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
53774         LightningError_set_action(&this_ptr_conv, val_conv);
53775 }
53776
53777 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
53778         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
53779         void* action_arg_ptr = untag_ptr(action_arg);
53780         CHECK_ACCESS(action_arg_ptr);
53781         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
53782         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
53783         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
53784         uint64_t ret_ref = 0;
53785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53787         return ret_ref;
53788 }
53789
53790 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
53791         LDKLightningError ret_var = LightningError_clone(arg);
53792         uint64_t ret_ref = 0;
53793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53795         return ret_ref;
53796 }
53797 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
53798         LDKLightningError arg_conv;
53799         arg_conv.inner = untag_ptr(arg);
53800         arg_conv.is_owned = ptr_is_owned(arg);
53801         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53802         arg_conv.is_owned = false;
53803         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
53804         return ret_conv;
53805 }
53806
53807 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
53808         LDKLightningError orig_conv;
53809         orig_conv.inner = untag_ptr(orig);
53810         orig_conv.is_owned = ptr_is_owned(orig);
53811         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53812         orig_conv.is_owned = false;
53813         LDKLightningError ret_var = LightningError_clone(&orig_conv);
53814         uint64_t ret_ref = 0;
53815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53817         return ret_ref;
53818 }
53819
53820 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
53821         LDKCommitmentUpdate this_obj_conv;
53822         this_obj_conv.inner = untag_ptr(this_obj);
53823         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53825         CommitmentUpdate_free(this_obj_conv);
53826 }
53827
53828 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
53829         LDKCommitmentUpdate this_ptr_conv;
53830         this_ptr_conv.inner = untag_ptr(this_ptr);
53831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53833         this_ptr_conv.is_owned = false;
53834         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
53835         uint64_tArray ret_arr = NULL;
53836         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53837         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53838         for (size_t p = 0; p < ret_var.datalen; p++) {
53839                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
53840                 uint64_t ret_conv_15_ref = 0;
53841                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
53842                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
53843                 ret_arr_ptr[p] = ret_conv_15_ref;
53844         }
53845         
53846         FREE(ret_var.data);
53847         return ret_arr;
53848 }
53849
53850 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
53851         LDKCommitmentUpdate this_ptr_conv;
53852         this_ptr_conv.inner = untag_ptr(this_ptr);
53853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53855         this_ptr_conv.is_owned = false;
53856         LDKCVec_UpdateAddHTLCZ val_constr;
53857         val_constr.datalen = val->arr_len;
53858         if (val_constr.datalen > 0)
53859                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
53860         else
53861                 val_constr.data = NULL;
53862         uint64_t* val_vals = val->elems;
53863         for (size_t p = 0; p < val_constr.datalen; p++) {
53864                 uint64_t val_conv_15 = val_vals[p];
53865                 LDKUpdateAddHTLC val_conv_15_conv;
53866                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
53867                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
53868                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
53869                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
53870                 val_constr.data[p] = val_conv_15_conv;
53871         }
53872         FREE(val);
53873         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
53874 }
53875
53876 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
53877         LDKCommitmentUpdate this_ptr_conv;
53878         this_ptr_conv.inner = untag_ptr(this_ptr);
53879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53881         this_ptr_conv.is_owned = false;
53882         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
53883         uint64_tArray ret_arr = NULL;
53884         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53885         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53886         for (size_t t = 0; t < ret_var.datalen; t++) {
53887                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
53888                 uint64_t ret_conv_19_ref = 0;
53889                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
53890                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
53891                 ret_arr_ptr[t] = ret_conv_19_ref;
53892         }
53893         
53894         FREE(ret_var.data);
53895         return ret_arr;
53896 }
53897
53898 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
53899         LDKCommitmentUpdate this_ptr_conv;
53900         this_ptr_conv.inner = untag_ptr(this_ptr);
53901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53903         this_ptr_conv.is_owned = false;
53904         LDKCVec_UpdateFulfillHTLCZ val_constr;
53905         val_constr.datalen = val->arr_len;
53906         if (val_constr.datalen > 0)
53907                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
53908         else
53909                 val_constr.data = NULL;
53910         uint64_t* val_vals = val->elems;
53911         for (size_t t = 0; t < val_constr.datalen; t++) {
53912                 uint64_t val_conv_19 = val_vals[t];
53913                 LDKUpdateFulfillHTLC val_conv_19_conv;
53914                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
53915                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
53916                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
53917                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
53918                 val_constr.data[t] = val_conv_19_conv;
53919         }
53920         FREE(val);
53921         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
53922 }
53923
53924 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
53925         LDKCommitmentUpdate this_ptr_conv;
53926         this_ptr_conv.inner = untag_ptr(this_ptr);
53927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53929         this_ptr_conv.is_owned = false;
53930         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
53931         uint64_tArray ret_arr = NULL;
53932         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53933         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53934         for (size_t q = 0; q < ret_var.datalen; q++) {
53935                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
53936                 uint64_t ret_conv_16_ref = 0;
53937                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
53938                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
53939                 ret_arr_ptr[q] = ret_conv_16_ref;
53940         }
53941         
53942         FREE(ret_var.data);
53943         return ret_arr;
53944 }
53945
53946 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
53947         LDKCommitmentUpdate this_ptr_conv;
53948         this_ptr_conv.inner = untag_ptr(this_ptr);
53949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53951         this_ptr_conv.is_owned = false;
53952         LDKCVec_UpdateFailHTLCZ val_constr;
53953         val_constr.datalen = val->arr_len;
53954         if (val_constr.datalen > 0)
53955                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
53956         else
53957                 val_constr.data = NULL;
53958         uint64_t* val_vals = val->elems;
53959         for (size_t q = 0; q < val_constr.datalen; q++) {
53960                 uint64_t val_conv_16 = val_vals[q];
53961                 LDKUpdateFailHTLC val_conv_16_conv;
53962                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
53963                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
53964                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
53965                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
53966                 val_constr.data[q] = val_conv_16_conv;
53967         }
53968         FREE(val);
53969         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
53970 }
53971
53972 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
53973         LDKCommitmentUpdate this_ptr_conv;
53974         this_ptr_conv.inner = untag_ptr(this_ptr);
53975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53977         this_ptr_conv.is_owned = false;
53978         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
53979         uint64_tArray ret_arr = NULL;
53980         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53981         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53982         for (size_t z = 0; z < ret_var.datalen; z++) {
53983                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
53984                 uint64_t ret_conv_25_ref = 0;
53985                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
53986                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
53987                 ret_arr_ptr[z] = ret_conv_25_ref;
53988         }
53989         
53990         FREE(ret_var.data);
53991         return ret_arr;
53992 }
53993
53994 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) {
53995         LDKCommitmentUpdate this_ptr_conv;
53996         this_ptr_conv.inner = untag_ptr(this_ptr);
53997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53999         this_ptr_conv.is_owned = false;
54000         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
54001         val_constr.datalen = val->arr_len;
54002         if (val_constr.datalen > 0)
54003                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
54004         else
54005                 val_constr.data = NULL;
54006         uint64_t* val_vals = val->elems;
54007         for (size_t z = 0; z < val_constr.datalen; z++) {
54008                 uint64_t val_conv_25 = val_vals[z];
54009                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
54010                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
54011                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
54012                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
54013                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
54014                 val_constr.data[z] = val_conv_25_conv;
54015         }
54016         FREE(val);
54017         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
54018 }
54019
54020 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
54021         LDKCommitmentUpdate this_ptr_conv;
54022         this_ptr_conv.inner = untag_ptr(this_ptr);
54023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54025         this_ptr_conv.is_owned = false;
54026         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
54027         uint64_t ret_ref = 0;
54028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54030         return ret_ref;
54031 }
54032
54033 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
54034         LDKCommitmentUpdate this_ptr_conv;
54035         this_ptr_conv.inner = untag_ptr(this_ptr);
54036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54038         this_ptr_conv.is_owned = false;
54039         LDKUpdateFee val_conv;
54040         val_conv.inner = untag_ptr(val);
54041         val_conv.is_owned = ptr_is_owned(val);
54042         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54043         val_conv = UpdateFee_clone(&val_conv);
54044         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
54045 }
54046
54047 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
54048         LDKCommitmentUpdate this_ptr_conv;
54049         this_ptr_conv.inner = untag_ptr(this_ptr);
54050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54052         this_ptr_conv.is_owned = false;
54053         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
54054         uint64_t ret_ref = 0;
54055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54057         return ret_ref;
54058 }
54059
54060 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
54061         LDKCommitmentUpdate this_ptr_conv;
54062         this_ptr_conv.inner = untag_ptr(this_ptr);
54063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54065         this_ptr_conv.is_owned = false;
54066         LDKCommitmentSigned val_conv;
54067         val_conv.inner = untag_ptr(val);
54068         val_conv.is_owned = ptr_is_owned(val);
54069         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54070         val_conv = CommitmentSigned_clone(&val_conv);
54071         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
54072 }
54073
54074 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) {
54075         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
54076         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
54077         if (update_add_htlcs_arg_constr.datalen > 0)
54078                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
54079         else
54080                 update_add_htlcs_arg_constr.data = NULL;
54081         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
54082         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
54083                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
54084                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
54085                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
54086                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
54087                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
54088                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
54089                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
54090         }
54091         FREE(update_add_htlcs_arg);
54092         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
54093         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
54094         if (update_fulfill_htlcs_arg_constr.datalen > 0)
54095                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
54096         else
54097                 update_fulfill_htlcs_arg_constr.data = NULL;
54098         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
54099         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
54100                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
54101                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
54102                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
54103                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
54104                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
54105                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
54106                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
54107         }
54108         FREE(update_fulfill_htlcs_arg);
54109         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
54110         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
54111         if (update_fail_htlcs_arg_constr.datalen > 0)
54112                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
54113         else
54114                 update_fail_htlcs_arg_constr.data = NULL;
54115         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
54116         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
54117                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
54118                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
54119                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
54120                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
54121                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
54122                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
54123                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
54124         }
54125         FREE(update_fail_htlcs_arg);
54126         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
54127         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
54128         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
54129                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
54130         else
54131                 update_fail_malformed_htlcs_arg_constr.data = NULL;
54132         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
54133         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
54134                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
54135                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
54136                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
54137                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
54138                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
54139                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
54140                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
54141         }
54142         FREE(update_fail_malformed_htlcs_arg);
54143         LDKUpdateFee update_fee_arg_conv;
54144         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
54145         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
54146         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
54147         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
54148         LDKCommitmentSigned commitment_signed_arg_conv;
54149         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
54150         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
54151         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
54152         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
54153         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);
54154         uint64_t ret_ref = 0;
54155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54157         return ret_ref;
54158 }
54159
54160 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
54161         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
54162         uint64_t ret_ref = 0;
54163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54165         return ret_ref;
54166 }
54167 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
54168         LDKCommitmentUpdate arg_conv;
54169         arg_conv.inner = untag_ptr(arg);
54170         arg_conv.is_owned = ptr_is_owned(arg);
54171         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54172         arg_conv.is_owned = false;
54173         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
54174         return ret_conv;
54175 }
54176
54177 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
54178         LDKCommitmentUpdate orig_conv;
54179         orig_conv.inner = untag_ptr(orig);
54180         orig_conv.is_owned = ptr_is_owned(orig);
54181         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54182         orig_conv.is_owned = false;
54183         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
54184         uint64_t ret_ref = 0;
54185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54187         return ret_ref;
54188 }
54189
54190 int64_t  __attribute__((export_name("TS_CommitmentUpdate_hash"))) TS_CommitmentUpdate_hash(uint64_t o) {
54191         LDKCommitmentUpdate o_conv;
54192         o_conv.inner = untag_ptr(o);
54193         o_conv.is_owned = ptr_is_owned(o);
54194         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54195         o_conv.is_owned = false;
54196         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
54197         return ret_conv;
54198 }
54199
54200 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
54201         LDKCommitmentUpdate a_conv;
54202         a_conv.inner = untag_ptr(a);
54203         a_conv.is_owned = ptr_is_owned(a);
54204         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54205         a_conv.is_owned = false;
54206         LDKCommitmentUpdate b_conv;
54207         b_conv.inner = untag_ptr(b);
54208         b_conv.is_owned = ptr_is_owned(b);
54209         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54210         b_conv.is_owned = false;
54211         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
54212         return ret_conv;
54213 }
54214
54215 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
54216         if (!ptr_is_owned(this_ptr)) return;
54217         void* this_ptr_ptr = untag_ptr(this_ptr);
54218         CHECK_ACCESS(this_ptr_ptr);
54219         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
54220         FREE(untag_ptr(this_ptr));
54221         ChannelMessageHandler_free(this_ptr_conv);
54222 }
54223
54224 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
54225         if (!ptr_is_owned(this_ptr)) return;
54226         void* this_ptr_ptr = untag_ptr(this_ptr);
54227         CHECK_ACCESS(this_ptr_ptr);
54228         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
54229         FREE(untag_ptr(this_ptr));
54230         RoutingMessageHandler_free(this_ptr_conv);
54231 }
54232
54233 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
54234         if (!ptr_is_owned(this_ptr)) return;
54235         void* this_ptr_ptr = untag_ptr(this_ptr);
54236         CHECK_ACCESS(this_ptr_ptr);
54237         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
54238         FREE(untag_ptr(this_ptr));
54239         OnionMessageHandler_free(this_ptr_conv);
54240 }
54241
54242 void  __attribute__((export_name("TS_FinalOnionHopData_free"))) TS_FinalOnionHopData_free(uint64_t this_obj) {
54243         LDKFinalOnionHopData this_obj_conv;
54244         this_obj_conv.inner = untag_ptr(this_obj);
54245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54247         FinalOnionHopData_free(this_obj_conv);
54248 }
54249
54250 int8_tArray  __attribute__((export_name("TS_FinalOnionHopData_get_payment_secret"))) TS_FinalOnionHopData_get_payment_secret(uint64_t this_ptr) {
54251         LDKFinalOnionHopData this_ptr_conv;
54252         this_ptr_conv.inner = untag_ptr(this_ptr);
54253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54255         this_ptr_conv.is_owned = false;
54256         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54257         memcpy(ret_arr->elems, *FinalOnionHopData_get_payment_secret(&this_ptr_conv), 32);
54258         return ret_arr;
54259 }
54260
54261 void  __attribute__((export_name("TS_FinalOnionHopData_set_payment_secret"))) TS_FinalOnionHopData_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
54262         LDKFinalOnionHopData this_ptr_conv;
54263         this_ptr_conv.inner = untag_ptr(this_ptr);
54264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54266         this_ptr_conv.is_owned = false;
54267         LDKThirtyTwoBytes val_ref;
54268         CHECK(val->arr_len == 32);
54269         memcpy(val_ref.data, val->elems, 32); FREE(val);
54270         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
54271 }
54272
54273 int64_t  __attribute__((export_name("TS_FinalOnionHopData_get_total_msat"))) TS_FinalOnionHopData_get_total_msat(uint64_t this_ptr) {
54274         LDKFinalOnionHopData this_ptr_conv;
54275         this_ptr_conv.inner = untag_ptr(this_ptr);
54276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54278         this_ptr_conv.is_owned = false;
54279         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
54280         return ret_conv;
54281 }
54282
54283 void  __attribute__((export_name("TS_FinalOnionHopData_set_total_msat"))) TS_FinalOnionHopData_set_total_msat(uint64_t this_ptr, int64_t val) {
54284         LDKFinalOnionHopData this_ptr_conv;
54285         this_ptr_conv.inner = untag_ptr(this_ptr);
54286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54288         this_ptr_conv.is_owned = false;
54289         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
54290 }
54291
54292 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_new"))) TS_FinalOnionHopData_new(int8_tArray payment_secret_arg, int64_t total_msat_arg) {
54293         LDKThirtyTwoBytes payment_secret_arg_ref;
54294         CHECK(payment_secret_arg->arr_len == 32);
54295         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
54296         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
54297         uint64_t ret_ref = 0;
54298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54300         return ret_ref;
54301 }
54302
54303 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
54304         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
54305         uint64_t ret_ref = 0;
54306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54308         return ret_ref;
54309 }
54310 int64_t  __attribute__((export_name("TS_FinalOnionHopData_clone_ptr"))) TS_FinalOnionHopData_clone_ptr(uint64_t arg) {
54311         LDKFinalOnionHopData arg_conv;
54312         arg_conv.inner = untag_ptr(arg);
54313         arg_conv.is_owned = ptr_is_owned(arg);
54314         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54315         arg_conv.is_owned = false;
54316         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
54317         return ret_conv;
54318 }
54319
54320 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_clone"))) TS_FinalOnionHopData_clone(uint64_t orig) {
54321         LDKFinalOnionHopData orig_conv;
54322         orig_conv.inner = untag_ptr(orig);
54323         orig_conv.is_owned = ptr_is_owned(orig);
54324         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54325         orig_conv.is_owned = false;
54326         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
54327         uint64_t ret_ref = 0;
54328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54330         return ret_ref;
54331 }
54332
54333 void  __attribute__((export_name("TS_OnionPacket_free"))) TS_OnionPacket_free(uint64_t this_obj) {
54334         LDKOnionPacket this_obj_conv;
54335         this_obj_conv.inner = untag_ptr(this_obj);
54336         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54338         OnionPacket_free(this_obj_conv);
54339 }
54340
54341 int8_t  __attribute__((export_name("TS_OnionPacket_get_version"))) TS_OnionPacket_get_version(uint64_t this_ptr) {
54342         LDKOnionPacket this_ptr_conv;
54343         this_ptr_conv.inner = untag_ptr(this_ptr);
54344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54346         this_ptr_conv.is_owned = false;
54347         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
54348         return ret_conv;
54349 }
54350
54351 void  __attribute__((export_name("TS_OnionPacket_set_version"))) TS_OnionPacket_set_version(uint64_t this_ptr, int8_t val) {
54352         LDKOnionPacket this_ptr_conv;
54353         this_ptr_conv.inner = untag_ptr(this_ptr);
54354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54356         this_ptr_conv.is_owned = false;
54357         OnionPacket_set_version(&this_ptr_conv, val);
54358 }
54359
54360 uint64_t  __attribute__((export_name("TS_OnionPacket_get_public_key"))) TS_OnionPacket_get_public_key(uint64_t this_ptr) {
54361         LDKOnionPacket this_ptr_conv;
54362         this_ptr_conv.inner = untag_ptr(this_ptr);
54363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54365         this_ptr_conv.is_owned = false;
54366         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
54367         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
54368         return tag_ptr(ret_conv, true);
54369 }
54370
54371 void  __attribute__((export_name("TS_OnionPacket_set_public_key"))) TS_OnionPacket_set_public_key(uint64_t this_ptr, uint64_t val) {
54372         LDKOnionPacket this_ptr_conv;
54373         this_ptr_conv.inner = untag_ptr(this_ptr);
54374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54376         this_ptr_conv.is_owned = false;
54377         void* val_ptr = untag_ptr(val);
54378         CHECK_ACCESS(val_ptr);
54379         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
54380         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
54381         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
54382 }
54383
54384 int8_tArray  __attribute__((export_name("TS_OnionPacket_get_hmac"))) TS_OnionPacket_get_hmac(uint64_t this_ptr) {
54385         LDKOnionPacket this_ptr_conv;
54386         this_ptr_conv.inner = untag_ptr(this_ptr);
54387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54389         this_ptr_conv.is_owned = false;
54390         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54391         memcpy(ret_arr->elems, *OnionPacket_get_hmac(&this_ptr_conv), 32);
54392         return ret_arr;
54393 }
54394
54395 void  __attribute__((export_name("TS_OnionPacket_set_hmac"))) TS_OnionPacket_set_hmac(uint64_t this_ptr, int8_tArray val) {
54396         LDKOnionPacket this_ptr_conv;
54397         this_ptr_conv.inner = untag_ptr(this_ptr);
54398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54400         this_ptr_conv.is_owned = false;
54401         LDKThirtyTwoBytes val_ref;
54402         CHECK(val->arr_len == 32);
54403         memcpy(val_ref.data, val->elems, 32); FREE(val);
54404         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
54405 }
54406
54407 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
54408         LDKOnionPacket ret_var = OnionPacket_clone(arg);
54409         uint64_t ret_ref = 0;
54410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54412         return ret_ref;
54413 }
54414 int64_t  __attribute__((export_name("TS_OnionPacket_clone_ptr"))) TS_OnionPacket_clone_ptr(uint64_t arg) {
54415         LDKOnionPacket arg_conv;
54416         arg_conv.inner = untag_ptr(arg);
54417         arg_conv.is_owned = ptr_is_owned(arg);
54418         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54419         arg_conv.is_owned = false;
54420         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
54421         return ret_conv;
54422 }
54423
54424 uint64_t  __attribute__((export_name("TS_OnionPacket_clone"))) TS_OnionPacket_clone(uint64_t orig) {
54425         LDKOnionPacket orig_conv;
54426         orig_conv.inner = untag_ptr(orig);
54427         orig_conv.is_owned = ptr_is_owned(orig);
54428         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54429         orig_conv.is_owned = false;
54430         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
54431         uint64_t ret_ref = 0;
54432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54434         return ret_ref;
54435 }
54436
54437 int64_t  __attribute__((export_name("TS_OnionPacket_hash"))) TS_OnionPacket_hash(uint64_t o) {
54438         LDKOnionPacket o_conv;
54439         o_conv.inner = untag_ptr(o);
54440         o_conv.is_owned = ptr_is_owned(o);
54441         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54442         o_conv.is_owned = false;
54443         int64_t ret_conv = OnionPacket_hash(&o_conv);
54444         return ret_conv;
54445 }
54446
54447 jboolean  __attribute__((export_name("TS_OnionPacket_eq"))) TS_OnionPacket_eq(uint64_t a, uint64_t b) {
54448         LDKOnionPacket a_conv;
54449         a_conv.inner = untag_ptr(a);
54450         a_conv.is_owned = ptr_is_owned(a);
54451         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54452         a_conv.is_owned = false;
54453         LDKOnionPacket b_conv;
54454         b_conv.inner = untag_ptr(b);
54455         b_conv.is_owned = ptr_is_owned(b);
54456         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54457         b_conv.is_owned = false;
54458         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
54459         return ret_conv;
54460 }
54461
54462 void  __attribute__((export_name("TS_TrampolineOnionPacket_free"))) TS_TrampolineOnionPacket_free(uint64_t this_obj) {
54463         LDKTrampolineOnionPacket this_obj_conv;
54464         this_obj_conv.inner = untag_ptr(this_obj);
54465         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54467         TrampolineOnionPacket_free(this_obj_conv);
54468 }
54469
54470 int8_t  __attribute__((export_name("TS_TrampolineOnionPacket_get_version"))) TS_TrampolineOnionPacket_get_version(uint64_t this_ptr) {
54471         LDKTrampolineOnionPacket this_ptr_conv;
54472         this_ptr_conv.inner = untag_ptr(this_ptr);
54473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54475         this_ptr_conv.is_owned = false;
54476         int8_t ret_conv = TrampolineOnionPacket_get_version(&this_ptr_conv);
54477         return ret_conv;
54478 }
54479
54480 void  __attribute__((export_name("TS_TrampolineOnionPacket_set_version"))) TS_TrampolineOnionPacket_set_version(uint64_t this_ptr, int8_t val) {
54481         LDKTrampolineOnionPacket this_ptr_conv;
54482         this_ptr_conv.inner = untag_ptr(this_ptr);
54483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54485         this_ptr_conv.is_owned = false;
54486         TrampolineOnionPacket_set_version(&this_ptr_conv, val);
54487 }
54488
54489 int8_tArray  __attribute__((export_name("TS_TrampolineOnionPacket_get_public_key"))) TS_TrampolineOnionPacket_get_public_key(uint64_t this_ptr) {
54490         LDKTrampolineOnionPacket this_ptr_conv;
54491         this_ptr_conv.inner = untag_ptr(this_ptr);
54492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54494         this_ptr_conv.is_owned = false;
54495         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54496         memcpy(ret_arr->elems, TrampolineOnionPacket_get_public_key(&this_ptr_conv).compressed_form, 33);
54497         return ret_arr;
54498 }
54499
54500 void  __attribute__((export_name("TS_TrampolineOnionPacket_set_public_key"))) TS_TrampolineOnionPacket_set_public_key(uint64_t this_ptr, int8_tArray val) {
54501         LDKTrampolineOnionPacket this_ptr_conv;
54502         this_ptr_conv.inner = untag_ptr(this_ptr);
54503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54505         this_ptr_conv.is_owned = false;
54506         LDKPublicKey val_ref;
54507         CHECK(val->arr_len == 33);
54508         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
54509         TrampolineOnionPacket_set_public_key(&this_ptr_conv, val_ref);
54510 }
54511
54512 int8_tArray  __attribute__((export_name("TS_TrampolineOnionPacket_get_hop_data"))) TS_TrampolineOnionPacket_get_hop_data(uint64_t this_ptr) {
54513         LDKTrampolineOnionPacket this_ptr_conv;
54514         this_ptr_conv.inner = untag_ptr(this_ptr);
54515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54517         this_ptr_conv.is_owned = false;
54518         LDKCVec_u8Z ret_var = TrampolineOnionPacket_get_hop_data(&this_ptr_conv);
54519         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54520         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54521         CVec_u8Z_free(ret_var);
54522         return ret_arr;
54523 }
54524
54525 void  __attribute__((export_name("TS_TrampolineOnionPacket_set_hop_data"))) TS_TrampolineOnionPacket_set_hop_data(uint64_t this_ptr, int8_tArray val) {
54526         LDKTrampolineOnionPacket this_ptr_conv;
54527         this_ptr_conv.inner = untag_ptr(this_ptr);
54528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54530         this_ptr_conv.is_owned = false;
54531         LDKCVec_u8Z val_ref;
54532         val_ref.datalen = val->arr_len;
54533         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
54534         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
54535         TrampolineOnionPacket_set_hop_data(&this_ptr_conv, val_ref);
54536 }
54537
54538 int8_tArray  __attribute__((export_name("TS_TrampolineOnionPacket_get_hmac"))) TS_TrampolineOnionPacket_get_hmac(uint64_t this_ptr) {
54539         LDKTrampolineOnionPacket this_ptr_conv;
54540         this_ptr_conv.inner = untag_ptr(this_ptr);
54541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54543         this_ptr_conv.is_owned = false;
54544         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54545         memcpy(ret_arr->elems, *TrampolineOnionPacket_get_hmac(&this_ptr_conv), 32);
54546         return ret_arr;
54547 }
54548
54549 void  __attribute__((export_name("TS_TrampolineOnionPacket_set_hmac"))) TS_TrampolineOnionPacket_set_hmac(uint64_t this_ptr, int8_tArray val) {
54550         LDKTrampolineOnionPacket this_ptr_conv;
54551         this_ptr_conv.inner = untag_ptr(this_ptr);
54552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54554         this_ptr_conv.is_owned = false;
54555         LDKThirtyTwoBytes val_ref;
54556         CHECK(val->arr_len == 32);
54557         memcpy(val_ref.data, val->elems, 32); FREE(val);
54558         TrampolineOnionPacket_set_hmac(&this_ptr_conv, val_ref);
54559 }
54560
54561 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) {
54562         LDKPublicKey public_key_arg_ref;
54563         CHECK(public_key_arg->arr_len == 33);
54564         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
54565         LDKCVec_u8Z hop_data_arg_ref;
54566         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
54567         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54568         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
54569         LDKThirtyTwoBytes hmac_arg_ref;
54570         CHECK(hmac_arg->arr_len == 32);
54571         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
54572         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
54573         uint64_t ret_ref = 0;
54574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54576         return ret_ref;
54577 }
54578
54579 static inline uint64_t TrampolineOnionPacket_clone_ptr(LDKTrampolineOnionPacket *NONNULL_PTR arg) {
54580         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(arg);
54581         uint64_t ret_ref = 0;
54582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54584         return ret_ref;
54585 }
54586 int64_t  __attribute__((export_name("TS_TrampolineOnionPacket_clone_ptr"))) TS_TrampolineOnionPacket_clone_ptr(uint64_t arg) {
54587         LDKTrampolineOnionPacket arg_conv;
54588         arg_conv.inner = untag_ptr(arg);
54589         arg_conv.is_owned = ptr_is_owned(arg);
54590         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54591         arg_conv.is_owned = false;
54592         int64_t ret_conv = TrampolineOnionPacket_clone_ptr(&arg_conv);
54593         return ret_conv;
54594 }
54595
54596 uint64_t  __attribute__((export_name("TS_TrampolineOnionPacket_clone"))) TS_TrampolineOnionPacket_clone(uint64_t orig) {
54597         LDKTrampolineOnionPacket orig_conv;
54598         orig_conv.inner = untag_ptr(orig);
54599         orig_conv.is_owned = ptr_is_owned(orig);
54600         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54601         orig_conv.is_owned = false;
54602         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(&orig_conv);
54603         uint64_t ret_ref = 0;
54604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54606         return ret_ref;
54607 }
54608
54609 int64_t  __attribute__((export_name("TS_TrampolineOnionPacket_hash"))) TS_TrampolineOnionPacket_hash(uint64_t o) {
54610         LDKTrampolineOnionPacket o_conv;
54611         o_conv.inner = untag_ptr(o);
54612         o_conv.is_owned = ptr_is_owned(o);
54613         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54614         o_conv.is_owned = false;
54615         int64_t ret_conv = TrampolineOnionPacket_hash(&o_conv);
54616         return ret_conv;
54617 }
54618
54619 jboolean  __attribute__((export_name("TS_TrampolineOnionPacket_eq"))) TS_TrampolineOnionPacket_eq(uint64_t a, uint64_t b) {
54620         LDKTrampolineOnionPacket a_conv;
54621         a_conv.inner = untag_ptr(a);
54622         a_conv.is_owned = ptr_is_owned(a);
54623         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54624         a_conv.is_owned = false;
54625         LDKTrampolineOnionPacket b_conv;
54626         b_conv.inner = untag_ptr(b);
54627         b_conv.is_owned = ptr_is_owned(b);
54628         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54629         b_conv.is_owned = false;
54630         jboolean ret_conv = TrampolineOnionPacket_eq(&a_conv, &b_conv);
54631         return ret_conv;
54632 }
54633
54634 int8_tArray  __attribute__((export_name("TS_TrampolineOnionPacket_write"))) TS_TrampolineOnionPacket_write(uint64_t obj) {
54635         LDKTrampolineOnionPacket obj_conv;
54636         obj_conv.inner = untag_ptr(obj);
54637         obj_conv.is_owned = ptr_is_owned(obj);
54638         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54639         obj_conv.is_owned = false;
54640         LDKCVec_u8Z ret_var = TrampolineOnionPacket_write(&obj_conv);
54641         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54642         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54643         CVec_u8Z_free(ret_var);
54644         return ret_arr;
54645 }
54646
54647 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
54648         LDKAcceptChannel obj_conv;
54649         obj_conv.inner = untag_ptr(obj);
54650         obj_conv.is_owned = ptr_is_owned(obj);
54651         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54652         obj_conv.is_owned = false;
54653         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
54654         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54655         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54656         CVec_u8Z_free(ret_var);
54657         return ret_arr;
54658 }
54659
54660 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
54661         LDKu8slice ser_ref;
54662         ser_ref.datalen = ser->arr_len;
54663         ser_ref.data = ser->elems;
54664         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
54665         *ret_conv = AcceptChannel_read(ser_ref);
54666         FREE(ser);
54667         return tag_ptr(ret_conv, true);
54668 }
54669
54670 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_write"))) TS_AcceptChannelV2_write(uint64_t obj) {
54671         LDKAcceptChannelV2 obj_conv;
54672         obj_conv.inner = untag_ptr(obj);
54673         obj_conv.is_owned = ptr_is_owned(obj);
54674         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54675         obj_conv.is_owned = false;
54676         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
54677         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54678         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54679         CVec_u8Z_free(ret_var);
54680         return ret_arr;
54681 }
54682
54683 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_read"))) TS_AcceptChannelV2_read(int8_tArray ser) {
54684         LDKu8slice ser_ref;
54685         ser_ref.datalen = ser->arr_len;
54686         ser_ref.data = ser->elems;
54687         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
54688         *ret_conv = AcceptChannelV2_read(ser_ref);
54689         FREE(ser);
54690         return tag_ptr(ret_conv, true);
54691 }
54692
54693 int8_tArray  __attribute__((export_name("TS_Stfu_write"))) TS_Stfu_write(uint64_t obj) {
54694         LDKStfu obj_conv;
54695         obj_conv.inner = untag_ptr(obj);
54696         obj_conv.is_owned = ptr_is_owned(obj);
54697         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54698         obj_conv.is_owned = false;
54699         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
54700         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54701         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54702         CVec_u8Z_free(ret_var);
54703         return ret_arr;
54704 }
54705
54706 uint64_t  __attribute__((export_name("TS_Stfu_read"))) TS_Stfu_read(int8_tArray ser) {
54707         LDKu8slice ser_ref;
54708         ser_ref.datalen = ser->arr_len;
54709         ser_ref.data = ser->elems;
54710         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
54711         *ret_conv = Stfu_read(ser_ref);
54712         FREE(ser);
54713         return tag_ptr(ret_conv, true);
54714 }
54715
54716 int8_tArray  __attribute__((export_name("TS_Splice_write"))) TS_Splice_write(uint64_t obj) {
54717         LDKSplice obj_conv;
54718         obj_conv.inner = untag_ptr(obj);
54719         obj_conv.is_owned = ptr_is_owned(obj);
54720         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54721         obj_conv.is_owned = false;
54722         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
54723         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54724         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54725         CVec_u8Z_free(ret_var);
54726         return ret_arr;
54727 }
54728
54729 uint64_t  __attribute__((export_name("TS_Splice_read"))) TS_Splice_read(int8_tArray ser) {
54730         LDKu8slice ser_ref;
54731         ser_ref.datalen = ser->arr_len;
54732         ser_ref.data = ser->elems;
54733         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
54734         *ret_conv = Splice_read(ser_ref);
54735         FREE(ser);
54736         return tag_ptr(ret_conv, true);
54737 }
54738
54739 int8_tArray  __attribute__((export_name("TS_SpliceAck_write"))) TS_SpliceAck_write(uint64_t obj) {
54740         LDKSpliceAck obj_conv;
54741         obj_conv.inner = untag_ptr(obj);
54742         obj_conv.is_owned = ptr_is_owned(obj);
54743         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54744         obj_conv.is_owned = false;
54745         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
54746         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54747         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54748         CVec_u8Z_free(ret_var);
54749         return ret_arr;
54750 }
54751
54752 uint64_t  __attribute__((export_name("TS_SpliceAck_read"))) TS_SpliceAck_read(int8_tArray ser) {
54753         LDKu8slice ser_ref;
54754         ser_ref.datalen = ser->arr_len;
54755         ser_ref.data = ser->elems;
54756         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
54757         *ret_conv = SpliceAck_read(ser_ref);
54758         FREE(ser);
54759         return tag_ptr(ret_conv, true);
54760 }
54761
54762 int8_tArray  __attribute__((export_name("TS_SpliceLocked_write"))) TS_SpliceLocked_write(uint64_t obj) {
54763         LDKSpliceLocked obj_conv;
54764         obj_conv.inner = untag_ptr(obj);
54765         obj_conv.is_owned = ptr_is_owned(obj);
54766         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54767         obj_conv.is_owned = false;
54768         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
54769         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54770         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54771         CVec_u8Z_free(ret_var);
54772         return ret_arr;
54773 }
54774
54775 uint64_t  __attribute__((export_name("TS_SpliceLocked_read"))) TS_SpliceLocked_read(int8_tArray ser) {
54776         LDKu8slice ser_ref;
54777         ser_ref.datalen = ser->arr_len;
54778         ser_ref.data = ser->elems;
54779         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
54780         *ret_conv = SpliceLocked_read(ser_ref);
54781         FREE(ser);
54782         return tag_ptr(ret_conv, true);
54783 }
54784
54785 int8_tArray  __attribute__((export_name("TS_TxAddInput_write"))) TS_TxAddInput_write(uint64_t obj) {
54786         LDKTxAddInput obj_conv;
54787         obj_conv.inner = untag_ptr(obj);
54788         obj_conv.is_owned = ptr_is_owned(obj);
54789         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54790         obj_conv.is_owned = false;
54791         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
54792         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54793         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54794         CVec_u8Z_free(ret_var);
54795         return ret_arr;
54796 }
54797
54798 uint64_t  __attribute__((export_name("TS_TxAddInput_read"))) TS_TxAddInput_read(int8_tArray ser) {
54799         LDKu8slice ser_ref;
54800         ser_ref.datalen = ser->arr_len;
54801         ser_ref.data = ser->elems;
54802         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
54803         *ret_conv = TxAddInput_read(ser_ref);
54804         FREE(ser);
54805         return tag_ptr(ret_conv, true);
54806 }
54807
54808 int8_tArray  __attribute__((export_name("TS_TxAddOutput_write"))) TS_TxAddOutput_write(uint64_t obj) {
54809         LDKTxAddOutput obj_conv;
54810         obj_conv.inner = untag_ptr(obj);
54811         obj_conv.is_owned = ptr_is_owned(obj);
54812         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54813         obj_conv.is_owned = false;
54814         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
54815         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54816         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54817         CVec_u8Z_free(ret_var);
54818         return ret_arr;
54819 }
54820
54821 uint64_t  __attribute__((export_name("TS_TxAddOutput_read"))) TS_TxAddOutput_read(int8_tArray ser) {
54822         LDKu8slice ser_ref;
54823         ser_ref.datalen = ser->arr_len;
54824         ser_ref.data = ser->elems;
54825         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
54826         *ret_conv = TxAddOutput_read(ser_ref);
54827         FREE(ser);
54828         return tag_ptr(ret_conv, true);
54829 }
54830
54831 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_write"))) TS_TxRemoveInput_write(uint64_t obj) {
54832         LDKTxRemoveInput obj_conv;
54833         obj_conv.inner = untag_ptr(obj);
54834         obj_conv.is_owned = ptr_is_owned(obj);
54835         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54836         obj_conv.is_owned = false;
54837         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
54838         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54839         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54840         CVec_u8Z_free(ret_var);
54841         return ret_arr;
54842 }
54843
54844 uint64_t  __attribute__((export_name("TS_TxRemoveInput_read"))) TS_TxRemoveInput_read(int8_tArray ser) {
54845         LDKu8slice ser_ref;
54846         ser_ref.datalen = ser->arr_len;
54847         ser_ref.data = ser->elems;
54848         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
54849         *ret_conv = TxRemoveInput_read(ser_ref);
54850         FREE(ser);
54851         return tag_ptr(ret_conv, true);
54852 }
54853
54854 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_write"))) TS_TxRemoveOutput_write(uint64_t obj) {
54855         LDKTxRemoveOutput obj_conv;
54856         obj_conv.inner = untag_ptr(obj);
54857         obj_conv.is_owned = ptr_is_owned(obj);
54858         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54859         obj_conv.is_owned = false;
54860         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
54861         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54862         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54863         CVec_u8Z_free(ret_var);
54864         return ret_arr;
54865 }
54866
54867 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_read"))) TS_TxRemoveOutput_read(int8_tArray ser) {
54868         LDKu8slice ser_ref;
54869         ser_ref.datalen = ser->arr_len;
54870         ser_ref.data = ser->elems;
54871         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
54872         *ret_conv = TxRemoveOutput_read(ser_ref);
54873         FREE(ser);
54874         return tag_ptr(ret_conv, true);
54875 }
54876
54877 int8_tArray  __attribute__((export_name("TS_TxComplete_write"))) TS_TxComplete_write(uint64_t obj) {
54878         LDKTxComplete obj_conv;
54879         obj_conv.inner = untag_ptr(obj);
54880         obj_conv.is_owned = ptr_is_owned(obj);
54881         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54882         obj_conv.is_owned = false;
54883         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
54884         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54885         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54886         CVec_u8Z_free(ret_var);
54887         return ret_arr;
54888 }
54889
54890 uint64_t  __attribute__((export_name("TS_TxComplete_read"))) TS_TxComplete_read(int8_tArray ser) {
54891         LDKu8slice ser_ref;
54892         ser_ref.datalen = ser->arr_len;
54893         ser_ref.data = ser->elems;
54894         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
54895         *ret_conv = TxComplete_read(ser_ref);
54896         FREE(ser);
54897         return tag_ptr(ret_conv, true);
54898 }
54899
54900 int8_tArray  __attribute__((export_name("TS_TxSignatures_write"))) TS_TxSignatures_write(uint64_t obj) {
54901         LDKTxSignatures obj_conv;
54902         obj_conv.inner = untag_ptr(obj);
54903         obj_conv.is_owned = ptr_is_owned(obj);
54904         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54905         obj_conv.is_owned = false;
54906         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
54907         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54908         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54909         CVec_u8Z_free(ret_var);
54910         return ret_arr;
54911 }
54912
54913 uint64_t  __attribute__((export_name("TS_TxSignatures_read"))) TS_TxSignatures_read(int8_tArray ser) {
54914         LDKu8slice ser_ref;
54915         ser_ref.datalen = ser->arr_len;
54916         ser_ref.data = ser->elems;
54917         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
54918         *ret_conv = TxSignatures_read(ser_ref);
54919         FREE(ser);
54920         return tag_ptr(ret_conv, true);
54921 }
54922
54923 int8_tArray  __attribute__((export_name("TS_TxInitRbf_write"))) TS_TxInitRbf_write(uint64_t obj) {
54924         LDKTxInitRbf obj_conv;
54925         obj_conv.inner = untag_ptr(obj);
54926         obj_conv.is_owned = ptr_is_owned(obj);
54927         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54928         obj_conv.is_owned = false;
54929         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
54930         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54931         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54932         CVec_u8Z_free(ret_var);
54933         return ret_arr;
54934 }
54935
54936 uint64_t  __attribute__((export_name("TS_TxInitRbf_read"))) TS_TxInitRbf_read(int8_tArray ser) {
54937         LDKu8slice ser_ref;
54938         ser_ref.datalen = ser->arr_len;
54939         ser_ref.data = ser->elems;
54940         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
54941         *ret_conv = TxInitRbf_read(ser_ref);
54942         FREE(ser);
54943         return tag_ptr(ret_conv, true);
54944 }
54945
54946 int8_tArray  __attribute__((export_name("TS_TxAckRbf_write"))) TS_TxAckRbf_write(uint64_t obj) {
54947         LDKTxAckRbf obj_conv;
54948         obj_conv.inner = untag_ptr(obj);
54949         obj_conv.is_owned = ptr_is_owned(obj);
54950         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54951         obj_conv.is_owned = false;
54952         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
54953         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54954         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54955         CVec_u8Z_free(ret_var);
54956         return ret_arr;
54957 }
54958
54959 uint64_t  __attribute__((export_name("TS_TxAckRbf_read"))) TS_TxAckRbf_read(int8_tArray ser) {
54960         LDKu8slice ser_ref;
54961         ser_ref.datalen = ser->arr_len;
54962         ser_ref.data = ser->elems;
54963         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
54964         *ret_conv = TxAckRbf_read(ser_ref);
54965         FREE(ser);
54966         return tag_ptr(ret_conv, true);
54967 }
54968
54969 int8_tArray  __attribute__((export_name("TS_TxAbort_write"))) TS_TxAbort_write(uint64_t obj) {
54970         LDKTxAbort obj_conv;
54971         obj_conv.inner = untag_ptr(obj);
54972         obj_conv.is_owned = ptr_is_owned(obj);
54973         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54974         obj_conv.is_owned = false;
54975         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
54976         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54977         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54978         CVec_u8Z_free(ret_var);
54979         return ret_arr;
54980 }
54981
54982 uint64_t  __attribute__((export_name("TS_TxAbort_read"))) TS_TxAbort_read(int8_tArray ser) {
54983         LDKu8slice ser_ref;
54984         ser_ref.datalen = ser->arr_len;
54985         ser_ref.data = ser->elems;
54986         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
54987         *ret_conv = TxAbort_read(ser_ref);
54988         FREE(ser);
54989         return tag_ptr(ret_conv, true);
54990 }
54991
54992 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
54993         LDKAnnouncementSignatures obj_conv;
54994         obj_conv.inner = untag_ptr(obj);
54995         obj_conv.is_owned = ptr_is_owned(obj);
54996         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54997         obj_conv.is_owned = false;
54998         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
54999         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55000         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55001         CVec_u8Z_free(ret_var);
55002         return ret_arr;
55003 }
55004
55005 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
55006         LDKu8slice ser_ref;
55007         ser_ref.datalen = ser->arr_len;
55008         ser_ref.data = ser->elems;
55009         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
55010         *ret_conv = AnnouncementSignatures_read(ser_ref);
55011         FREE(ser);
55012         return tag_ptr(ret_conv, true);
55013 }
55014
55015 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
55016         LDKChannelReestablish obj_conv;
55017         obj_conv.inner = untag_ptr(obj);
55018         obj_conv.is_owned = ptr_is_owned(obj);
55019         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55020         obj_conv.is_owned = false;
55021         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
55022         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55023         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55024         CVec_u8Z_free(ret_var);
55025         return ret_arr;
55026 }
55027
55028 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
55029         LDKu8slice ser_ref;
55030         ser_ref.datalen = ser->arr_len;
55031         ser_ref.data = ser->elems;
55032         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
55033         *ret_conv = ChannelReestablish_read(ser_ref);
55034         FREE(ser);
55035         return tag_ptr(ret_conv, true);
55036 }
55037
55038 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
55039         LDKClosingSigned obj_conv;
55040         obj_conv.inner = untag_ptr(obj);
55041         obj_conv.is_owned = ptr_is_owned(obj);
55042         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55043         obj_conv.is_owned = false;
55044         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
55045         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55046         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55047         CVec_u8Z_free(ret_var);
55048         return ret_arr;
55049 }
55050
55051 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
55052         LDKu8slice ser_ref;
55053         ser_ref.datalen = ser->arr_len;
55054         ser_ref.data = ser->elems;
55055         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
55056         *ret_conv = ClosingSigned_read(ser_ref);
55057         FREE(ser);
55058         return tag_ptr(ret_conv, true);
55059 }
55060
55061 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
55062         LDKClosingSignedFeeRange obj_conv;
55063         obj_conv.inner = untag_ptr(obj);
55064         obj_conv.is_owned = ptr_is_owned(obj);
55065         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55066         obj_conv.is_owned = false;
55067         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
55068         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55069         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55070         CVec_u8Z_free(ret_var);
55071         return ret_arr;
55072 }
55073
55074 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
55075         LDKu8slice ser_ref;
55076         ser_ref.datalen = ser->arr_len;
55077         ser_ref.data = ser->elems;
55078         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
55079         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
55080         FREE(ser);
55081         return tag_ptr(ret_conv, true);
55082 }
55083
55084 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
55085         LDKCommitmentSigned obj_conv;
55086         obj_conv.inner = untag_ptr(obj);
55087         obj_conv.is_owned = ptr_is_owned(obj);
55088         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55089         obj_conv.is_owned = false;
55090         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
55091         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55092         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55093         CVec_u8Z_free(ret_var);
55094         return ret_arr;
55095 }
55096
55097 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
55098         LDKu8slice ser_ref;
55099         ser_ref.datalen = ser->arr_len;
55100         ser_ref.data = ser->elems;
55101         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
55102         *ret_conv = CommitmentSigned_read(ser_ref);
55103         FREE(ser);
55104         return tag_ptr(ret_conv, true);
55105 }
55106
55107 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
55108         LDKFundingCreated obj_conv;
55109         obj_conv.inner = untag_ptr(obj);
55110         obj_conv.is_owned = ptr_is_owned(obj);
55111         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55112         obj_conv.is_owned = false;
55113         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
55114         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55115         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55116         CVec_u8Z_free(ret_var);
55117         return ret_arr;
55118 }
55119
55120 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
55121         LDKu8slice ser_ref;
55122         ser_ref.datalen = ser->arr_len;
55123         ser_ref.data = ser->elems;
55124         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
55125         *ret_conv = FundingCreated_read(ser_ref);
55126         FREE(ser);
55127         return tag_ptr(ret_conv, true);
55128 }
55129
55130 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
55131         LDKFundingSigned obj_conv;
55132         obj_conv.inner = untag_ptr(obj);
55133         obj_conv.is_owned = ptr_is_owned(obj);
55134         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55135         obj_conv.is_owned = false;
55136         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
55137         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55138         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55139         CVec_u8Z_free(ret_var);
55140         return ret_arr;
55141 }
55142
55143 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
55144         LDKu8slice ser_ref;
55145         ser_ref.datalen = ser->arr_len;
55146         ser_ref.data = ser->elems;
55147         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
55148         *ret_conv = FundingSigned_read(ser_ref);
55149         FREE(ser);
55150         return tag_ptr(ret_conv, true);
55151 }
55152
55153 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
55154         LDKChannelReady obj_conv;
55155         obj_conv.inner = untag_ptr(obj);
55156         obj_conv.is_owned = ptr_is_owned(obj);
55157         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55158         obj_conv.is_owned = false;
55159         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
55160         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55161         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55162         CVec_u8Z_free(ret_var);
55163         return ret_arr;
55164 }
55165
55166 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
55167         LDKu8slice ser_ref;
55168         ser_ref.datalen = ser->arr_len;
55169         ser_ref.data = ser->elems;
55170         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
55171         *ret_conv = ChannelReady_read(ser_ref);
55172         FREE(ser);
55173         return tag_ptr(ret_conv, true);
55174 }
55175
55176 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
55177         LDKInit obj_conv;
55178         obj_conv.inner = untag_ptr(obj);
55179         obj_conv.is_owned = ptr_is_owned(obj);
55180         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55181         obj_conv.is_owned = false;
55182         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
55183         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55184         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55185         CVec_u8Z_free(ret_var);
55186         return ret_arr;
55187 }
55188
55189 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
55190         LDKu8slice ser_ref;
55191         ser_ref.datalen = ser->arr_len;
55192         ser_ref.data = ser->elems;
55193         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
55194         *ret_conv = Init_read(ser_ref);
55195         FREE(ser);
55196         return tag_ptr(ret_conv, true);
55197 }
55198
55199 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
55200         LDKOpenChannel obj_conv;
55201         obj_conv.inner = untag_ptr(obj);
55202         obj_conv.is_owned = ptr_is_owned(obj);
55203         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55204         obj_conv.is_owned = false;
55205         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
55206         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55207         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55208         CVec_u8Z_free(ret_var);
55209         return ret_arr;
55210 }
55211
55212 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
55213         LDKu8slice ser_ref;
55214         ser_ref.datalen = ser->arr_len;
55215         ser_ref.data = ser->elems;
55216         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
55217         *ret_conv = OpenChannel_read(ser_ref);
55218         FREE(ser);
55219         return tag_ptr(ret_conv, true);
55220 }
55221
55222 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_write"))) TS_OpenChannelV2_write(uint64_t obj) {
55223         LDKOpenChannelV2 obj_conv;
55224         obj_conv.inner = untag_ptr(obj);
55225         obj_conv.is_owned = ptr_is_owned(obj);
55226         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55227         obj_conv.is_owned = false;
55228         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
55229         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55230         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55231         CVec_u8Z_free(ret_var);
55232         return ret_arr;
55233 }
55234
55235 uint64_t  __attribute__((export_name("TS_OpenChannelV2_read"))) TS_OpenChannelV2_read(int8_tArray ser) {
55236         LDKu8slice ser_ref;
55237         ser_ref.datalen = ser->arr_len;
55238         ser_ref.data = ser->elems;
55239         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
55240         *ret_conv = OpenChannelV2_read(ser_ref);
55241         FREE(ser);
55242         return tag_ptr(ret_conv, true);
55243 }
55244
55245 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
55246         LDKRevokeAndACK obj_conv;
55247         obj_conv.inner = untag_ptr(obj);
55248         obj_conv.is_owned = ptr_is_owned(obj);
55249         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55250         obj_conv.is_owned = false;
55251         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
55252         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55253         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55254         CVec_u8Z_free(ret_var);
55255         return ret_arr;
55256 }
55257
55258 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
55259         LDKu8slice ser_ref;
55260         ser_ref.datalen = ser->arr_len;
55261         ser_ref.data = ser->elems;
55262         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
55263         *ret_conv = RevokeAndACK_read(ser_ref);
55264         FREE(ser);
55265         return tag_ptr(ret_conv, true);
55266 }
55267
55268 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
55269         LDKShutdown obj_conv;
55270         obj_conv.inner = untag_ptr(obj);
55271         obj_conv.is_owned = ptr_is_owned(obj);
55272         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55273         obj_conv.is_owned = false;
55274         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
55275         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55276         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55277         CVec_u8Z_free(ret_var);
55278         return ret_arr;
55279 }
55280
55281 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
55282         LDKu8slice ser_ref;
55283         ser_ref.datalen = ser->arr_len;
55284         ser_ref.data = ser->elems;
55285         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
55286         *ret_conv = Shutdown_read(ser_ref);
55287         FREE(ser);
55288         return tag_ptr(ret_conv, true);
55289 }
55290
55291 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
55292         LDKUpdateFailHTLC obj_conv;
55293         obj_conv.inner = untag_ptr(obj);
55294         obj_conv.is_owned = ptr_is_owned(obj);
55295         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55296         obj_conv.is_owned = false;
55297         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
55298         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55299         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55300         CVec_u8Z_free(ret_var);
55301         return ret_arr;
55302 }
55303
55304 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
55305         LDKu8slice ser_ref;
55306         ser_ref.datalen = ser->arr_len;
55307         ser_ref.data = ser->elems;
55308         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
55309         *ret_conv = UpdateFailHTLC_read(ser_ref);
55310         FREE(ser);
55311         return tag_ptr(ret_conv, true);
55312 }
55313
55314 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
55315         LDKUpdateFailMalformedHTLC obj_conv;
55316         obj_conv.inner = untag_ptr(obj);
55317         obj_conv.is_owned = ptr_is_owned(obj);
55318         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55319         obj_conv.is_owned = false;
55320         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
55321         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55322         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55323         CVec_u8Z_free(ret_var);
55324         return ret_arr;
55325 }
55326
55327 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
55328         LDKu8slice ser_ref;
55329         ser_ref.datalen = ser->arr_len;
55330         ser_ref.data = ser->elems;
55331         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
55332         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
55333         FREE(ser);
55334         return tag_ptr(ret_conv, true);
55335 }
55336
55337 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
55338         LDKUpdateFee obj_conv;
55339         obj_conv.inner = untag_ptr(obj);
55340         obj_conv.is_owned = ptr_is_owned(obj);
55341         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55342         obj_conv.is_owned = false;
55343         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
55344         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55345         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55346         CVec_u8Z_free(ret_var);
55347         return ret_arr;
55348 }
55349
55350 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
55351         LDKu8slice ser_ref;
55352         ser_ref.datalen = ser->arr_len;
55353         ser_ref.data = ser->elems;
55354         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
55355         *ret_conv = UpdateFee_read(ser_ref);
55356         FREE(ser);
55357         return tag_ptr(ret_conv, true);
55358 }
55359
55360 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
55361         LDKUpdateFulfillHTLC obj_conv;
55362         obj_conv.inner = untag_ptr(obj);
55363         obj_conv.is_owned = ptr_is_owned(obj);
55364         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55365         obj_conv.is_owned = false;
55366         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
55367         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55368         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55369         CVec_u8Z_free(ret_var);
55370         return ret_arr;
55371 }
55372
55373 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
55374         LDKu8slice ser_ref;
55375         ser_ref.datalen = ser->arr_len;
55376         ser_ref.data = ser->elems;
55377         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
55378         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
55379         FREE(ser);
55380         return tag_ptr(ret_conv, true);
55381 }
55382
55383 int8_tArray  __attribute__((export_name("TS_OnionPacket_write"))) TS_OnionPacket_write(uint64_t obj) {
55384         LDKOnionPacket obj_conv;
55385         obj_conv.inner = untag_ptr(obj);
55386         obj_conv.is_owned = ptr_is_owned(obj);
55387         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55388         obj_conv.is_owned = false;
55389         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
55390         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55391         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55392         CVec_u8Z_free(ret_var);
55393         return ret_arr;
55394 }
55395
55396 uint64_t  __attribute__((export_name("TS_OnionPacket_read"))) TS_OnionPacket_read(int8_tArray ser) {
55397         LDKu8slice ser_ref;
55398         ser_ref.datalen = ser->arr_len;
55399         ser_ref.data = ser->elems;
55400         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
55401         *ret_conv = OnionPacket_read(ser_ref);
55402         FREE(ser);
55403         return tag_ptr(ret_conv, true);
55404 }
55405
55406 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
55407         LDKUpdateAddHTLC obj_conv;
55408         obj_conv.inner = untag_ptr(obj);
55409         obj_conv.is_owned = ptr_is_owned(obj);
55410         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55411         obj_conv.is_owned = false;
55412         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
55413         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55414         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55415         CVec_u8Z_free(ret_var);
55416         return ret_arr;
55417 }
55418
55419 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
55420         LDKu8slice ser_ref;
55421         ser_ref.datalen = ser->arr_len;
55422         ser_ref.data = ser->elems;
55423         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
55424         *ret_conv = UpdateAddHTLC_read(ser_ref);
55425         FREE(ser);
55426         return tag_ptr(ret_conv, true);
55427 }
55428
55429 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
55430         LDKu8slice ser_ref;
55431         ser_ref.datalen = ser->arr_len;
55432         ser_ref.data = ser->elems;
55433         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
55434         *ret_conv = OnionMessage_read(ser_ref);
55435         FREE(ser);
55436         return tag_ptr(ret_conv, true);
55437 }
55438
55439 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
55440         LDKOnionMessage obj_conv;
55441         obj_conv.inner = untag_ptr(obj);
55442         obj_conv.is_owned = ptr_is_owned(obj);
55443         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55444         obj_conv.is_owned = false;
55445         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
55446         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55447         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55448         CVec_u8Z_free(ret_var);
55449         return ret_arr;
55450 }
55451
55452 int8_tArray  __attribute__((export_name("TS_FinalOnionHopData_write"))) TS_FinalOnionHopData_write(uint64_t obj) {
55453         LDKFinalOnionHopData obj_conv;
55454         obj_conv.inner = untag_ptr(obj);
55455         obj_conv.is_owned = ptr_is_owned(obj);
55456         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55457         obj_conv.is_owned = false;
55458         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
55459         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55460         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55461         CVec_u8Z_free(ret_var);
55462         return ret_arr;
55463 }
55464
55465 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_read"))) TS_FinalOnionHopData_read(int8_tArray ser) {
55466         LDKu8slice ser_ref;
55467         ser_ref.datalen = ser->arr_len;
55468         ser_ref.data = ser->elems;
55469         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
55470         *ret_conv = FinalOnionHopData_read(ser_ref);
55471         FREE(ser);
55472         return tag_ptr(ret_conv, true);
55473 }
55474
55475 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
55476         LDKPing obj_conv;
55477         obj_conv.inner = untag_ptr(obj);
55478         obj_conv.is_owned = ptr_is_owned(obj);
55479         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55480         obj_conv.is_owned = false;
55481         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
55482         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55483         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55484         CVec_u8Z_free(ret_var);
55485         return ret_arr;
55486 }
55487
55488 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
55489         LDKu8slice ser_ref;
55490         ser_ref.datalen = ser->arr_len;
55491         ser_ref.data = ser->elems;
55492         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
55493         *ret_conv = Ping_read(ser_ref);
55494         FREE(ser);
55495         return tag_ptr(ret_conv, true);
55496 }
55497
55498 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
55499         LDKPong obj_conv;
55500         obj_conv.inner = untag_ptr(obj);
55501         obj_conv.is_owned = ptr_is_owned(obj);
55502         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55503         obj_conv.is_owned = false;
55504         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
55505         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55506         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55507         CVec_u8Z_free(ret_var);
55508         return ret_arr;
55509 }
55510
55511 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
55512         LDKu8slice ser_ref;
55513         ser_ref.datalen = ser->arr_len;
55514         ser_ref.data = ser->elems;
55515         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
55516         *ret_conv = Pong_read(ser_ref);
55517         FREE(ser);
55518         return tag_ptr(ret_conv, true);
55519 }
55520
55521 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
55522         LDKUnsignedChannelAnnouncement obj_conv;
55523         obj_conv.inner = untag_ptr(obj);
55524         obj_conv.is_owned = ptr_is_owned(obj);
55525         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55526         obj_conv.is_owned = false;
55527         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
55528         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55529         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55530         CVec_u8Z_free(ret_var);
55531         return ret_arr;
55532 }
55533
55534 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
55535         LDKu8slice ser_ref;
55536         ser_ref.datalen = ser->arr_len;
55537         ser_ref.data = ser->elems;
55538         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
55539         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
55540         FREE(ser);
55541         return tag_ptr(ret_conv, true);
55542 }
55543
55544 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
55545         LDKChannelAnnouncement obj_conv;
55546         obj_conv.inner = untag_ptr(obj);
55547         obj_conv.is_owned = ptr_is_owned(obj);
55548         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55549         obj_conv.is_owned = false;
55550         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
55551         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55552         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55553         CVec_u8Z_free(ret_var);
55554         return ret_arr;
55555 }
55556
55557 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
55558         LDKu8slice ser_ref;
55559         ser_ref.datalen = ser->arr_len;
55560         ser_ref.data = ser->elems;
55561         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
55562         *ret_conv = ChannelAnnouncement_read(ser_ref);
55563         FREE(ser);
55564         return tag_ptr(ret_conv, true);
55565 }
55566
55567 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
55568         LDKUnsignedChannelUpdate obj_conv;
55569         obj_conv.inner = untag_ptr(obj);
55570         obj_conv.is_owned = ptr_is_owned(obj);
55571         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55572         obj_conv.is_owned = false;
55573         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
55574         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55575         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55576         CVec_u8Z_free(ret_var);
55577         return ret_arr;
55578 }
55579
55580 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
55581         LDKu8slice ser_ref;
55582         ser_ref.datalen = ser->arr_len;
55583         ser_ref.data = ser->elems;
55584         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
55585         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
55586         FREE(ser);
55587         return tag_ptr(ret_conv, true);
55588 }
55589
55590 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
55591         LDKChannelUpdate obj_conv;
55592         obj_conv.inner = untag_ptr(obj);
55593         obj_conv.is_owned = ptr_is_owned(obj);
55594         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55595         obj_conv.is_owned = false;
55596         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
55597         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55598         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55599         CVec_u8Z_free(ret_var);
55600         return ret_arr;
55601 }
55602
55603 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
55604         LDKu8slice ser_ref;
55605         ser_ref.datalen = ser->arr_len;
55606         ser_ref.data = ser->elems;
55607         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
55608         *ret_conv = ChannelUpdate_read(ser_ref);
55609         FREE(ser);
55610         return tag_ptr(ret_conv, true);
55611 }
55612
55613 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
55614         LDKErrorMessage obj_conv;
55615         obj_conv.inner = untag_ptr(obj);
55616         obj_conv.is_owned = ptr_is_owned(obj);
55617         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55618         obj_conv.is_owned = false;
55619         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
55620         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55621         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55622         CVec_u8Z_free(ret_var);
55623         return ret_arr;
55624 }
55625
55626 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
55627         LDKu8slice ser_ref;
55628         ser_ref.datalen = ser->arr_len;
55629         ser_ref.data = ser->elems;
55630         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
55631         *ret_conv = ErrorMessage_read(ser_ref);
55632         FREE(ser);
55633         return tag_ptr(ret_conv, true);
55634 }
55635
55636 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
55637         LDKWarningMessage obj_conv;
55638         obj_conv.inner = untag_ptr(obj);
55639         obj_conv.is_owned = ptr_is_owned(obj);
55640         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55641         obj_conv.is_owned = false;
55642         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
55643         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55644         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55645         CVec_u8Z_free(ret_var);
55646         return ret_arr;
55647 }
55648
55649 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
55650         LDKu8slice ser_ref;
55651         ser_ref.datalen = ser->arr_len;
55652         ser_ref.data = ser->elems;
55653         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
55654         *ret_conv = WarningMessage_read(ser_ref);
55655         FREE(ser);
55656         return tag_ptr(ret_conv, true);
55657 }
55658
55659 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
55660         LDKUnsignedNodeAnnouncement obj_conv;
55661         obj_conv.inner = untag_ptr(obj);
55662         obj_conv.is_owned = ptr_is_owned(obj);
55663         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55664         obj_conv.is_owned = false;
55665         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
55666         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55667         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55668         CVec_u8Z_free(ret_var);
55669         return ret_arr;
55670 }
55671
55672 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
55673         LDKu8slice ser_ref;
55674         ser_ref.datalen = ser->arr_len;
55675         ser_ref.data = ser->elems;
55676         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
55677         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
55678         FREE(ser);
55679         return tag_ptr(ret_conv, true);
55680 }
55681
55682 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
55683         LDKNodeAnnouncement obj_conv;
55684         obj_conv.inner = untag_ptr(obj);
55685         obj_conv.is_owned = ptr_is_owned(obj);
55686         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55687         obj_conv.is_owned = false;
55688         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
55689         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55690         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55691         CVec_u8Z_free(ret_var);
55692         return ret_arr;
55693 }
55694
55695 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
55696         LDKu8slice ser_ref;
55697         ser_ref.datalen = ser->arr_len;
55698         ser_ref.data = ser->elems;
55699         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
55700         *ret_conv = NodeAnnouncement_read(ser_ref);
55701         FREE(ser);
55702         return tag_ptr(ret_conv, true);
55703 }
55704
55705 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
55706         LDKu8slice ser_ref;
55707         ser_ref.datalen = ser->arr_len;
55708         ser_ref.data = ser->elems;
55709         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
55710         *ret_conv = QueryShortChannelIds_read(ser_ref);
55711         FREE(ser);
55712         return tag_ptr(ret_conv, true);
55713 }
55714
55715 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
55716         LDKQueryShortChannelIds obj_conv;
55717         obj_conv.inner = untag_ptr(obj);
55718         obj_conv.is_owned = ptr_is_owned(obj);
55719         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55720         obj_conv.is_owned = false;
55721         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
55722         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55723         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55724         CVec_u8Z_free(ret_var);
55725         return ret_arr;
55726 }
55727
55728 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
55729         LDKReplyShortChannelIdsEnd obj_conv;
55730         obj_conv.inner = untag_ptr(obj);
55731         obj_conv.is_owned = ptr_is_owned(obj);
55732         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55733         obj_conv.is_owned = false;
55734         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
55735         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55736         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55737         CVec_u8Z_free(ret_var);
55738         return ret_arr;
55739 }
55740
55741 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
55742         LDKu8slice ser_ref;
55743         ser_ref.datalen = ser->arr_len;
55744         ser_ref.data = ser->elems;
55745         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
55746         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
55747         FREE(ser);
55748         return tag_ptr(ret_conv, true);
55749 }
55750
55751 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
55752         LDKQueryChannelRange this_arg_conv;
55753         this_arg_conv.inner = untag_ptr(this_arg);
55754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55756         this_arg_conv.is_owned = false;
55757         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
55758         return ret_conv;
55759 }
55760
55761 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
55762         LDKQueryChannelRange obj_conv;
55763         obj_conv.inner = untag_ptr(obj);
55764         obj_conv.is_owned = ptr_is_owned(obj);
55765         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55766         obj_conv.is_owned = false;
55767         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
55768         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55769         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55770         CVec_u8Z_free(ret_var);
55771         return ret_arr;
55772 }
55773
55774 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
55775         LDKu8slice ser_ref;
55776         ser_ref.datalen = ser->arr_len;
55777         ser_ref.data = ser->elems;
55778         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
55779         *ret_conv = QueryChannelRange_read(ser_ref);
55780         FREE(ser);
55781         return tag_ptr(ret_conv, true);
55782 }
55783
55784 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
55785         LDKu8slice ser_ref;
55786         ser_ref.datalen = ser->arr_len;
55787         ser_ref.data = ser->elems;
55788         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
55789         *ret_conv = ReplyChannelRange_read(ser_ref);
55790         FREE(ser);
55791         return tag_ptr(ret_conv, true);
55792 }
55793
55794 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
55795         LDKReplyChannelRange obj_conv;
55796         obj_conv.inner = untag_ptr(obj);
55797         obj_conv.is_owned = ptr_is_owned(obj);
55798         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55799         obj_conv.is_owned = false;
55800         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
55801         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55802         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55803         CVec_u8Z_free(ret_var);
55804         return ret_arr;
55805 }
55806
55807 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
55808         LDKGossipTimestampFilter obj_conv;
55809         obj_conv.inner = untag_ptr(obj);
55810         obj_conv.is_owned = ptr_is_owned(obj);
55811         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55812         obj_conv.is_owned = false;
55813         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
55814         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55815         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55816         CVec_u8Z_free(ret_var);
55817         return ret_arr;
55818 }
55819
55820 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
55821         LDKu8slice ser_ref;
55822         ser_ref.datalen = ser->arr_len;
55823         ser_ref.data = ser->elems;
55824         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
55825         *ret_conv = GossipTimestampFilter_read(ser_ref);
55826         FREE(ser);
55827         return tag_ptr(ret_conv, true);
55828 }
55829
55830 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
55831         if (!ptr_is_owned(this_ptr)) return;
55832         void* this_ptr_ptr = untag_ptr(this_ptr);
55833         CHECK_ACCESS(this_ptr_ptr);
55834         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
55835         FREE(untag_ptr(this_ptr));
55836         CustomMessageHandler_free(this_ptr_conv);
55837 }
55838
55839 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
55840         LDKIgnoringMessageHandler this_obj_conv;
55841         this_obj_conv.inner = untag_ptr(this_obj);
55842         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55844         IgnoringMessageHandler_free(this_obj_conv);
55845 }
55846
55847 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
55848         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
55849         uint64_t ret_ref = 0;
55850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55852         return ret_ref;
55853 }
55854
55855 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_EventsProvider"))) TS_IgnoringMessageHandler_as_EventsProvider(uint64_t this_arg) {
55856         LDKIgnoringMessageHandler this_arg_conv;
55857         this_arg_conv.inner = untag_ptr(this_arg);
55858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55860         this_arg_conv.is_owned = false;
55861         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
55862         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
55863         return tag_ptr(ret_ret, true);
55864 }
55865
55866 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
55867         LDKIgnoringMessageHandler this_arg_conv;
55868         this_arg_conv.inner = untag_ptr(this_arg);
55869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55871         this_arg_conv.is_owned = false;
55872         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
55873         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
55874         return tag_ptr(ret_ret, true);
55875 }
55876
55877 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
55878         LDKIgnoringMessageHandler this_arg_conv;
55879         this_arg_conv.inner = untag_ptr(this_arg);
55880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55882         this_arg_conv.is_owned = false;
55883         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
55884         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
55885         return tag_ptr(ret_ret, true);
55886 }
55887
55888 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
55889         LDKIgnoringMessageHandler this_arg_conv;
55890         this_arg_conv.inner = untag_ptr(this_arg);
55891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55893         this_arg_conv.is_owned = false;
55894         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
55895         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
55896         return tag_ptr(ret_ret, true);
55897 }
55898
55899 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OffersMessageHandler"))) TS_IgnoringMessageHandler_as_OffersMessageHandler(uint64_t this_arg) {
55900         LDKIgnoringMessageHandler this_arg_conv;
55901         this_arg_conv.inner = untag_ptr(this_arg);
55902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55904         this_arg_conv.is_owned = false;
55905         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
55906         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
55907         return tag_ptr(ret_ret, true);
55908 }
55909
55910 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
55911         LDKIgnoringMessageHandler this_arg_conv;
55912         this_arg_conv.inner = untag_ptr(this_arg);
55913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55915         this_arg_conv.is_owned = false;
55916         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
55917         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
55918         return tag_ptr(ret_ret, true);
55919 }
55920
55921 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
55922         LDKIgnoringMessageHandler this_arg_conv;
55923         this_arg_conv.inner = untag_ptr(this_arg);
55924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55926         this_arg_conv.is_owned = false;
55927         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
55928         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
55929         return tag_ptr(ret_ret, true);
55930 }
55931
55932 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
55933         LDKIgnoringMessageHandler this_arg_conv;
55934         this_arg_conv.inner = untag_ptr(this_arg);
55935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55937         this_arg_conv.is_owned = false;
55938         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
55939         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
55940         return tag_ptr(ret_ret, true);
55941 }
55942
55943 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
55944         LDKErroringMessageHandler this_obj_conv;
55945         this_obj_conv.inner = untag_ptr(this_obj);
55946         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55948         ErroringMessageHandler_free(this_obj_conv);
55949 }
55950
55951 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
55952         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
55953         uint64_t ret_ref = 0;
55954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55956         return ret_ref;
55957 }
55958
55959 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
55960         LDKErroringMessageHandler this_arg_conv;
55961         this_arg_conv.inner = untag_ptr(this_arg);
55962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55964         this_arg_conv.is_owned = false;
55965         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
55966         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
55967         return tag_ptr(ret_ret, true);
55968 }
55969
55970 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
55971         LDKErroringMessageHandler this_arg_conv;
55972         this_arg_conv.inner = untag_ptr(this_arg);
55973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55975         this_arg_conv.is_owned = false;
55976         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
55977         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
55978         return tag_ptr(ret_ret, true);
55979 }
55980
55981 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
55982         LDKMessageHandler this_obj_conv;
55983         this_obj_conv.inner = untag_ptr(this_obj);
55984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55986         MessageHandler_free(this_obj_conv);
55987 }
55988
55989 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
55990         LDKMessageHandler this_ptr_conv;
55991         this_ptr_conv.inner = untag_ptr(this_ptr);
55992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55994         this_ptr_conv.is_owned = false;
55995         // WARNING: This object doesn't live past this scope, needs clone!
55996         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
55997         return ret_ret;
55998 }
55999
56000 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
56001         LDKMessageHandler this_ptr_conv;
56002         this_ptr_conv.inner = untag_ptr(this_ptr);
56003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56005         this_ptr_conv.is_owned = false;
56006         void* val_ptr = untag_ptr(val);
56007         CHECK_ACCESS(val_ptr);
56008         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
56009         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
56010                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56011                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
56012         }
56013         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
56014 }
56015
56016 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
56017         LDKMessageHandler this_ptr_conv;
56018         this_ptr_conv.inner = untag_ptr(this_ptr);
56019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56021         this_ptr_conv.is_owned = false;
56022         // WARNING: This object doesn't live past this scope, needs clone!
56023         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
56024         return ret_ret;
56025 }
56026
56027 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
56028         LDKMessageHandler this_ptr_conv;
56029         this_ptr_conv.inner = untag_ptr(this_ptr);
56030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56032         this_ptr_conv.is_owned = false;
56033         void* val_ptr = untag_ptr(val);
56034         CHECK_ACCESS(val_ptr);
56035         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
56036         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
56037                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56038                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
56039         }
56040         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
56041 }
56042
56043 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
56044         LDKMessageHandler this_ptr_conv;
56045         this_ptr_conv.inner = untag_ptr(this_ptr);
56046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56048         this_ptr_conv.is_owned = false;
56049         // WARNING: This object doesn't live past this scope, needs clone!
56050         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
56051         return ret_ret;
56052 }
56053
56054 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
56055         LDKMessageHandler this_ptr_conv;
56056         this_ptr_conv.inner = untag_ptr(this_ptr);
56057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56059         this_ptr_conv.is_owned = false;
56060         void* val_ptr = untag_ptr(val);
56061         CHECK_ACCESS(val_ptr);
56062         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
56063         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
56064                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56065                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
56066         }
56067         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
56068 }
56069
56070 uint64_t  __attribute__((export_name("TS_MessageHandler_get_custom_message_handler"))) TS_MessageHandler_get_custom_message_handler(uint64_t this_ptr) {
56071         LDKMessageHandler this_ptr_conv;
56072         this_ptr_conv.inner = untag_ptr(this_ptr);
56073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56075         this_ptr_conv.is_owned = false;
56076         // WARNING: This object doesn't live past this scope, needs clone!
56077         uint64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
56078         return ret_ret;
56079 }
56080
56081 void  __attribute__((export_name("TS_MessageHandler_set_custom_message_handler"))) TS_MessageHandler_set_custom_message_handler(uint64_t this_ptr, uint64_t val) {
56082         LDKMessageHandler this_ptr_conv;
56083         this_ptr_conv.inner = untag_ptr(this_ptr);
56084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56086         this_ptr_conv.is_owned = false;
56087         void* val_ptr = untag_ptr(val);
56088         CHECK_ACCESS(val_ptr);
56089         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
56090         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
56091                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56092                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
56093         }
56094         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
56095 }
56096
56097 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) {
56098         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
56099         CHECK_ACCESS(chan_handler_arg_ptr);
56100         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
56101         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
56102                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56103                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
56104         }
56105         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
56106         CHECK_ACCESS(route_handler_arg_ptr);
56107         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
56108         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
56109                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56110                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
56111         }
56112         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
56113         CHECK_ACCESS(onion_message_handler_arg_ptr);
56114         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
56115         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
56116                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56117                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
56118         }
56119         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
56120         CHECK_ACCESS(custom_message_handler_arg_ptr);
56121         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
56122         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
56123                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56124                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
56125         }
56126         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
56127         uint64_t ret_ref = 0;
56128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56130         return ret_ref;
56131 }
56132
56133 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
56134         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
56135         *ret_ret = SocketDescriptor_clone(arg);
56136         return tag_ptr(ret_ret, true);
56137 }
56138 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
56139         void* arg_ptr = untag_ptr(arg);
56140         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
56141         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
56142         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
56143         return ret_conv;
56144 }
56145
56146 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
56147         void* orig_ptr = untag_ptr(orig);
56148         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
56149         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
56150         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
56151         *ret_ret = SocketDescriptor_clone(orig_conv);
56152         return tag_ptr(ret_ret, true);
56153 }
56154
56155 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
56156         if (!ptr_is_owned(this_ptr)) return;
56157         void* this_ptr_ptr = untag_ptr(this_ptr);
56158         CHECK_ACCESS(this_ptr_ptr);
56159         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
56160         FREE(untag_ptr(this_ptr));
56161         SocketDescriptor_free(this_ptr_conv);
56162 }
56163
56164 void  __attribute__((export_name("TS_PeerDetails_free"))) TS_PeerDetails_free(uint64_t this_obj) {
56165         LDKPeerDetails this_obj_conv;
56166         this_obj_conv.inner = untag_ptr(this_obj);
56167         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56169         PeerDetails_free(this_obj_conv);
56170 }
56171
56172 int8_tArray  __attribute__((export_name("TS_PeerDetails_get_counterparty_node_id"))) TS_PeerDetails_get_counterparty_node_id(uint64_t this_ptr) {
56173         LDKPeerDetails this_ptr_conv;
56174         this_ptr_conv.inner = untag_ptr(this_ptr);
56175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56177         this_ptr_conv.is_owned = false;
56178         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
56179         memcpy(ret_arr->elems, PeerDetails_get_counterparty_node_id(&this_ptr_conv).compressed_form, 33);
56180         return ret_arr;
56181 }
56182
56183 void  __attribute__((export_name("TS_PeerDetails_set_counterparty_node_id"))) TS_PeerDetails_set_counterparty_node_id(uint64_t this_ptr, int8_tArray val) {
56184         LDKPeerDetails this_ptr_conv;
56185         this_ptr_conv.inner = untag_ptr(this_ptr);
56186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56188         this_ptr_conv.is_owned = false;
56189         LDKPublicKey val_ref;
56190         CHECK(val->arr_len == 33);
56191         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
56192         PeerDetails_set_counterparty_node_id(&this_ptr_conv, val_ref);
56193 }
56194
56195 uint64_t  __attribute__((export_name("TS_PeerDetails_get_socket_address"))) TS_PeerDetails_get_socket_address(uint64_t this_ptr) {
56196         LDKPeerDetails this_ptr_conv;
56197         this_ptr_conv.inner = untag_ptr(this_ptr);
56198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56200         this_ptr_conv.is_owned = false;
56201         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
56202         *ret_copy = PeerDetails_get_socket_address(&this_ptr_conv);
56203         uint64_t ret_ref = tag_ptr(ret_copy, true);
56204         return ret_ref;
56205 }
56206
56207 void  __attribute__((export_name("TS_PeerDetails_set_socket_address"))) TS_PeerDetails_set_socket_address(uint64_t this_ptr, uint64_t val) {
56208         LDKPeerDetails this_ptr_conv;
56209         this_ptr_conv.inner = untag_ptr(this_ptr);
56210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56212         this_ptr_conv.is_owned = false;
56213         void* val_ptr = untag_ptr(val);
56214         CHECK_ACCESS(val_ptr);
56215         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
56216         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
56217         PeerDetails_set_socket_address(&this_ptr_conv, val_conv);
56218 }
56219
56220 uint64_t  __attribute__((export_name("TS_PeerDetails_get_init_features"))) TS_PeerDetails_get_init_features(uint64_t this_ptr) {
56221         LDKPeerDetails this_ptr_conv;
56222         this_ptr_conv.inner = untag_ptr(this_ptr);
56223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56225         this_ptr_conv.is_owned = false;
56226         LDKInitFeatures ret_var = PeerDetails_get_init_features(&this_ptr_conv);
56227         uint64_t ret_ref = 0;
56228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56230         return ret_ref;
56231 }
56232
56233 void  __attribute__((export_name("TS_PeerDetails_set_init_features"))) TS_PeerDetails_set_init_features(uint64_t this_ptr, uint64_t val) {
56234         LDKPeerDetails this_ptr_conv;
56235         this_ptr_conv.inner = untag_ptr(this_ptr);
56236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56238         this_ptr_conv.is_owned = false;
56239         LDKInitFeatures val_conv;
56240         val_conv.inner = untag_ptr(val);
56241         val_conv.is_owned = ptr_is_owned(val);
56242         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56243         val_conv = InitFeatures_clone(&val_conv);
56244         PeerDetails_set_init_features(&this_ptr_conv, val_conv);
56245 }
56246
56247 jboolean  __attribute__((export_name("TS_PeerDetails_get_is_inbound_connection"))) TS_PeerDetails_get_is_inbound_connection(uint64_t this_ptr) {
56248         LDKPeerDetails this_ptr_conv;
56249         this_ptr_conv.inner = untag_ptr(this_ptr);
56250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56252         this_ptr_conv.is_owned = false;
56253         jboolean ret_conv = PeerDetails_get_is_inbound_connection(&this_ptr_conv);
56254         return ret_conv;
56255 }
56256
56257 void  __attribute__((export_name("TS_PeerDetails_set_is_inbound_connection"))) TS_PeerDetails_set_is_inbound_connection(uint64_t this_ptr, jboolean val) {
56258         LDKPeerDetails this_ptr_conv;
56259         this_ptr_conv.inner = untag_ptr(this_ptr);
56260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56262         this_ptr_conv.is_owned = false;
56263         PeerDetails_set_is_inbound_connection(&this_ptr_conv, val);
56264 }
56265
56266 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) {
56267         LDKPublicKey counterparty_node_id_arg_ref;
56268         CHECK(counterparty_node_id_arg->arr_len == 33);
56269         memcpy(counterparty_node_id_arg_ref.compressed_form, counterparty_node_id_arg->elems, 33); FREE(counterparty_node_id_arg);
56270         void* socket_address_arg_ptr = untag_ptr(socket_address_arg);
56271         CHECK_ACCESS(socket_address_arg_ptr);
56272         LDKCOption_SocketAddressZ socket_address_arg_conv = *(LDKCOption_SocketAddressZ*)(socket_address_arg_ptr);
56273         LDKInitFeatures init_features_arg_conv;
56274         init_features_arg_conv.inner = untag_ptr(init_features_arg);
56275         init_features_arg_conv.is_owned = ptr_is_owned(init_features_arg);
56276         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_features_arg_conv);
56277         init_features_arg_conv = InitFeatures_clone(&init_features_arg_conv);
56278         LDKPeerDetails ret_var = PeerDetails_new(counterparty_node_id_arg_ref, socket_address_arg_conv, init_features_arg_conv, is_inbound_connection_arg);
56279         uint64_t ret_ref = 0;
56280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56282         return ret_ref;
56283 }
56284
56285 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
56286         LDKPeerHandleError this_obj_conv;
56287         this_obj_conv.inner = untag_ptr(this_obj);
56288         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56290         PeerHandleError_free(this_obj_conv);
56291 }
56292
56293 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
56294         LDKPeerHandleError ret_var = PeerHandleError_new();
56295         uint64_t ret_ref = 0;
56296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56298         return ret_ref;
56299 }
56300
56301 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
56302         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
56303         uint64_t ret_ref = 0;
56304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56306         return ret_ref;
56307 }
56308 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
56309         LDKPeerHandleError arg_conv;
56310         arg_conv.inner = untag_ptr(arg);
56311         arg_conv.is_owned = ptr_is_owned(arg);
56312         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56313         arg_conv.is_owned = false;
56314         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
56315         return ret_conv;
56316 }
56317
56318 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
56319         LDKPeerHandleError orig_conv;
56320         orig_conv.inner = untag_ptr(orig);
56321         orig_conv.is_owned = ptr_is_owned(orig);
56322         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56323         orig_conv.is_owned = false;
56324         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
56325         uint64_t ret_ref = 0;
56326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56328         return ret_ref;
56329 }
56330
56331 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
56332         LDKPeerManager this_obj_conv;
56333         this_obj_conv.inner = untag_ptr(this_obj);
56334         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56336         PeerManager_free(this_obj_conv);
56337 }
56338
56339 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) {
56340         LDKMessageHandler message_handler_conv;
56341         message_handler_conv.inner = untag_ptr(message_handler);
56342         message_handler_conv.is_owned = ptr_is_owned(message_handler);
56343         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
56344         // WARNING: we need a move here but no clone is available for LDKMessageHandler
56345         
56346         uint8_t ephemeral_random_data_arr[32];
56347         CHECK(ephemeral_random_data->arr_len == 32);
56348         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
56349         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
56350         void* logger_ptr = untag_ptr(logger);
56351         CHECK_ACCESS(logger_ptr);
56352         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
56353         if (logger_conv.free == LDKLogger_JCalls_free) {
56354                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56355                 LDKLogger_JCalls_cloned(&logger_conv);
56356         }
56357         void* node_signer_ptr = untag_ptr(node_signer);
56358         CHECK_ACCESS(node_signer_ptr);
56359         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
56360         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
56361                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56362                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
56363         }
56364         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
56365         uint64_t ret_ref = 0;
56366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56368         return ret_ref;
56369 }
56370
56371 uint64_tArray  __attribute__((export_name("TS_PeerManager_list_peers"))) TS_PeerManager_list_peers(uint64_t this_arg) {
56372         LDKPeerManager this_arg_conv;
56373         this_arg_conv.inner = untag_ptr(this_arg);
56374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56376         this_arg_conv.is_owned = false;
56377         LDKCVec_PeerDetailsZ ret_var = PeerManager_list_peers(&this_arg_conv);
56378         uint64_tArray ret_arr = NULL;
56379         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
56380         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
56381         for (size_t n = 0; n < ret_var.datalen; n++) {
56382                 LDKPeerDetails ret_conv_13_var = ret_var.data[n];
56383                 uint64_t ret_conv_13_ref = 0;
56384                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
56385                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
56386                 ret_arr_ptr[n] = ret_conv_13_ref;
56387         }
56388         
56389         FREE(ret_var.data);
56390         return ret_arr;
56391 }
56392
56393 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) {
56394         LDKPeerManager this_arg_conv;
56395         this_arg_conv.inner = untag_ptr(this_arg);
56396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56398         this_arg_conv.is_owned = false;
56399         LDKPublicKey their_node_id_ref;
56400         CHECK(their_node_id->arr_len == 33);
56401         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
56402         LDKPeerDetails ret_var = PeerManager_peer_by_node_id(&this_arg_conv, their_node_id_ref);
56403         uint64_t ret_ref = 0;
56404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56406         return ret_ref;
56407 }
56408
56409 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) {
56410         LDKPeerManager this_arg_conv;
56411         this_arg_conv.inner = untag_ptr(this_arg);
56412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56414         this_arg_conv.is_owned = false;
56415         LDKPublicKey their_node_id_ref;
56416         CHECK(their_node_id->arr_len == 33);
56417         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
56418         void* descriptor_ptr = untag_ptr(descriptor);
56419         CHECK_ACCESS(descriptor_ptr);
56420         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
56421         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
56422                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56423                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
56424         }
56425         void* remote_network_address_ptr = untag_ptr(remote_network_address);
56426         CHECK_ACCESS(remote_network_address_ptr);
56427         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
56428         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
56429         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
56430         return tag_ptr(ret_conv, true);
56431 }
56432
56433 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) {
56434         LDKPeerManager this_arg_conv;
56435         this_arg_conv.inner = untag_ptr(this_arg);
56436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56438         this_arg_conv.is_owned = false;
56439         void* descriptor_ptr = untag_ptr(descriptor);
56440         CHECK_ACCESS(descriptor_ptr);
56441         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
56442         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
56443                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56444                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
56445         }
56446         void* remote_network_address_ptr = untag_ptr(remote_network_address);
56447         CHECK_ACCESS(remote_network_address_ptr);
56448         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
56449         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
56450         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
56451         return tag_ptr(ret_conv, true);
56452 }
56453
56454 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
56455         LDKPeerManager this_arg_conv;
56456         this_arg_conv.inner = untag_ptr(this_arg);
56457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56459         this_arg_conv.is_owned = false;
56460         void* descriptor_ptr = untag_ptr(descriptor);
56461         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
56462         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
56463         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
56464         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
56465         return tag_ptr(ret_conv, true);
56466 }
56467
56468 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
56469         LDKPeerManager this_arg_conv;
56470         this_arg_conv.inner = untag_ptr(this_arg);
56471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56473         this_arg_conv.is_owned = false;
56474         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
56475         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
56476         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
56477         LDKu8slice data_ref;
56478         data_ref.datalen = data->arr_len;
56479         data_ref.data = data->elems;
56480         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
56481         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
56482         FREE(data);
56483         return tag_ptr(ret_conv, true);
56484 }
56485
56486 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
56487         LDKPeerManager this_arg_conv;
56488         this_arg_conv.inner = untag_ptr(this_arg);
56489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56491         this_arg_conv.is_owned = false;
56492         PeerManager_process_events(&this_arg_conv);
56493 }
56494
56495 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
56496         LDKPeerManager this_arg_conv;
56497         this_arg_conv.inner = untag_ptr(this_arg);
56498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56500         this_arg_conv.is_owned = false;
56501         void* descriptor_ptr = untag_ptr(descriptor);
56502         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
56503         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
56504         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
56505 }
56506
56507 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
56508         LDKPeerManager this_arg_conv;
56509         this_arg_conv.inner = untag_ptr(this_arg);
56510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56512         this_arg_conv.is_owned = false;
56513         LDKPublicKey node_id_ref;
56514         CHECK(node_id->arr_len == 33);
56515         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
56516         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
56517 }
56518
56519 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
56520         LDKPeerManager this_arg_conv;
56521         this_arg_conv.inner = untag_ptr(this_arg);
56522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56524         this_arg_conv.is_owned = false;
56525         PeerManager_disconnect_all_peers(&this_arg_conv);
56526 }
56527
56528 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
56529         LDKPeerManager this_arg_conv;
56530         this_arg_conv.inner = untag_ptr(this_arg);
56531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56533         this_arg_conv.is_owned = false;
56534         PeerManager_timer_tick_occurred(&this_arg_conv);
56535 }
56536
56537 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) {
56538         LDKPeerManager this_arg_conv;
56539         this_arg_conv.inner = untag_ptr(this_arg);
56540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56542         this_arg_conv.is_owned = false;
56543         LDKThreeBytes rgb_ref;
56544         CHECK(rgb->arr_len == 3);
56545         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
56546         LDKThirtyTwoBytes alias_ref;
56547         CHECK(alias->arr_len == 32);
56548         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
56549         LDKCVec_SocketAddressZ addresses_constr;
56550         addresses_constr.datalen = addresses->arr_len;
56551         if (addresses_constr.datalen > 0)
56552                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
56553         else
56554                 addresses_constr.data = NULL;
56555         uint64_t* addresses_vals = addresses->elems;
56556         for (size_t p = 0; p < addresses_constr.datalen; p++) {
56557                 uint64_t addresses_conv_15 = addresses_vals[p];
56558                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
56559                 CHECK_ACCESS(addresses_conv_15_ptr);
56560                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
56561                 addresses_constr.data[p] = addresses_conv_15_conv;
56562         }
56563         FREE(addresses);
56564         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
56565 }
56566
56567 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(uint64_t channel_type_features) {
56568         LDKChannelTypeFeatures channel_type_features_conv;
56569         channel_type_features_conv.inner = untag_ptr(channel_type_features);
56570         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
56571         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
56572         channel_type_features_conv.is_owned = false;
56573         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
56574         return ret_conv;
56575 }
56576
56577 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(uint64_t channel_type_features) {
56578         LDKChannelTypeFeatures channel_type_features_conv;
56579         channel_type_features_conv.inner = untag_ptr(channel_type_features);
56580         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
56581         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
56582         channel_type_features_conv.is_owned = false;
56583         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
56584         return ret_conv;
56585 }
56586
56587 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
56588         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
56589         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
56590         return ret_conv;
56591 }
56592
56593 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
56594         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
56595         return ret_conv;
56596 }
56597
56598 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
56599         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
56600         return ret_conv;
56601 }
56602
56603 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
56604         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
56605         return ret_conv;
56606 }
56607
56608 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
56609         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
56610         return ret_conv;
56611 }
56612
56613 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
56614         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
56615         return ret_conv;
56616 }
56617
56618 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
56619         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
56620         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
56621         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
56622         return ret_conv;
56623 }
56624
56625 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
56626         LDKWitness witness_ref;
56627         witness_ref.datalen = witness->arr_len;
56628         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
56629         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
56630         witness_ref.data_is_owned = true;
56631         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
56632         *ret_copy = HTLCClaim_from_witness(witness_ref);
56633         uint64_t ret_ref = tag_ptr(ret_copy, true);
56634         return ret_ref;
56635 }
56636
56637 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
56638         uint8_t commitment_seed_arr[32];
56639         CHECK(commitment_seed->arr_len == 32);
56640         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
56641         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
56642         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56643         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
56644         return ret_arr;
56645 }
56646
56647 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) {
56648         LDKCVec_u8Z to_holder_script_ref;
56649         to_holder_script_ref.datalen = to_holder_script->arr_len;
56650         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
56651         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
56652         LDKCVec_u8Z to_counterparty_script_ref;
56653         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
56654         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
56655         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
56656         LDKOutPoint funding_outpoint_conv;
56657         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
56658         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
56659         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
56660         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
56661         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);
56662         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56663         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56664         Transaction_free(ret_var);
56665         return ret_arr;
56666 }
56667
56668 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
56669         LDKCounterpartyCommitmentSecrets this_obj_conv;
56670         this_obj_conv.inner = untag_ptr(this_obj);
56671         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56673         CounterpartyCommitmentSecrets_free(this_obj_conv);
56674 }
56675
56676 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
56677         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
56678         uint64_t ret_ref = 0;
56679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56681         return ret_ref;
56682 }
56683 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
56684         LDKCounterpartyCommitmentSecrets arg_conv;
56685         arg_conv.inner = untag_ptr(arg);
56686         arg_conv.is_owned = ptr_is_owned(arg);
56687         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56688         arg_conv.is_owned = false;
56689         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
56690         return ret_conv;
56691 }
56692
56693 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
56694         LDKCounterpartyCommitmentSecrets orig_conv;
56695         orig_conv.inner = untag_ptr(orig);
56696         orig_conv.is_owned = ptr_is_owned(orig);
56697         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56698         orig_conv.is_owned = false;
56699         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
56700         uint64_t ret_ref = 0;
56701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56703         return ret_ref;
56704 }
56705
56706 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
56707         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
56708         uint64_t ret_ref = 0;
56709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56711         return ret_ref;
56712 }
56713
56714 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
56715         LDKCounterpartyCommitmentSecrets this_arg_conv;
56716         this_arg_conv.inner = untag_ptr(this_arg);
56717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56719         this_arg_conv.is_owned = false;
56720         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
56721         return ret_conv;
56722 }
56723
56724 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
56725         LDKCounterpartyCommitmentSecrets this_arg_conv;
56726         this_arg_conv.inner = untag_ptr(this_arg);
56727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56729         this_arg_conv.is_owned = false;
56730         LDKThirtyTwoBytes secret_ref;
56731         CHECK(secret->arr_len == 32);
56732         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
56733         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56734         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
56735         return tag_ptr(ret_conv, true);
56736 }
56737
56738 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
56739         LDKCounterpartyCommitmentSecrets this_arg_conv;
56740         this_arg_conv.inner = untag_ptr(this_arg);
56741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56743         this_arg_conv.is_owned = false;
56744         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56745         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
56746         return ret_arr;
56747 }
56748
56749 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
56750         LDKCounterpartyCommitmentSecrets obj_conv;
56751         obj_conv.inner = untag_ptr(obj);
56752         obj_conv.is_owned = ptr_is_owned(obj);
56753         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56754         obj_conv.is_owned = false;
56755         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
56756         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56757         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56758         CVec_u8Z_free(ret_var);
56759         return ret_arr;
56760 }
56761
56762 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
56763         LDKu8slice ser_ref;
56764         ser_ref.datalen = ser->arr_len;
56765         ser_ref.data = ser->elems;
56766         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
56767         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
56768         FREE(ser);
56769         return tag_ptr(ret_conv, true);
56770 }
56771
56772 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
56773         LDKPublicKey per_commitment_point_ref;
56774         CHECK(per_commitment_point->arr_len == 33);
56775         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
56776         uint8_t base_secret_arr[32];
56777         CHECK(base_secret->arr_len == 32);
56778         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
56779         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
56780         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56781         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
56782         return ret_arr;
56783 }
56784
56785 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) {
56786         uint8_t per_commitment_secret_arr[32];
56787         CHECK(per_commitment_secret->arr_len == 32);
56788         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
56789         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
56790         uint8_t countersignatory_revocation_base_secret_arr[32];
56791         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
56792         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
56793         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
56794         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56795         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
56796         return ret_arr;
56797 }
56798
56799 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
56800         LDKTxCreationKeys this_obj_conv;
56801         this_obj_conv.inner = untag_ptr(this_obj);
56802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56804         TxCreationKeys_free(this_obj_conv);
56805 }
56806
56807 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
56808         LDKTxCreationKeys this_ptr_conv;
56809         this_ptr_conv.inner = untag_ptr(this_ptr);
56810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56812         this_ptr_conv.is_owned = false;
56813         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
56814         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
56815         return ret_arr;
56816 }
56817
56818 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
56819         LDKTxCreationKeys this_ptr_conv;
56820         this_ptr_conv.inner = untag_ptr(this_ptr);
56821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56823         this_ptr_conv.is_owned = false;
56824         LDKPublicKey val_ref;
56825         CHECK(val->arr_len == 33);
56826         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
56827         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
56828 }
56829
56830 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
56831         LDKTxCreationKeys this_ptr_conv;
56832         this_ptr_conv.inner = untag_ptr(this_ptr);
56833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56835         this_ptr_conv.is_owned = false;
56836         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_conv);
56837         uint64_t ret_ref = 0;
56838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56840         return ret_ref;
56841 }
56842
56843 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, uint64_t val) {
56844         LDKTxCreationKeys this_ptr_conv;
56845         this_ptr_conv.inner = untag_ptr(this_ptr);
56846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56848         this_ptr_conv.is_owned = false;
56849         LDKRevocationKey val_conv;
56850         val_conv.inner = untag_ptr(val);
56851         val_conv.is_owned = ptr_is_owned(val);
56852         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56853         val_conv = RevocationKey_clone(&val_conv);
56854         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
56855 }
56856
56857 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
56858         LDKTxCreationKeys this_ptr_conv;
56859         this_ptr_conv.inner = untag_ptr(this_ptr);
56860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56862         this_ptr_conv.is_owned = false;
56863         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
56864         uint64_t ret_ref = 0;
56865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56867         return ret_ref;
56868 }
56869
56870 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, uint64_t val) {
56871         LDKTxCreationKeys this_ptr_conv;
56872         this_ptr_conv.inner = untag_ptr(this_ptr);
56873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56875         this_ptr_conv.is_owned = false;
56876         LDKHtlcKey val_conv;
56877         val_conv.inner = untag_ptr(val);
56878         val_conv.is_owned = ptr_is_owned(val);
56879         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56880         val_conv = HtlcKey_clone(&val_conv);
56881         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
56882 }
56883
56884 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
56885         LDKTxCreationKeys this_ptr_conv;
56886         this_ptr_conv.inner = untag_ptr(this_ptr);
56887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56889         this_ptr_conv.is_owned = false;
56890         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
56891         uint64_t ret_ref = 0;
56892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56894         return ret_ref;
56895 }
56896
56897 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, uint64_t val) {
56898         LDKTxCreationKeys this_ptr_conv;
56899         this_ptr_conv.inner = untag_ptr(this_ptr);
56900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56902         this_ptr_conv.is_owned = false;
56903         LDKHtlcKey val_conv;
56904         val_conv.inner = untag_ptr(val);
56905         val_conv.is_owned = ptr_is_owned(val);
56906         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56907         val_conv = HtlcKey_clone(&val_conv);
56908         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
56909 }
56910
56911 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
56912         LDKTxCreationKeys this_ptr_conv;
56913         this_ptr_conv.inner = untag_ptr(this_ptr);
56914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56916         this_ptr_conv.is_owned = false;
56917         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
56918         uint64_t ret_ref = 0;
56919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56921         return ret_ref;
56922 }
56923
56924 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) {
56925         LDKTxCreationKeys this_ptr_conv;
56926         this_ptr_conv.inner = untag_ptr(this_ptr);
56927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56929         this_ptr_conv.is_owned = false;
56930         LDKDelayedPaymentKey val_conv;
56931         val_conv.inner = untag_ptr(val);
56932         val_conv.is_owned = ptr_is_owned(val);
56933         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56934         val_conv = DelayedPaymentKey_clone(&val_conv);
56935         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
56936 }
56937
56938 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) {
56939         LDKPublicKey per_commitment_point_arg_ref;
56940         CHECK(per_commitment_point_arg->arr_len == 33);
56941         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
56942         LDKRevocationKey revocation_key_arg_conv;
56943         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
56944         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
56945         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
56946         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
56947         LDKHtlcKey broadcaster_htlc_key_arg_conv;
56948         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
56949         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
56950         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
56951         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
56952         LDKHtlcKey countersignatory_htlc_key_arg_conv;
56953         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
56954         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
56955         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
56956         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
56957         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
56958         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
56959         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
56960         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
56961         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
56962         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);
56963         uint64_t ret_ref = 0;
56964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56966         return ret_ref;
56967 }
56968
56969 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
56970         LDKTxCreationKeys a_conv;
56971         a_conv.inner = untag_ptr(a);
56972         a_conv.is_owned = ptr_is_owned(a);
56973         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56974         a_conv.is_owned = false;
56975         LDKTxCreationKeys b_conv;
56976         b_conv.inner = untag_ptr(b);
56977         b_conv.is_owned = ptr_is_owned(b);
56978         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56979         b_conv.is_owned = false;
56980         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
56981         return ret_conv;
56982 }
56983
56984 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
56985         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
56986         uint64_t ret_ref = 0;
56987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56989         return ret_ref;
56990 }
56991 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
56992         LDKTxCreationKeys arg_conv;
56993         arg_conv.inner = untag_ptr(arg);
56994         arg_conv.is_owned = ptr_is_owned(arg);
56995         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56996         arg_conv.is_owned = false;
56997         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
56998         return ret_conv;
56999 }
57000
57001 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
57002         LDKTxCreationKeys orig_conv;
57003         orig_conv.inner = untag_ptr(orig);
57004         orig_conv.is_owned = ptr_is_owned(orig);
57005         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57006         orig_conv.is_owned = false;
57007         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
57008         uint64_t ret_ref = 0;
57009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57011         return ret_ref;
57012 }
57013
57014 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
57015         LDKTxCreationKeys obj_conv;
57016         obj_conv.inner = untag_ptr(obj);
57017         obj_conv.is_owned = ptr_is_owned(obj);
57018         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57019         obj_conv.is_owned = false;
57020         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
57021         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57022         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57023         CVec_u8Z_free(ret_var);
57024         return ret_arr;
57025 }
57026
57027 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
57028         LDKu8slice ser_ref;
57029         ser_ref.datalen = ser->arr_len;
57030         ser_ref.data = ser->elems;
57031         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
57032         *ret_conv = TxCreationKeys_read(ser_ref);
57033         FREE(ser);
57034         return tag_ptr(ret_conv, true);
57035 }
57036
57037 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
57038         LDKChannelPublicKeys this_obj_conv;
57039         this_obj_conv.inner = untag_ptr(this_obj);
57040         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57042         ChannelPublicKeys_free(this_obj_conv);
57043 }
57044
57045 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
57046         LDKChannelPublicKeys this_ptr_conv;
57047         this_ptr_conv.inner = untag_ptr(this_ptr);
57048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57050         this_ptr_conv.is_owned = false;
57051         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
57052         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
57053         return ret_arr;
57054 }
57055
57056 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
57057         LDKChannelPublicKeys this_ptr_conv;
57058         this_ptr_conv.inner = untag_ptr(this_ptr);
57059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57061         this_ptr_conv.is_owned = false;
57062         LDKPublicKey val_ref;
57063         CHECK(val->arr_len == 33);
57064         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
57065         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
57066 }
57067
57068 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
57069         LDKChannelPublicKeys this_ptr_conv;
57070         this_ptr_conv.inner = untag_ptr(this_ptr);
57071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57073         this_ptr_conv.is_owned = false;
57074         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
57075         uint64_t ret_ref = 0;
57076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57078         return ret_ref;
57079 }
57080
57081 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, uint64_t val) {
57082         LDKChannelPublicKeys this_ptr_conv;
57083         this_ptr_conv.inner = untag_ptr(this_ptr);
57084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57086         this_ptr_conv.is_owned = false;
57087         LDKRevocationBasepoint val_conv;
57088         val_conv.inner = untag_ptr(val);
57089         val_conv.is_owned = ptr_is_owned(val);
57090         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57091         val_conv = RevocationBasepoint_clone(&val_conv);
57092         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
57093 }
57094
57095 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
57096         LDKChannelPublicKeys this_ptr_conv;
57097         this_ptr_conv.inner = untag_ptr(this_ptr);
57098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57100         this_ptr_conv.is_owned = false;
57101         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
57102         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
57103         return ret_arr;
57104 }
57105
57106 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
57107         LDKChannelPublicKeys this_ptr_conv;
57108         this_ptr_conv.inner = untag_ptr(this_ptr);
57109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57111         this_ptr_conv.is_owned = false;
57112         LDKPublicKey val_ref;
57113         CHECK(val->arr_len == 33);
57114         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
57115         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
57116 }
57117
57118 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
57119         LDKChannelPublicKeys this_ptr_conv;
57120         this_ptr_conv.inner = untag_ptr(this_ptr);
57121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57123         this_ptr_conv.is_owned = false;
57124         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
57125         uint64_t ret_ref = 0;
57126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57128         return ret_ref;
57129 }
57130
57131 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, uint64_t val) {
57132         LDKChannelPublicKeys this_ptr_conv;
57133         this_ptr_conv.inner = untag_ptr(this_ptr);
57134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57136         this_ptr_conv.is_owned = false;
57137         LDKDelayedPaymentBasepoint val_conv;
57138         val_conv.inner = untag_ptr(val);
57139         val_conv.is_owned = ptr_is_owned(val);
57140         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57141         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
57142         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
57143 }
57144
57145 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
57146         LDKChannelPublicKeys this_ptr_conv;
57147         this_ptr_conv.inner = untag_ptr(this_ptr);
57148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57150         this_ptr_conv.is_owned = false;
57151         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
57152         uint64_t ret_ref = 0;
57153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57155         return ret_ref;
57156 }
57157
57158 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, uint64_t val) {
57159         LDKChannelPublicKeys this_ptr_conv;
57160         this_ptr_conv.inner = untag_ptr(this_ptr);
57161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57163         this_ptr_conv.is_owned = false;
57164         LDKHtlcBasepoint val_conv;
57165         val_conv.inner = untag_ptr(val);
57166         val_conv.is_owned = ptr_is_owned(val);
57167         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57168         val_conv = HtlcBasepoint_clone(&val_conv);
57169         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
57170 }
57171
57172 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) {
57173         LDKPublicKey funding_pubkey_arg_ref;
57174         CHECK(funding_pubkey_arg->arr_len == 33);
57175         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
57176         LDKRevocationBasepoint revocation_basepoint_arg_conv;
57177         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
57178         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
57179         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
57180         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
57181         LDKPublicKey payment_point_arg_ref;
57182         CHECK(payment_point_arg->arr_len == 33);
57183         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
57184         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
57185         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
57186         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
57187         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
57188         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
57189         LDKHtlcBasepoint htlc_basepoint_arg_conv;
57190         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
57191         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
57192         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
57193         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
57194         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);
57195         uint64_t ret_ref = 0;
57196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57198         return ret_ref;
57199 }
57200
57201 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
57202         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
57203         uint64_t ret_ref = 0;
57204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57206         return ret_ref;
57207 }
57208 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
57209         LDKChannelPublicKeys arg_conv;
57210         arg_conv.inner = untag_ptr(arg);
57211         arg_conv.is_owned = ptr_is_owned(arg);
57212         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57213         arg_conv.is_owned = false;
57214         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
57215         return ret_conv;
57216 }
57217
57218 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
57219         LDKChannelPublicKeys orig_conv;
57220         orig_conv.inner = untag_ptr(orig);
57221         orig_conv.is_owned = ptr_is_owned(orig);
57222         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57223         orig_conv.is_owned = false;
57224         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
57225         uint64_t ret_ref = 0;
57226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57228         return ret_ref;
57229 }
57230
57231 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_hash"))) TS_ChannelPublicKeys_hash(uint64_t o) {
57232         LDKChannelPublicKeys o_conv;
57233         o_conv.inner = untag_ptr(o);
57234         o_conv.is_owned = ptr_is_owned(o);
57235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57236         o_conv.is_owned = false;
57237         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
57238         return ret_conv;
57239 }
57240
57241 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
57242         LDKChannelPublicKeys a_conv;
57243         a_conv.inner = untag_ptr(a);
57244         a_conv.is_owned = ptr_is_owned(a);
57245         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57246         a_conv.is_owned = false;
57247         LDKChannelPublicKeys b_conv;
57248         b_conv.inner = untag_ptr(b);
57249         b_conv.is_owned = ptr_is_owned(b);
57250         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57251         b_conv.is_owned = false;
57252         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
57253         return ret_conv;
57254 }
57255
57256 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
57257         LDKChannelPublicKeys obj_conv;
57258         obj_conv.inner = untag_ptr(obj);
57259         obj_conv.is_owned = ptr_is_owned(obj);
57260         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57261         obj_conv.is_owned = false;
57262         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
57263         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57264         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57265         CVec_u8Z_free(ret_var);
57266         return ret_arr;
57267 }
57268
57269 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
57270         LDKu8slice ser_ref;
57271         ser_ref.datalen = ser->arr_len;
57272         ser_ref.data = ser->elems;
57273         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
57274         *ret_conv = ChannelPublicKeys_read(ser_ref);
57275         FREE(ser);
57276         return tag_ptr(ret_conv, true);
57277 }
57278
57279 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) {
57280         LDKPublicKey per_commitment_point_ref;
57281         CHECK(per_commitment_point->arr_len == 33);
57282         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
57283         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
57284         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
57285         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
57286         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
57287         broadcaster_delayed_payment_base_conv.is_owned = false;
57288         LDKHtlcBasepoint broadcaster_htlc_base_conv;
57289         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
57290         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
57291         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
57292         broadcaster_htlc_base_conv.is_owned = false;
57293         LDKRevocationBasepoint countersignatory_revocation_base_conv;
57294         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
57295         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
57296         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
57297         countersignatory_revocation_base_conv.is_owned = false;
57298         LDKHtlcBasepoint countersignatory_htlc_base_conv;
57299         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
57300         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
57301         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
57302         countersignatory_htlc_base_conv.is_owned = false;
57303         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);
57304         uint64_t ret_ref = 0;
57305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57307         return ret_ref;
57308 }
57309
57310 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) {
57311         LDKPublicKey per_commitment_point_ref;
57312         CHECK(per_commitment_point->arr_len == 33);
57313         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
57314         LDKChannelPublicKeys broadcaster_keys_conv;
57315         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
57316         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
57317         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
57318         broadcaster_keys_conv.is_owned = false;
57319         LDKChannelPublicKeys countersignatory_keys_conv;
57320         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
57321         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
57322         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
57323         countersignatory_keys_conv.is_owned = false;
57324         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
57325         uint64_t ret_ref = 0;
57326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57328         return ret_ref;
57329 }
57330
57331 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) {
57332         LDKRevocationKey revocation_key_conv;
57333         revocation_key_conv.inner = untag_ptr(revocation_key);
57334         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
57335         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
57336         revocation_key_conv.is_owned = false;
57337         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
57338         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
57339         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
57340         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
57341         broadcaster_delayed_payment_key_conv.is_owned = false;
57342         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
57343         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57344         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57345         CVec_u8Z_free(ret_var);
57346         return ret_arr;
57347 }
57348
57349 int8_tArray  __attribute__((export_name("TS_get_counterparty_payment_script"))) TS_get_counterparty_payment_script(uint64_t channel_type_features, int8_tArray payment_key) {
57350         LDKChannelTypeFeatures channel_type_features_conv;
57351         channel_type_features_conv.inner = untag_ptr(channel_type_features);
57352         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
57353         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
57354         channel_type_features_conv.is_owned = false;
57355         LDKPublicKey payment_key_ref;
57356         CHECK(payment_key->arr_len == 33);
57357         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
57358         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
57359         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57360         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57361         CVec_u8Z_free(ret_var);
57362         return ret_arr;
57363 }
57364
57365 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
57366         LDKHTLCOutputInCommitment this_obj_conv;
57367         this_obj_conv.inner = untag_ptr(this_obj);
57368         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57370         HTLCOutputInCommitment_free(this_obj_conv);
57371 }
57372
57373 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
57374         LDKHTLCOutputInCommitment this_ptr_conv;
57375         this_ptr_conv.inner = untag_ptr(this_ptr);
57376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57378         this_ptr_conv.is_owned = false;
57379         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
57380         return ret_conv;
57381 }
57382
57383 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
57384         LDKHTLCOutputInCommitment this_ptr_conv;
57385         this_ptr_conv.inner = untag_ptr(this_ptr);
57386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57388         this_ptr_conv.is_owned = false;
57389         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
57390 }
57391
57392 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
57393         LDKHTLCOutputInCommitment this_ptr_conv;
57394         this_ptr_conv.inner = untag_ptr(this_ptr);
57395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57397         this_ptr_conv.is_owned = false;
57398         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
57399         return ret_conv;
57400 }
57401
57402 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
57403         LDKHTLCOutputInCommitment this_ptr_conv;
57404         this_ptr_conv.inner = untag_ptr(this_ptr);
57405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57407         this_ptr_conv.is_owned = false;
57408         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
57409 }
57410
57411 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
57412         LDKHTLCOutputInCommitment this_ptr_conv;
57413         this_ptr_conv.inner = untag_ptr(this_ptr);
57414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57416         this_ptr_conv.is_owned = false;
57417         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
57418         return ret_conv;
57419 }
57420
57421 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
57422         LDKHTLCOutputInCommitment this_ptr_conv;
57423         this_ptr_conv.inner = untag_ptr(this_ptr);
57424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57426         this_ptr_conv.is_owned = false;
57427         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
57428 }
57429
57430 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
57431         LDKHTLCOutputInCommitment this_ptr_conv;
57432         this_ptr_conv.inner = untag_ptr(this_ptr);
57433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57435         this_ptr_conv.is_owned = false;
57436         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57437         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
57438         return ret_arr;
57439 }
57440
57441 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
57442         LDKHTLCOutputInCommitment this_ptr_conv;
57443         this_ptr_conv.inner = untag_ptr(this_ptr);
57444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57446         this_ptr_conv.is_owned = false;
57447         LDKThirtyTwoBytes val_ref;
57448         CHECK(val->arr_len == 32);
57449         memcpy(val_ref.data, val->elems, 32); FREE(val);
57450         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
57451 }
57452
57453 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
57454         LDKHTLCOutputInCommitment this_ptr_conv;
57455         this_ptr_conv.inner = untag_ptr(this_ptr);
57456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57458         this_ptr_conv.is_owned = false;
57459         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
57460         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
57461         uint64_t ret_ref = tag_ptr(ret_copy, true);
57462         return ret_ref;
57463 }
57464
57465 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
57466         LDKHTLCOutputInCommitment this_ptr_conv;
57467         this_ptr_conv.inner = untag_ptr(this_ptr);
57468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57470         this_ptr_conv.is_owned = false;
57471         void* val_ptr = untag_ptr(val);
57472         CHECK_ACCESS(val_ptr);
57473         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
57474         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
57475         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
57476 }
57477
57478 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) {
57479         LDKThirtyTwoBytes payment_hash_arg_ref;
57480         CHECK(payment_hash_arg->arr_len == 32);
57481         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
57482         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
57483         CHECK_ACCESS(transaction_output_index_arg_ptr);
57484         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
57485         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
57486         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
57487         uint64_t ret_ref = 0;
57488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57490         return ret_ref;
57491 }
57492
57493 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
57494         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
57495         uint64_t ret_ref = 0;
57496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57498         return ret_ref;
57499 }
57500 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
57501         LDKHTLCOutputInCommitment arg_conv;
57502         arg_conv.inner = untag_ptr(arg);
57503         arg_conv.is_owned = ptr_is_owned(arg);
57504         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57505         arg_conv.is_owned = false;
57506         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
57507         return ret_conv;
57508 }
57509
57510 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
57511         LDKHTLCOutputInCommitment orig_conv;
57512         orig_conv.inner = untag_ptr(orig);
57513         orig_conv.is_owned = ptr_is_owned(orig);
57514         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57515         orig_conv.is_owned = false;
57516         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
57517         uint64_t ret_ref = 0;
57518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57520         return ret_ref;
57521 }
57522
57523 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
57524         LDKHTLCOutputInCommitment a_conv;
57525         a_conv.inner = untag_ptr(a);
57526         a_conv.is_owned = ptr_is_owned(a);
57527         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57528         a_conv.is_owned = false;
57529         LDKHTLCOutputInCommitment b_conv;
57530         b_conv.inner = untag_ptr(b);
57531         b_conv.is_owned = ptr_is_owned(b);
57532         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57533         b_conv.is_owned = false;
57534         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
57535         return ret_conv;
57536 }
57537
57538 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
57539         LDKHTLCOutputInCommitment obj_conv;
57540         obj_conv.inner = untag_ptr(obj);
57541         obj_conv.is_owned = ptr_is_owned(obj);
57542         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57543         obj_conv.is_owned = false;
57544         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
57545         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57546         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57547         CVec_u8Z_free(ret_var);
57548         return ret_arr;
57549 }
57550
57551 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
57552         LDKu8slice ser_ref;
57553         ser_ref.datalen = ser->arr_len;
57554         ser_ref.data = ser->elems;
57555         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
57556         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
57557         FREE(ser);
57558         return tag_ptr(ret_conv, true);
57559 }
57560
57561 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, uint64_t channel_type_features, uint64_t keys) {
57562         LDKHTLCOutputInCommitment htlc_conv;
57563         htlc_conv.inner = untag_ptr(htlc);
57564         htlc_conv.is_owned = ptr_is_owned(htlc);
57565         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
57566         htlc_conv.is_owned = false;
57567         LDKChannelTypeFeatures channel_type_features_conv;
57568         channel_type_features_conv.inner = untag_ptr(channel_type_features);
57569         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
57570         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
57571         channel_type_features_conv.is_owned = false;
57572         LDKTxCreationKeys keys_conv;
57573         keys_conv.inner = untag_ptr(keys);
57574         keys_conv.is_owned = ptr_is_owned(keys);
57575         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
57576         keys_conv.is_owned = false;
57577         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
57578         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57579         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57580         CVec_u8Z_free(ret_var);
57581         return ret_arr;
57582 }
57583
57584 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
57585         LDKPublicKey broadcaster_ref;
57586         CHECK(broadcaster->arr_len == 33);
57587         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
57588         LDKPublicKey countersignatory_ref;
57589         CHECK(countersignatory->arr_len == 33);
57590         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
57591         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
57592         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57593         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57594         CVec_u8Z_free(ret_var);
57595         return ret_arr;
57596 }
57597
57598 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) {
57599         uint8_t commitment_txid_arr[32];
57600         CHECK(commitment_txid->arr_len == 32);
57601         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
57602         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
57603         LDKHTLCOutputInCommitment htlc_conv;
57604         htlc_conv.inner = untag_ptr(htlc);
57605         htlc_conv.is_owned = ptr_is_owned(htlc);
57606         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
57607         htlc_conv.is_owned = false;
57608         LDKChannelTypeFeatures channel_type_features_conv;
57609         channel_type_features_conv.inner = untag_ptr(channel_type_features);
57610         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
57611         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
57612         channel_type_features_conv.is_owned = false;
57613         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
57614         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
57615         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
57616         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
57617         broadcaster_delayed_payment_key_conv.is_owned = false;
57618         LDKRevocationKey revocation_key_conv;
57619         revocation_key_conv.inner = untag_ptr(revocation_key);
57620         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
57621         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
57622         revocation_key_conv.is_owned = false;
57623         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);
57624         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57625         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57626         Transaction_free(ret_var);
57627         return ret_arr;
57628 }
57629
57630 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) {
57631         LDKECDSASignature local_sig_ref;
57632         CHECK(local_sig->arr_len == 64);
57633         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
57634         LDKECDSASignature remote_sig_ref;
57635         CHECK(remote_sig->arr_len == 64);
57636         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
57637         void* preimage_ptr = untag_ptr(preimage);
57638         CHECK_ACCESS(preimage_ptr);
57639         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
57640         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
57641         LDKu8slice redeem_script_ref;
57642         redeem_script_ref.datalen = redeem_script->arr_len;
57643         redeem_script_ref.data = redeem_script->elems;
57644         LDKChannelTypeFeatures channel_type_features_conv;
57645         channel_type_features_conv.inner = untag_ptr(channel_type_features);
57646         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
57647         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
57648         channel_type_features_conv.is_owned = false;
57649         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
57650         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57651         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57652         Witness_free(ret_var);
57653         FREE(redeem_script);
57654         return ret_arr;
57655 }
57656
57657 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
57658         LDKPublicKey payment_point_ref;
57659         CHECK(payment_point->arr_len == 33);
57660         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
57661         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
57662         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57663         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57664         CVec_u8Z_free(ret_var);
57665         return ret_arr;
57666 }
57667
57668 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
57669         LDKPublicKey funding_pubkey_ref;
57670         CHECK(funding_pubkey->arr_len == 33);
57671         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
57672         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
57673         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57674         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57675         CVec_u8Z_free(ret_var);
57676         return ret_arr;
57677 }
57678
57679 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
57680         LDKPublicKey funding_key_ref;
57681         CHECK(funding_key->arr_len == 33);
57682         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
57683         LDKECDSASignature funding_sig_ref;
57684         CHECK(funding_sig->arr_len == 64);
57685         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
57686         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
57687         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57688         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57689         Witness_free(ret_var);
57690         return ret_arr;
57691 }
57692
57693 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
57694         LDKChannelTransactionParameters this_obj_conv;
57695         this_obj_conv.inner = untag_ptr(this_obj);
57696         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57698         ChannelTransactionParameters_free(this_obj_conv);
57699 }
57700
57701 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
57702         LDKChannelTransactionParameters this_ptr_conv;
57703         this_ptr_conv.inner = untag_ptr(this_ptr);
57704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57706         this_ptr_conv.is_owned = false;
57707         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
57708         uint64_t ret_ref = 0;
57709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57711         return ret_ref;
57712 }
57713
57714 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
57715         LDKChannelTransactionParameters this_ptr_conv;
57716         this_ptr_conv.inner = untag_ptr(this_ptr);
57717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57719         this_ptr_conv.is_owned = false;
57720         LDKChannelPublicKeys val_conv;
57721         val_conv.inner = untag_ptr(val);
57722         val_conv.is_owned = ptr_is_owned(val);
57723         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57724         val_conv = ChannelPublicKeys_clone(&val_conv);
57725         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
57726 }
57727
57728 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
57729         LDKChannelTransactionParameters this_ptr_conv;
57730         this_ptr_conv.inner = untag_ptr(this_ptr);
57731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57733         this_ptr_conv.is_owned = false;
57734         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
57735         return ret_conv;
57736 }
57737
57738 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) {
57739         LDKChannelTransactionParameters this_ptr_conv;
57740         this_ptr_conv.inner = untag_ptr(this_ptr);
57741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57743         this_ptr_conv.is_owned = false;
57744         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
57745 }
57746
57747 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
57748         LDKChannelTransactionParameters this_ptr_conv;
57749         this_ptr_conv.inner = untag_ptr(this_ptr);
57750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57752         this_ptr_conv.is_owned = false;
57753         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
57754         return ret_conv;
57755 }
57756
57757 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
57758         LDKChannelTransactionParameters this_ptr_conv;
57759         this_ptr_conv.inner = untag_ptr(this_ptr);
57760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57762         this_ptr_conv.is_owned = false;
57763         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
57764 }
57765
57766 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
57767         LDKChannelTransactionParameters this_ptr_conv;
57768         this_ptr_conv.inner = untag_ptr(this_ptr);
57769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57771         this_ptr_conv.is_owned = false;
57772         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
57773         uint64_t ret_ref = 0;
57774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57776         return ret_ref;
57777 }
57778
57779 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
57780         LDKChannelTransactionParameters this_ptr_conv;
57781         this_ptr_conv.inner = untag_ptr(this_ptr);
57782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57784         this_ptr_conv.is_owned = false;
57785         LDKCounterpartyChannelTransactionParameters val_conv;
57786         val_conv.inner = untag_ptr(val);
57787         val_conv.is_owned = ptr_is_owned(val);
57788         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57789         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
57790         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
57791 }
57792
57793 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
57794         LDKChannelTransactionParameters this_ptr_conv;
57795         this_ptr_conv.inner = untag_ptr(this_ptr);
57796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57798         this_ptr_conv.is_owned = false;
57799         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
57800         uint64_t ret_ref = 0;
57801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57803         return ret_ref;
57804 }
57805
57806 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
57807         LDKChannelTransactionParameters this_ptr_conv;
57808         this_ptr_conv.inner = untag_ptr(this_ptr);
57809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57811         this_ptr_conv.is_owned = false;
57812         LDKOutPoint val_conv;
57813         val_conv.inner = untag_ptr(val);
57814         val_conv.is_owned = ptr_is_owned(val);
57815         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57816         val_conv = OutPoint_clone(&val_conv);
57817         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
57818 }
57819
57820 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_channel_type_features"))) TS_ChannelTransactionParameters_get_channel_type_features(uint64_t this_ptr) {
57821         LDKChannelTransactionParameters this_ptr_conv;
57822         this_ptr_conv.inner = untag_ptr(this_ptr);
57823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57825         this_ptr_conv.is_owned = false;
57826         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
57827         uint64_t ret_ref = 0;
57828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57830         return ret_ref;
57831 }
57832
57833 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_channel_type_features"))) TS_ChannelTransactionParameters_set_channel_type_features(uint64_t this_ptr, uint64_t val) {
57834         LDKChannelTransactionParameters this_ptr_conv;
57835         this_ptr_conv.inner = untag_ptr(this_ptr);
57836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57838         this_ptr_conv.is_owned = false;
57839         LDKChannelTypeFeatures val_conv;
57840         val_conv.inner = untag_ptr(val);
57841         val_conv.is_owned = ptr_is_owned(val);
57842         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57843         val_conv = ChannelTypeFeatures_clone(&val_conv);
57844         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
57845 }
57846
57847 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) {
57848         LDKChannelPublicKeys holder_pubkeys_arg_conv;
57849         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
57850         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
57851         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
57852         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
57853         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
57854         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
57855         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
57856         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
57857         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
57858         LDKOutPoint funding_outpoint_arg_conv;
57859         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
57860         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
57861         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
57862         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
57863         LDKChannelTypeFeatures channel_type_features_arg_conv;
57864         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
57865         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
57866         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
57867         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
57868         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);
57869         uint64_t ret_ref = 0;
57870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57872         return ret_ref;
57873 }
57874
57875 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
57876         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
57877         uint64_t ret_ref = 0;
57878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57880         return ret_ref;
57881 }
57882 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
57883         LDKChannelTransactionParameters arg_conv;
57884         arg_conv.inner = untag_ptr(arg);
57885         arg_conv.is_owned = ptr_is_owned(arg);
57886         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57887         arg_conv.is_owned = false;
57888         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
57889         return ret_conv;
57890 }
57891
57892 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
57893         LDKChannelTransactionParameters orig_conv;
57894         orig_conv.inner = untag_ptr(orig);
57895         orig_conv.is_owned = ptr_is_owned(orig);
57896         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57897         orig_conv.is_owned = false;
57898         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
57899         uint64_t ret_ref = 0;
57900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57902         return ret_ref;
57903 }
57904
57905 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_hash"))) TS_ChannelTransactionParameters_hash(uint64_t o) {
57906         LDKChannelTransactionParameters o_conv;
57907         o_conv.inner = untag_ptr(o);
57908         o_conv.is_owned = ptr_is_owned(o);
57909         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57910         o_conv.is_owned = false;
57911         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
57912         return ret_conv;
57913 }
57914
57915 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
57916         LDKChannelTransactionParameters a_conv;
57917         a_conv.inner = untag_ptr(a);
57918         a_conv.is_owned = ptr_is_owned(a);
57919         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57920         a_conv.is_owned = false;
57921         LDKChannelTransactionParameters b_conv;
57922         b_conv.inner = untag_ptr(b);
57923         b_conv.is_owned = ptr_is_owned(b);
57924         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57925         b_conv.is_owned = false;
57926         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
57927         return ret_conv;
57928 }
57929
57930 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
57931         LDKCounterpartyChannelTransactionParameters this_obj_conv;
57932         this_obj_conv.inner = untag_ptr(this_obj);
57933         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57935         CounterpartyChannelTransactionParameters_free(this_obj_conv);
57936 }
57937
57938 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
57939         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
57940         this_ptr_conv.inner = untag_ptr(this_ptr);
57941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57943         this_ptr_conv.is_owned = false;
57944         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
57945         uint64_t ret_ref = 0;
57946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57948         return ret_ref;
57949 }
57950
57951 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
57952         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
57953         this_ptr_conv.inner = untag_ptr(this_ptr);
57954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57956         this_ptr_conv.is_owned = false;
57957         LDKChannelPublicKeys val_conv;
57958         val_conv.inner = untag_ptr(val);
57959         val_conv.is_owned = ptr_is_owned(val);
57960         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57961         val_conv = ChannelPublicKeys_clone(&val_conv);
57962         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
57963 }
57964
57965 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
57966         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
57967         this_ptr_conv.inner = untag_ptr(this_ptr);
57968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57970         this_ptr_conv.is_owned = false;
57971         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
57972         return ret_conv;
57973 }
57974
57975 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
57976         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
57977         this_ptr_conv.inner = untag_ptr(this_ptr);
57978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57980         this_ptr_conv.is_owned = false;
57981         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
57982 }
57983
57984 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
57985         LDKChannelPublicKeys pubkeys_arg_conv;
57986         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
57987         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
57988         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
57989         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
57990         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
57991         uint64_t ret_ref = 0;
57992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57994         return ret_ref;
57995 }
57996
57997 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
57998         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
57999         uint64_t ret_ref = 0;
58000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58002         return ret_ref;
58003 }
58004 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
58005         LDKCounterpartyChannelTransactionParameters arg_conv;
58006         arg_conv.inner = untag_ptr(arg);
58007         arg_conv.is_owned = ptr_is_owned(arg);
58008         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58009         arg_conv.is_owned = false;
58010         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
58011         return ret_conv;
58012 }
58013
58014 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
58015         LDKCounterpartyChannelTransactionParameters orig_conv;
58016         orig_conv.inner = untag_ptr(orig);
58017         orig_conv.is_owned = ptr_is_owned(orig);
58018         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58019         orig_conv.is_owned = false;
58020         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
58021         uint64_t ret_ref = 0;
58022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58024         return ret_ref;
58025 }
58026
58027 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_hash"))) TS_CounterpartyChannelTransactionParameters_hash(uint64_t o) {
58028         LDKCounterpartyChannelTransactionParameters o_conv;
58029         o_conv.inner = untag_ptr(o);
58030         o_conv.is_owned = ptr_is_owned(o);
58031         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58032         o_conv.is_owned = false;
58033         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
58034         return ret_conv;
58035 }
58036
58037 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
58038         LDKCounterpartyChannelTransactionParameters a_conv;
58039         a_conv.inner = untag_ptr(a);
58040         a_conv.is_owned = ptr_is_owned(a);
58041         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58042         a_conv.is_owned = false;
58043         LDKCounterpartyChannelTransactionParameters b_conv;
58044         b_conv.inner = untag_ptr(b);
58045         b_conv.is_owned = ptr_is_owned(b);
58046         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58047         b_conv.is_owned = false;
58048         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
58049         return ret_conv;
58050 }
58051
58052 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
58053         LDKChannelTransactionParameters this_arg_conv;
58054         this_arg_conv.inner = untag_ptr(this_arg);
58055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58057         this_arg_conv.is_owned = false;
58058         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
58059         return ret_conv;
58060 }
58061
58062 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
58063         LDKChannelTransactionParameters this_arg_conv;
58064         this_arg_conv.inner = untag_ptr(this_arg);
58065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58067         this_arg_conv.is_owned = false;
58068         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
58069         uint64_t ret_ref = 0;
58070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58072         return ret_ref;
58073 }
58074
58075 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
58076         LDKChannelTransactionParameters this_arg_conv;
58077         this_arg_conv.inner = untag_ptr(this_arg);
58078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58080         this_arg_conv.is_owned = false;
58081         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
58082         uint64_t ret_ref = 0;
58083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58085         return ret_ref;
58086 }
58087
58088 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
58089         LDKCounterpartyChannelTransactionParameters obj_conv;
58090         obj_conv.inner = untag_ptr(obj);
58091         obj_conv.is_owned = ptr_is_owned(obj);
58092         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58093         obj_conv.is_owned = false;
58094         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
58095         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58096         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58097         CVec_u8Z_free(ret_var);
58098         return ret_arr;
58099 }
58100
58101 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
58102         LDKu8slice ser_ref;
58103         ser_ref.datalen = ser->arr_len;
58104         ser_ref.data = ser->elems;
58105         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
58106         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
58107         FREE(ser);
58108         return tag_ptr(ret_conv, true);
58109 }
58110
58111 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
58112         LDKChannelTransactionParameters obj_conv;
58113         obj_conv.inner = untag_ptr(obj);
58114         obj_conv.is_owned = ptr_is_owned(obj);
58115         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58116         obj_conv.is_owned = false;
58117         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
58118         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58119         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58120         CVec_u8Z_free(ret_var);
58121         return ret_arr;
58122 }
58123
58124 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
58125         LDKu8slice ser_ref;
58126         ser_ref.datalen = ser->arr_len;
58127         ser_ref.data = ser->elems;
58128         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
58129         *ret_conv = ChannelTransactionParameters_read(ser_ref);
58130         FREE(ser);
58131         return tag_ptr(ret_conv, true);
58132 }
58133
58134 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
58135         LDKDirectedChannelTransactionParameters this_obj_conv;
58136         this_obj_conv.inner = untag_ptr(this_obj);
58137         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58139         DirectedChannelTransactionParameters_free(this_obj_conv);
58140 }
58141
58142 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
58143         LDKDirectedChannelTransactionParameters this_arg_conv;
58144         this_arg_conv.inner = untag_ptr(this_arg);
58145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58147         this_arg_conv.is_owned = false;
58148         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
58149         uint64_t ret_ref = 0;
58150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58152         return ret_ref;
58153 }
58154
58155 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
58156         LDKDirectedChannelTransactionParameters this_arg_conv;
58157         this_arg_conv.inner = untag_ptr(this_arg);
58158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58160         this_arg_conv.is_owned = false;
58161         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
58162         uint64_t ret_ref = 0;
58163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58165         return ret_ref;
58166 }
58167
58168 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
58169         LDKDirectedChannelTransactionParameters this_arg_conv;
58170         this_arg_conv.inner = untag_ptr(this_arg);
58171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58173         this_arg_conv.is_owned = false;
58174         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
58175         return ret_conv;
58176 }
58177
58178 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
58179         LDKDirectedChannelTransactionParameters this_arg_conv;
58180         this_arg_conv.inner = untag_ptr(this_arg);
58181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58183         this_arg_conv.is_owned = false;
58184         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
58185         return ret_conv;
58186 }
58187
58188 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
58189         LDKDirectedChannelTransactionParameters this_arg_conv;
58190         this_arg_conv.inner = untag_ptr(this_arg);
58191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58193         this_arg_conv.is_owned = false;
58194         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
58195         uint64_t ret_ref = 0;
58196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58198         return ret_ref;
58199 }
58200
58201 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_channel_type_features"))) TS_DirectedChannelTransactionParameters_channel_type_features(uint64_t this_arg) {
58202         LDKDirectedChannelTransactionParameters this_arg_conv;
58203         this_arg_conv.inner = untag_ptr(this_arg);
58204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58206         this_arg_conv.is_owned = false;
58207         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
58208         uint64_t ret_ref = 0;
58209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58211         return ret_ref;
58212 }
58213
58214 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
58215         LDKHolderCommitmentTransaction this_obj_conv;
58216         this_obj_conv.inner = untag_ptr(this_obj);
58217         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58219         HolderCommitmentTransaction_free(this_obj_conv);
58220 }
58221
58222 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
58223         LDKHolderCommitmentTransaction this_ptr_conv;
58224         this_ptr_conv.inner = untag_ptr(this_ptr);
58225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58227         this_ptr_conv.is_owned = false;
58228         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
58229         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
58230         return ret_arr;
58231 }
58232
58233 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
58234         LDKHolderCommitmentTransaction this_ptr_conv;
58235         this_ptr_conv.inner = untag_ptr(this_ptr);
58236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58238         this_ptr_conv.is_owned = false;
58239         LDKECDSASignature val_ref;
58240         CHECK(val->arr_len == 64);
58241         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
58242         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
58243 }
58244
58245 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
58246         LDKHolderCommitmentTransaction this_ptr_conv;
58247         this_ptr_conv.inner = untag_ptr(this_ptr);
58248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58250         this_ptr_conv.is_owned = false;
58251         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
58252         ptrArray ret_arr = NULL;
58253         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
58254         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
58255         for (size_t m = 0; m < ret_var.datalen; m++) {
58256                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
58257                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
58258                 ret_arr_ptr[m] = ret_conv_12_arr;
58259         }
58260         
58261         FREE(ret_var.data);
58262         return ret_arr;
58263 }
58264
58265 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
58266         LDKHolderCommitmentTransaction this_ptr_conv;
58267         this_ptr_conv.inner = untag_ptr(this_ptr);
58268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58270         this_ptr_conv.is_owned = false;
58271         LDKCVec_ECDSASignatureZ val_constr;
58272         val_constr.datalen = val->arr_len;
58273         if (val_constr.datalen > 0)
58274                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
58275         else
58276                 val_constr.data = NULL;
58277         int8_tArray* val_vals = (void*) val->elems;
58278         for (size_t m = 0; m < val_constr.datalen; m++) {
58279                 int8_tArray val_conv_12 = val_vals[m];
58280                 LDKECDSASignature val_conv_12_ref;
58281                 CHECK(val_conv_12->arr_len == 64);
58282                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
58283                 val_constr.data[m] = val_conv_12_ref;
58284         }
58285         FREE(val);
58286         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
58287 }
58288
58289 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
58290         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
58291         uint64_t ret_ref = 0;
58292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58294         return ret_ref;
58295 }
58296 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
58297         LDKHolderCommitmentTransaction arg_conv;
58298         arg_conv.inner = untag_ptr(arg);
58299         arg_conv.is_owned = ptr_is_owned(arg);
58300         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58301         arg_conv.is_owned = false;
58302         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
58303         return ret_conv;
58304 }
58305
58306 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
58307         LDKHolderCommitmentTransaction orig_conv;
58308         orig_conv.inner = untag_ptr(orig);
58309         orig_conv.is_owned = ptr_is_owned(orig);
58310         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58311         orig_conv.is_owned = false;
58312         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
58313         uint64_t ret_ref = 0;
58314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58316         return ret_ref;
58317 }
58318
58319 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
58320         LDKHolderCommitmentTransaction obj_conv;
58321         obj_conv.inner = untag_ptr(obj);
58322         obj_conv.is_owned = ptr_is_owned(obj);
58323         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58324         obj_conv.is_owned = false;
58325         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
58326         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58327         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58328         CVec_u8Z_free(ret_var);
58329         return ret_arr;
58330 }
58331
58332 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
58333         LDKu8slice ser_ref;
58334         ser_ref.datalen = ser->arr_len;
58335         ser_ref.data = ser->elems;
58336         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
58337         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
58338         FREE(ser);
58339         return tag_ptr(ret_conv, true);
58340 }
58341
58342 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) {
58343         LDKCommitmentTransaction commitment_tx_conv;
58344         commitment_tx_conv.inner = untag_ptr(commitment_tx);
58345         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
58346         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
58347         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
58348         LDKECDSASignature counterparty_sig_ref;
58349         CHECK(counterparty_sig->arr_len == 64);
58350         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
58351         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
58352         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
58353         if (counterparty_htlc_sigs_constr.datalen > 0)
58354                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
58355         else
58356                 counterparty_htlc_sigs_constr.data = NULL;
58357         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
58358         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
58359                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
58360                 LDKECDSASignature counterparty_htlc_sigs_conv_12_ref;
58361                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
58362                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
58363                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
58364         }
58365         FREE(counterparty_htlc_sigs);
58366         LDKPublicKey holder_funding_key_ref;
58367         CHECK(holder_funding_key->arr_len == 33);
58368         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
58369         LDKPublicKey counterparty_funding_key_ref;
58370         CHECK(counterparty_funding_key->arr_len == 33);
58371         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
58372         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
58373         uint64_t ret_ref = 0;
58374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58376         return ret_ref;
58377 }
58378
58379 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
58380         LDKBuiltCommitmentTransaction this_obj_conv;
58381         this_obj_conv.inner = untag_ptr(this_obj);
58382         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58384         BuiltCommitmentTransaction_free(this_obj_conv);
58385 }
58386
58387 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
58388         LDKBuiltCommitmentTransaction this_ptr_conv;
58389         this_ptr_conv.inner = untag_ptr(this_ptr);
58390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58392         this_ptr_conv.is_owned = false;
58393         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
58394         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58395         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58396         Transaction_free(ret_var);
58397         return ret_arr;
58398 }
58399
58400 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
58401         LDKBuiltCommitmentTransaction this_ptr_conv;
58402         this_ptr_conv.inner = untag_ptr(this_ptr);
58403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58405         this_ptr_conv.is_owned = false;
58406         LDKTransaction val_ref;
58407         val_ref.datalen = val->arr_len;
58408         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
58409         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
58410         val_ref.data_is_owned = true;
58411         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
58412 }
58413
58414 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
58415         LDKBuiltCommitmentTransaction this_ptr_conv;
58416         this_ptr_conv.inner = untag_ptr(this_ptr);
58417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58419         this_ptr_conv.is_owned = false;
58420         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58421         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
58422         return ret_arr;
58423 }
58424
58425 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
58426         LDKBuiltCommitmentTransaction this_ptr_conv;
58427         this_ptr_conv.inner = untag_ptr(this_ptr);
58428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58430         this_ptr_conv.is_owned = false;
58431         LDKThirtyTwoBytes val_ref;
58432         CHECK(val->arr_len == 32);
58433         memcpy(val_ref.data, val->elems, 32); FREE(val);
58434         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
58435 }
58436
58437 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
58438         LDKTransaction transaction_arg_ref;
58439         transaction_arg_ref.datalen = transaction_arg->arr_len;
58440         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
58441         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
58442         transaction_arg_ref.data_is_owned = true;
58443         LDKThirtyTwoBytes txid_arg_ref;
58444         CHECK(txid_arg->arr_len == 32);
58445         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
58446         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
58447         uint64_t ret_ref = 0;
58448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58450         return ret_ref;
58451 }
58452
58453 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
58454         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
58455         uint64_t ret_ref = 0;
58456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58458         return ret_ref;
58459 }
58460 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
58461         LDKBuiltCommitmentTransaction arg_conv;
58462         arg_conv.inner = untag_ptr(arg);
58463         arg_conv.is_owned = ptr_is_owned(arg);
58464         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58465         arg_conv.is_owned = false;
58466         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
58467         return ret_conv;
58468 }
58469
58470 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
58471         LDKBuiltCommitmentTransaction orig_conv;
58472         orig_conv.inner = untag_ptr(orig);
58473         orig_conv.is_owned = ptr_is_owned(orig);
58474         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58475         orig_conv.is_owned = false;
58476         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
58477         uint64_t ret_ref = 0;
58478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58480         return ret_ref;
58481 }
58482
58483 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
58484         LDKBuiltCommitmentTransaction obj_conv;
58485         obj_conv.inner = untag_ptr(obj);
58486         obj_conv.is_owned = ptr_is_owned(obj);
58487         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58488         obj_conv.is_owned = false;
58489         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
58490         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58491         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58492         CVec_u8Z_free(ret_var);
58493         return ret_arr;
58494 }
58495
58496 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
58497         LDKu8slice ser_ref;
58498         ser_ref.datalen = ser->arr_len;
58499         ser_ref.data = ser->elems;
58500         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
58501         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
58502         FREE(ser);
58503         return tag_ptr(ret_conv, true);
58504 }
58505
58506 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) {
58507         LDKBuiltCommitmentTransaction this_arg_conv;
58508         this_arg_conv.inner = untag_ptr(this_arg);
58509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58511         this_arg_conv.is_owned = false;
58512         LDKu8slice funding_redeemscript_ref;
58513         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58514         funding_redeemscript_ref.data = funding_redeemscript->elems;
58515         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58516         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
58517         FREE(funding_redeemscript);
58518         return ret_arr;
58519 }
58520
58521 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) {
58522         LDKBuiltCommitmentTransaction this_arg_conv;
58523         this_arg_conv.inner = untag_ptr(this_arg);
58524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58526         this_arg_conv.is_owned = false;
58527         uint8_t funding_key_arr[32];
58528         CHECK(funding_key->arr_len == 32);
58529         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
58530         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
58531         LDKu8slice funding_redeemscript_ref;
58532         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58533         funding_redeemscript_ref.data = funding_redeemscript->elems;
58534         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
58535         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
58536         FREE(funding_redeemscript);
58537         return ret_arr;
58538 }
58539
58540 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) {
58541         LDKBuiltCommitmentTransaction this_arg_conv;
58542         this_arg_conv.inner = untag_ptr(this_arg);
58543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58545         this_arg_conv.is_owned = false;
58546         uint8_t funding_key_arr[32];
58547         CHECK(funding_key->arr_len == 32);
58548         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
58549         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
58550         LDKu8slice funding_redeemscript_ref;
58551         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58552         funding_redeemscript_ref.data = funding_redeemscript->elems;
58553         void* entropy_source_ptr = untag_ptr(entropy_source);
58554         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
58555         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
58556         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
58557         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);
58558         FREE(funding_redeemscript);
58559         return ret_arr;
58560 }
58561
58562 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
58563         LDKClosingTransaction this_obj_conv;
58564         this_obj_conv.inner = untag_ptr(this_obj);
58565         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58567         ClosingTransaction_free(this_obj_conv);
58568 }
58569
58570 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
58571         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
58572         uint64_t ret_ref = 0;
58573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58575         return ret_ref;
58576 }
58577 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
58578         LDKClosingTransaction arg_conv;
58579         arg_conv.inner = untag_ptr(arg);
58580         arg_conv.is_owned = ptr_is_owned(arg);
58581         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58582         arg_conv.is_owned = false;
58583         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
58584         return ret_conv;
58585 }
58586
58587 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
58588         LDKClosingTransaction orig_conv;
58589         orig_conv.inner = untag_ptr(orig);
58590         orig_conv.is_owned = ptr_is_owned(orig);
58591         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58592         orig_conv.is_owned = false;
58593         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
58594         uint64_t ret_ref = 0;
58595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58597         return ret_ref;
58598 }
58599
58600 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
58601         LDKClosingTransaction o_conv;
58602         o_conv.inner = untag_ptr(o);
58603         o_conv.is_owned = ptr_is_owned(o);
58604         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58605         o_conv.is_owned = false;
58606         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
58607         return ret_conv;
58608 }
58609
58610 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
58611         LDKClosingTransaction a_conv;
58612         a_conv.inner = untag_ptr(a);
58613         a_conv.is_owned = ptr_is_owned(a);
58614         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58615         a_conv.is_owned = false;
58616         LDKClosingTransaction b_conv;
58617         b_conv.inner = untag_ptr(b);
58618         b_conv.is_owned = ptr_is_owned(b);
58619         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58620         b_conv.is_owned = false;
58621         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
58622         return ret_conv;
58623 }
58624
58625 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) {
58626         LDKCVec_u8Z to_holder_script_ref;
58627         to_holder_script_ref.datalen = to_holder_script->arr_len;
58628         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
58629         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
58630         LDKCVec_u8Z to_counterparty_script_ref;
58631         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
58632         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
58633         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
58634         LDKOutPoint funding_outpoint_conv;
58635         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
58636         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
58637         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
58638         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
58639         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
58640         uint64_t ret_ref = 0;
58641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58643         return ret_ref;
58644 }
58645
58646 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
58647         LDKClosingTransaction this_arg_conv;
58648         this_arg_conv.inner = untag_ptr(this_arg);
58649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58651         this_arg_conv.is_owned = false;
58652         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
58653         uint64_t ret_ref = 0;
58654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58656         return ret_ref;
58657 }
58658
58659 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
58660         LDKClosingTransaction this_arg_conv;
58661         this_arg_conv.inner = untag_ptr(this_arg);
58662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58664         this_arg_conv.is_owned = false;
58665         LDKOutPoint funding_outpoint_conv;
58666         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
58667         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
58668         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
58669         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
58670         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
58671         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
58672         return tag_ptr(ret_conv, true);
58673 }
58674
58675 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
58676         LDKClosingTransaction this_arg_conv;
58677         this_arg_conv.inner = untag_ptr(this_arg);
58678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58680         this_arg_conv.is_owned = false;
58681         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
58682         return ret_conv;
58683 }
58684
58685 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
58686         LDKClosingTransaction this_arg_conv;
58687         this_arg_conv.inner = untag_ptr(this_arg);
58688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58690         this_arg_conv.is_owned = false;
58691         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
58692         return ret_conv;
58693 }
58694
58695 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
58696         LDKClosingTransaction this_arg_conv;
58697         this_arg_conv.inner = untag_ptr(this_arg);
58698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58700         this_arg_conv.is_owned = false;
58701         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
58702         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58703         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58704         return ret_arr;
58705 }
58706
58707 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
58708         LDKClosingTransaction this_arg_conv;
58709         this_arg_conv.inner = untag_ptr(this_arg);
58710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58712         this_arg_conv.is_owned = false;
58713         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
58714         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58715         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58716         return ret_arr;
58717 }
58718
58719 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
58720         LDKTrustedClosingTransaction this_obj_conv;
58721         this_obj_conv.inner = untag_ptr(this_obj);
58722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58724         TrustedClosingTransaction_free(this_obj_conv);
58725 }
58726
58727 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
58728         LDKTrustedClosingTransaction this_arg_conv;
58729         this_arg_conv.inner = untag_ptr(this_arg);
58730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58732         this_arg_conv.is_owned = false;
58733         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
58734         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58735         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58736         Transaction_free(ret_var);
58737         return ret_arr;
58738 }
58739
58740 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) {
58741         LDKTrustedClosingTransaction this_arg_conv;
58742         this_arg_conv.inner = untag_ptr(this_arg);
58743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58745         this_arg_conv.is_owned = false;
58746         LDKu8slice funding_redeemscript_ref;
58747         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58748         funding_redeemscript_ref.data = funding_redeemscript->elems;
58749         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58750         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
58751         FREE(funding_redeemscript);
58752         return ret_arr;
58753 }
58754
58755 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) {
58756         LDKTrustedClosingTransaction this_arg_conv;
58757         this_arg_conv.inner = untag_ptr(this_arg);
58758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58760         this_arg_conv.is_owned = false;
58761         uint8_t funding_key_arr[32];
58762         CHECK(funding_key->arr_len == 32);
58763         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
58764         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
58765         LDKu8slice funding_redeemscript_ref;
58766         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58767         funding_redeemscript_ref.data = funding_redeemscript->elems;
58768         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
58769         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
58770         FREE(funding_redeemscript);
58771         return ret_arr;
58772 }
58773
58774 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
58775         LDKCommitmentTransaction this_obj_conv;
58776         this_obj_conv.inner = untag_ptr(this_obj);
58777         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58779         CommitmentTransaction_free(this_obj_conv);
58780 }
58781
58782 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
58783         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
58784         uint64_t ret_ref = 0;
58785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58787         return ret_ref;
58788 }
58789 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
58790         LDKCommitmentTransaction arg_conv;
58791         arg_conv.inner = untag_ptr(arg);
58792         arg_conv.is_owned = ptr_is_owned(arg);
58793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58794         arg_conv.is_owned = false;
58795         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
58796         return ret_conv;
58797 }
58798
58799 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
58800         LDKCommitmentTransaction orig_conv;
58801         orig_conv.inner = untag_ptr(orig);
58802         orig_conv.is_owned = ptr_is_owned(orig);
58803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58804         orig_conv.is_owned = false;
58805         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
58806         uint64_t ret_ref = 0;
58807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58809         return ret_ref;
58810 }
58811
58812 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
58813         LDKCommitmentTransaction obj_conv;
58814         obj_conv.inner = untag_ptr(obj);
58815         obj_conv.is_owned = ptr_is_owned(obj);
58816         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58817         obj_conv.is_owned = false;
58818         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
58819         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58820         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58821         CVec_u8Z_free(ret_var);
58822         return ret_arr;
58823 }
58824
58825 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
58826         LDKu8slice ser_ref;
58827         ser_ref.datalen = ser->arr_len;
58828         ser_ref.data = ser->elems;
58829         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
58830         *ret_conv = CommitmentTransaction_read(ser_ref);
58831         FREE(ser);
58832         return tag_ptr(ret_conv, true);
58833 }
58834
58835 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
58836         LDKCommitmentTransaction this_arg_conv;
58837         this_arg_conv.inner = untag_ptr(this_arg);
58838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58840         this_arg_conv.is_owned = false;
58841         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
58842         return ret_conv;
58843 }
58844
58845 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_per_commitment_point"))) TS_CommitmentTransaction_per_commitment_point(uint64_t this_arg) {
58846         LDKCommitmentTransaction this_arg_conv;
58847         this_arg_conv.inner = untag_ptr(this_arg);
58848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58850         this_arg_conv.is_owned = false;
58851         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58852         memcpy(ret_arr->elems, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form, 33);
58853         return ret_arr;
58854 }
58855
58856 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
58857         LDKCommitmentTransaction this_arg_conv;
58858         this_arg_conv.inner = untag_ptr(this_arg);
58859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58861         this_arg_conv.is_owned = false;
58862         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
58863         return ret_conv;
58864 }
58865
58866 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
58867         LDKCommitmentTransaction this_arg_conv;
58868         this_arg_conv.inner = untag_ptr(this_arg);
58869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58871         this_arg_conv.is_owned = false;
58872         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
58873         return ret_conv;
58874 }
58875
58876 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
58877         LDKCommitmentTransaction this_arg_conv;
58878         this_arg_conv.inner = untag_ptr(this_arg);
58879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58881         this_arg_conv.is_owned = false;
58882         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
58883         return ret_conv;
58884 }
58885
58886 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
58887         LDKCommitmentTransaction this_arg_conv;
58888         this_arg_conv.inner = untag_ptr(this_arg);
58889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58891         this_arg_conv.is_owned = false;
58892         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
58893         uint64_t ret_ref = 0;
58894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58896         return ret_ref;
58897 }
58898
58899 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) {
58900         LDKCommitmentTransaction this_arg_conv;
58901         this_arg_conv.inner = untag_ptr(this_arg);
58902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58904         this_arg_conv.is_owned = false;
58905         LDKDirectedChannelTransactionParameters channel_parameters_conv;
58906         channel_parameters_conv.inner = untag_ptr(channel_parameters);
58907         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
58908         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
58909         channel_parameters_conv.is_owned = false;
58910         LDKChannelPublicKeys broadcaster_keys_conv;
58911         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
58912         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
58913         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
58914         broadcaster_keys_conv.is_owned = false;
58915         LDKChannelPublicKeys countersignatory_keys_conv;
58916         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
58917         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
58918         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
58919         countersignatory_keys_conv.is_owned = false;
58920         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
58921         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
58922         return tag_ptr(ret_conv, true);
58923 }
58924
58925 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
58926         LDKTrustedCommitmentTransaction this_obj_conv;
58927         this_obj_conv.inner = untag_ptr(this_obj);
58928         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58930         TrustedCommitmentTransaction_free(this_obj_conv);
58931 }
58932
58933 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
58934         LDKTrustedCommitmentTransaction this_arg_conv;
58935         this_arg_conv.inner = untag_ptr(this_arg);
58936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58938         this_arg_conv.is_owned = false;
58939         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58940         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
58941         return ret_arr;
58942 }
58943
58944 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
58945         LDKTrustedCommitmentTransaction this_arg_conv;
58946         this_arg_conv.inner = untag_ptr(this_arg);
58947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58949         this_arg_conv.is_owned = false;
58950         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
58951         uint64_t ret_ref = 0;
58952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58954         return ret_ref;
58955 }
58956
58957 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
58958         LDKTrustedCommitmentTransaction this_arg_conv;
58959         this_arg_conv.inner = untag_ptr(this_arg);
58960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58962         this_arg_conv.is_owned = false;
58963         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
58964         uint64_t ret_ref = 0;
58965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58967         return ret_ref;
58968 }
58969
58970 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_channel_type_features"))) TS_TrustedCommitmentTransaction_channel_type_features(uint64_t this_arg) {
58971         LDKTrustedCommitmentTransaction this_arg_conv;
58972         this_arg_conv.inner = untag_ptr(this_arg);
58973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58975         this_arg_conv.is_owned = false;
58976         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
58977         uint64_t ret_ref = 0;
58978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58980         return ret_ref;
58981 }
58982
58983 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) {
58984         LDKTrustedCommitmentTransaction this_arg_conv;
58985         this_arg_conv.inner = untag_ptr(this_arg);
58986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58988         this_arg_conv.is_owned = false;
58989         uint8_t htlc_base_key_arr[32];
58990         CHECK(htlc_base_key->arr_len == 32);
58991         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
58992         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
58993         LDKDirectedChannelTransactionParameters channel_parameters_conv;
58994         channel_parameters_conv.inner = untag_ptr(channel_parameters);
58995         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
58996         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
58997         channel_parameters_conv.is_owned = false;
58998         void* entropy_source_ptr = untag_ptr(entropy_source);
58999         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
59000         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
59001         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
59002         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
59003         return tag_ptr(ret_conv, true);
59004 }
59005
59006 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_revokeable_output_index"))) TS_TrustedCommitmentTransaction_revokeable_output_index(uint64_t this_arg) {
59007         LDKTrustedCommitmentTransaction this_arg_conv;
59008         this_arg_conv.inner = untag_ptr(this_arg);
59009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59011         this_arg_conv.is_owned = false;
59012         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
59013         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
59014         uint64_t ret_ref = tag_ptr(ret_copy, true);
59015         return ret_ref;
59016 }
59017
59018 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) {
59019         LDKTrustedCommitmentTransaction this_arg_conv;
59020         this_arg_conv.inner = untag_ptr(this_arg);
59021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59023         this_arg_conv.is_owned = false;
59024         LDKCVec_u8Z destination_script_ref;
59025         destination_script_ref.datalen = destination_script->arr_len;
59026         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
59027         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
59028         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
59029         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
59030         return tag_ptr(ret_conv, true);
59031 }
59032
59033 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) {
59034         LDKPublicKey broadcaster_payment_basepoint_ref;
59035         CHECK(broadcaster_payment_basepoint->arr_len == 33);
59036         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
59037         LDKPublicKey countersignatory_payment_basepoint_ref;
59038         CHECK(countersignatory_payment_basepoint->arr_len == 33);
59039         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
59040         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
59041         return ret_conv;
59042 }
59043
59044 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
59045         LDKInitFeatures a_conv;
59046         a_conv.inner = untag_ptr(a);
59047         a_conv.is_owned = ptr_is_owned(a);
59048         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59049         a_conv.is_owned = false;
59050         LDKInitFeatures b_conv;
59051         b_conv.inner = untag_ptr(b);
59052         b_conv.is_owned = ptr_is_owned(b);
59053         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59054         b_conv.is_owned = false;
59055         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
59056         return ret_conv;
59057 }
59058
59059 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
59060         LDKNodeFeatures a_conv;
59061         a_conv.inner = untag_ptr(a);
59062         a_conv.is_owned = ptr_is_owned(a);
59063         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59064         a_conv.is_owned = false;
59065         LDKNodeFeatures b_conv;
59066         b_conv.inner = untag_ptr(b);
59067         b_conv.is_owned = ptr_is_owned(b);
59068         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59069         b_conv.is_owned = false;
59070         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
59071         return ret_conv;
59072 }
59073
59074 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
59075         LDKChannelFeatures a_conv;
59076         a_conv.inner = untag_ptr(a);
59077         a_conv.is_owned = ptr_is_owned(a);
59078         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59079         a_conv.is_owned = false;
59080         LDKChannelFeatures b_conv;
59081         b_conv.inner = untag_ptr(b);
59082         b_conv.is_owned = ptr_is_owned(b);
59083         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59084         b_conv.is_owned = false;
59085         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
59086         return ret_conv;
59087 }
59088
59089 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_eq"))) TS_Bolt11InvoiceFeatures_eq(uint64_t a, uint64_t b) {
59090         LDKBolt11InvoiceFeatures a_conv;
59091         a_conv.inner = untag_ptr(a);
59092         a_conv.is_owned = ptr_is_owned(a);
59093         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59094         a_conv.is_owned = false;
59095         LDKBolt11InvoiceFeatures b_conv;
59096         b_conv.inner = untag_ptr(b);
59097         b_conv.is_owned = ptr_is_owned(b);
59098         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59099         b_conv.is_owned = false;
59100         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
59101         return ret_conv;
59102 }
59103
59104 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
59105         LDKOfferFeatures a_conv;
59106         a_conv.inner = untag_ptr(a);
59107         a_conv.is_owned = ptr_is_owned(a);
59108         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59109         a_conv.is_owned = false;
59110         LDKOfferFeatures b_conv;
59111         b_conv.inner = untag_ptr(b);
59112         b_conv.is_owned = ptr_is_owned(b);
59113         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59114         b_conv.is_owned = false;
59115         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
59116         return ret_conv;
59117 }
59118
59119 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
59120         LDKInvoiceRequestFeatures a_conv;
59121         a_conv.inner = untag_ptr(a);
59122         a_conv.is_owned = ptr_is_owned(a);
59123         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59124         a_conv.is_owned = false;
59125         LDKInvoiceRequestFeatures b_conv;
59126         b_conv.inner = untag_ptr(b);
59127         b_conv.is_owned = ptr_is_owned(b);
59128         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59129         b_conv.is_owned = false;
59130         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
59131         return ret_conv;
59132 }
59133
59134 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
59135         LDKBolt12InvoiceFeatures a_conv;
59136         a_conv.inner = untag_ptr(a);
59137         a_conv.is_owned = ptr_is_owned(a);
59138         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59139         a_conv.is_owned = false;
59140         LDKBolt12InvoiceFeatures b_conv;
59141         b_conv.inner = untag_ptr(b);
59142         b_conv.is_owned = ptr_is_owned(b);
59143         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59144         b_conv.is_owned = false;
59145         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
59146         return ret_conv;
59147 }
59148
59149 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
59150         LDKBlindedHopFeatures a_conv;
59151         a_conv.inner = untag_ptr(a);
59152         a_conv.is_owned = ptr_is_owned(a);
59153         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59154         a_conv.is_owned = false;
59155         LDKBlindedHopFeatures b_conv;
59156         b_conv.inner = untag_ptr(b);
59157         b_conv.is_owned = ptr_is_owned(b);
59158         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59159         b_conv.is_owned = false;
59160         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
59161         return ret_conv;
59162 }
59163
59164 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
59165         LDKChannelTypeFeatures a_conv;
59166         a_conv.inner = untag_ptr(a);
59167         a_conv.is_owned = ptr_is_owned(a);
59168         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59169         a_conv.is_owned = false;
59170         LDKChannelTypeFeatures b_conv;
59171         b_conv.inner = untag_ptr(b);
59172         b_conv.is_owned = ptr_is_owned(b);
59173         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59174         b_conv.is_owned = false;
59175         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
59176         return ret_conv;
59177 }
59178
59179 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
59180         LDKInitFeatures ret_var = InitFeatures_clone(arg);
59181         uint64_t ret_ref = 0;
59182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59184         return ret_ref;
59185 }
59186 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
59187         LDKInitFeatures arg_conv;
59188         arg_conv.inner = untag_ptr(arg);
59189         arg_conv.is_owned = ptr_is_owned(arg);
59190         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59191         arg_conv.is_owned = false;
59192         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
59193         return ret_conv;
59194 }
59195
59196 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
59197         LDKInitFeatures orig_conv;
59198         orig_conv.inner = untag_ptr(orig);
59199         orig_conv.is_owned = ptr_is_owned(orig);
59200         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59201         orig_conv.is_owned = false;
59202         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
59203         uint64_t ret_ref = 0;
59204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59206         return ret_ref;
59207 }
59208
59209 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
59210         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
59211         uint64_t ret_ref = 0;
59212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59214         return ret_ref;
59215 }
59216 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
59217         LDKNodeFeatures arg_conv;
59218         arg_conv.inner = untag_ptr(arg);
59219         arg_conv.is_owned = ptr_is_owned(arg);
59220         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59221         arg_conv.is_owned = false;
59222         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
59223         return ret_conv;
59224 }
59225
59226 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
59227         LDKNodeFeatures orig_conv;
59228         orig_conv.inner = untag_ptr(orig);
59229         orig_conv.is_owned = ptr_is_owned(orig);
59230         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59231         orig_conv.is_owned = false;
59232         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
59233         uint64_t ret_ref = 0;
59234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59236         return ret_ref;
59237 }
59238
59239 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
59240         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
59241         uint64_t ret_ref = 0;
59242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59244         return ret_ref;
59245 }
59246 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
59247         LDKChannelFeatures arg_conv;
59248         arg_conv.inner = untag_ptr(arg);
59249         arg_conv.is_owned = ptr_is_owned(arg);
59250         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59251         arg_conv.is_owned = false;
59252         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
59253         return ret_conv;
59254 }
59255
59256 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
59257         LDKChannelFeatures orig_conv;
59258         orig_conv.inner = untag_ptr(orig);
59259         orig_conv.is_owned = ptr_is_owned(orig);
59260         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59261         orig_conv.is_owned = false;
59262         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
59263         uint64_t ret_ref = 0;
59264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59266         return ret_ref;
59267 }
59268
59269 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
59270         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
59271         uint64_t ret_ref = 0;
59272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59274         return ret_ref;
59275 }
59276 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone_ptr"))) TS_Bolt11InvoiceFeatures_clone_ptr(uint64_t arg) {
59277         LDKBolt11InvoiceFeatures arg_conv;
59278         arg_conv.inner = untag_ptr(arg);
59279         arg_conv.is_owned = ptr_is_owned(arg);
59280         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59281         arg_conv.is_owned = false;
59282         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
59283         return ret_conv;
59284 }
59285
59286 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone"))) TS_Bolt11InvoiceFeatures_clone(uint64_t orig) {
59287         LDKBolt11InvoiceFeatures orig_conv;
59288         orig_conv.inner = untag_ptr(orig);
59289         orig_conv.is_owned = ptr_is_owned(orig);
59290         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59291         orig_conv.is_owned = false;
59292         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
59293         uint64_t ret_ref = 0;
59294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59296         return ret_ref;
59297 }
59298
59299 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
59300         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
59301         uint64_t ret_ref = 0;
59302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59304         return ret_ref;
59305 }
59306 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
59307         LDKOfferFeatures arg_conv;
59308         arg_conv.inner = untag_ptr(arg);
59309         arg_conv.is_owned = ptr_is_owned(arg);
59310         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59311         arg_conv.is_owned = false;
59312         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
59313         return ret_conv;
59314 }
59315
59316 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
59317         LDKOfferFeatures orig_conv;
59318         orig_conv.inner = untag_ptr(orig);
59319         orig_conv.is_owned = ptr_is_owned(orig);
59320         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59321         orig_conv.is_owned = false;
59322         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
59323         uint64_t ret_ref = 0;
59324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59326         return ret_ref;
59327 }
59328
59329 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
59330         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
59331         uint64_t ret_ref = 0;
59332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59334         return ret_ref;
59335 }
59336 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
59337         LDKInvoiceRequestFeatures arg_conv;
59338         arg_conv.inner = untag_ptr(arg);
59339         arg_conv.is_owned = ptr_is_owned(arg);
59340         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59341         arg_conv.is_owned = false;
59342         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
59343         return ret_conv;
59344 }
59345
59346 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
59347         LDKInvoiceRequestFeatures orig_conv;
59348         orig_conv.inner = untag_ptr(orig);
59349         orig_conv.is_owned = ptr_is_owned(orig);
59350         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59351         orig_conv.is_owned = false;
59352         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
59353         uint64_t ret_ref = 0;
59354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59356         return ret_ref;
59357 }
59358
59359 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
59360         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
59361         uint64_t ret_ref = 0;
59362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59364         return ret_ref;
59365 }
59366 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
59367         LDKBolt12InvoiceFeatures arg_conv;
59368         arg_conv.inner = untag_ptr(arg);
59369         arg_conv.is_owned = ptr_is_owned(arg);
59370         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59371         arg_conv.is_owned = false;
59372         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
59373         return ret_conv;
59374 }
59375
59376 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
59377         LDKBolt12InvoiceFeatures orig_conv;
59378         orig_conv.inner = untag_ptr(orig);
59379         orig_conv.is_owned = ptr_is_owned(orig);
59380         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59381         orig_conv.is_owned = false;
59382         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
59383         uint64_t ret_ref = 0;
59384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59386         return ret_ref;
59387 }
59388
59389 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
59390         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
59391         uint64_t ret_ref = 0;
59392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59394         return ret_ref;
59395 }
59396 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
59397         LDKBlindedHopFeatures arg_conv;
59398         arg_conv.inner = untag_ptr(arg);
59399         arg_conv.is_owned = ptr_is_owned(arg);
59400         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59401         arg_conv.is_owned = false;
59402         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
59403         return ret_conv;
59404 }
59405
59406 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
59407         LDKBlindedHopFeatures orig_conv;
59408         orig_conv.inner = untag_ptr(orig);
59409         orig_conv.is_owned = ptr_is_owned(orig);
59410         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59411         orig_conv.is_owned = false;
59412         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
59413         uint64_t ret_ref = 0;
59414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59416         return ret_ref;
59417 }
59418
59419 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
59420         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
59421         uint64_t ret_ref = 0;
59422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59424         return ret_ref;
59425 }
59426 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
59427         LDKChannelTypeFeatures arg_conv;
59428         arg_conv.inner = untag_ptr(arg);
59429         arg_conv.is_owned = ptr_is_owned(arg);
59430         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59431         arg_conv.is_owned = false;
59432         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
59433         return ret_conv;
59434 }
59435
59436 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
59437         LDKChannelTypeFeatures orig_conv;
59438         orig_conv.inner = untag_ptr(orig);
59439         orig_conv.is_owned = ptr_is_owned(orig);
59440         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59441         orig_conv.is_owned = false;
59442         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
59443         uint64_t ret_ref = 0;
59444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59446         return ret_ref;
59447 }
59448
59449 int64_t  __attribute__((export_name("TS_InitFeatures_hash"))) TS_InitFeatures_hash(uint64_t o) {
59450         LDKInitFeatures o_conv;
59451         o_conv.inner = untag_ptr(o);
59452         o_conv.is_owned = ptr_is_owned(o);
59453         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59454         o_conv.is_owned = false;
59455         int64_t ret_conv = InitFeatures_hash(&o_conv);
59456         return ret_conv;
59457 }
59458
59459 int64_t  __attribute__((export_name("TS_NodeFeatures_hash"))) TS_NodeFeatures_hash(uint64_t o) {
59460         LDKNodeFeatures o_conv;
59461         o_conv.inner = untag_ptr(o);
59462         o_conv.is_owned = ptr_is_owned(o);
59463         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59464         o_conv.is_owned = false;
59465         int64_t ret_conv = NodeFeatures_hash(&o_conv);
59466         return ret_conv;
59467 }
59468
59469 int64_t  __attribute__((export_name("TS_ChannelFeatures_hash"))) TS_ChannelFeatures_hash(uint64_t o) {
59470         LDKChannelFeatures o_conv;
59471         o_conv.inner = untag_ptr(o);
59472         o_conv.is_owned = ptr_is_owned(o);
59473         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59474         o_conv.is_owned = false;
59475         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
59476         return ret_conv;
59477 }
59478
59479 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_hash"))) TS_Bolt11InvoiceFeatures_hash(uint64_t o) {
59480         LDKBolt11InvoiceFeatures o_conv;
59481         o_conv.inner = untag_ptr(o);
59482         o_conv.is_owned = ptr_is_owned(o);
59483         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59484         o_conv.is_owned = false;
59485         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
59486         return ret_conv;
59487 }
59488
59489 int64_t  __attribute__((export_name("TS_OfferFeatures_hash"))) TS_OfferFeatures_hash(uint64_t o) {
59490         LDKOfferFeatures o_conv;
59491         o_conv.inner = untag_ptr(o);
59492         o_conv.is_owned = ptr_is_owned(o);
59493         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59494         o_conv.is_owned = false;
59495         int64_t ret_conv = OfferFeatures_hash(&o_conv);
59496         return ret_conv;
59497 }
59498
59499 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_hash"))) TS_InvoiceRequestFeatures_hash(uint64_t o) {
59500         LDKInvoiceRequestFeatures o_conv;
59501         o_conv.inner = untag_ptr(o);
59502         o_conv.is_owned = ptr_is_owned(o);
59503         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59504         o_conv.is_owned = false;
59505         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
59506         return ret_conv;
59507 }
59508
59509 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_hash"))) TS_Bolt12InvoiceFeatures_hash(uint64_t o) {
59510         LDKBolt12InvoiceFeatures o_conv;
59511         o_conv.inner = untag_ptr(o);
59512         o_conv.is_owned = ptr_is_owned(o);
59513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59514         o_conv.is_owned = false;
59515         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
59516         return ret_conv;
59517 }
59518
59519 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_hash"))) TS_BlindedHopFeatures_hash(uint64_t o) {
59520         LDKBlindedHopFeatures o_conv;
59521         o_conv.inner = untag_ptr(o);
59522         o_conv.is_owned = ptr_is_owned(o);
59523         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59524         o_conv.is_owned = false;
59525         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
59526         return ret_conv;
59527 }
59528
59529 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_hash"))) TS_ChannelTypeFeatures_hash(uint64_t o) {
59530         LDKChannelTypeFeatures o_conv;
59531         o_conv.inner = untag_ptr(o);
59532         o_conv.is_owned = ptr_is_owned(o);
59533         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59534         o_conv.is_owned = false;
59535         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
59536         return ret_conv;
59537 }
59538
59539 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
59540         LDKInitFeatures this_obj_conv;
59541         this_obj_conv.inner = untag_ptr(this_obj);
59542         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59544         InitFeatures_free(this_obj_conv);
59545 }
59546
59547 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
59548         LDKNodeFeatures this_obj_conv;
59549         this_obj_conv.inner = untag_ptr(this_obj);
59550         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59552         NodeFeatures_free(this_obj_conv);
59553 }
59554
59555 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
59556         LDKChannelFeatures this_obj_conv;
59557         this_obj_conv.inner = untag_ptr(this_obj);
59558         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59560         ChannelFeatures_free(this_obj_conv);
59561 }
59562
59563 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_free"))) TS_Bolt11InvoiceFeatures_free(uint64_t this_obj) {
59564         LDKBolt11InvoiceFeatures this_obj_conv;
59565         this_obj_conv.inner = untag_ptr(this_obj);
59566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59568         Bolt11InvoiceFeatures_free(this_obj_conv);
59569 }
59570
59571 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
59572         LDKOfferFeatures this_obj_conv;
59573         this_obj_conv.inner = untag_ptr(this_obj);
59574         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59576         OfferFeatures_free(this_obj_conv);
59577 }
59578
59579 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
59580         LDKInvoiceRequestFeatures this_obj_conv;
59581         this_obj_conv.inner = untag_ptr(this_obj);
59582         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59584         InvoiceRequestFeatures_free(this_obj_conv);
59585 }
59586
59587 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
59588         LDKBolt12InvoiceFeatures this_obj_conv;
59589         this_obj_conv.inner = untag_ptr(this_obj);
59590         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59592         Bolt12InvoiceFeatures_free(this_obj_conv);
59593 }
59594
59595 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
59596         LDKBlindedHopFeatures this_obj_conv;
59597         this_obj_conv.inner = untag_ptr(this_obj);
59598         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59600         BlindedHopFeatures_free(this_obj_conv);
59601 }
59602
59603 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
59604         LDKChannelTypeFeatures this_obj_conv;
59605         this_obj_conv.inner = untag_ptr(this_obj);
59606         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59608         ChannelTypeFeatures_free(this_obj_conv);
59609 }
59610
59611 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
59612         LDKInitFeatures ret_var = InitFeatures_empty();
59613         uint64_t ret_ref = 0;
59614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59616         return ret_ref;
59617 }
59618
59619 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits_from"))) TS_InitFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
59620         LDKInitFeatures this_arg_conv;
59621         this_arg_conv.inner = untag_ptr(this_arg);
59622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59624         this_arg_conv.is_owned = false;
59625         LDKInitFeatures other_conv;
59626         other_conv.inner = untag_ptr(other);
59627         other_conv.is_owned = ptr_is_owned(other);
59628         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
59629         other_conv.is_owned = false;
59630         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
59631         return ret_conv;
59632 }
59633
59634 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
59635         LDKInitFeatures this_arg_conv;
59636         this_arg_conv.inner = untag_ptr(this_arg);
59637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59639         this_arg_conv.is_owned = false;
59640         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
59641         return ret_conv;
59642 }
59643
59644 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_feature_bit"))) TS_InitFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
59645         LDKInitFeatures this_arg_conv;
59646         this_arg_conv.inner = untag_ptr(this_arg);
59647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59649         this_arg_conv.is_owned = false;
59650         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59651         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
59652         return tag_ptr(ret_conv, true);
59653 }
59654
59655 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_feature_bit"))) TS_InitFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
59656         LDKInitFeatures this_arg_conv;
59657         this_arg_conv.inner = untag_ptr(this_arg);
59658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59660         this_arg_conv.is_owned = false;
59661         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59662         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
59663         return tag_ptr(ret_conv, true);
59664 }
59665
59666 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_custom_bit"))) TS_InitFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
59667         LDKInitFeatures this_arg_conv;
59668         this_arg_conv.inner = untag_ptr(this_arg);
59669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59671         this_arg_conv.is_owned = false;
59672         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59673         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
59674         return tag_ptr(ret_conv, true);
59675 }
59676
59677 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_custom_bit"))) TS_InitFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
59678         LDKInitFeatures this_arg_conv;
59679         this_arg_conv.inner = untag_ptr(this_arg);
59680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59682         this_arg_conv.is_owned = false;
59683         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59684         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
59685         return tag_ptr(ret_conv, true);
59686 }
59687
59688 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
59689         LDKNodeFeatures ret_var = NodeFeatures_empty();
59690         uint64_t ret_ref = 0;
59691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59693         return ret_ref;
59694 }
59695
59696 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits_from"))) TS_NodeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
59697         LDKNodeFeatures this_arg_conv;
59698         this_arg_conv.inner = untag_ptr(this_arg);
59699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59701         this_arg_conv.is_owned = false;
59702         LDKNodeFeatures other_conv;
59703         other_conv.inner = untag_ptr(other);
59704         other_conv.is_owned = ptr_is_owned(other);
59705         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
59706         other_conv.is_owned = false;
59707         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
59708         return ret_conv;
59709 }
59710
59711 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
59712         LDKNodeFeatures this_arg_conv;
59713         this_arg_conv.inner = untag_ptr(this_arg);
59714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59716         this_arg_conv.is_owned = false;
59717         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
59718         return ret_conv;
59719 }
59720
59721 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_feature_bit"))) TS_NodeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
59722         LDKNodeFeatures this_arg_conv;
59723         this_arg_conv.inner = untag_ptr(this_arg);
59724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59726         this_arg_conv.is_owned = false;
59727         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59728         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
59729         return tag_ptr(ret_conv, true);
59730 }
59731
59732 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_feature_bit"))) TS_NodeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
59733         LDKNodeFeatures this_arg_conv;
59734         this_arg_conv.inner = untag_ptr(this_arg);
59735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59737         this_arg_conv.is_owned = false;
59738         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59739         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
59740         return tag_ptr(ret_conv, true);
59741 }
59742
59743 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_custom_bit"))) TS_NodeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
59744         LDKNodeFeatures this_arg_conv;
59745         this_arg_conv.inner = untag_ptr(this_arg);
59746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59748         this_arg_conv.is_owned = false;
59749         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59750         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
59751         return tag_ptr(ret_conv, true);
59752 }
59753
59754 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_custom_bit"))) TS_NodeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
59755         LDKNodeFeatures this_arg_conv;
59756         this_arg_conv.inner = untag_ptr(this_arg);
59757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59759         this_arg_conv.is_owned = false;
59760         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59761         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
59762         return tag_ptr(ret_conv, true);
59763 }
59764
59765 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
59766         LDKChannelFeatures ret_var = ChannelFeatures_empty();
59767         uint64_t ret_ref = 0;
59768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59770         return ret_ref;
59771 }
59772
59773 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits_from"))) TS_ChannelFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
59774         LDKChannelFeatures this_arg_conv;
59775         this_arg_conv.inner = untag_ptr(this_arg);
59776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59778         this_arg_conv.is_owned = false;
59779         LDKChannelFeatures other_conv;
59780         other_conv.inner = untag_ptr(other);
59781         other_conv.is_owned = ptr_is_owned(other);
59782         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
59783         other_conv.is_owned = false;
59784         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
59785         return ret_conv;
59786 }
59787
59788 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
59789         LDKChannelFeatures this_arg_conv;
59790         this_arg_conv.inner = untag_ptr(this_arg);
59791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59793         this_arg_conv.is_owned = false;
59794         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
59795         return ret_conv;
59796 }
59797
59798 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_feature_bit"))) TS_ChannelFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
59799         LDKChannelFeatures this_arg_conv;
59800         this_arg_conv.inner = untag_ptr(this_arg);
59801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59803         this_arg_conv.is_owned = false;
59804         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59805         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
59806         return tag_ptr(ret_conv, true);
59807 }
59808
59809 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_feature_bit"))) TS_ChannelFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
59810         LDKChannelFeatures this_arg_conv;
59811         this_arg_conv.inner = untag_ptr(this_arg);
59812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59814         this_arg_conv.is_owned = false;
59815         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59816         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
59817         return tag_ptr(ret_conv, true);
59818 }
59819
59820 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_custom_bit"))) TS_ChannelFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
59821         LDKChannelFeatures this_arg_conv;
59822         this_arg_conv.inner = untag_ptr(this_arg);
59823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59825         this_arg_conv.is_owned = false;
59826         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59827         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
59828         return tag_ptr(ret_conv, true);
59829 }
59830
59831 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_custom_bit"))) TS_ChannelFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
59832         LDKChannelFeatures this_arg_conv;
59833         this_arg_conv.inner = untag_ptr(this_arg);
59834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59836         this_arg_conv.is_owned = false;
59837         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59838         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
59839         return tag_ptr(ret_conv, true);
59840 }
59841
59842 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_empty"))) TS_Bolt11InvoiceFeatures_empty() {
59843         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
59844         uint64_t ret_ref = 0;
59845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59847         return ret_ref;
59848 }
59849
59850 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
59851         LDKBolt11InvoiceFeatures this_arg_conv;
59852         this_arg_conv.inner = untag_ptr(this_arg);
59853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59855         this_arg_conv.is_owned = false;
59856         LDKBolt11InvoiceFeatures other_conv;
59857         other_conv.inner = untag_ptr(other);
59858         other_conv.is_owned = ptr_is_owned(other);
59859         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
59860         other_conv.is_owned = false;
59861         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
59862         return ret_conv;
59863 }
59864
59865 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
59866         LDKBolt11InvoiceFeatures this_arg_conv;
59867         this_arg_conv.inner = untag_ptr(this_arg);
59868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59870         this_arg_conv.is_owned = false;
59871         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
59872         return ret_conv;
59873 }
59874
59875 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_feature_bit"))) TS_Bolt11InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
59876         LDKBolt11InvoiceFeatures this_arg_conv;
59877         this_arg_conv.inner = untag_ptr(this_arg);
59878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59880         this_arg_conv.is_owned = false;
59881         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59882         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
59883         return tag_ptr(ret_conv, true);
59884 }
59885
59886 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt11InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
59887         LDKBolt11InvoiceFeatures this_arg_conv;
59888         this_arg_conv.inner = untag_ptr(this_arg);
59889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59891         this_arg_conv.is_owned = false;
59892         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59893         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
59894         return tag_ptr(ret_conv, true);
59895 }
59896
59897 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_custom_bit"))) TS_Bolt11InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
59898         LDKBolt11InvoiceFeatures this_arg_conv;
59899         this_arg_conv.inner = untag_ptr(this_arg);
59900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59902         this_arg_conv.is_owned = false;
59903         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59904         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
59905         return tag_ptr(ret_conv, true);
59906 }
59907
59908 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt11InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
59909         LDKBolt11InvoiceFeatures this_arg_conv;
59910         this_arg_conv.inner = untag_ptr(this_arg);
59911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59913         this_arg_conv.is_owned = false;
59914         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59915         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
59916         return tag_ptr(ret_conv, true);
59917 }
59918
59919 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
59920         LDKOfferFeatures ret_var = OfferFeatures_empty();
59921         uint64_t ret_ref = 0;
59922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59924         return ret_ref;
59925 }
59926
59927 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits_from"))) TS_OfferFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
59928         LDKOfferFeatures this_arg_conv;
59929         this_arg_conv.inner = untag_ptr(this_arg);
59930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59932         this_arg_conv.is_owned = false;
59933         LDKOfferFeatures other_conv;
59934         other_conv.inner = untag_ptr(other);
59935         other_conv.is_owned = ptr_is_owned(other);
59936         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
59937         other_conv.is_owned = false;
59938         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
59939         return ret_conv;
59940 }
59941
59942 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
59943         LDKOfferFeatures this_arg_conv;
59944         this_arg_conv.inner = untag_ptr(this_arg);
59945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59947         this_arg_conv.is_owned = false;
59948         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
59949         return ret_conv;
59950 }
59951
59952 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_feature_bit"))) TS_OfferFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
59953         LDKOfferFeatures this_arg_conv;
59954         this_arg_conv.inner = untag_ptr(this_arg);
59955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59957         this_arg_conv.is_owned = false;
59958         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59959         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
59960         return tag_ptr(ret_conv, true);
59961 }
59962
59963 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_feature_bit"))) TS_OfferFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
59964         LDKOfferFeatures this_arg_conv;
59965         this_arg_conv.inner = untag_ptr(this_arg);
59966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59968         this_arg_conv.is_owned = false;
59969         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59970         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
59971         return tag_ptr(ret_conv, true);
59972 }
59973
59974 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_custom_bit"))) TS_OfferFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
59975         LDKOfferFeatures this_arg_conv;
59976         this_arg_conv.inner = untag_ptr(this_arg);
59977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59979         this_arg_conv.is_owned = false;
59980         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59981         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
59982         return tag_ptr(ret_conv, true);
59983 }
59984
59985 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_custom_bit"))) TS_OfferFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
59986         LDKOfferFeatures this_arg_conv;
59987         this_arg_conv.inner = untag_ptr(this_arg);
59988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59990         this_arg_conv.is_owned = false;
59991         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59992         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
59993         return tag_ptr(ret_conv, true);
59994 }
59995
59996 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
59997         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
59998         uint64_t ret_ref = 0;
59999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60001         return ret_ref;
60002 }
60003
60004 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits_from"))) TS_InvoiceRequestFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
60005         LDKInvoiceRequestFeatures this_arg_conv;
60006         this_arg_conv.inner = untag_ptr(this_arg);
60007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60009         this_arg_conv.is_owned = false;
60010         LDKInvoiceRequestFeatures other_conv;
60011         other_conv.inner = untag_ptr(other);
60012         other_conv.is_owned = ptr_is_owned(other);
60013         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60014         other_conv.is_owned = false;
60015         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60016         return ret_conv;
60017 }
60018
60019 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
60020         LDKInvoiceRequestFeatures this_arg_conv;
60021         this_arg_conv.inner = untag_ptr(this_arg);
60022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60024         this_arg_conv.is_owned = false;
60025         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
60026         return ret_conv;
60027 }
60028
60029 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_feature_bit"))) TS_InvoiceRequestFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
60030         LDKInvoiceRequestFeatures this_arg_conv;
60031         this_arg_conv.inner = untag_ptr(this_arg);
60032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60034         this_arg_conv.is_owned = false;
60035         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60036         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
60037         return tag_ptr(ret_conv, true);
60038 }
60039
60040 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_feature_bit"))) TS_InvoiceRequestFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
60041         LDKInvoiceRequestFeatures this_arg_conv;
60042         this_arg_conv.inner = untag_ptr(this_arg);
60043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60045         this_arg_conv.is_owned = false;
60046         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60047         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60048         return tag_ptr(ret_conv, true);
60049 }
60050
60051 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_custom_bit"))) TS_InvoiceRequestFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
60052         LDKInvoiceRequestFeatures this_arg_conv;
60053         this_arg_conv.inner = untag_ptr(this_arg);
60054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60056         this_arg_conv.is_owned = false;
60057         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60058         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
60059         return tag_ptr(ret_conv, true);
60060 }
60061
60062 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_custom_bit"))) TS_InvoiceRequestFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
60063         LDKInvoiceRequestFeatures this_arg_conv;
60064         this_arg_conv.inner = untag_ptr(this_arg);
60065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60067         this_arg_conv.is_owned = false;
60068         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60069         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60070         return tag_ptr(ret_conv, true);
60071 }
60072
60073 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
60074         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
60075         uint64_t ret_ref = 0;
60076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60078         return ret_ref;
60079 }
60080
60081 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
60082         LDKBolt12InvoiceFeatures this_arg_conv;
60083         this_arg_conv.inner = untag_ptr(this_arg);
60084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60086         this_arg_conv.is_owned = false;
60087         LDKBolt12InvoiceFeatures other_conv;
60088         other_conv.inner = untag_ptr(other);
60089         other_conv.is_owned = ptr_is_owned(other);
60090         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60091         other_conv.is_owned = false;
60092         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60093         return ret_conv;
60094 }
60095
60096 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
60097         LDKBolt12InvoiceFeatures this_arg_conv;
60098         this_arg_conv.inner = untag_ptr(this_arg);
60099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60101         this_arg_conv.is_owned = false;
60102         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
60103         return ret_conv;
60104 }
60105
60106 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_feature_bit"))) TS_Bolt12InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
60107         LDKBolt12InvoiceFeatures this_arg_conv;
60108         this_arg_conv.inner = untag_ptr(this_arg);
60109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60111         this_arg_conv.is_owned = false;
60112         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60113         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
60114         return tag_ptr(ret_conv, true);
60115 }
60116
60117 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt12InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
60118         LDKBolt12InvoiceFeatures this_arg_conv;
60119         this_arg_conv.inner = untag_ptr(this_arg);
60120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60122         this_arg_conv.is_owned = false;
60123         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60124         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60125         return tag_ptr(ret_conv, true);
60126 }
60127
60128 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_custom_bit"))) TS_Bolt12InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
60129         LDKBolt12InvoiceFeatures this_arg_conv;
60130         this_arg_conv.inner = untag_ptr(this_arg);
60131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60133         this_arg_conv.is_owned = false;
60134         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60135         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
60136         return tag_ptr(ret_conv, true);
60137 }
60138
60139 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt12InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
60140         LDKBolt12InvoiceFeatures this_arg_conv;
60141         this_arg_conv.inner = untag_ptr(this_arg);
60142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60144         this_arg_conv.is_owned = false;
60145         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60146         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60147         return tag_ptr(ret_conv, true);
60148 }
60149
60150 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
60151         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
60152         uint64_t ret_ref = 0;
60153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60155         return ret_ref;
60156 }
60157
60158 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits_from"))) TS_BlindedHopFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
60159         LDKBlindedHopFeatures this_arg_conv;
60160         this_arg_conv.inner = untag_ptr(this_arg);
60161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60163         this_arg_conv.is_owned = false;
60164         LDKBlindedHopFeatures other_conv;
60165         other_conv.inner = untag_ptr(other);
60166         other_conv.is_owned = ptr_is_owned(other);
60167         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60168         other_conv.is_owned = false;
60169         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60170         return ret_conv;
60171 }
60172
60173 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
60174         LDKBlindedHopFeatures this_arg_conv;
60175         this_arg_conv.inner = untag_ptr(this_arg);
60176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60178         this_arg_conv.is_owned = false;
60179         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
60180         return ret_conv;
60181 }
60182
60183 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_feature_bit"))) TS_BlindedHopFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
60184         LDKBlindedHopFeatures this_arg_conv;
60185         this_arg_conv.inner = untag_ptr(this_arg);
60186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60188         this_arg_conv.is_owned = false;
60189         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60190         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
60191         return tag_ptr(ret_conv, true);
60192 }
60193
60194 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_feature_bit"))) TS_BlindedHopFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
60195         LDKBlindedHopFeatures this_arg_conv;
60196         this_arg_conv.inner = untag_ptr(this_arg);
60197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60199         this_arg_conv.is_owned = false;
60200         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60201         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60202         return tag_ptr(ret_conv, true);
60203 }
60204
60205 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_custom_bit"))) TS_BlindedHopFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
60206         LDKBlindedHopFeatures this_arg_conv;
60207         this_arg_conv.inner = untag_ptr(this_arg);
60208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60210         this_arg_conv.is_owned = false;
60211         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60212         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
60213         return tag_ptr(ret_conv, true);
60214 }
60215
60216 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_custom_bit"))) TS_BlindedHopFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
60217         LDKBlindedHopFeatures this_arg_conv;
60218         this_arg_conv.inner = untag_ptr(this_arg);
60219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60221         this_arg_conv.is_owned = false;
60222         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60223         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60224         return tag_ptr(ret_conv, true);
60225 }
60226
60227 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
60228         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
60229         uint64_t ret_ref = 0;
60230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60232         return ret_ref;
60233 }
60234
60235 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits_from"))) TS_ChannelTypeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
60236         LDKChannelTypeFeatures this_arg_conv;
60237         this_arg_conv.inner = untag_ptr(this_arg);
60238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60240         this_arg_conv.is_owned = false;
60241         LDKChannelTypeFeatures other_conv;
60242         other_conv.inner = untag_ptr(other);
60243         other_conv.is_owned = ptr_is_owned(other);
60244         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60245         other_conv.is_owned = false;
60246         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60247         return ret_conv;
60248 }
60249
60250 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
60251         LDKChannelTypeFeatures this_arg_conv;
60252         this_arg_conv.inner = untag_ptr(this_arg);
60253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60255         this_arg_conv.is_owned = false;
60256         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
60257         return ret_conv;
60258 }
60259
60260 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_feature_bit"))) TS_ChannelTypeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
60261         LDKChannelTypeFeatures this_arg_conv;
60262         this_arg_conv.inner = untag_ptr(this_arg);
60263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60265         this_arg_conv.is_owned = false;
60266         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60267         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
60268         return tag_ptr(ret_conv, true);
60269 }
60270
60271 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_feature_bit"))) TS_ChannelTypeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
60272         LDKChannelTypeFeatures this_arg_conv;
60273         this_arg_conv.inner = untag_ptr(this_arg);
60274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60276         this_arg_conv.is_owned = false;
60277         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60278         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60279         return tag_ptr(ret_conv, true);
60280 }
60281
60282 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_custom_bit"))) TS_ChannelTypeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
60283         LDKChannelTypeFeatures this_arg_conv;
60284         this_arg_conv.inner = untag_ptr(this_arg);
60285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60287         this_arg_conv.is_owned = false;
60288         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60289         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
60290         return tag_ptr(ret_conv, true);
60291 }
60292
60293 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_custom_bit"))) TS_ChannelTypeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
60294         LDKChannelTypeFeatures this_arg_conv;
60295         this_arg_conv.inner = untag_ptr(this_arg);
60296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60298         this_arg_conv.is_owned = false;
60299         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60300         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60301         return tag_ptr(ret_conv, true);
60302 }
60303
60304 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
60305         LDKInitFeatures obj_conv;
60306         obj_conv.inner = untag_ptr(obj);
60307         obj_conv.is_owned = ptr_is_owned(obj);
60308         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60309         obj_conv.is_owned = false;
60310         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
60311         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60312         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60313         CVec_u8Z_free(ret_var);
60314         return ret_arr;
60315 }
60316
60317 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
60318         LDKu8slice ser_ref;
60319         ser_ref.datalen = ser->arr_len;
60320         ser_ref.data = ser->elems;
60321         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
60322         *ret_conv = InitFeatures_read(ser_ref);
60323         FREE(ser);
60324         return tag_ptr(ret_conv, true);
60325 }
60326
60327 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
60328         LDKChannelFeatures obj_conv;
60329         obj_conv.inner = untag_ptr(obj);
60330         obj_conv.is_owned = ptr_is_owned(obj);
60331         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60332         obj_conv.is_owned = false;
60333         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
60334         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60335         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60336         CVec_u8Z_free(ret_var);
60337         return ret_arr;
60338 }
60339
60340 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
60341         LDKu8slice ser_ref;
60342         ser_ref.datalen = ser->arr_len;
60343         ser_ref.data = ser->elems;
60344         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
60345         *ret_conv = ChannelFeatures_read(ser_ref);
60346         FREE(ser);
60347         return tag_ptr(ret_conv, true);
60348 }
60349
60350 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
60351         LDKNodeFeatures obj_conv;
60352         obj_conv.inner = untag_ptr(obj);
60353         obj_conv.is_owned = ptr_is_owned(obj);
60354         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60355         obj_conv.is_owned = false;
60356         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
60357         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60358         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60359         CVec_u8Z_free(ret_var);
60360         return ret_arr;
60361 }
60362
60363 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
60364         LDKu8slice ser_ref;
60365         ser_ref.datalen = ser->arr_len;
60366         ser_ref.data = ser->elems;
60367         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
60368         *ret_conv = NodeFeatures_read(ser_ref);
60369         FREE(ser);
60370         return tag_ptr(ret_conv, true);
60371 }
60372
60373 int8_tArray  __attribute__((export_name("TS_Bolt11InvoiceFeatures_write"))) TS_Bolt11InvoiceFeatures_write(uint64_t obj) {
60374         LDKBolt11InvoiceFeatures obj_conv;
60375         obj_conv.inner = untag_ptr(obj);
60376         obj_conv.is_owned = ptr_is_owned(obj);
60377         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60378         obj_conv.is_owned = false;
60379         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
60380         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60381         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60382         CVec_u8Z_free(ret_var);
60383         return ret_arr;
60384 }
60385
60386 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_read"))) TS_Bolt11InvoiceFeatures_read(int8_tArray ser) {
60387         LDKu8slice ser_ref;
60388         ser_ref.datalen = ser->arr_len;
60389         ser_ref.data = ser->elems;
60390         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
60391         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
60392         FREE(ser);
60393         return tag_ptr(ret_conv, true);
60394 }
60395
60396 int8_tArray  __attribute__((export_name("TS_Bolt12InvoiceFeatures_write"))) TS_Bolt12InvoiceFeatures_write(uint64_t obj) {
60397         LDKBolt12InvoiceFeatures obj_conv;
60398         obj_conv.inner = untag_ptr(obj);
60399         obj_conv.is_owned = ptr_is_owned(obj);
60400         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60401         obj_conv.is_owned = false;
60402         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
60403         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60404         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60405         CVec_u8Z_free(ret_var);
60406         return ret_arr;
60407 }
60408
60409 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_read"))) TS_Bolt12InvoiceFeatures_read(int8_tArray ser) {
60410         LDKu8slice ser_ref;
60411         ser_ref.datalen = ser->arr_len;
60412         ser_ref.data = ser->elems;
60413         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
60414         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
60415         FREE(ser);
60416         return tag_ptr(ret_conv, true);
60417 }
60418
60419 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
60420         LDKBlindedHopFeatures obj_conv;
60421         obj_conv.inner = untag_ptr(obj);
60422         obj_conv.is_owned = ptr_is_owned(obj);
60423         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60424         obj_conv.is_owned = false;
60425         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
60426         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60427         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60428         CVec_u8Z_free(ret_var);
60429         return ret_arr;
60430 }
60431
60432 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
60433         LDKu8slice ser_ref;
60434         ser_ref.datalen = ser->arr_len;
60435         ser_ref.data = ser->elems;
60436         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
60437         *ret_conv = BlindedHopFeatures_read(ser_ref);
60438         FREE(ser);
60439         return tag_ptr(ret_conv, true);
60440 }
60441
60442 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
60443         LDKChannelTypeFeatures obj_conv;
60444         obj_conv.inner = untag_ptr(obj);
60445         obj_conv.is_owned = ptr_is_owned(obj);
60446         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60447         obj_conv.is_owned = false;
60448         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
60449         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60450         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60451         CVec_u8Z_free(ret_var);
60452         return ret_arr;
60453 }
60454
60455 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
60456         LDKu8slice ser_ref;
60457         ser_ref.datalen = ser->arr_len;
60458         ser_ref.data = ser->elems;
60459         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
60460         *ret_conv = ChannelTypeFeatures_read(ser_ref);
60461         FREE(ser);
60462         return tag_ptr(ret_conv, true);
60463 }
60464
60465 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
60466         LDKInitFeatures this_arg_conv;
60467         this_arg_conv.inner = untag_ptr(this_arg);
60468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60470         this_arg_conv.is_owned = false;
60471         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
60472 }
60473
60474 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
60475         LDKInitFeatures this_arg_conv;
60476         this_arg_conv.inner = untag_ptr(this_arg);
60477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60479         this_arg_conv.is_owned = false;
60480         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
60481 }
60482
60483 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
60484         LDKInitFeatures this_arg_conv;
60485         this_arg_conv.inner = untag_ptr(this_arg);
60486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60488         this_arg_conv.is_owned = false;
60489         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
60490         return ret_conv;
60491 }
60492
60493 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
60494         LDKNodeFeatures this_arg_conv;
60495         this_arg_conv.inner = untag_ptr(this_arg);
60496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60498         this_arg_conv.is_owned = false;
60499         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
60500 }
60501
60502 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
60503         LDKNodeFeatures this_arg_conv;
60504         this_arg_conv.inner = untag_ptr(this_arg);
60505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60507         this_arg_conv.is_owned = false;
60508         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
60509 }
60510
60511 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
60512         LDKNodeFeatures this_arg_conv;
60513         this_arg_conv.inner = untag_ptr(this_arg);
60514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60516         this_arg_conv.is_owned = false;
60517         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
60518         return ret_conv;
60519 }
60520
60521 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
60522         LDKInitFeatures this_arg_conv;
60523         this_arg_conv.inner = untag_ptr(this_arg);
60524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60526         this_arg_conv.is_owned = false;
60527         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
60528         return ret_conv;
60529 }
60530
60531 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
60532         LDKNodeFeatures this_arg_conv;
60533         this_arg_conv.inner = untag_ptr(this_arg);
60534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60536         this_arg_conv.is_owned = false;
60537         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
60538         return ret_conv;
60539 }
60540
60541 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
60542         LDKInitFeatures this_arg_conv;
60543         this_arg_conv.inner = untag_ptr(this_arg);
60544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60546         this_arg_conv.is_owned = false;
60547         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
60548 }
60549
60550 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
60551         LDKInitFeatures this_arg_conv;
60552         this_arg_conv.inner = untag_ptr(this_arg);
60553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60555         this_arg_conv.is_owned = false;
60556         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
60557 }
60558
60559 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
60560         LDKInitFeatures this_arg_conv;
60561         this_arg_conv.inner = untag_ptr(this_arg);
60562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60564         this_arg_conv.is_owned = false;
60565         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
60566         return ret_conv;
60567 }
60568
60569 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
60570         LDKInitFeatures this_arg_conv;
60571         this_arg_conv.inner = untag_ptr(this_arg);
60572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60574         this_arg_conv.is_owned = false;
60575         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
60576 }
60577
60578 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
60579         LDKInitFeatures this_arg_conv;
60580         this_arg_conv.inner = untag_ptr(this_arg);
60581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60583         this_arg_conv.is_owned = false;
60584         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
60585 }
60586
60587 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
60588         LDKInitFeatures this_arg_conv;
60589         this_arg_conv.inner = untag_ptr(this_arg);
60590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60592         this_arg_conv.is_owned = false;
60593         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
60594         return ret_conv;
60595 }
60596
60597 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
60598         LDKNodeFeatures this_arg_conv;
60599         this_arg_conv.inner = untag_ptr(this_arg);
60600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60602         this_arg_conv.is_owned = false;
60603         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
60604 }
60605
60606 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
60607         LDKNodeFeatures this_arg_conv;
60608         this_arg_conv.inner = untag_ptr(this_arg);
60609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60611         this_arg_conv.is_owned = false;
60612         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
60613 }
60614
60615 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
60616         LDKNodeFeatures this_arg_conv;
60617         this_arg_conv.inner = untag_ptr(this_arg);
60618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60620         this_arg_conv.is_owned = false;
60621         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
60622         return ret_conv;
60623 }
60624
60625 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
60626         LDKInitFeatures this_arg_conv;
60627         this_arg_conv.inner = untag_ptr(this_arg);
60628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60630         this_arg_conv.is_owned = false;
60631         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
60632         return ret_conv;
60633 }
60634
60635 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
60636         LDKNodeFeatures this_arg_conv;
60637         this_arg_conv.inner = untag_ptr(this_arg);
60638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60640         this_arg_conv.is_owned = false;
60641         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
60642         return ret_conv;
60643 }
60644
60645 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
60646         LDKInitFeatures this_arg_conv;
60647         this_arg_conv.inner = untag_ptr(this_arg);
60648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60650         this_arg_conv.is_owned = false;
60651         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
60652 }
60653
60654 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
60655         LDKInitFeatures this_arg_conv;
60656         this_arg_conv.inner = untag_ptr(this_arg);
60657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60659         this_arg_conv.is_owned = false;
60660         InitFeatures_set_gossip_queries_required(&this_arg_conv);
60661 }
60662
60663 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
60664         LDKInitFeatures this_arg_conv;
60665         this_arg_conv.inner = untag_ptr(this_arg);
60666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60668         this_arg_conv.is_owned = false;
60669         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
60670         return ret_conv;
60671 }
60672
60673 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
60674         LDKNodeFeatures this_arg_conv;
60675         this_arg_conv.inner = untag_ptr(this_arg);
60676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60678         this_arg_conv.is_owned = false;
60679         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
60680 }
60681
60682 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
60683         LDKNodeFeatures this_arg_conv;
60684         this_arg_conv.inner = untag_ptr(this_arg);
60685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60687         this_arg_conv.is_owned = false;
60688         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
60689 }
60690
60691 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
60692         LDKNodeFeatures this_arg_conv;
60693         this_arg_conv.inner = untag_ptr(this_arg);
60694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60696         this_arg_conv.is_owned = false;
60697         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
60698         return ret_conv;
60699 }
60700
60701 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
60702         LDKInitFeatures this_arg_conv;
60703         this_arg_conv.inner = untag_ptr(this_arg);
60704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60706         this_arg_conv.is_owned = false;
60707         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
60708         return ret_conv;
60709 }
60710
60711 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
60712         LDKNodeFeatures this_arg_conv;
60713         this_arg_conv.inner = untag_ptr(this_arg);
60714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60716         this_arg_conv.is_owned = false;
60717         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
60718         return ret_conv;
60719 }
60720
60721 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
60722         LDKInitFeatures this_arg_conv;
60723         this_arg_conv.inner = untag_ptr(this_arg);
60724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60726         this_arg_conv.is_owned = false;
60727         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
60728 }
60729
60730 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
60731         LDKInitFeatures this_arg_conv;
60732         this_arg_conv.inner = untag_ptr(this_arg);
60733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60735         this_arg_conv.is_owned = false;
60736         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
60737 }
60738
60739 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
60740         LDKInitFeatures this_arg_conv;
60741         this_arg_conv.inner = untag_ptr(this_arg);
60742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60744         this_arg_conv.is_owned = false;
60745         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
60746         return ret_conv;
60747 }
60748
60749 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
60750         LDKNodeFeatures this_arg_conv;
60751         this_arg_conv.inner = untag_ptr(this_arg);
60752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60754         this_arg_conv.is_owned = false;
60755         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
60756 }
60757
60758 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
60759         LDKNodeFeatures this_arg_conv;
60760         this_arg_conv.inner = untag_ptr(this_arg);
60761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60763         this_arg_conv.is_owned = false;
60764         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
60765 }
60766
60767 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
60768         LDKNodeFeatures this_arg_conv;
60769         this_arg_conv.inner = untag_ptr(this_arg);
60770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60772         this_arg_conv.is_owned = false;
60773         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
60774         return ret_conv;
60775 }
60776
60777 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
60778         LDKBolt11InvoiceFeatures this_arg_conv;
60779         this_arg_conv.inner = untag_ptr(this_arg);
60780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60782         this_arg_conv.is_owned = false;
60783         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
60784 }
60785
60786 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_required"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
60787         LDKBolt11InvoiceFeatures this_arg_conv;
60788         this_arg_conv.inner = untag_ptr(this_arg);
60789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60791         this_arg_conv.is_owned = false;
60792         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
60793 }
60794
60795 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_variable_length_onion"))) TS_Bolt11InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
60796         LDKBolt11InvoiceFeatures this_arg_conv;
60797         this_arg_conv.inner = untag_ptr(this_arg);
60798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60800         this_arg_conv.is_owned = false;
60801         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
60802         return ret_conv;
60803 }
60804
60805 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
60806         LDKInitFeatures this_arg_conv;
60807         this_arg_conv.inner = untag_ptr(this_arg);
60808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60810         this_arg_conv.is_owned = false;
60811         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
60812         return ret_conv;
60813 }
60814
60815 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
60816         LDKNodeFeatures this_arg_conv;
60817         this_arg_conv.inner = untag_ptr(this_arg);
60818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60820         this_arg_conv.is_owned = false;
60821         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
60822         return ret_conv;
60823 }
60824
60825 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_variable_length_onion"))) TS_Bolt11InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
60826         LDKBolt11InvoiceFeatures this_arg_conv;
60827         this_arg_conv.inner = untag_ptr(this_arg);
60828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60830         this_arg_conv.is_owned = false;
60831         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
60832         return ret_conv;
60833 }
60834
60835 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
60836         LDKInitFeatures this_arg_conv;
60837         this_arg_conv.inner = untag_ptr(this_arg);
60838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60840         this_arg_conv.is_owned = false;
60841         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
60842 }
60843
60844 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
60845         LDKInitFeatures this_arg_conv;
60846         this_arg_conv.inner = untag_ptr(this_arg);
60847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60849         this_arg_conv.is_owned = false;
60850         InitFeatures_set_static_remote_key_required(&this_arg_conv);
60851 }
60852
60853 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
60854         LDKInitFeatures this_arg_conv;
60855         this_arg_conv.inner = untag_ptr(this_arg);
60856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60858         this_arg_conv.is_owned = false;
60859         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
60860         return ret_conv;
60861 }
60862
60863 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
60864         LDKNodeFeatures this_arg_conv;
60865         this_arg_conv.inner = untag_ptr(this_arg);
60866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60868         this_arg_conv.is_owned = false;
60869         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
60870 }
60871
60872 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
60873         LDKNodeFeatures this_arg_conv;
60874         this_arg_conv.inner = untag_ptr(this_arg);
60875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60877         this_arg_conv.is_owned = false;
60878         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
60879 }
60880
60881 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
60882         LDKNodeFeatures this_arg_conv;
60883         this_arg_conv.inner = untag_ptr(this_arg);
60884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60886         this_arg_conv.is_owned = false;
60887         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
60888         return ret_conv;
60889 }
60890
60891 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
60892         LDKChannelTypeFeatures this_arg_conv;
60893         this_arg_conv.inner = untag_ptr(this_arg);
60894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60896         this_arg_conv.is_owned = false;
60897         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
60898 }
60899
60900 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
60901         LDKChannelTypeFeatures this_arg_conv;
60902         this_arg_conv.inner = untag_ptr(this_arg);
60903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60905         this_arg_conv.is_owned = false;
60906         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
60907 }
60908
60909 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
60910         LDKChannelTypeFeatures this_arg_conv;
60911         this_arg_conv.inner = untag_ptr(this_arg);
60912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60914         this_arg_conv.is_owned = false;
60915         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
60916         return ret_conv;
60917 }
60918
60919 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
60920         LDKInitFeatures this_arg_conv;
60921         this_arg_conv.inner = untag_ptr(this_arg);
60922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60924         this_arg_conv.is_owned = false;
60925         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
60926         return ret_conv;
60927 }
60928
60929 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
60930         LDKNodeFeatures this_arg_conv;
60931         this_arg_conv.inner = untag_ptr(this_arg);
60932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60934         this_arg_conv.is_owned = false;
60935         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
60936         return ret_conv;
60937 }
60938
60939 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
60940         LDKChannelTypeFeatures this_arg_conv;
60941         this_arg_conv.inner = untag_ptr(this_arg);
60942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60944         this_arg_conv.is_owned = false;
60945         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
60946         return ret_conv;
60947 }
60948
60949 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
60950         LDKInitFeatures this_arg_conv;
60951         this_arg_conv.inner = untag_ptr(this_arg);
60952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60954         this_arg_conv.is_owned = false;
60955         InitFeatures_set_payment_secret_optional(&this_arg_conv);
60956 }
60957
60958 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
60959         LDKInitFeatures this_arg_conv;
60960         this_arg_conv.inner = untag_ptr(this_arg);
60961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60963         this_arg_conv.is_owned = false;
60964         InitFeatures_set_payment_secret_required(&this_arg_conv);
60965 }
60966
60967 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
60968         LDKInitFeatures this_arg_conv;
60969         this_arg_conv.inner = untag_ptr(this_arg);
60970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60972         this_arg_conv.is_owned = false;
60973         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
60974         return ret_conv;
60975 }
60976
60977 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
60978         LDKNodeFeatures this_arg_conv;
60979         this_arg_conv.inner = untag_ptr(this_arg);
60980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60982         this_arg_conv.is_owned = false;
60983         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
60984 }
60985
60986 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
60987         LDKNodeFeatures this_arg_conv;
60988         this_arg_conv.inner = untag_ptr(this_arg);
60989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60991         this_arg_conv.is_owned = false;
60992         NodeFeatures_set_payment_secret_required(&this_arg_conv);
60993 }
60994
60995 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
60996         LDKNodeFeatures this_arg_conv;
60997         this_arg_conv.inner = untag_ptr(this_arg);
60998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61000         this_arg_conv.is_owned = false;
61001         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
61002         return ret_conv;
61003 }
61004
61005 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_optional"))) TS_Bolt11InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
61006         LDKBolt11InvoiceFeatures this_arg_conv;
61007         this_arg_conv.inner = untag_ptr(this_arg);
61008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61010         this_arg_conv.is_owned = false;
61011         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
61012 }
61013
61014 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_required"))) TS_Bolt11InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
61015         LDKBolt11InvoiceFeatures this_arg_conv;
61016         this_arg_conv.inner = untag_ptr(this_arg);
61017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61019         this_arg_conv.is_owned = false;
61020         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
61021 }
61022
61023 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_secret"))) TS_Bolt11InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
61024         LDKBolt11InvoiceFeatures this_arg_conv;
61025         this_arg_conv.inner = untag_ptr(this_arg);
61026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61028         this_arg_conv.is_owned = false;
61029         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
61030         return ret_conv;
61031 }
61032
61033 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
61034         LDKInitFeatures this_arg_conv;
61035         this_arg_conv.inner = untag_ptr(this_arg);
61036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61038         this_arg_conv.is_owned = false;
61039         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
61040         return ret_conv;
61041 }
61042
61043 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
61044         LDKNodeFeatures this_arg_conv;
61045         this_arg_conv.inner = untag_ptr(this_arg);
61046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61048         this_arg_conv.is_owned = false;
61049         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
61050         return ret_conv;
61051 }
61052
61053 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_secret"))) TS_Bolt11InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
61054         LDKBolt11InvoiceFeatures this_arg_conv;
61055         this_arg_conv.inner = untag_ptr(this_arg);
61056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61058         this_arg_conv.is_owned = false;
61059         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
61060         return ret_conv;
61061 }
61062
61063 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
61064         LDKInitFeatures this_arg_conv;
61065         this_arg_conv.inner = untag_ptr(this_arg);
61066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61068         this_arg_conv.is_owned = false;
61069         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
61070 }
61071
61072 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
61073         LDKInitFeatures this_arg_conv;
61074         this_arg_conv.inner = untag_ptr(this_arg);
61075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61077         this_arg_conv.is_owned = false;
61078         InitFeatures_set_basic_mpp_required(&this_arg_conv);
61079 }
61080
61081 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
61082         LDKInitFeatures this_arg_conv;
61083         this_arg_conv.inner = untag_ptr(this_arg);
61084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61086         this_arg_conv.is_owned = false;
61087         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
61088         return ret_conv;
61089 }
61090
61091 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
61092         LDKNodeFeatures this_arg_conv;
61093         this_arg_conv.inner = untag_ptr(this_arg);
61094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61096         this_arg_conv.is_owned = false;
61097         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
61098 }
61099
61100 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
61101         LDKNodeFeatures this_arg_conv;
61102         this_arg_conv.inner = untag_ptr(this_arg);
61103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61105         this_arg_conv.is_owned = false;
61106         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
61107 }
61108
61109 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
61110         LDKNodeFeatures this_arg_conv;
61111         this_arg_conv.inner = untag_ptr(this_arg);
61112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61114         this_arg_conv.is_owned = false;
61115         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
61116         return ret_conv;
61117 }
61118
61119 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
61120         LDKBolt11InvoiceFeatures this_arg_conv;
61121         this_arg_conv.inner = untag_ptr(this_arg);
61122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61124         this_arg_conv.is_owned = false;
61125         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
61126 }
61127
61128 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
61129         LDKBolt11InvoiceFeatures this_arg_conv;
61130         this_arg_conv.inner = untag_ptr(this_arg);
61131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61133         this_arg_conv.is_owned = false;
61134         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
61135 }
61136
61137 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_basic_mpp"))) TS_Bolt11InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
61138         LDKBolt11InvoiceFeatures this_arg_conv;
61139         this_arg_conv.inner = untag_ptr(this_arg);
61140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61142         this_arg_conv.is_owned = false;
61143         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
61144         return ret_conv;
61145 }
61146
61147 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
61148         LDKBolt12InvoiceFeatures this_arg_conv;
61149         this_arg_conv.inner = untag_ptr(this_arg);
61150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61152         this_arg_conv.is_owned = false;
61153         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
61154 }
61155
61156 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
61157         LDKBolt12InvoiceFeatures this_arg_conv;
61158         this_arg_conv.inner = untag_ptr(this_arg);
61159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61161         this_arg_conv.is_owned = false;
61162         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
61163 }
61164
61165 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
61166         LDKBolt12InvoiceFeatures this_arg_conv;
61167         this_arg_conv.inner = untag_ptr(this_arg);
61168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61170         this_arg_conv.is_owned = false;
61171         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
61172         return ret_conv;
61173 }
61174
61175 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
61176         LDKInitFeatures this_arg_conv;
61177         this_arg_conv.inner = untag_ptr(this_arg);
61178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61180         this_arg_conv.is_owned = false;
61181         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
61182         return ret_conv;
61183 }
61184
61185 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
61186         LDKNodeFeatures this_arg_conv;
61187         this_arg_conv.inner = untag_ptr(this_arg);
61188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61190         this_arg_conv.is_owned = false;
61191         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
61192         return ret_conv;
61193 }
61194
61195 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_basic_mpp"))) TS_Bolt11InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
61196         LDKBolt11InvoiceFeatures this_arg_conv;
61197         this_arg_conv.inner = untag_ptr(this_arg);
61198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61200         this_arg_conv.is_owned = false;
61201         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
61202         return ret_conv;
61203 }
61204
61205 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
61206         LDKBolt12InvoiceFeatures this_arg_conv;
61207         this_arg_conv.inner = untag_ptr(this_arg);
61208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61210         this_arg_conv.is_owned = false;
61211         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
61212         return ret_conv;
61213 }
61214
61215 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
61216         LDKInitFeatures this_arg_conv;
61217         this_arg_conv.inner = untag_ptr(this_arg);
61218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61220         this_arg_conv.is_owned = false;
61221         InitFeatures_set_wumbo_optional(&this_arg_conv);
61222 }
61223
61224 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
61225         LDKInitFeatures this_arg_conv;
61226         this_arg_conv.inner = untag_ptr(this_arg);
61227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61229         this_arg_conv.is_owned = false;
61230         InitFeatures_set_wumbo_required(&this_arg_conv);
61231 }
61232
61233 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
61234         LDKInitFeatures this_arg_conv;
61235         this_arg_conv.inner = untag_ptr(this_arg);
61236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61238         this_arg_conv.is_owned = false;
61239         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
61240         return ret_conv;
61241 }
61242
61243 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
61244         LDKNodeFeatures this_arg_conv;
61245         this_arg_conv.inner = untag_ptr(this_arg);
61246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61248         this_arg_conv.is_owned = false;
61249         NodeFeatures_set_wumbo_optional(&this_arg_conv);
61250 }
61251
61252 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
61253         LDKNodeFeatures this_arg_conv;
61254         this_arg_conv.inner = untag_ptr(this_arg);
61255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61257         this_arg_conv.is_owned = false;
61258         NodeFeatures_set_wumbo_required(&this_arg_conv);
61259 }
61260
61261 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
61262         LDKNodeFeatures this_arg_conv;
61263         this_arg_conv.inner = untag_ptr(this_arg);
61264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61266         this_arg_conv.is_owned = false;
61267         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
61268         return ret_conv;
61269 }
61270
61271 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
61272         LDKInitFeatures this_arg_conv;
61273         this_arg_conv.inner = untag_ptr(this_arg);
61274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61276         this_arg_conv.is_owned = false;
61277         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
61278         return ret_conv;
61279 }
61280
61281 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
61282         LDKNodeFeatures this_arg_conv;
61283         this_arg_conv.inner = untag_ptr(this_arg);
61284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61286         this_arg_conv.is_owned = false;
61287         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
61288         return ret_conv;
61289 }
61290
61291 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) {
61292         LDKInitFeatures this_arg_conv;
61293         this_arg_conv.inner = untag_ptr(this_arg);
61294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61296         this_arg_conv.is_owned = false;
61297         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
61298 }
61299
61300 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) {
61301         LDKInitFeatures this_arg_conv;
61302         this_arg_conv.inner = untag_ptr(this_arg);
61303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61305         this_arg_conv.is_owned = false;
61306         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
61307 }
61308
61309 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
61310         LDKInitFeatures this_arg_conv;
61311         this_arg_conv.inner = untag_ptr(this_arg);
61312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61314         this_arg_conv.is_owned = false;
61315         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61316         return ret_conv;
61317 }
61318
61319 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) {
61320         LDKNodeFeatures this_arg_conv;
61321         this_arg_conv.inner = untag_ptr(this_arg);
61322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61324         this_arg_conv.is_owned = false;
61325         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
61326 }
61327
61328 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) {
61329         LDKNodeFeatures this_arg_conv;
61330         this_arg_conv.inner = untag_ptr(this_arg);
61331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61333         this_arg_conv.is_owned = false;
61334         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
61335 }
61336
61337 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
61338         LDKNodeFeatures this_arg_conv;
61339         this_arg_conv.inner = untag_ptr(this_arg);
61340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61342         this_arg_conv.is_owned = false;
61343         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61344         return ret_conv;
61345 }
61346
61347 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) {
61348         LDKChannelTypeFeatures this_arg_conv;
61349         this_arg_conv.inner = untag_ptr(this_arg);
61350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61352         this_arg_conv.is_owned = false;
61353         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
61354 }
61355
61356 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) {
61357         LDKChannelTypeFeatures this_arg_conv;
61358         this_arg_conv.inner = untag_ptr(this_arg);
61359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61361         this_arg_conv.is_owned = false;
61362         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
61363 }
61364
61365 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
61366         LDKChannelTypeFeatures this_arg_conv;
61367         this_arg_conv.inner = untag_ptr(this_arg);
61368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61370         this_arg_conv.is_owned = false;
61371         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61372         return ret_conv;
61373 }
61374
61375 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
61376         LDKInitFeatures this_arg_conv;
61377         this_arg_conv.inner = untag_ptr(this_arg);
61378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61380         this_arg_conv.is_owned = false;
61381         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61382         return ret_conv;
61383 }
61384
61385 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
61386         LDKNodeFeatures this_arg_conv;
61387         this_arg_conv.inner = untag_ptr(this_arg);
61388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61390         this_arg_conv.is_owned = false;
61391         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61392         return ret_conv;
61393 }
61394
61395 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
61396         LDKChannelTypeFeatures this_arg_conv;
61397         this_arg_conv.inner = untag_ptr(this_arg);
61398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61400         this_arg_conv.is_owned = false;
61401         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61402         return ret_conv;
61403 }
61404
61405 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) {
61406         LDKInitFeatures this_arg_conv;
61407         this_arg_conv.inner = untag_ptr(this_arg);
61408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61410         this_arg_conv.is_owned = false;
61411         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
61412 }
61413
61414 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) {
61415         LDKInitFeatures this_arg_conv;
61416         this_arg_conv.inner = untag_ptr(this_arg);
61417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61419         this_arg_conv.is_owned = false;
61420         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
61421 }
61422
61423 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
61424         LDKInitFeatures this_arg_conv;
61425         this_arg_conv.inner = untag_ptr(this_arg);
61426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61428         this_arg_conv.is_owned = false;
61429         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
61430         return ret_conv;
61431 }
61432
61433 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) {
61434         LDKNodeFeatures this_arg_conv;
61435         this_arg_conv.inner = untag_ptr(this_arg);
61436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61438         this_arg_conv.is_owned = false;
61439         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
61440 }
61441
61442 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) {
61443         LDKNodeFeatures this_arg_conv;
61444         this_arg_conv.inner = untag_ptr(this_arg);
61445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61447         this_arg_conv.is_owned = false;
61448         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
61449 }
61450
61451 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
61452         LDKNodeFeatures this_arg_conv;
61453         this_arg_conv.inner = untag_ptr(this_arg);
61454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61456         this_arg_conv.is_owned = false;
61457         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
61458         return ret_conv;
61459 }
61460
61461 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) {
61462         LDKChannelTypeFeatures this_arg_conv;
61463         this_arg_conv.inner = untag_ptr(this_arg);
61464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61466         this_arg_conv.is_owned = false;
61467         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
61468 }
61469
61470 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) {
61471         LDKChannelTypeFeatures this_arg_conv;
61472         this_arg_conv.inner = untag_ptr(this_arg);
61473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61475         this_arg_conv.is_owned = false;
61476         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
61477 }
61478
61479 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
61480         LDKChannelTypeFeatures this_arg_conv;
61481         this_arg_conv.inner = untag_ptr(this_arg);
61482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61484         this_arg_conv.is_owned = false;
61485         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
61486         return ret_conv;
61487 }
61488
61489 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
61490         LDKInitFeatures this_arg_conv;
61491         this_arg_conv.inner = untag_ptr(this_arg);
61492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61494         this_arg_conv.is_owned = false;
61495         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
61496         return ret_conv;
61497 }
61498
61499 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
61500         LDKNodeFeatures this_arg_conv;
61501         this_arg_conv.inner = untag_ptr(this_arg);
61502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61504         this_arg_conv.is_owned = false;
61505         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
61506         return ret_conv;
61507 }
61508
61509 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
61510         LDKChannelTypeFeatures this_arg_conv;
61511         this_arg_conv.inner = untag_ptr(this_arg);
61512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61514         this_arg_conv.is_owned = false;
61515         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
61516         return ret_conv;
61517 }
61518
61519 void  __attribute__((export_name("TS_InitFeatures_set_route_blinding_optional"))) TS_InitFeatures_set_route_blinding_optional(uint64_t this_arg) {
61520         LDKInitFeatures this_arg_conv;
61521         this_arg_conv.inner = untag_ptr(this_arg);
61522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61524         this_arg_conv.is_owned = false;
61525         InitFeatures_set_route_blinding_optional(&this_arg_conv);
61526 }
61527
61528 void  __attribute__((export_name("TS_InitFeatures_set_route_blinding_required"))) TS_InitFeatures_set_route_blinding_required(uint64_t this_arg) {
61529         LDKInitFeatures this_arg_conv;
61530         this_arg_conv.inner = untag_ptr(this_arg);
61531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61533         this_arg_conv.is_owned = false;
61534         InitFeatures_set_route_blinding_required(&this_arg_conv);
61535 }
61536
61537 jboolean  __attribute__((export_name("TS_InitFeatures_supports_route_blinding"))) TS_InitFeatures_supports_route_blinding(uint64_t this_arg) {
61538         LDKInitFeatures this_arg_conv;
61539         this_arg_conv.inner = untag_ptr(this_arg);
61540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61542         this_arg_conv.is_owned = false;
61543         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
61544         return ret_conv;
61545 }
61546
61547 void  __attribute__((export_name("TS_NodeFeatures_set_route_blinding_optional"))) TS_NodeFeatures_set_route_blinding_optional(uint64_t this_arg) {
61548         LDKNodeFeatures this_arg_conv;
61549         this_arg_conv.inner = untag_ptr(this_arg);
61550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61552         this_arg_conv.is_owned = false;
61553         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
61554 }
61555
61556 void  __attribute__((export_name("TS_NodeFeatures_set_route_blinding_required"))) TS_NodeFeatures_set_route_blinding_required(uint64_t this_arg) {
61557         LDKNodeFeatures this_arg_conv;
61558         this_arg_conv.inner = untag_ptr(this_arg);
61559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61561         this_arg_conv.is_owned = false;
61562         NodeFeatures_set_route_blinding_required(&this_arg_conv);
61563 }
61564
61565 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_route_blinding"))) TS_NodeFeatures_supports_route_blinding(uint64_t this_arg) {
61566         LDKNodeFeatures this_arg_conv;
61567         this_arg_conv.inner = untag_ptr(this_arg);
61568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61570         this_arg_conv.is_owned = false;
61571         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
61572         return ret_conv;
61573 }
61574
61575 jboolean  __attribute__((export_name("TS_InitFeatures_requires_route_blinding"))) TS_InitFeatures_requires_route_blinding(uint64_t this_arg) {
61576         LDKInitFeatures this_arg_conv;
61577         this_arg_conv.inner = untag_ptr(this_arg);
61578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61580         this_arg_conv.is_owned = false;
61581         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
61582         return ret_conv;
61583 }
61584
61585 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_route_blinding"))) TS_NodeFeatures_requires_route_blinding(uint64_t this_arg) {
61586         LDKNodeFeatures this_arg_conv;
61587         this_arg_conv.inner = untag_ptr(this_arg);
61588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61590         this_arg_conv.is_owned = false;
61591         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
61592         return ret_conv;
61593 }
61594
61595 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
61596         LDKInitFeatures this_arg_conv;
61597         this_arg_conv.inner = untag_ptr(this_arg);
61598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61600         this_arg_conv.is_owned = false;
61601         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
61602 }
61603
61604 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
61605         LDKInitFeatures this_arg_conv;
61606         this_arg_conv.inner = untag_ptr(this_arg);
61607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61609         this_arg_conv.is_owned = false;
61610         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
61611 }
61612
61613 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
61614         LDKInitFeatures this_arg_conv;
61615         this_arg_conv.inner = untag_ptr(this_arg);
61616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61618         this_arg_conv.is_owned = false;
61619         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
61620         return ret_conv;
61621 }
61622
61623 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
61624         LDKNodeFeatures this_arg_conv;
61625         this_arg_conv.inner = untag_ptr(this_arg);
61626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61628         this_arg_conv.is_owned = false;
61629         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
61630 }
61631
61632 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
61633         LDKNodeFeatures this_arg_conv;
61634         this_arg_conv.inner = untag_ptr(this_arg);
61635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61637         this_arg_conv.is_owned = false;
61638         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
61639 }
61640
61641 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
61642         LDKNodeFeatures this_arg_conv;
61643         this_arg_conv.inner = untag_ptr(this_arg);
61644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61646         this_arg_conv.is_owned = false;
61647         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
61648         return ret_conv;
61649 }
61650
61651 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
61652         LDKInitFeatures this_arg_conv;
61653         this_arg_conv.inner = untag_ptr(this_arg);
61654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61656         this_arg_conv.is_owned = false;
61657         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
61658         return ret_conv;
61659 }
61660
61661 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
61662         LDKNodeFeatures this_arg_conv;
61663         this_arg_conv.inner = untag_ptr(this_arg);
61664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61666         this_arg_conv.is_owned = false;
61667         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
61668         return ret_conv;
61669 }
61670
61671 void  __attribute__((export_name("TS_InitFeatures_set_taproot_optional"))) TS_InitFeatures_set_taproot_optional(uint64_t this_arg) {
61672         LDKInitFeatures this_arg_conv;
61673         this_arg_conv.inner = untag_ptr(this_arg);
61674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61676         this_arg_conv.is_owned = false;
61677         InitFeatures_set_taproot_optional(&this_arg_conv);
61678 }
61679
61680 void  __attribute__((export_name("TS_InitFeatures_set_taproot_required"))) TS_InitFeatures_set_taproot_required(uint64_t this_arg) {
61681         LDKInitFeatures this_arg_conv;
61682         this_arg_conv.inner = untag_ptr(this_arg);
61683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61685         this_arg_conv.is_owned = false;
61686         InitFeatures_set_taproot_required(&this_arg_conv);
61687 }
61688
61689 jboolean  __attribute__((export_name("TS_InitFeatures_supports_taproot"))) TS_InitFeatures_supports_taproot(uint64_t this_arg) {
61690         LDKInitFeatures this_arg_conv;
61691         this_arg_conv.inner = untag_ptr(this_arg);
61692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61694         this_arg_conv.is_owned = false;
61695         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
61696         return ret_conv;
61697 }
61698
61699 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_optional"))) TS_NodeFeatures_set_taproot_optional(uint64_t this_arg) {
61700         LDKNodeFeatures this_arg_conv;
61701         this_arg_conv.inner = untag_ptr(this_arg);
61702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61704         this_arg_conv.is_owned = false;
61705         NodeFeatures_set_taproot_optional(&this_arg_conv);
61706 }
61707
61708 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_required"))) TS_NodeFeatures_set_taproot_required(uint64_t this_arg) {
61709         LDKNodeFeatures this_arg_conv;
61710         this_arg_conv.inner = untag_ptr(this_arg);
61711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61713         this_arg_conv.is_owned = false;
61714         NodeFeatures_set_taproot_required(&this_arg_conv);
61715 }
61716
61717 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_taproot"))) TS_NodeFeatures_supports_taproot(uint64_t this_arg) {
61718         LDKNodeFeatures this_arg_conv;
61719         this_arg_conv.inner = untag_ptr(this_arg);
61720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61722         this_arg_conv.is_owned = false;
61723         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
61724         return ret_conv;
61725 }
61726
61727 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_optional"))) TS_ChannelTypeFeatures_set_taproot_optional(uint64_t this_arg) {
61728         LDKChannelTypeFeatures this_arg_conv;
61729         this_arg_conv.inner = untag_ptr(this_arg);
61730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61732         this_arg_conv.is_owned = false;
61733         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
61734 }
61735
61736 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_required"))) TS_ChannelTypeFeatures_set_taproot_required(uint64_t this_arg) {
61737         LDKChannelTypeFeatures this_arg_conv;
61738         this_arg_conv.inner = untag_ptr(this_arg);
61739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61741         this_arg_conv.is_owned = false;
61742         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
61743 }
61744
61745 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_taproot"))) TS_ChannelTypeFeatures_supports_taproot(uint64_t this_arg) {
61746         LDKChannelTypeFeatures this_arg_conv;
61747         this_arg_conv.inner = untag_ptr(this_arg);
61748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61750         this_arg_conv.is_owned = false;
61751         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
61752         return ret_conv;
61753 }
61754
61755 jboolean  __attribute__((export_name("TS_InitFeatures_requires_taproot"))) TS_InitFeatures_requires_taproot(uint64_t this_arg) {
61756         LDKInitFeatures this_arg_conv;
61757         this_arg_conv.inner = untag_ptr(this_arg);
61758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61760         this_arg_conv.is_owned = false;
61761         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
61762         return ret_conv;
61763 }
61764
61765 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_taproot"))) TS_NodeFeatures_requires_taproot(uint64_t this_arg) {
61766         LDKNodeFeatures this_arg_conv;
61767         this_arg_conv.inner = untag_ptr(this_arg);
61768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61770         this_arg_conv.is_owned = false;
61771         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
61772         return ret_conv;
61773 }
61774
61775 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_taproot"))) TS_ChannelTypeFeatures_requires_taproot(uint64_t this_arg) {
61776         LDKChannelTypeFeatures this_arg_conv;
61777         this_arg_conv.inner = untag_ptr(this_arg);
61778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61780         this_arg_conv.is_owned = false;
61781         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
61782         return ret_conv;
61783 }
61784
61785 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
61786         LDKInitFeatures this_arg_conv;
61787         this_arg_conv.inner = untag_ptr(this_arg);
61788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61790         this_arg_conv.is_owned = false;
61791         InitFeatures_set_onion_messages_optional(&this_arg_conv);
61792 }
61793
61794 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
61795         LDKInitFeatures this_arg_conv;
61796         this_arg_conv.inner = untag_ptr(this_arg);
61797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61799         this_arg_conv.is_owned = false;
61800         InitFeatures_set_onion_messages_required(&this_arg_conv);
61801 }
61802
61803 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
61804         LDKInitFeatures this_arg_conv;
61805         this_arg_conv.inner = untag_ptr(this_arg);
61806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61808         this_arg_conv.is_owned = false;
61809         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
61810         return ret_conv;
61811 }
61812
61813 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
61814         LDKNodeFeatures this_arg_conv;
61815         this_arg_conv.inner = untag_ptr(this_arg);
61816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61818         this_arg_conv.is_owned = false;
61819         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
61820 }
61821
61822 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
61823         LDKNodeFeatures this_arg_conv;
61824         this_arg_conv.inner = untag_ptr(this_arg);
61825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61827         this_arg_conv.is_owned = false;
61828         NodeFeatures_set_onion_messages_required(&this_arg_conv);
61829 }
61830
61831 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
61832         LDKNodeFeatures this_arg_conv;
61833         this_arg_conv.inner = untag_ptr(this_arg);
61834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61836         this_arg_conv.is_owned = false;
61837         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
61838         return ret_conv;
61839 }
61840
61841 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
61842         LDKInitFeatures this_arg_conv;
61843         this_arg_conv.inner = untag_ptr(this_arg);
61844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61846         this_arg_conv.is_owned = false;
61847         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
61848         return ret_conv;
61849 }
61850
61851 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
61852         LDKNodeFeatures this_arg_conv;
61853         this_arg_conv.inner = untag_ptr(this_arg);
61854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61856         this_arg_conv.is_owned = false;
61857         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
61858         return ret_conv;
61859 }
61860
61861 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
61862         LDKInitFeatures this_arg_conv;
61863         this_arg_conv.inner = untag_ptr(this_arg);
61864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61866         this_arg_conv.is_owned = false;
61867         InitFeatures_set_channel_type_optional(&this_arg_conv);
61868 }
61869
61870 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
61871         LDKInitFeatures this_arg_conv;
61872         this_arg_conv.inner = untag_ptr(this_arg);
61873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61875         this_arg_conv.is_owned = false;
61876         InitFeatures_set_channel_type_required(&this_arg_conv);
61877 }
61878
61879 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
61880         LDKInitFeatures this_arg_conv;
61881         this_arg_conv.inner = untag_ptr(this_arg);
61882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61884         this_arg_conv.is_owned = false;
61885         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
61886         return ret_conv;
61887 }
61888
61889 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
61890         LDKNodeFeatures this_arg_conv;
61891         this_arg_conv.inner = untag_ptr(this_arg);
61892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61894         this_arg_conv.is_owned = false;
61895         NodeFeatures_set_channel_type_optional(&this_arg_conv);
61896 }
61897
61898 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
61899         LDKNodeFeatures this_arg_conv;
61900         this_arg_conv.inner = untag_ptr(this_arg);
61901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61903         this_arg_conv.is_owned = false;
61904         NodeFeatures_set_channel_type_required(&this_arg_conv);
61905 }
61906
61907 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
61908         LDKNodeFeatures this_arg_conv;
61909         this_arg_conv.inner = untag_ptr(this_arg);
61910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61912         this_arg_conv.is_owned = false;
61913         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
61914         return ret_conv;
61915 }
61916
61917 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
61918         LDKInitFeatures this_arg_conv;
61919         this_arg_conv.inner = untag_ptr(this_arg);
61920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61922         this_arg_conv.is_owned = false;
61923         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
61924         return ret_conv;
61925 }
61926
61927 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
61928         LDKNodeFeatures this_arg_conv;
61929         this_arg_conv.inner = untag_ptr(this_arg);
61930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61932         this_arg_conv.is_owned = false;
61933         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
61934         return ret_conv;
61935 }
61936
61937 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
61938         LDKInitFeatures this_arg_conv;
61939         this_arg_conv.inner = untag_ptr(this_arg);
61940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61942         this_arg_conv.is_owned = false;
61943         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
61944 }
61945
61946 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
61947         LDKInitFeatures this_arg_conv;
61948         this_arg_conv.inner = untag_ptr(this_arg);
61949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61951         this_arg_conv.is_owned = false;
61952         InitFeatures_set_scid_privacy_required(&this_arg_conv);
61953 }
61954
61955 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
61956         LDKInitFeatures this_arg_conv;
61957         this_arg_conv.inner = untag_ptr(this_arg);
61958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61960         this_arg_conv.is_owned = false;
61961         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
61962         return ret_conv;
61963 }
61964
61965 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
61966         LDKNodeFeatures this_arg_conv;
61967         this_arg_conv.inner = untag_ptr(this_arg);
61968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61970         this_arg_conv.is_owned = false;
61971         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
61972 }
61973
61974 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
61975         LDKNodeFeatures this_arg_conv;
61976         this_arg_conv.inner = untag_ptr(this_arg);
61977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61979         this_arg_conv.is_owned = false;
61980         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
61981 }
61982
61983 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
61984         LDKNodeFeatures this_arg_conv;
61985         this_arg_conv.inner = untag_ptr(this_arg);
61986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61988         this_arg_conv.is_owned = false;
61989         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
61990         return ret_conv;
61991 }
61992
61993 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
61994         LDKChannelTypeFeatures this_arg_conv;
61995         this_arg_conv.inner = untag_ptr(this_arg);
61996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61998         this_arg_conv.is_owned = false;
61999         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
62000 }
62001
62002 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
62003         LDKChannelTypeFeatures this_arg_conv;
62004         this_arg_conv.inner = untag_ptr(this_arg);
62005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62007         this_arg_conv.is_owned = false;
62008         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
62009 }
62010
62011 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
62012         LDKChannelTypeFeatures this_arg_conv;
62013         this_arg_conv.inner = untag_ptr(this_arg);
62014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62016         this_arg_conv.is_owned = false;
62017         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
62018         return ret_conv;
62019 }
62020
62021 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
62022         LDKInitFeatures this_arg_conv;
62023         this_arg_conv.inner = untag_ptr(this_arg);
62024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62026         this_arg_conv.is_owned = false;
62027         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
62028         return ret_conv;
62029 }
62030
62031 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
62032         LDKNodeFeatures this_arg_conv;
62033         this_arg_conv.inner = untag_ptr(this_arg);
62034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62036         this_arg_conv.is_owned = false;
62037         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
62038         return ret_conv;
62039 }
62040
62041 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
62042         LDKChannelTypeFeatures this_arg_conv;
62043         this_arg_conv.inner = untag_ptr(this_arg);
62044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62046         this_arg_conv.is_owned = false;
62047         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
62048         return ret_conv;
62049 }
62050
62051 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_optional"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
62052         LDKBolt11InvoiceFeatures this_arg_conv;
62053         this_arg_conv.inner = untag_ptr(this_arg);
62054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62056         this_arg_conv.is_owned = false;
62057         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
62058 }
62059
62060 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_required"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
62061         LDKBolt11InvoiceFeatures this_arg_conv;
62062         this_arg_conv.inner = untag_ptr(this_arg);
62063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62065         this_arg_conv.is_owned = false;
62066         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
62067 }
62068
62069 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_metadata"))) TS_Bolt11InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
62070         LDKBolt11InvoiceFeatures this_arg_conv;
62071         this_arg_conv.inner = untag_ptr(this_arg);
62072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62074         this_arg_conv.is_owned = false;
62075         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
62076         return ret_conv;
62077 }
62078
62079 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_metadata"))) TS_Bolt11InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
62080         LDKBolt11InvoiceFeatures this_arg_conv;
62081         this_arg_conv.inner = untag_ptr(this_arg);
62082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62084         this_arg_conv.is_owned = false;
62085         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
62086         return ret_conv;
62087 }
62088
62089 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
62090         LDKInitFeatures this_arg_conv;
62091         this_arg_conv.inner = untag_ptr(this_arg);
62092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62094         this_arg_conv.is_owned = false;
62095         InitFeatures_set_zero_conf_optional(&this_arg_conv);
62096 }
62097
62098 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
62099         LDKInitFeatures this_arg_conv;
62100         this_arg_conv.inner = untag_ptr(this_arg);
62101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62103         this_arg_conv.is_owned = false;
62104         InitFeatures_set_zero_conf_required(&this_arg_conv);
62105 }
62106
62107 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
62108         LDKInitFeatures this_arg_conv;
62109         this_arg_conv.inner = untag_ptr(this_arg);
62110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62112         this_arg_conv.is_owned = false;
62113         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
62114         return ret_conv;
62115 }
62116
62117 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
62118         LDKNodeFeatures this_arg_conv;
62119         this_arg_conv.inner = untag_ptr(this_arg);
62120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62122         this_arg_conv.is_owned = false;
62123         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
62124 }
62125
62126 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
62127         LDKNodeFeatures this_arg_conv;
62128         this_arg_conv.inner = untag_ptr(this_arg);
62129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62131         this_arg_conv.is_owned = false;
62132         NodeFeatures_set_zero_conf_required(&this_arg_conv);
62133 }
62134
62135 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
62136         LDKNodeFeatures this_arg_conv;
62137         this_arg_conv.inner = untag_ptr(this_arg);
62138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62140         this_arg_conv.is_owned = false;
62141         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
62142         return ret_conv;
62143 }
62144
62145 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
62146         LDKChannelTypeFeatures this_arg_conv;
62147         this_arg_conv.inner = untag_ptr(this_arg);
62148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62150         this_arg_conv.is_owned = false;
62151         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
62152 }
62153
62154 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
62155         LDKChannelTypeFeatures this_arg_conv;
62156         this_arg_conv.inner = untag_ptr(this_arg);
62157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62159         this_arg_conv.is_owned = false;
62160         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
62161 }
62162
62163 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
62164         LDKChannelTypeFeatures this_arg_conv;
62165         this_arg_conv.inner = untag_ptr(this_arg);
62166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62168         this_arg_conv.is_owned = false;
62169         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
62170         return ret_conv;
62171 }
62172
62173 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
62174         LDKInitFeatures this_arg_conv;
62175         this_arg_conv.inner = untag_ptr(this_arg);
62176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62178         this_arg_conv.is_owned = false;
62179         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
62180         return ret_conv;
62181 }
62182
62183 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
62184         LDKNodeFeatures this_arg_conv;
62185         this_arg_conv.inner = untag_ptr(this_arg);
62186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62188         this_arg_conv.is_owned = false;
62189         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
62190         return ret_conv;
62191 }
62192
62193 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
62194         LDKChannelTypeFeatures this_arg_conv;
62195         this_arg_conv.inner = untag_ptr(this_arg);
62196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62198         this_arg_conv.is_owned = false;
62199         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
62200         return ret_conv;
62201 }
62202
62203 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
62204         LDKNodeFeatures this_arg_conv;
62205         this_arg_conv.inner = untag_ptr(this_arg);
62206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62208         this_arg_conv.is_owned = false;
62209         NodeFeatures_set_keysend_optional(&this_arg_conv);
62210 }
62211
62212 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
62213         LDKNodeFeatures this_arg_conv;
62214         this_arg_conv.inner = untag_ptr(this_arg);
62215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62217         this_arg_conv.is_owned = false;
62218         NodeFeatures_set_keysend_required(&this_arg_conv);
62219 }
62220
62221 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
62222         LDKNodeFeatures this_arg_conv;
62223         this_arg_conv.inner = untag_ptr(this_arg);
62224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62226         this_arg_conv.is_owned = false;
62227         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
62228         return ret_conv;
62229 }
62230
62231 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
62232         LDKNodeFeatures this_arg_conv;
62233         this_arg_conv.inner = untag_ptr(this_arg);
62234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62236         this_arg_conv.is_owned = false;
62237         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
62238         return ret_conv;
62239 }
62240
62241 void  __attribute__((export_name("TS_InitFeatures_set_trampoline_routing_optional"))) TS_InitFeatures_set_trampoline_routing_optional(uint64_t this_arg) {
62242         LDKInitFeatures this_arg_conv;
62243         this_arg_conv.inner = untag_ptr(this_arg);
62244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62246         this_arg_conv.is_owned = false;
62247         InitFeatures_set_trampoline_routing_optional(&this_arg_conv);
62248 }
62249
62250 void  __attribute__((export_name("TS_InitFeatures_set_trampoline_routing_required"))) TS_InitFeatures_set_trampoline_routing_required(uint64_t this_arg) {
62251         LDKInitFeatures this_arg_conv;
62252         this_arg_conv.inner = untag_ptr(this_arg);
62253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62255         this_arg_conv.is_owned = false;
62256         InitFeatures_set_trampoline_routing_required(&this_arg_conv);
62257 }
62258
62259 jboolean  __attribute__((export_name("TS_InitFeatures_supports_trampoline_routing"))) TS_InitFeatures_supports_trampoline_routing(uint64_t this_arg) {
62260         LDKInitFeatures this_arg_conv;
62261         this_arg_conv.inner = untag_ptr(this_arg);
62262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62264         this_arg_conv.is_owned = false;
62265         jboolean ret_conv = InitFeatures_supports_trampoline_routing(&this_arg_conv);
62266         return ret_conv;
62267 }
62268
62269 void  __attribute__((export_name("TS_NodeFeatures_set_trampoline_routing_optional"))) TS_NodeFeatures_set_trampoline_routing_optional(uint64_t this_arg) {
62270         LDKNodeFeatures this_arg_conv;
62271         this_arg_conv.inner = untag_ptr(this_arg);
62272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62274         this_arg_conv.is_owned = false;
62275         NodeFeatures_set_trampoline_routing_optional(&this_arg_conv);
62276 }
62277
62278 void  __attribute__((export_name("TS_NodeFeatures_set_trampoline_routing_required"))) TS_NodeFeatures_set_trampoline_routing_required(uint64_t this_arg) {
62279         LDKNodeFeatures this_arg_conv;
62280         this_arg_conv.inner = untag_ptr(this_arg);
62281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62283         this_arg_conv.is_owned = false;
62284         NodeFeatures_set_trampoline_routing_required(&this_arg_conv);
62285 }
62286
62287 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_trampoline_routing"))) TS_NodeFeatures_supports_trampoline_routing(uint64_t this_arg) {
62288         LDKNodeFeatures this_arg_conv;
62289         this_arg_conv.inner = untag_ptr(this_arg);
62290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62292         this_arg_conv.is_owned = false;
62293         jboolean ret_conv = NodeFeatures_supports_trampoline_routing(&this_arg_conv);
62294         return ret_conv;
62295 }
62296
62297 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_trampoline_routing_optional"))) TS_Bolt11InvoiceFeatures_set_trampoline_routing_optional(uint64_t this_arg) {
62298         LDKBolt11InvoiceFeatures this_arg_conv;
62299         this_arg_conv.inner = untag_ptr(this_arg);
62300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62302         this_arg_conv.is_owned = false;
62303         Bolt11InvoiceFeatures_set_trampoline_routing_optional(&this_arg_conv);
62304 }
62305
62306 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_trampoline_routing_required"))) TS_Bolt11InvoiceFeatures_set_trampoline_routing_required(uint64_t this_arg) {
62307         LDKBolt11InvoiceFeatures this_arg_conv;
62308         this_arg_conv.inner = untag_ptr(this_arg);
62309         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62311         this_arg_conv.is_owned = false;
62312         Bolt11InvoiceFeatures_set_trampoline_routing_required(&this_arg_conv);
62313 }
62314
62315 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_trampoline_routing"))) TS_Bolt11InvoiceFeatures_supports_trampoline_routing(uint64_t this_arg) {
62316         LDKBolt11InvoiceFeatures this_arg_conv;
62317         this_arg_conv.inner = untag_ptr(this_arg);
62318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62320         this_arg_conv.is_owned = false;
62321         jboolean ret_conv = Bolt11InvoiceFeatures_supports_trampoline_routing(&this_arg_conv);
62322         return ret_conv;
62323 }
62324
62325 jboolean  __attribute__((export_name("TS_InitFeatures_requires_trampoline_routing"))) TS_InitFeatures_requires_trampoline_routing(uint64_t this_arg) {
62326         LDKInitFeatures this_arg_conv;
62327         this_arg_conv.inner = untag_ptr(this_arg);
62328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62330         this_arg_conv.is_owned = false;
62331         jboolean ret_conv = InitFeatures_requires_trampoline_routing(&this_arg_conv);
62332         return ret_conv;
62333 }
62334
62335 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_trampoline_routing"))) TS_NodeFeatures_requires_trampoline_routing(uint64_t this_arg) {
62336         LDKNodeFeatures this_arg_conv;
62337         this_arg_conv.inner = untag_ptr(this_arg);
62338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62340         this_arg_conv.is_owned = false;
62341         jboolean ret_conv = NodeFeatures_requires_trampoline_routing(&this_arg_conv);
62342         return ret_conv;
62343 }
62344
62345 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_trampoline_routing"))) TS_Bolt11InvoiceFeatures_requires_trampoline_routing(uint64_t this_arg) {
62346         LDKBolt11InvoiceFeatures this_arg_conv;
62347         this_arg_conv.inner = untag_ptr(this_arg);
62348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62350         this_arg_conv.is_owned = false;
62351         jboolean ret_conv = Bolt11InvoiceFeatures_requires_trampoline_routing(&this_arg_conv);
62352         return ret_conv;
62353 }
62354
62355 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
62356         LDKShutdownScript this_obj_conv;
62357         this_obj_conv.inner = untag_ptr(this_obj);
62358         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62360         ShutdownScript_free(this_obj_conv);
62361 }
62362
62363 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
62364         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
62365         uint64_t ret_ref = 0;
62366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62368         return ret_ref;
62369 }
62370 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
62371         LDKShutdownScript arg_conv;
62372         arg_conv.inner = untag_ptr(arg);
62373         arg_conv.is_owned = ptr_is_owned(arg);
62374         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62375         arg_conv.is_owned = false;
62376         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
62377         return ret_conv;
62378 }
62379
62380 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
62381         LDKShutdownScript orig_conv;
62382         orig_conv.inner = untag_ptr(orig);
62383         orig_conv.is_owned = ptr_is_owned(orig);
62384         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62385         orig_conv.is_owned = false;
62386         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
62387         uint64_t ret_ref = 0;
62388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62390         return ret_ref;
62391 }
62392
62393 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
62394         LDKShutdownScript a_conv;
62395         a_conv.inner = untag_ptr(a);
62396         a_conv.is_owned = ptr_is_owned(a);
62397         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62398         a_conv.is_owned = false;
62399         LDKShutdownScript b_conv;
62400         b_conv.inner = untag_ptr(b);
62401         b_conv.is_owned = ptr_is_owned(b);
62402         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62403         b_conv.is_owned = false;
62404         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
62405         return ret_conv;
62406 }
62407
62408 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
62409         LDKInvalidShutdownScript this_obj_conv;
62410         this_obj_conv.inner = untag_ptr(this_obj);
62411         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62413         InvalidShutdownScript_free(this_obj_conv);
62414 }
62415
62416 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
62417         LDKInvalidShutdownScript this_ptr_conv;
62418         this_ptr_conv.inner = untag_ptr(this_ptr);
62419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62421         this_ptr_conv.is_owned = false;
62422         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
62423         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62424         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62425         CVec_u8Z_free(ret_var);
62426         return ret_arr;
62427 }
62428
62429 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
62430         LDKInvalidShutdownScript this_ptr_conv;
62431         this_ptr_conv.inner = untag_ptr(this_ptr);
62432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62434         this_ptr_conv.is_owned = false;
62435         LDKCVec_u8Z val_ref;
62436         val_ref.datalen = val->arr_len;
62437         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
62438         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
62439         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
62440 }
62441
62442 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
62443         LDKCVec_u8Z script_arg_ref;
62444         script_arg_ref.datalen = script_arg->arr_len;
62445         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
62446         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
62447         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
62448         uint64_t ret_ref = 0;
62449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62451         return ret_ref;
62452 }
62453
62454 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
62455         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
62456         uint64_t ret_ref = 0;
62457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62459         return ret_ref;
62460 }
62461 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
62462         LDKInvalidShutdownScript arg_conv;
62463         arg_conv.inner = untag_ptr(arg);
62464         arg_conv.is_owned = ptr_is_owned(arg);
62465         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62466         arg_conv.is_owned = false;
62467         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
62468         return ret_conv;
62469 }
62470
62471 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
62472         LDKInvalidShutdownScript orig_conv;
62473         orig_conv.inner = untag_ptr(orig);
62474         orig_conv.is_owned = ptr_is_owned(orig);
62475         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62476         orig_conv.is_owned = false;
62477         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
62478         uint64_t ret_ref = 0;
62479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62481         return ret_ref;
62482 }
62483
62484 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
62485         LDKShutdownScript obj_conv;
62486         obj_conv.inner = untag_ptr(obj);
62487         obj_conv.is_owned = ptr_is_owned(obj);
62488         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62489         obj_conv.is_owned = false;
62490         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
62491         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62492         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62493         CVec_u8Z_free(ret_var);
62494         return ret_arr;
62495 }
62496
62497 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
62498         LDKu8slice ser_ref;
62499         ser_ref.datalen = ser->arr_len;
62500         ser_ref.data = ser->elems;
62501         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
62502         *ret_conv = ShutdownScript_read(ser_ref);
62503         FREE(ser);
62504         return tag_ptr(ret_conv, true);
62505 }
62506
62507 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
62508         uint8_t pubkey_hash_arr[20];
62509         CHECK(pubkey_hash->arr_len == 20);
62510         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
62511         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
62512         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
62513         uint64_t ret_ref = 0;
62514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62516         return ret_ref;
62517 }
62518
62519 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
62520         uint8_t script_hash_arr[32];
62521         CHECK(script_hash->arr_len == 32);
62522         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
62523         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
62524         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
62525         uint64_t ret_ref = 0;
62526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62528         return ret_ref;
62529 }
62530
62531 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(uint64_t witness_program) {
62532         void* witness_program_ptr = untag_ptr(witness_program);
62533         CHECK_ACCESS(witness_program_ptr);
62534         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
62535         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
62536         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
62537         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
62538         return tag_ptr(ret_conv, true);
62539 }
62540
62541 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
62542         LDKShutdownScript this_arg_conv;
62543         this_arg_conv.inner = untag_ptr(this_arg);
62544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62546         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
62547         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
62548         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62549         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62550         CVec_u8Z_free(ret_var);
62551         return ret_arr;
62552 }
62553
62554 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
62555         LDKShutdownScript this_arg_conv;
62556         this_arg_conv.inner = untag_ptr(this_arg);
62557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62559         this_arg_conv.is_owned = false;
62560         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62561         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
62562         return ret_arr;
62563 }
62564
62565 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
62566         LDKShutdownScript this_arg_conv;
62567         this_arg_conv.inner = untag_ptr(this_arg);
62568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62570         this_arg_conv.is_owned = false;
62571         LDKInitFeatures features_conv;
62572         features_conv.inner = untag_ptr(features);
62573         features_conv.is_owned = ptr_is_owned(features);
62574         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
62575         features_conv.is_owned = false;
62576         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
62577         return ret_conv;
62578 }
62579
62580 void  __attribute__((export_name("TS_ChannelId_free"))) TS_ChannelId_free(uint64_t this_obj) {
62581         LDKChannelId this_obj_conv;
62582         this_obj_conv.inner = untag_ptr(this_obj);
62583         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62585         ChannelId_free(this_obj_conv);
62586 }
62587
62588 int8_tArray  __attribute__((export_name("TS_ChannelId_get_a"))) TS_ChannelId_get_a(uint64_t this_ptr) {
62589         LDKChannelId this_ptr_conv;
62590         this_ptr_conv.inner = untag_ptr(this_ptr);
62591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62593         this_ptr_conv.is_owned = false;
62594         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62595         memcpy(ret_arr->elems, *ChannelId_get_a(&this_ptr_conv), 32);
62596         return ret_arr;
62597 }
62598
62599 void  __attribute__((export_name("TS_ChannelId_set_a"))) TS_ChannelId_set_a(uint64_t this_ptr, int8_tArray val) {
62600         LDKChannelId this_ptr_conv;
62601         this_ptr_conv.inner = untag_ptr(this_ptr);
62602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62604         this_ptr_conv.is_owned = false;
62605         LDKThirtyTwoBytes val_ref;
62606         CHECK(val->arr_len == 32);
62607         memcpy(val_ref.data, val->elems, 32); FREE(val);
62608         ChannelId_set_a(&this_ptr_conv, val_ref);
62609 }
62610
62611 uint64_t  __attribute__((export_name("TS_ChannelId_new"))) TS_ChannelId_new(int8_tArray a_arg) {
62612         LDKThirtyTwoBytes a_arg_ref;
62613         CHECK(a_arg->arr_len == 32);
62614         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
62615         LDKChannelId ret_var = ChannelId_new(a_arg_ref);
62616         uint64_t ret_ref = 0;
62617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62619         return ret_ref;
62620 }
62621
62622 static inline uint64_t ChannelId_clone_ptr(LDKChannelId *NONNULL_PTR arg) {
62623         LDKChannelId ret_var = ChannelId_clone(arg);
62624         uint64_t ret_ref = 0;
62625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62627         return ret_ref;
62628 }
62629 int64_t  __attribute__((export_name("TS_ChannelId_clone_ptr"))) TS_ChannelId_clone_ptr(uint64_t arg) {
62630         LDKChannelId arg_conv;
62631         arg_conv.inner = untag_ptr(arg);
62632         arg_conv.is_owned = ptr_is_owned(arg);
62633         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62634         arg_conv.is_owned = false;
62635         int64_t ret_conv = ChannelId_clone_ptr(&arg_conv);
62636         return ret_conv;
62637 }
62638
62639 uint64_t  __attribute__((export_name("TS_ChannelId_clone"))) TS_ChannelId_clone(uint64_t orig) {
62640         LDKChannelId orig_conv;
62641         orig_conv.inner = untag_ptr(orig);
62642         orig_conv.is_owned = ptr_is_owned(orig);
62643         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62644         orig_conv.is_owned = false;
62645         LDKChannelId ret_var = ChannelId_clone(&orig_conv);
62646         uint64_t ret_ref = 0;
62647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62649         return ret_ref;
62650 }
62651
62652 jboolean  __attribute__((export_name("TS_ChannelId_eq"))) TS_ChannelId_eq(uint64_t a, uint64_t b) {
62653         LDKChannelId a_conv;
62654         a_conv.inner = untag_ptr(a);
62655         a_conv.is_owned = ptr_is_owned(a);
62656         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62657         a_conv.is_owned = false;
62658         LDKChannelId b_conv;
62659         b_conv.inner = untag_ptr(b);
62660         b_conv.is_owned = ptr_is_owned(b);
62661         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62662         b_conv.is_owned = false;
62663         jboolean ret_conv = ChannelId_eq(&a_conv, &b_conv);
62664         return ret_conv;
62665 }
62666
62667 int64_t  __attribute__((export_name("TS_ChannelId_hash"))) TS_ChannelId_hash(uint64_t o) {
62668         LDKChannelId o_conv;
62669         o_conv.inner = untag_ptr(o);
62670         o_conv.is_owned = ptr_is_owned(o);
62671         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62672         o_conv.is_owned = false;
62673         int64_t ret_conv = ChannelId_hash(&o_conv);
62674         return ret_conv;
62675 }
62676
62677 uint64_t  __attribute__((export_name("TS_ChannelId_v1_from_funding_txid"))) TS_ChannelId_v1_from_funding_txid(int8_tArray txid, int16_t output_index) {
62678         uint8_t txid_arr[32];
62679         CHECK(txid->arr_len == 32);
62680         memcpy(txid_arr, txid->elems, 32); FREE(txid);
62681         uint8_t (*txid_ref)[32] = &txid_arr;
62682         LDKChannelId ret_var = ChannelId_v1_from_funding_txid(txid_ref, output_index);
62683         uint64_t ret_ref = 0;
62684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62686         return ret_ref;
62687 }
62688
62689 uint64_t  __attribute__((export_name("TS_ChannelId_v1_from_funding_outpoint"))) TS_ChannelId_v1_from_funding_outpoint(uint64_t outpoint) {
62690         LDKOutPoint outpoint_conv;
62691         outpoint_conv.inner = untag_ptr(outpoint);
62692         outpoint_conv.is_owned = ptr_is_owned(outpoint);
62693         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
62694         outpoint_conv = OutPoint_clone(&outpoint_conv);
62695         LDKChannelId ret_var = ChannelId_v1_from_funding_outpoint(outpoint_conv);
62696         uint64_t ret_ref = 0;
62697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62699         return ret_ref;
62700 }
62701
62702 uint64_t  __attribute__((export_name("TS_ChannelId_temporary_from_entropy_source"))) TS_ChannelId_temporary_from_entropy_source(uint64_t entropy_source) {
62703         void* entropy_source_ptr = untag_ptr(entropy_source);
62704         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
62705         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
62706         LDKChannelId ret_var = ChannelId_temporary_from_entropy_source(entropy_source_conv);
62707         uint64_t ret_ref = 0;
62708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62710         return ret_ref;
62711 }
62712
62713 uint64_t  __attribute__((export_name("TS_ChannelId_from_bytes"))) TS_ChannelId_from_bytes(int8_tArray data) {
62714         LDKThirtyTwoBytes data_ref;
62715         CHECK(data->arr_len == 32);
62716         memcpy(data_ref.data, data->elems, 32); FREE(data);
62717         LDKChannelId ret_var = ChannelId_from_bytes(data_ref);
62718         uint64_t ret_ref = 0;
62719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62721         return ret_ref;
62722 }
62723
62724 uint64_t  __attribute__((export_name("TS_ChannelId_new_zero"))) TS_ChannelId_new_zero() {
62725         LDKChannelId ret_var = ChannelId_new_zero();
62726         uint64_t ret_ref = 0;
62727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62729         return ret_ref;
62730 }
62731
62732 jboolean  __attribute__((export_name("TS_ChannelId_is_zero"))) TS_ChannelId_is_zero(uint64_t this_arg) {
62733         LDKChannelId this_arg_conv;
62734         this_arg_conv.inner = untag_ptr(this_arg);
62735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62737         this_arg_conv.is_owned = false;
62738         jboolean ret_conv = ChannelId_is_zero(&this_arg_conv);
62739         return ret_conv;
62740 }
62741
62742 uint64_t  __attribute__((export_name("TS_ChannelId_v2_from_revocation_basepoints"))) TS_ChannelId_v2_from_revocation_basepoints(uint64_t ours, uint64_t theirs) {
62743         LDKRevocationBasepoint ours_conv;
62744         ours_conv.inner = untag_ptr(ours);
62745         ours_conv.is_owned = ptr_is_owned(ours);
62746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ours_conv);
62747         ours_conv.is_owned = false;
62748         LDKRevocationBasepoint theirs_conv;
62749         theirs_conv.inner = untag_ptr(theirs);
62750         theirs_conv.is_owned = ptr_is_owned(theirs);
62751         CHECK_INNER_FIELD_ACCESS_OR_NULL(theirs_conv);
62752         theirs_conv.is_owned = false;
62753         LDKChannelId ret_var = ChannelId_v2_from_revocation_basepoints(&ours_conv, &theirs_conv);
62754         uint64_t ret_ref = 0;
62755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62757         return ret_ref;
62758 }
62759
62760 uint64_t  __attribute__((export_name("TS_ChannelId_temporary_v2_from_revocation_basepoint"))) TS_ChannelId_temporary_v2_from_revocation_basepoint(uint64_t our_revocation_basepoint) {
62761         LDKRevocationBasepoint our_revocation_basepoint_conv;
62762         our_revocation_basepoint_conv.inner = untag_ptr(our_revocation_basepoint);
62763         our_revocation_basepoint_conv.is_owned = ptr_is_owned(our_revocation_basepoint);
62764         CHECK_INNER_FIELD_ACCESS_OR_NULL(our_revocation_basepoint_conv);
62765         our_revocation_basepoint_conv.is_owned = false;
62766         LDKChannelId ret_var = ChannelId_temporary_v2_from_revocation_basepoint(&our_revocation_basepoint_conv);
62767         uint64_t ret_ref = 0;
62768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62770         return ret_ref;
62771 }
62772
62773 int8_tArray  __attribute__((export_name("TS_ChannelId_write"))) TS_ChannelId_write(uint64_t obj) {
62774         LDKChannelId obj_conv;
62775         obj_conv.inner = untag_ptr(obj);
62776         obj_conv.is_owned = ptr_is_owned(obj);
62777         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62778         obj_conv.is_owned = false;
62779         LDKCVec_u8Z ret_var = ChannelId_write(&obj_conv);
62780         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62781         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62782         CVec_u8Z_free(ret_var);
62783         return ret_arr;
62784 }
62785
62786 uint64_t  __attribute__((export_name("TS_ChannelId_read"))) TS_ChannelId_read(int8_tArray ser) {
62787         LDKu8slice ser_ref;
62788         ser_ref.datalen = ser->arr_len;
62789         ser_ref.data = ser->elems;
62790         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
62791         *ret_conv = ChannelId_read(ser_ref);
62792         FREE(ser);
62793         return tag_ptr(ret_conv, true);
62794 }
62795
62796 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
62797         if (!ptr_is_owned(this_ptr)) return;
62798         void* this_ptr_ptr = untag_ptr(this_ptr);
62799         CHECK_ACCESS(this_ptr_ptr);
62800         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
62801         FREE(untag_ptr(this_ptr));
62802         Retry_free(this_ptr_conv);
62803 }
62804
62805 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
62806         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
62807         *ret_copy = Retry_clone(arg);
62808         uint64_t ret_ref = tag_ptr(ret_copy, true);
62809         return ret_ref;
62810 }
62811 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
62812         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
62813         int64_t ret_conv = Retry_clone_ptr(arg_conv);
62814         return ret_conv;
62815 }
62816
62817 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
62818         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
62819         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
62820         *ret_copy = Retry_clone(orig_conv);
62821         uint64_t ret_ref = tag_ptr(ret_copy, true);
62822         return ret_ref;
62823 }
62824
62825 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(int32_t a) {
62826         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
62827         *ret_copy = Retry_attempts(a);
62828         uint64_t ret_ref = tag_ptr(ret_copy, true);
62829         return ret_ref;
62830 }
62831
62832 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
62833         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
62834         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
62835         jboolean ret_conv = Retry_eq(a_conv, b_conv);
62836         return ret_conv;
62837 }
62838
62839 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
62840         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
62841         int64_t ret_conv = Retry_hash(o_conv);
62842         return ret_conv;
62843 }
62844
62845 int8_tArray  __attribute__((export_name("TS_Retry_write"))) TS_Retry_write(uint64_t obj) {
62846         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
62847         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
62848         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62849         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62850         CVec_u8Z_free(ret_var);
62851         return ret_arr;
62852 }
62853
62854 uint64_t  __attribute__((export_name("TS_Retry_read"))) TS_Retry_read(int8_tArray ser) {
62855         LDKu8slice ser_ref;
62856         ser_ref.datalen = ser->arr_len;
62857         ser_ref.data = ser->elems;
62858         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
62859         *ret_conv = Retry_read(ser_ref);
62860         FREE(ser);
62861         return tag_ptr(ret_conv, true);
62862 }
62863
62864 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
62865         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
62866         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
62867         return ret_conv;
62868 }
62869
62870 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
62871         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
62872         return ret_conv;
62873 }
62874
62875 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
62876         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
62877         return ret_conv;
62878 }
62879
62880 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
62881         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
62882         return ret_conv;
62883 }
62884
62885 jboolean  __attribute__((export_name("TS_RetryableSendFailure_eq"))) TS_RetryableSendFailure_eq(uint64_t a, uint64_t b) {
62886         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
62887         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
62888         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
62889         return ret_conv;
62890 }
62891
62892 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
62893         if (!ptr_is_owned(this_ptr)) return;
62894         void* this_ptr_ptr = untag_ptr(this_ptr);
62895         CHECK_ACCESS(this_ptr_ptr);
62896         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
62897         FREE(untag_ptr(this_ptr));
62898         PaymentSendFailure_free(this_ptr_conv);
62899 }
62900
62901 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
62902         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
62903         *ret_copy = PaymentSendFailure_clone(arg);
62904         uint64_t ret_ref = tag_ptr(ret_copy, true);
62905         return ret_ref;
62906 }
62907 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
62908         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
62909         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
62910         return ret_conv;
62911 }
62912
62913 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
62914         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
62915         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
62916         *ret_copy = PaymentSendFailure_clone(orig_conv);
62917         uint64_t ret_ref = tag_ptr(ret_copy, true);
62918         return ret_ref;
62919 }
62920
62921 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
62922         void* a_ptr = untag_ptr(a);
62923         CHECK_ACCESS(a_ptr);
62924         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
62925         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
62926         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
62927         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
62928         uint64_t ret_ref = tag_ptr(ret_copy, true);
62929         return ret_ref;
62930 }
62931
62932 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
62933         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
62934         a_constr.datalen = a->arr_len;
62935         if (a_constr.datalen > 0)
62936                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
62937         else
62938                 a_constr.data = NULL;
62939         uint64_t* a_vals = a->elems;
62940         for (size_t w = 0; w < a_constr.datalen; w++) {
62941                 uint64_t a_conv_22 = a_vals[w];
62942                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
62943                 CHECK_ACCESS(a_conv_22_ptr);
62944                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
62945                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
62946                 a_constr.data[w] = a_conv_22_conv;
62947         }
62948         FREE(a);
62949         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
62950         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
62951         uint64_t ret_ref = tag_ptr(ret_copy, true);
62952         return ret_ref;
62953 }
62954
62955 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
62956         LDKCVec_APIErrorZ a_constr;
62957         a_constr.datalen = a->arr_len;
62958         if (a_constr.datalen > 0)
62959                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
62960         else
62961                 a_constr.data = NULL;
62962         uint64_t* a_vals = a->elems;
62963         for (size_t k = 0; k < a_constr.datalen; k++) {
62964                 uint64_t a_conv_10 = a_vals[k];
62965                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
62966                 CHECK_ACCESS(a_conv_10_ptr);
62967                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
62968                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
62969                 a_constr.data[k] = a_conv_10_conv;
62970         }
62971         FREE(a);
62972         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
62973         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
62974         uint64_t ret_ref = tag_ptr(ret_copy, true);
62975         return ret_ref;
62976 }
62977
62978 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
62979         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
62980         *ret_copy = PaymentSendFailure_duplicate_payment();
62981         uint64_t ret_ref = tag_ptr(ret_copy, true);
62982         return ret_ref;
62983 }
62984
62985 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) {
62986         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
62987         results_constr.datalen = results->arr_len;
62988         if (results_constr.datalen > 0)
62989                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
62990         else
62991                 results_constr.data = NULL;
62992         uint64_t* results_vals = results->elems;
62993         for (size_t w = 0; w < results_constr.datalen; w++) {
62994                 uint64_t results_conv_22 = results_vals[w];
62995                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
62996                 CHECK_ACCESS(results_conv_22_ptr);
62997                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
62998                 results_constr.data[w] = results_conv_22_conv;
62999         }
63000         FREE(results);
63001         LDKRouteParameters failed_paths_retry_conv;
63002         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
63003         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
63004         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
63005         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
63006         LDKThirtyTwoBytes payment_id_ref;
63007         CHECK(payment_id->arr_len == 32);
63008         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
63009         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
63010         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
63011         uint64_t ret_ref = tag_ptr(ret_copy, true);
63012         return ret_ref;
63013 }
63014
63015 jboolean  __attribute__((export_name("TS_PaymentSendFailure_eq"))) TS_PaymentSendFailure_eq(uint64_t a, uint64_t b) {
63016         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
63017         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
63018         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
63019         return ret_conv;
63020 }
63021
63022 void  __attribute__((export_name("TS_ProbeSendFailure_free"))) TS_ProbeSendFailure_free(uint64_t this_ptr) {
63023         if (!ptr_is_owned(this_ptr)) return;
63024         void* this_ptr_ptr = untag_ptr(this_ptr);
63025         CHECK_ACCESS(this_ptr_ptr);
63026         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
63027         FREE(untag_ptr(this_ptr));
63028         ProbeSendFailure_free(this_ptr_conv);
63029 }
63030
63031 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
63032         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
63033         *ret_copy = ProbeSendFailure_clone(arg);
63034         uint64_t ret_ref = tag_ptr(ret_copy, true);
63035         return ret_ref;
63036 }
63037 int64_t  __attribute__((export_name("TS_ProbeSendFailure_clone_ptr"))) TS_ProbeSendFailure_clone_ptr(uint64_t arg) {
63038         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
63039         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
63040         return ret_conv;
63041 }
63042
63043 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_clone"))) TS_ProbeSendFailure_clone(uint64_t orig) {
63044         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
63045         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
63046         *ret_copy = ProbeSendFailure_clone(orig_conv);
63047         uint64_t ret_ref = tag_ptr(ret_copy, true);
63048         return ret_ref;
63049 }
63050
63051 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_route_not_found"))) TS_ProbeSendFailure_route_not_found() {
63052         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
63053         *ret_copy = ProbeSendFailure_route_not_found();
63054         uint64_t ret_ref = tag_ptr(ret_copy, true);
63055         return ret_ref;
63056 }
63057
63058 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_sending_failed"))) TS_ProbeSendFailure_sending_failed(uint64_t a) {
63059         void* a_ptr = untag_ptr(a);
63060         CHECK_ACCESS(a_ptr);
63061         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
63062         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
63063         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
63064         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
63065         uint64_t ret_ref = tag_ptr(ret_copy, true);
63066         return ret_ref;
63067 }
63068
63069 jboolean  __attribute__((export_name("TS_ProbeSendFailure_eq"))) TS_ProbeSendFailure_eq(uint64_t a, uint64_t b) {
63070         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
63071         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
63072         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
63073         return ret_conv;
63074 }
63075
63076 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
63077         LDKRecipientOnionFields this_obj_conv;
63078         this_obj_conv.inner = untag_ptr(this_obj);
63079         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63081         RecipientOnionFields_free(this_obj_conv);
63082 }
63083
63084 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
63085         LDKRecipientOnionFields this_ptr_conv;
63086         this_ptr_conv.inner = untag_ptr(this_ptr);
63087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63089         this_ptr_conv.is_owned = false;
63090         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
63091         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
63092         uint64_t ret_ref = tag_ptr(ret_copy, true);
63093         return ret_ref;
63094 }
63095
63096 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, uint64_t val) {
63097         LDKRecipientOnionFields this_ptr_conv;
63098         this_ptr_conv.inner = untag_ptr(this_ptr);
63099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63101         this_ptr_conv.is_owned = false;
63102         void* val_ptr = untag_ptr(val);
63103         CHECK_ACCESS(val_ptr);
63104         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
63105         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
63106         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
63107 }
63108
63109 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
63110         LDKRecipientOnionFields this_ptr_conv;
63111         this_ptr_conv.inner = untag_ptr(this_ptr);
63112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63114         this_ptr_conv.is_owned = false;
63115         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
63116         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
63117         uint64_t ret_ref = tag_ptr(ret_copy, true);
63118         return ret_ref;
63119 }
63120
63121 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
63122         LDKRecipientOnionFields this_ptr_conv;
63123         this_ptr_conv.inner = untag_ptr(this_ptr);
63124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63126         this_ptr_conv.is_owned = false;
63127         void* val_ptr = untag_ptr(val);
63128         CHECK_ACCESS(val_ptr);
63129         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
63130         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
63131         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
63132 }
63133
63134 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
63135         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
63136         uint64_t ret_ref = 0;
63137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63139         return ret_ref;
63140 }
63141 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
63142         LDKRecipientOnionFields arg_conv;
63143         arg_conv.inner = untag_ptr(arg);
63144         arg_conv.is_owned = ptr_is_owned(arg);
63145         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63146         arg_conv.is_owned = false;
63147         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
63148         return ret_conv;
63149 }
63150
63151 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
63152         LDKRecipientOnionFields orig_conv;
63153         orig_conv.inner = untag_ptr(orig);
63154         orig_conv.is_owned = ptr_is_owned(orig);
63155         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63156         orig_conv.is_owned = false;
63157         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
63158         uint64_t ret_ref = 0;
63159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63161         return ret_ref;
63162 }
63163
63164 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
63165         LDKRecipientOnionFields a_conv;
63166         a_conv.inner = untag_ptr(a);
63167         a_conv.is_owned = ptr_is_owned(a);
63168         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63169         a_conv.is_owned = false;
63170         LDKRecipientOnionFields b_conv;
63171         b_conv.inner = untag_ptr(b);
63172         b_conv.is_owned = ptr_is_owned(b);
63173         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63174         b_conv.is_owned = false;
63175         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
63176         return ret_conv;
63177 }
63178
63179 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
63180         LDKRecipientOnionFields obj_conv;
63181         obj_conv.inner = untag_ptr(obj);
63182         obj_conv.is_owned = ptr_is_owned(obj);
63183         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63184         obj_conv.is_owned = false;
63185         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
63186         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63187         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63188         CVec_u8Z_free(ret_var);
63189         return ret_arr;
63190 }
63191
63192 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
63193         LDKu8slice ser_ref;
63194         ser_ref.datalen = ser->arr_len;
63195         ser_ref.data = ser->elems;
63196         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
63197         *ret_conv = RecipientOnionFields_read(ser_ref);
63198         FREE(ser);
63199         return tag_ptr(ret_conv, true);
63200 }
63201
63202 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
63203         LDKThirtyTwoBytes payment_secret_ref;
63204         CHECK(payment_secret->arr_len == 32);
63205         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
63206         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
63207         uint64_t ret_ref = 0;
63208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63210         return ret_ref;
63211 }
63212
63213 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
63214         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
63215         uint64_t ret_ref = 0;
63216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63218         return ret_ref;
63219 }
63220
63221 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_with_custom_tlvs"))) TS_RecipientOnionFields_with_custom_tlvs(uint64_t this_arg, uint64_tArray custom_tlvs) {
63222         LDKRecipientOnionFields this_arg_conv;
63223         this_arg_conv.inner = untag_ptr(this_arg);
63224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63226         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
63227         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
63228         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
63229         if (custom_tlvs_constr.datalen > 0)
63230                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
63231         else
63232                 custom_tlvs_constr.data = NULL;
63233         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
63234         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
63235                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
63236                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
63237                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
63238                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
63239                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
63240                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
63241         }
63242         FREE(custom_tlvs);
63243         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
63244         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
63245         return tag_ptr(ret_conv, true);
63246 }
63247
63248 uint64_tArray  __attribute__((export_name("TS_RecipientOnionFields_custom_tlvs"))) TS_RecipientOnionFields_custom_tlvs(uint64_t this_arg) {
63249         LDKRecipientOnionFields this_arg_conv;
63250         this_arg_conv.inner = untag_ptr(this_arg);
63251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63253         this_arg_conv.is_owned = false;
63254         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
63255         uint64_tArray ret_arr = NULL;
63256         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63257         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63258         for (size_t x = 0; x < ret_var.datalen; x++) {
63259                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
63260                 *ret_conv_23_conv = ret_var.data[x];
63261                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
63262         }
63263         
63264         FREE(ret_var.data);
63265         return ret_arr;
63266 }
63267
63268 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
63269         if (!ptr_is_owned(this_ptr)) return;
63270         void* this_ptr_ptr = untag_ptr(this_ptr);
63271         CHECK_ACCESS(this_ptr_ptr);
63272         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
63273         FREE(untag_ptr(this_ptr));
63274         CustomMessageReader_free(this_ptr_conv);
63275 }
63276
63277 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
63278         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
63279         *ret_ret = Type_clone(arg);
63280         return tag_ptr(ret_ret, true);
63281 }
63282 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
63283         void* arg_ptr = untag_ptr(arg);
63284         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
63285         LDKType* arg_conv = (LDKType*)arg_ptr;
63286         int64_t ret_conv = Type_clone_ptr(arg_conv);
63287         return ret_conv;
63288 }
63289
63290 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
63291         void* orig_ptr = untag_ptr(orig);
63292         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
63293         LDKType* orig_conv = (LDKType*)orig_ptr;
63294         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
63295         *ret_ret = Type_clone(orig_conv);
63296         return tag_ptr(ret_ret, true);
63297 }
63298
63299 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
63300         if (!ptr_is_owned(this_ptr)) return;
63301         void* this_ptr_ptr = untag_ptr(this_ptr);
63302         CHECK_ACCESS(this_ptr_ptr);
63303         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
63304         FREE(untag_ptr(this_ptr));
63305         Type_free(this_ptr_conv);
63306 }
63307
63308 void  __attribute__((export_name("TS_OfferId_free"))) TS_OfferId_free(uint64_t this_obj) {
63309         LDKOfferId this_obj_conv;
63310         this_obj_conv.inner = untag_ptr(this_obj);
63311         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63313         OfferId_free(this_obj_conv);
63314 }
63315
63316 int8_tArray  __attribute__((export_name("TS_OfferId_get_a"))) TS_OfferId_get_a(uint64_t this_ptr) {
63317         LDKOfferId this_ptr_conv;
63318         this_ptr_conv.inner = untag_ptr(this_ptr);
63319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63321         this_ptr_conv.is_owned = false;
63322         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63323         memcpy(ret_arr->elems, *OfferId_get_a(&this_ptr_conv), 32);
63324         return ret_arr;
63325 }
63326
63327 void  __attribute__((export_name("TS_OfferId_set_a"))) TS_OfferId_set_a(uint64_t this_ptr, int8_tArray val) {
63328         LDKOfferId this_ptr_conv;
63329         this_ptr_conv.inner = untag_ptr(this_ptr);
63330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63332         this_ptr_conv.is_owned = false;
63333         LDKThirtyTwoBytes val_ref;
63334         CHECK(val->arr_len == 32);
63335         memcpy(val_ref.data, val->elems, 32); FREE(val);
63336         OfferId_set_a(&this_ptr_conv, val_ref);
63337 }
63338
63339 uint64_t  __attribute__((export_name("TS_OfferId_new"))) TS_OfferId_new(int8_tArray a_arg) {
63340         LDKThirtyTwoBytes a_arg_ref;
63341         CHECK(a_arg->arr_len == 32);
63342         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
63343         LDKOfferId ret_var = OfferId_new(a_arg_ref);
63344         uint64_t ret_ref = 0;
63345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63347         return ret_ref;
63348 }
63349
63350 static inline uint64_t OfferId_clone_ptr(LDKOfferId *NONNULL_PTR arg) {
63351         LDKOfferId ret_var = OfferId_clone(arg);
63352         uint64_t ret_ref = 0;
63353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63355         return ret_ref;
63356 }
63357 int64_t  __attribute__((export_name("TS_OfferId_clone_ptr"))) TS_OfferId_clone_ptr(uint64_t arg) {
63358         LDKOfferId arg_conv;
63359         arg_conv.inner = untag_ptr(arg);
63360         arg_conv.is_owned = ptr_is_owned(arg);
63361         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63362         arg_conv.is_owned = false;
63363         int64_t ret_conv = OfferId_clone_ptr(&arg_conv);
63364         return ret_conv;
63365 }
63366
63367 uint64_t  __attribute__((export_name("TS_OfferId_clone"))) TS_OfferId_clone(uint64_t orig) {
63368         LDKOfferId orig_conv;
63369         orig_conv.inner = untag_ptr(orig);
63370         orig_conv.is_owned = ptr_is_owned(orig);
63371         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63372         orig_conv.is_owned = false;
63373         LDKOfferId ret_var = OfferId_clone(&orig_conv);
63374         uint64_t ret_ref = 0;
63375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63377         return ret_ref;
63378 }
63379
63380 jboolean  __attribute__((export_name("TS_OfferId_eq"))) TS_OfferId_eq(uint64_t a, uint64_t b) {
63381         LDKOfferId a_conv;
63382         a_conv.inner = untag_ptr(a);
63383         a_conv.is_owned = ptr_is_owned(a);
63384         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63385         a_conv.is_owned = false;
63386         LDKOfferId b_conv;
63387         b_conv.inner = untag_ptr(b);
63388         b_conv.is_owned = ptr_is_owned(b);
63389         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63390         b_conv.is_owned = false;
63391         jboolean ret_conv = OfferId_eq(&a_conv, &b_conv);
63392         return ret_conv;
63393 }
63394
63395 int8_tArray  __attribute__((export_name("TS_OfferId_write"))) TS_OfferId_write(uint64_t obj) {
63396         LDKOfferId obj_conv;
63397         obj_conv.inner = untag_ptr(obj);
63398         obj_conv.is_owned = ptr_is_owned(obj);
63399         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63400         obj_conv.is_owned = false;
63401         LDKCVec_u8Z ret_var = OfferId_write(&obj_conv);
63402         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63403         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63404         CVec_u8Z_free(ret_var);
63405         return ret_arr;
63406 }
63407
63408 uint64_t  __attribute__((export_name("TS_OfferId_read"))) TS_OfferId_read(int8_tArray ser) {
63409         LDKu8slice ser_ref;
63410         ser_ref.datalen = ser->arr_len;
63411         ser_ref.data = ser->elems;
63412         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
63413         *ret_conv = OfferId_read(ser_ref);
63414         FREE(ser);
63415         return tag_ptr(ret_conv, true);
63416 }
63417
63418 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_free"))) TS_OfferWithExplicitMetadataBuilder_free(uint64_t this_obj) {
63419         LDKOfferWithExplicitMetadataBuilder this_obj_conv;
63420         this_obj_conv.inner = untag_ptr(this_obj);
63421         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63423         OfferWithExplicitMetadataBuilder_free(this_obj_conv);
63424 }
63425
63426 static inline uint64_t OfferWithExplicitMetadataBuilder_clone_ptr(LDKOfferWithExplicitMetadataBuilder *NONNULL_PTR arg) {
63427         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(arg);
63428         uint64_t ret_ref = 0;
63429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63431         return ret_ref;
63432 }
63433 int64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_clone_ptr"))) TS_OfferWithExplicitMetadataBuilder_clone_ptr(uint64_t arg) {
63434         LDKOfferWithExplicitMetadataBuilder arg_conv;
63435         arg_conv.inner = untag_ptr(arg);
63436         arg_conv.is_owned = ptr_is_owned(arg);
63437         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63438         arg_conv.is_owned = false;
63439         int64_t ret_conv = OfferWithExplicitMetadataBuilder_clone_ptr(&arg_conv);
63440         return ret_conv;
63441 }
63442
63443 uint64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_clone"))) TS_OfferWithExplicitMetadataBuilder_clone(uint64_t orig) {
63444         LDKOfferWithExplicitMetadataBuilder orig_conv;
63445         orig_conv.inner = untag_ptr(orig);
63446         orig_conv.is_owned = ptr_is_owned(orig);
63447         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63448         orig_conv.is_owned = false;
63449         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(&orig_conv);
63450         uint64_t ret_ref = 0;
63451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63453         return ret_ref;
63454 }
63455
63456 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_free"))) TS_OfferWithDerivedMetadataBuilder_free(uint64_t this_obj) {
63457         LDKOfferWithDerivedMetadataBuilder this_obj_conv;
63458         this_obj_conv.inner = untag_ptr(this_obj);
63459         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63461         OfferWithDerivedMetadataBuilder_free(this_obj_conv);
63462 }
63463
63464 static inline uint64_t OfferWithDerivedMetadataBuilder_clone_ptr(LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR arg) {
63465         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(arg);
63466         uint64_t ret_ref = 0;
63467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63469         return ret_ref;
63470 }
63471 int64_t  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_clone_ptr"))) TS_OfferWithDerivedMetadataBuilder_clone_ptr(uint64_t arg) {
63472         LDKOfferWithDerivedMetadataBuilder arg_conv;
63473         arg_conv.inner = untag_ptr(arg);
63474         arg_conv.is_owned = ptr_is_owned(arg);
63475         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63476         arg_conv.is_owned = false;
63477         int64_t ret_conv = OfferWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
63478         return ret_conv;
63479 }
63480
63481 uint64_t  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_clone"))) TS_OfferWithDerivedMetadataBuilder_clone(uint64_t orig) {
63482         LDKOfferWithDerivedMetadataBuilder orig_conv;
63483         orig_conv.inner = untag_ptr(orig);
63484         orig_conv.is_owned = ptr_is_owned(orig);
63485         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63486         orig_conv.is_owned = false;
63487         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(&orig_conv);
63488         uint64_t ret_ref = 0;
63489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63491         return ret_ref;
63492 }
63493
63494 uint64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_new"))) TS_OfferWithExplicitMetadataBuilder_new(int8_tArray signing_pubkey) {
63495         LDKPublicKey signing_pubkey_ref;
63496         CHECK(signing_pubkey->arr_len == 33);
63497         memcpy(signing_pubkey_ref.compressed_form, signing_pubkey->elems, 33); FREE(signing_pubkey);
63498         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_new(signing_pubkey_ref);
63499         uint64_t ret_ref = 0;
63500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63502         return ret_ref;
63503 }
63504
63505 uint64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_metadata"))) TS_OfferWithExplicitMetadataBuilder_metadata(uint64_t this_arg, int8_tArray metadata) {
63506         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63507         this_arg_conv.inner = untag_ptr(this_arg);
63508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63510         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63511         LDKCVec_u8Z metadata_ref;
63512         metadata_ref.datalen = metadata->arr_len;
63513         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
63514         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
63515         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
63516         *ret_conv = OfferWithExplicitMetadataBuilder_metadata(this_arg_conv, metadata_ref);
63517         return tag_ptr(ret_conv, true);
63518 }
63519
63520 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_chain"))) TS_OfferWithExplicitMetadataBuilder_chain(uint64_t this_arg, uint32_t network) {
63521         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63522         this_arg_conv.inner = untag_ptr(this_arg);
63523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63525         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63526         LDKNetwork network_conv = LDKNetwork_from_js(network);
63527         OfferWithExplicitMetadataBuilder_chain(this_arg_conv, network_conv);
63528 }
63529
63530 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_amount_msats"))) TS_OfferWithExplicitMetadataBuilder_amount_msats(uint64_t this_arg, int64_t amount_msats) {
63531         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63532         this_arg_conv.inner = untag_ptr(this_arg);
63533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63535         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63536         OfferWithExplicitMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
63537 }
63538
63539 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_absolute_expiry"))) TS_OfferWithExplicitMetadataBuilder_absolute_expiry(uint64_t this_arg, int64_t absolute_expiry) {
63540         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63541         this_arg_conv.inner = untag_ptr(this_arg);
63542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63544         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63545         OfferWithExplicitMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
63546 }
63547
63548 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_description"))) TS_OfferWithExplicitMetadataBuilder_description(uint64_t this_arg, jstring description) {
63549         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63550         this_arg_conv.inner = untag_ptr(this_arg);
63551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63553         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63554         LDKStr description_conv = str_ref_to_owned_c(description);
63555         OfferWithExplicitMetadataBuilder_description(this_arg_conv, description_conv);
63556 }
63557
63558 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_issuer"))) TS_OfferWithExplicitMetadataBuilder_issuer(uint64_t this_arg, jstring issuer) {
63559         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63560         this_arg_conv.inner = untag_ptr(this_arg);
63561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63563         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63564         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
63565         OfferWithExplicitMetadataBuilder_issuer(this_arg_conv, issuer_conv);
63566 }
63567
63568 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_path"))) TS_OfferWithExplicitMetadataBuilder_path(uint64_t this_arg, uint64_t path) {
63569         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63570         this_arg_conv.inner = untag_ptr(this_arg);
63571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63573         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63574         LDKBlindedPath path_conv;
63575         path_conv.inner = untag_ptr(path);
63576         path_conv.is_owned = ptr_is_owned(path);
63577         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63578         path_conv = BlindedPath_clone(&path_conv);
63579         OfferWithExplicitMetadataBuilder_path(this_arg_conv, path_conv);
63580 }
63581
63582 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_supported_quantity"))) TS_OfferWithExplicitMetadataBuilder_supported_quantity(uint64_t this_arg, uint64_t quantity) {
63583         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63584         this_arg_conv.inner = untag_ptr(this_arg);
63585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63587         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63588         void* quantity_ptr = untag_ptr(quantity);
63589         CHECK_ACCESS(quantity_ptr);
63590         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
63591         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
63592         OfferWithExplicitMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
63593 }
63594
63595 uint64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_build"))) TS_OfferWithExplicitMetadataBuilder_build(uint64_t this_arg) {
63596         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63597         this_arg_conv.inner = untag_ptr(this_arg);
63598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63600         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63601         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
63602         *ret_conv = OfferWithExplicitMetadataBuilder_build(this_arg_conv);
63603         return tag_ptr(ret_conv, true);
63604 }
63605
63606 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) {
63607         LDKPublicKey node_id_ref;
63608         CHECK(node_id->arr_len == 33);
63609         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
63610         LDKExpandedKey expanded_key_conv;
63611         expanded_key_conv.inner = untag_ptr(expanded_key);
63612         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
63613         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
63614         expanded_key_conv.is_owned = false;
63615         void* entropy_source_ptr = untag_ptr(entropy_source);
63616         CHECK_ACCESS(entropy_source_ptr);
63617         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
63618         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
63619                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63620                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
63621         }
63622         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(node_id_ref, &expanded_key_conv, entropy_source_conv);
63623         uint64_t ret_ref = 0;
63624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63626         return ret_ref;
63627 }
63628
63629 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_chain"))) TS_OfferWithDerivedMetadataBuilder_chain(uint64_t this_arg, uint32_t network) {
63630         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63631         this_arg_conv.inner = untag_ptr(this_arg);
63632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63634         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63635         LDKNetwork network_conv = LDKNetwork_from_js(network);
63636         OfferWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
63637 }
63638
63639 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_amount_msats"))) TS_OfferWithDerivedMetadataBuilder_amount_msats(uint64_t this_arg, int64_t amount_msats) {
63640         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63641         this_arg_conv.inner = untag_ptr(this_arg);
63642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63644         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63645         OfferWithDerivedMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
63646 }
63647
63648 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_absolute_expiry"))) TS_OfferWithDerivedMetadataBuilder_absolute_expiry(uint64_t this_arg, int64_t absolute_expiry) {
63649         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63650         this_arg_conv.inner = untag_ptr(this_arg);
63651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63653         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63654         OfferWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
63655 }
63656
63657 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_description"))) TS_OfferWithDerivedMetadataBuilder_description(uint64_t this_arg, jstring description) {
63658         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63659         this_arg_conv.inner = untag_ptr(this_arg);
63660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63662         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63663         LDKStr description_conv = str_ref_to_owned_c(description);
63664         OfferWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
63665 }
63666
63667 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_issuer"))) TS_OfferWithDerivedMetadataBuilder_issuer(uint64_t this_arg, jstring issuer) {
63668         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63669         this_arg_conv.inner = untag_ptr(this_arg);
63670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63672         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63673         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
63674         OfferWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
63675 }
63676
63677 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_path"))) TS_OfferWithDerivedMetadataBuilder_path(uint64_t this_arg, uint64_t path) {
63678         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63679         this_arg_conv.inner = untag_ptr(this_arg);
63680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63682         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63683         LDKBlindedPath path_conv;
63684         path_conv.inner = untag_ptr(path);
63685         path_conv.is_owned = ptr_is_owned(path);
63686         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63687         path_conv = BlindedPath_clone(&path_conv);
63688         OfferWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
63689 }
63690
63691 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_supported_quantity"))) TS_OfferWithDerivedMetadataBuilder_supported_quantity(uint64_t this_arg, uint64_t quantity) {
63692         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63693         this_arg_conv.inner = untag_ptr(this_arg);
63694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63696         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63697         void* quantity_ptr = untag_ptr(quantity);
63698         CHECK_ACCESS(quantity_ptr);
63699         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
63700         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
63701         OfferWithDerivedMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
63702 }
63703
63704 uint64_t  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_build"))) TS_OfferWithDerivedMetadataBuilder_build(uint64_t this_arg) {
63705         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63706         this_arg_conv.inner = untag_ptr(this_arg);
63707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63709         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63710         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
63711         *ret_conv = OfferWithDerivedMetadataBuilder_build(this_arg_conv);
63712         return tag_ptr(ret_conv, true);
63713 }
63714
63715 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
63716         LDKOffer this_obj_conv;
63717         this_obj_conv.inner = untag_ptr(this_obj);
63718         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63720         Offer_free(this_obj_conv);
63721 }
63722
63723 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
63724         LDKOffer ret_var = Offer_clone(arg);
63725         uint64_t ret_ref = 0;
63726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63728         return ret_ref;
63729 }
63730 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
63731         LDKOffer arg_conv;
63732         arg_conv.inner = untag_ptr(arg);
63733         arg_conv.is_owned = ptr_is_owned(arg);
63734         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63735         arg_conv.is_owned = false;
63736         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
63737         return ret_conv;
63738 }
63739
63740 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
63741         LDKOffer orig_conv;
63742         orig_conv.inner = untag_ptr(orig);
63743         orig_conv.is_owned = ptr_is_owned(orig);
63744         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63745         orig_conv.is_owned = false;
63746         LDKOffer ret_var = Offer_clone(&orig_conv);
63747         uint64_t ret_ref = 0;
63748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63750         return ret_ref;
63751 }
63752
63753 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
63754         LDKOffer this_arg_conv;
63755         this_arg_conv.inner = untag_ptr(this_arg);
63756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63758         this_arg_conv.is_owned = false;
63759         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
63760         ptrArray ret_arr = NULL;
63761         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
63762         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
63763         for (size_t m = 0; m < ret_var.datalen; m++) {
63764                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
63765                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
63766                 ret_arr_ptr[m] = ret_conv_12_arr;
63767         }
63768         
63769         FREE(ret_var.data);
63770         return ret_arr;
63771 }
63772
63773 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
63774         LDKOffer this_arg_conv;
63775         this_arg_conv.inner = untag_ptr(this_arg);
63776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63778         this_arg_conv.is_owned = false;
63779         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
63780         *ret_copy = Offer_metadata(&this_arg_conv);
63781         uint64_t ret_ref = tag_ptr(ret_copy, true);
63782         return ret_ref;
63783 }
63784
63785 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
63786         LDKOffer this_arg_conv;
63787         this_arg_conv.inner = untag_ptr(this_arg);
63788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63790         this_arg_conv.is_owned = false;
63791         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
63792         *ret_copy = Offer_amount(&this_arg_conv);
63793         uint64_t ret_ref = tag_ptr(ret_copy, true);
63794         return ret_ref;
63795 }
63796
63797 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
63798         LDKOffer this_arg_conv;
63799         this_arg_conv.inner = untag_ptr(this_arg);
63800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63802         this_arg_conv.is_owned = false;
63803         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
63804         uint64_t ret_ref = 0;
63805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63807         return ret_ref;
63808 }
63809
63810 uint64_t  __attribute__((export_name("TS_Offer_offer_features"))) TS_Offer_offer_features(uint64_t this_arg) {
63811         LDKOffer this_arg_conv;
63812         this_arg_conv.inner = untag_ptr(this_arg);
63813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63815         this_arg_conv.is_owned = false;
63816         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
63817         uint64_t ret_ref = 0;
63818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63820         return ret_ref;
63821 }
63822
63823 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
63824         LDKOffer this_arg_conv;
63825         this_arg_conv.inner = untag_ptr(this_arg);
63826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63828         this_arg_conv.is_owned = false;
63829         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
63830         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
63831         uint64_t ret_ref = tag_ptr(ret_copy, true);
63832         return ret_ref;
63833 }
63834
63835 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
63836         LDKOffer this_arg_conv;
63837         this_arg_conv.inner = untag_ptr(this_arg);
63838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63840         this_arg_conv.is_owned = false;
63841         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
63842         uint64_t ret_ref = 0;
63843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63845         return ret_ref;
63846 }
63847
63848 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
63849         LDKOffer this_arg_conv;
63850         this_arg_conv.inner = untag_ptr(this_arg);
63851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63853         this_arg_conv.is_owned = false;
63854         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
63855         uint64_tArray ret_arr = NULL;
63856         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63857         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63858         for (size_t n = 0; n < ret_var.datalen; n++) {
63859                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
63860                 uint64_t ret_conv_13_ref = 0;
63861                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
63862                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
63863                 ret_arr_ptr[n] = ret_conv_13_ref;
63864         }
63865         
63866         FREE(ret_var.data);
63867         return ret_arr;
63868 }
63869
63870 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
63871         LDKOffer this_arg_conv;
63872         this_arg_conv.inner = untag_ptr(this_arg);
63873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63875         this_arg_conv.is_owned = false;
63876         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
63877         *ret_copy = Offer_supported_quantity(&this_arg_conv);
63878         uint64_t ret_ref = tag_ptr(ret_copy, true);
63879         return ret_ref;
63880 }
63881
63882 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
63883         LDKOffer this_arg_conv;
63884         this_arg_conv.inner = untag_ptr(this_arg);
63885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63887         this_arg_conv.is_owned = false;
63888         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63889         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
63890         return ret_arr;
63891 }
63892
63893 uint64_t  __attribute__((export_name("TS_Offer_id"))) TS_Offer_id(uint64_t this_arg) {
63894         LDKOffer this_arg_conv;
63895         this_arg_conv.inner = untag_ptr(this_arg);
63896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63898         this_arg_conv.is_owned = false;
63899         LDKOfferId ret_var = Offer_id(&this_arg_conv);
63900         uint64_t ret_ref = 0;
63901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63903         return ret_ref;
63904 }
63905
63906 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
63907         LDKOffer this_arg_conv;
63908         this_arg_conv.inner = untag_ptr(this_arg);
63909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63911         this_arg_conv.is_owned = false;
63912         LDKThirtyTwoBytes chain_ref;
63913         CHECK(chain->arr_len == 32);
63914         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
63915         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
63916         return ret_conv;
63917 }
63918
63919 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) {
63920         LDKOffer this_arg_conv;
63921         this_arg_conv.inner = untag_ptr(this_arg);
63922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63924         this_arg_conv.is_owned = false;
63925         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
63926         return ret_conv;
63927 }
63928
63929 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
63930         LDKOffer this_arg_conv;
63931         this_arg_conv.inner = untag_ptr(this_arg);
63932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63934         this_arg_conv.is_owned = false;
63935         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
63936         return ret_conv;
63937 }
63938
63939 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
63940         LDKOffer this_arg_conv;
63941         this_arg_conv.inner = untag_ptr(this_arg);
63942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63944         this_arg_conv.is_owned = false;
63945         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
63946         return ret_conv;
63947 }
63948
63949 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) {
63950         LDKOffer this_arg_conv;
63951         this_arg_conv.inner = untag_ptr(this_arg);
63952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63954         this_arg_conv.is_owned = false;
63955         LDKExpandedKey expanded_key_conv;
63956         expanded_key_conv.inner = untag_ptr(expanded_key);
63957         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
63958         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
63959         expanded_key_conv.is_owned = false;
63960         void* entropy_source_ptr = untag_ptr(entropy_source);
63961         CHECK_ACCESS(entropy_source_ptr);
63962         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
63963         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
63964                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63965                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
63966         }
63967         LDKThirtyTwoBytes payment_id_ref;
63968         CHECK(payment_id->arr_len == 32);
63969         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
63970         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
63971         *ret_conv = Offer_request_invoice_deriving_payer_id(&this_arg_conv, &expanded_key_conv, entropy_source_conv, payment_id_ref);
63972         return tag_ptr(ret_conv, true);
63973 }
63974
63975 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) {
63976         LDKOffer this_arg_conv;
63977         this_arg_conv.inner = untag_ptr(this_arg);
63978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63980         this_arg_conv.is_owned = false;
63981         LDKPublicKey payer_id_ref;
63982         CHECK(payer_id->arr_len == 33);
63983         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
63984         LDKExpandedKey expanded_key_conv;
63985         expanded_key_conv.inner = untag_ptr(expanded_key);
63986         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
63987         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
63988         expanded_key_conv.is_owned = false;
63989         void* entropy_source_ptr = untag_ptr(entropy_source);
63990         CHECK_ACCESS(entropy_source_ptr);
63991         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
63992         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
63993                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63994                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
63995         }
63996         LDKThirtyTwoBytes payment_id_ref;
63997         CHECK(payment_id->arr_len == 32);
63998         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
63999         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
64000         *ret_conv = Offer_request_invoice_deriving_metadata(&this_arg_conv, payer_id_ref, &expanded_key_conv, entropy_source_conv, payment_id_ref);
64001         return tag_ptr(ret_conv, true);
64002 }
64003
64004 uint64_t  __attribute__((export_name("TS_Offer_request_invoice"))) TS_Offer_request_invoice(uint64_t this_arg, int8_tArray metadata, int8_tArray payer_id) {
64005         LDKOffer this_arg_conv;
64006         this_arg_conv.inner = untag_ptr(this_arg);
64007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64009         this_arg_conv.is_owned = false;
64010         LDKCVec_u8Z metadata_ref;
64011         metadata_ref.datalen = metadata->arr_len;
64012         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
64013         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
64014         LDKPublicKey payer_id_ref;
64015         CHECK(payer_id->arr_len == 33);
64016         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
64017         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
64018         *ret_conv = Offer_request_invoice(&this_arg_conv, metadata_ref, payer_id_ref);
64019         return tag_ptr(ret_conv, true);
64020 }
64021
64022 int64_t  __attribute__((export_name("TS_Offer_hash"))) TS_Offer_hash(uint64_t o) {
64023         LDKOffer o_conv;
64024         o_conv.inner = untag_ptr(o);
64025         o_conv.is_owned = ptr_is_owned(o);
64026         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64027         o_conv.is_owned = false;
64028         int64_t ret_conv = Offer_hash(&o_conv);
64029         return ret_conv;
64030 }
64031
64032 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
64033         LDKOffer obj_conv;
64034         obj_conv.inner = untag_ptr(obj);
64035         obj_conv.is_owned = ptr_is_owned(obj);
64036         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64037         obj_conv.is_owned = false;
64038         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
64039         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64040         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64041         CVec_u8Z_free(ret_var);
64042         return ret_arr;
64043 }
64044
64045 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_ptr) {
64046         if (!ptr_is_owned(this_ptr)) return;
64047         void* this_ptr_ptr = untag_ptr(this_ptr);
64048         CHECK_ACCESS(this_ptr_ptr);
64049         LDKAmount this_ptr_conv = *(LDKAmount*)(this_ptr_ptr);
64050         FREE(untag_ptr(this_ptr));
64051         Amount_free(this_ptr_conv);
64052 }
64053
64054 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
64055         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
64056         *ret_copy = Amount_clone(arg);
64057         uint64_t ret_ref = tag_ptr(ret_copy, true);
64058         return ret_ref;
64059 }
64060 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
64061         LDKAmount* arg_conv = (LDKAmount*)untag_ptr(arg);
64062         int64_t ret_conv = Amount_clone_ptr(arg_conv);
64063         return ret_conv;
64064 }
64065
64066 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
64067         LDKAmount* orig_conv = (LDKAmount*)untag_ptr(orig);
64068         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
64069         *ret_copy = Amount_clone(orig_conv);
64070         uint64_t ret_ref = tag_ptr(ret_copy, true);
64071         return ret_ref;
64072 }
64073
64074 uint64_t  __attribute__((export_name("TS_Amount_bitcoin"))) TS_Amount_bitcoin(int64_t amount_msats) {
64075         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
64076         *ret_copy = Amount_bitcoin(amount_msats);
64077         uint64_t ret_ref = tag_ptr(ret_copy, true);
64078         return ret_ref;
64079 }
64080
64081 uint64_t  __attribute__((export_name("TS_Amount_currency"))) TS_Amount_currency(int8_tArray iso4217_code, int64_t amount) {
64082         LDKThreeBytes iso4217_code_ref;
64083         CHECK(iso4217_code->arr_len == 3);
64084         memcpy(iso4217_code_ref.data, iso4217_code->elems, 3); FREE(iso4217_code);
64085         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
64086         *ret_copy = Amount_currency(iso4217_code_ref, amount);
64087         uint64_t ret_ref = tag_ptr(ret_copy, true);
64088         return ret_ref;
64089 }
64090
64091 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_ptr) {
64092         if (!ptr_is_owned(this_ptr)) return;
64093         void* this_ptr_ptr = untag_ptr(this_ptr);
64094         CHECK_ACCESS(this_ptr_ptr);
64095         LDKQuantity this_ptr_conv = *(LDKQuantity*)(this_ptr_ptr);
64096         FREE(untag_ptr(this_ptr));
64097         Quantity_free(this_ptr_conv);
64098 }
64099
64100 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
64101         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64102         *ret_copy = Quantity_clone(arg);
64103         uint64_t ret_ref = tag_ptr(ret_copy, true);
64104         return ret_ref;
64105 }
64106 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
64107         LDKQuantity* arg_conv = (LDKQuantity*)untag_ptr(arg);
64108         int64_t ret_conv = Quantity_clone_ptr(arg_conv);
64109         return ret_conv;
64110 }
64111
64112 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
64113         LDKQuantity* orig_conv = (LDKQuantity*)untag_ptr(orig);
64114         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64115         *ret_copy = Quantity_clone(orig_conv);
64116         uint64_t ret_ref = tag_ptr(ret_copy, true);
64117         return ret_ref;
64118 }
64119
64120 uint64_t  __attribute__((export_name("TS_Quantity_bounded"))) TS_Quantity_bounded(int64_t a) {
64121         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64122         *ret_copy = Quantity_bounded(a);
64123         uint64_t ret_ref = tag_ptr(ret_copy, true);
64124         return ret_ref;
64125 }
64126
64127 uint64_t  __attribute__((export_name("TS_Quantity_unbounded"))) TS_Quantity_unbounded() {
64128         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64129         *ret_copy = Quantity_unbounded();
64130         uint64_t ret_ref = tag_ptr(ret_copy, true);
64131         return ret_ref;
64132 }
64133
64134 uint64_t  __attribute__((export_name("TS_Quantity_one"))) TS_Quantity_one() {
64135         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64136         *ret_copy = Quantity_one();
64137         uint64_t ret_ref = tag_ptr(ret_copy, true);
64138         return ret_ref;
64139 }
64140
64141 uint64_t  __attribute__((export_name("TS_Offer_from_str"))) TS_Offer_from_str(jstring s) {
64142         LDKStr s_conv = str_ref_to_owned_c(s);
64143         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
64144         *ret_conv = Offer_from_str(s_conv);
64145         return tag_ptr(ret_conv, true);
64146 }
64147
64148 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_free"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_free(uint64_t this_obj) {
64149         LDKInvoiceWithExplicitSigningPubkeyBuilder this_obj_conv;
64150         this_obj_conv.inner = untag_ptr(this_obj);
64151         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64153         InvoiceWithExplicitSigningPubkeyBuilder_free(this_obj_conv);
64154 }
64155
64156 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_free"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_free(uint64_t this_obj) {
64157         LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj_conv;
64158         this_obj_conv.inner = untag_ptr(this_obj);
64159         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64161         InvoiceWithDerivedSigningPubkeyBuilder_free(this_obj_conv);
64162 }
64163
64164 uint64_t  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_build"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_build(uint64_t this_arg) {
64165         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64166         this_arg_conv.inner = untag_ptr(this_arg);
64167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64169         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64170         
64171         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
64172         *ret_conv = InvoiceWithExplicitSigningPubkeyBuilder_build(this_arg_conv);
64173         return tag_ptr(ret_conv, true);
64174 }
64175
64176 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(uint64_t this_arg, int32_t relative_expiry_secs) {
64177         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64178         this_arg_conv.inner = untag_ptr(this_arg);
64179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64181         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64182         
64183         InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
64184 }
64185
64186 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(uint64_t this_arg, int8_tArray script_hash) {
64187         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64188         this_arg_conv.inner = untag_ptr(this_arg);
64189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64191         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64192         
64193         uint8_t script_hash_arr[32];
64194         CHECK(script_hash->arr_len == 32);
64195         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
64196         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
64197         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
64198 }
64199
64200 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(uint64_t this_arg, int8_tArray pubkey_hash) {
64201         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64202         this_arg_conv.inner = untag_ptr(this_arg);
64203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64205         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64206         
64207         uint8_t pubkey_hash_arr[20];
64208         CHECK(pubkey_hash->arr_len == 20);
64209         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
64210         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
64211         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
64212 }
64213
64214 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(uint64_t this_arg, int8_tArray utput_key) {
64215         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64216         this_arg_conv.inner = untag_ptr(this_arg);
64217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64219         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64220         
64221         LDKTweakedPublicKey utput_key_ref;
64222         CHECK(utput_key->arr_len == 32);
64223         memcpy(utput_key_ref.x_coordinate, utput_key->elems, 32); FREE(utput_key);
64224         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
64225 }
64226
64227 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(uint64_t this_arg) {
64228         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64229         this_arg_conv.inner = untag_ptr(this_arg);
64230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64232         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64233         
64234         InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(this_arg_conv);
64235 }
64236
64237 uint64_t  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(uint64_t this_arg) {
64238         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64239         this_arg_conv.inner = untag_ptr(this_arg);
64240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64242         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64243         
64244         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
64245         *ret_conv = InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(this_arg_conv);
64246         return tag_ptr(ret_conv, true);
64247 }
64248
64249 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(uint64_t this_arg, int32_t relative_expiry_secs) {
64250         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64251         this_arg_conv.inner = untag_ptr(this_arg);
64252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64254         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64255         
64256         InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
64257 }
64258
64259 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(uint64_t this_arg, int8_tArray script_hash) {
64260         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64261         this_arg_conv.inner = untag_ptr(this_arg);
64262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64264         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64265         
64266         uint8_t script_hash_arr[32];
64267         CHECK(script_hash->arr_len == 32);
64268         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
64269         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
64270         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
64271 }
64272
64273 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(uint64_t this_arg, int8_tArray pubkey_hash) {
64274         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64275         this_arg_conv.inner = untag_ptr(this_arg);
64276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64278         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64279         
64280         uint8_t pubkey_hash_arr[20];
64281         CHECK(pubkey_hash->arr_len == 20);
64282         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
64283         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
64284         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
64285 }
64286
64287 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(uint64_t this_arg, int8_tArray utput_key) {
64288         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64289         this_arg_conv.inner = untag_ptr(this_arg);
64290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64292         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64293         
64294         LDKTweakedPublicKey utput_key_ref;
64295         CHECK(utput_key->arr_len == 32);
64296         memcpy(utput_key_ref.x_coordinate, utput_key->elems, 32); FREE(utput_key);
64297         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
64298 }
64299
64300 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(uint64_t this_arg) {
64301         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64302         this_arg_conv.inner = untag_ptr(this_arg);
64303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64305         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64306         
64307         InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(this_arg_conv);
64308 }
64309
64310 void  __attribute__((export_name("TS_UnsignedBolt12Invoice_free"))) TS_UnsignedBolt12Invoice_free(uint64_t this_obj) {
64311         LDKUnsignedBolt12Invoice this_obj_conv;
64312         this_obj_conv.inner = untag_ptr(this_obj);
64313         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64315         UnsignedBolt12Invoice_free(this_obj_conv);
64316 }
64317
64318 static inline uint64_t UnsignedBolt12Invoice_clone_ptr(LDKUnsignedBolt12Invoice *NONNULL_PTR arg) {
64319         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(arg);
64320         uint64_t ret_ref = 0;
64321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64323         return ret_ref;
64324 }
64325 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_clone_ptr"))) TS_UnsignedBolt12Invoice_clone_ptr(uint64_t arg) {
64326         LDKUnsignedBolt12Invoice arg_conv;
64327         arg_conv.inner = untag_ptr(arg);
64328         arg_conv.is_owned = ptr_is_owned(arg);
64329         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64330         arg_conv.is_owned = false;
64331         int64_t ret_conv = UnsignedBolt12Invoice_clone_ptr(&arg_conv);
64332         return ret_conv;
64333 }
64334
64335 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_clone"))) TS_UnsignedBolt12Invoice_clone(uint64_t orig) {
64336         LDKUnsignedBolt12Invoice orig_conv;
64337         orig_conv.inner = untag_ptr(orig);
64338         orig_conv.is_owned = ptr_is_owned(orig);
64339         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64340         orig_conv.is_owned = false;
64341         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(&orig_conv);
64342         uint64_t ret_ref = 0;
64343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64345         return ret_ref;
64346 }
64347
64348 void  __attribute__((export_name("TS_SignBolt12InvoiceFn_free"))) TS_SignBolt12InvoiceFn_free(uint64_t this_ptr) {
64349         if (!ptr_is_owned(this_ptr)) return;
64350         void* this_ptr_ptr = untag_ptr(this_ptr);
64351         CHECK_ACCESS(this_ptr_ptr);
64352         LDKSignBolt12InvoiceFn this_ptr_conv = *(LDKSignBolt12InvoiceFn*)(this_ptr_ptr);
64353         FREE(untag_ptr(this_ptr));
64354         SignBolt12InvoiceFn_free(this_ptr_conv);
64355 }
64356
64357 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_tagged_hash"))) TS_UnsignedBolt12Invoice_tagged_hash(uint64_t this_arg) {
64358         LDKUnsignedBolt12Invoice this_arg_conv;
64359         this_arg_conv.inner = untag_ptr(this_arg);
64360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64362         this_arg_conv.is_owned = false;
64363         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
64364         uint64_t ret_ref = 0;
64365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64367         return ret_ref;
64368 }
64369
64370 void  __attribute__((export_name("TS_Bolt12Invoice_free"))) TS_Bolt12Invoice_free(uint64_t this_obj) {
64371         LDKBolt12Invoice this_obj_conv;
64372         this_obj_conv.inner = untag_ptr(this_obj);
64373         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64375         Bolt12Invoice_free(this_obj_conv);
64376 }
64377
64378 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
64379         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
64380         uint64_t ret_ref = 0;
64381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64383         return ret_ref;
64384 }
64385 int64_t  __attribute__((export_name("TS_Bolt12Invoice_clone_ptr"))) TS_Bolt12Invoice_clone_ptr(uint64_t arg) {
64386         LDKBolt12Invoice arg_conv;
64387         arg_conv.inner = untag_ptr(arg);
64388         arg_conv.is_owned = ptr_is_owned(arg);
64389         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64390         arg_conv.is_owned = false;
64391         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
64392         return ret_conv;
64393 }
64394
64395 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_clone"))) TS_Bolt12Invoice_clone(uint64_t orig) {
64396         LDKBolt12Invoice orig_conv;
64397         orig_conv.inner = untag_ptr(orig);
64398         orig_conv.is_owned = ptr_is_owned(orig);
64399         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64400         orig_conv.is_owned = false;
64401         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
64402         uint64_t ret_ref = 0;
64403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64405         return ret_ref;
64406 }
64407
64408 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_chains"))) TS_UnsignedBolt12Invoice_offer_chains(uint64_t this_arg) {
64409         LDKUnsignedBolt12Invoice this_arg_conv;
64410         this_arg_conv.inner = untag_ptr(this_arg);
64411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64413         this_arg_conv.is_owned = false;
64414         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
64415         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
64416         uint64_t ret_ref = tag_ptr(ret_copy, true);
64417         return ret_ref;
64418 }
64419
64420 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_chain"))) TS_UnsignedBolt12Invoice_chain(uint64_t this_arg) {
64421         LDKUnsignedBolt12Invoice this_arg_conv;
64422         this_arg_conv.inner = untag_ptr(this_arg);
64423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64425         this_arg_conv.is_owned = false;
64426         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64427         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
64428         return ret_arr;
64429 }
64430
64431 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_metadata"))) TS_UnsignedBolt12Invoice_metadata(uint64_t this_arg) {
64432         LDKUnsignedBolt12Invoice this_arg_conv;
64433         this_arg_conv.inner = untag_ptr(this_arg);
64434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64436         this_arg_conv.is_owned = false;
64437         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64438         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
64439         uint64_t ret_ref = tag_ptr(ret_copy, true);
64440         return ret_ref;
64441 }
64442
64443 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount"))) TS_UnsignedBolt12Invoice_amount(uint64_t this_arg) {
64444         LDKUnsignedBolt12Invoice this_arg_conv;
64445         this_arg_conv.inner = untag_ptr(this_arg);
64446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64448         this_arg_conv.is_owned = false;
64449         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
64450         *ret_copy = UnsignedBolt12Invoice_amount(&this_arg_conv);
64451         uint64_t ret_ref = tag_ptr(ret_copy, true);
64452         return ret_ref;
64453 }
64454
64455 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_features"))) TS_UnsignedBolt12Invoice_offer_features(uint64_t this_arg) {
64456         LDKUnsignedBolt12Invoice this_arg_conv;
64457         this_arg_conv.inner = untag_ptr(this_arg);
64458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64460         this_arg_conv.is_owned = false;
64461         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
64462         uint64_t ret_ref = 0;
64463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64465         return ret_ref;
64466 }
64467
64468 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_description"))) TS_UnsignedBolt12Invoice_description(uint64_t this_arg) {
64469         LDKUnsignedBolt12Invoice this_arg_conv;
64470         this_arg_conv.inner = untag_ptr(this_arg);
64471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64473         this_arg_conv.is_owned = false;
64474         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
64475         uint64_t ret_ref = 0;
64476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64478         return ret_ref;
64479 }
64480
64481 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_absolute_expiry"))) TS_UnsignedBolt12Invoice_absolute_expiry(uint64_t this_arg) {
64482         LDKUnsignedBolt12Invoice this_arg_conv;
64483         this_arg_conv.inner = untag_ptr(this_arg);
64484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64486         this_arg_conv.is_owned = false;
64487         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64488         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
64489         uint64_t ret_ref = tag_ptr(ret_copy, true);
64490         return ret_ref;
64491 }
64492
64493 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_issuer"))) TS_UnsignedBolt12Invoice_issuer(uint64_t this_arg) {
64494         LDKUnsignedBolt12Invoice this_arg_conv;
64495         this_arg_conv.inner = untag_ptr(this_arg);
64496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64498         this_arg_conv.is_owned = false;
64499         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
64500         uint64_t ret_ref = 0;
64501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64503         return ret_ref;
64504 }
64505
64506 uint64_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_message_paths"))) TS_UnsignedBolt12Invoice_message_paths(uint64_t this_arg) {
64507         LDKUnsignedBolt12Invoice this_arg_conv;
64508         this_arg_conv.inner = untag_ptr(this_arg);
64509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64511         this_arg_conv.is_owned = false;
64512         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
64513         uint64_tArray ret_arr = NULL;
64514         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64515         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64516         for (size_t n = 0; n < ret_var.datalen; n++) {
64517                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
64518                 uint64_t ret_conv_13_ref = 0;
64519                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
64520                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
64521                 ret_arr_ptr[n] = ret_conv_13_ref;
64522         }
64523         
64524         FREE(ret_var.data);
64525         return ret_arr;
64526 }
64527
64528 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_supported_quantity"))) TS_UnsignedBolt12Invoice_supported_quantity(uint64_t this_arg) {
64529         LDKUnsignedBolt12Invoice this_arg_conv;
64530         this_arg_conv.inner = untag_ptr(this_arg);
64531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64533         this_arg_conv.is_owned = false;
64534         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
64535         *ret_copy = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
64536         uint64_t ret_ref = tag_ptr(ret_copy, true);
64537         return ret_ref;
64538 }
64539
64540 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_metadata"))) TS_UnsignedBolt12Invoice_payer_metadata(uint64_t this_arg) {
64541         LDKUnsignedBolt12Invoice this_arg_conv;
64542         this_arg_conv.inner = untag_ptr(this_arg);
64543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64545         this_arg_conv.is_owned = false;
64546         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
64547         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64548         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64549         return ret_arr;
64550 }
64551
64552 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_request_features"))) TS_UnsignedBolt12Invoice_invoice_request_features(uint64_t this_arg) {
64553         LDKUnsignedBolt12Invoice this_arg_conv;
64554         this_arg_conv.inner = untag_ptr(this_arg);
64555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64557         this_arg_conv.is_owned = false;
64558         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
64559         uint64_t ret_ref = 0;
64560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64562         return ret_ref;
64563 }
64564
64565 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_quantity"))) TS_UnsignedBolt12Invoice_quantity(uint64_t this_arg) {
64566         LDKUnsignedBolt12Invoice this_arg_conv;
64567         this_arg_conv.inner = untag_ptr(this_arg);
64568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64570         this_arg_conv.is_owned = false;
64571         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64572         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
64573         uint64_t ret_ref = tag_ptr(ret_copy, true);
64574         return ret_ref;
64575 }
64576
64577 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_id"))) TS_UnsignedBolt12Invoice_payer_id(uint64_t this_arg) {
64578         LDKUnsignedBolt12Invoice this_arg_conv;
64579         this_arg_conv.inner = untag_ptr(this_arg);
64580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64582         this_arg_conv.is_owned = false;
64583         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64584         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
64585         return ret_arr;
64586 }
64587
64588 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_note"))) TS_UnsignedBolt12Invoice_payer_note(uint64_t this_arg) {
64589         LDKUnsignedBolt12Invoice this_arg_conv;
64590         this_arg_conv.inner = untag_ptr(this_arg);
64591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64593         this_arg_conv.is_owned = false;
64594         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
64595         uint64_t ret_ref = 0;
64596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64598         return ret_ref;
64599 }
64600
64601 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_created_at"))) TS_UnsignedBolt12Invoice_created_at(uint64_t this_arg) {
64602         LDKUnsignedBolt12Invoice this_arg_conv;
64603         this_arg_conv.inner = untag_ptr(this_arg);
64604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64606         this_arg_conv.is_owned = false;
64607         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
64608         return ret_conv;
64609 }
64610
64611 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_relative_expiry"))) TS_UnsignedBolt12Invoice_relative_expiry(uint64_t this_arg) {
64612         LDKUnsignedBolt12Invoice this_arg_conv;
64613         this_arg_conv.inner = untag_ptr(this_arg);
64614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64616         this_arg_conv.is_owned = false;
64617         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
64618         return ret_conv;
64619 }
64620
64621 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payment_hash"))) TS_UnsignedBolt12Invoice_payment_hash(uint64_t this_arg) {
64622         LDKUnsignedBolt12Invoice this_arg_conv;
64623         this_arg_conv.inner = untag_ptr(this_arg);
64624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64626         this_arg_conv.is_owned = false;
64627         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64628         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
64629         return ret_arr;
64630 }
64631
64632 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount_msats"))) TS_UnsignedBolt12Invoice_amount_msats(uint64_t this_arg) {
64633         LDKUnsignedBolt12Invoice this_arg_conv;
64634         this_arg_conv.inner = untag_ptr(this_arg);
64635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64637         this_arg_conv.is_owned = false;
64638         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
64639         return ret_conv;
64640 }
64641
64642 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_features"))) TS_UnsignedBolt12Invoice_invoice_features(uint64_t this_arg) {
64643         LDKUnsignedBolt12Invoice this_arg_conv;
64644         this_arg_conv.inner = untag_ptr(this_arg);
64645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64647         this_arg_conv.is_owned = false;
64648         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
64649         uint64_t ret_ref = 0;
64650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64652         return ret_ref;
64653 }
64654
64655 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_signing_pubkey"))) TS_UnsignedBolt12Invoice_signing_pubkey(uint64_t this_arg) {
64656         LDKUnsignedBolt12Invoice this_arg_conv;
64657         this_arg_conv.inner = untag_ptr(this_arg);
64658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64660         this_arg_conv.is_owned = false;
64661         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64662         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
64663         return ret_arr;
64664 }
64665
64666 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_chains"))) TS_Bolt12Invoice_offer_chains(uint64_t this_arg) {
64667         LDKBolt12Invoice this_arg_conv;
64668         this_arg_conv.inner = untag_ptr(this_arg);
64669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64671         this_arg_conv.is_owned = false;
64672         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
64673         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
64674         uint64_t ret_ref = tag_ptr(ret_copy, true);
64675         return ret_ref;
64676 }
64677
64678 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_chain"))) TS_Bolt12Invoice_chain(uint64_t this_arg) {
64679         LDKBolt12Invoice this_arg_conv;
64680         this_arg_conv.inner = untag_ptr(this_arg);
64681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64683         this_arg_conv.is_owned = false;
64684         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64685         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
64686         return ret_arr;
64687 }
64688
64689 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_metadata"))) TS_Bolt12Invoice_metadata(uint64_t this_arg) {
64690         LDKBolt12Invoice this_arg_conv;
64691         this_arg_conv.inner = untag_ptr(this_arg);
64692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64694         this_arg_conv.is_owned = false;
64695         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64696         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
64697         uint64_t ret_ref = tag_ptr(ret_copy, true);
64698         return ret_ref;
64699 }
64700
64701 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_amount"))) TS_Bolt12Invoice_amount(uint64_t this_arg) {
64702         LDKBolt12Invoice this_arg_conv;
64703         this_arg_conv.inner = untag_ptr(this_arg);
64704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64706         this_arg_conv.is_owned = false;
64707         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
64708         *ret_copy = Bolt12Invoice_amount(&this_arg_conv);
64709         uint64_t ret_ref = tag_ptr(ret_copy, true);
64710         return ret_ref;
64711 }
64712
64713 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_features"))) TS_Bolt12Invoice_offer_features(uint64_t this_arg) {
64714         LDKBolt12Invoice this_arg_conv;
64715         this_arg_conv.inner = untag_ptr(this_arg);
64716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64718         this_arg_conv.is_owned = false;
64719         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
64720         uint64_t ret_ref = 0;
64721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64723         return ret_ref;
64724 }
64725
64726 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_description"))) TS_Bolt12Invoice_description(uint64_t this_arg) {
64727         LDKBolt12Invoice this_arg_conv;
64728         this_arg_conv.inner = untag_ptr(this_arg);
64729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64731         this_arg_conv.is_owned = false;
64732         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
64733         uint64_t ret_ref = 0;
64734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64736         return ret_ref;
64737 }
64738
64739 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_absolute_expiry"))) TS_Bolt12Invoice_absolute_expiry(uint64_t this_arg) {
64740         LDKBolt12Invoice this_arg_conv;
64741         this_arg_conv.inner = untag_ptr(this_arg);
64742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64744         this_arg_conv.is_owned = false;
64745         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64746         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
64747         uint64_t ret_ref = tag_ptr(ret_copy, true);
64748         return ret_ref;
64749 }
64750
64751 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_issuer"))) TS_Bolt12Invoice_issuer(uint64_t this_arg) {
64752         LDKBolt12Invoice this_arg_conv;
64753         this_arg_conv.inner = untag_ptr(this_arg);
64754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64756         this_arg_conv.is_owned = false;
64757         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
64758         uint64_t ret_ref = 0;
64759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64761         return ret_ref;
64762 }
64763
64764 uint64_tArray  __attribute__((export_name("TS_Bolt12Invoice_message_paths"))) TS_Bolt12Invoice_message_paths(uint64_t this_arg) {
64765         LDKBolt12Invoice this_arg_conv;
64766         this_arg_conv.inner = untag_ptr(this_arg);
64767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64769         this_arg_conv.is_owned = false;
64770         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
64771         uint64_tArray ret_arr = NULL;
64772         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64773         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64774         for (size_t n = 0; n < ret_var.datalen; n++) {
64775                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
64776                 uint64_t ret_conv_13_ref = 0;
64777                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
64778                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
64779                 ret_arr_ptr[n] = ret_conv_13_ref;
64780         }
64781         
64782         FREE(ret_var.data);
64783         return ret_arr;
64784 }
64785
64786 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_supported_quantity"))) TS_Bolt12Invoice_supported_quantity(uint64_t this_arg) {
64787         LDKBolt12Invoice this_arg_conv;
64788         this_arg_conv.inner = untag_ptr(this_arg);
64789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64791         this_arg_conv.is_owned = false;
64792         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
64793         *ret_copy = Bolt12Invoice_supported_quantity(&this_arg_conv);
64794         uint64_t ret_ref = tag_ptr(ret_copy, true);
64795         return ret_ref;
64796 }
64797
64798 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_metadata"))) TS_Bolt12Invoice_payer_metadata(uint64_t this_arg) {
64799         LDKBolt12Invoice this_arg_conv;
64800         this_arg_conv.inner = untag_ptr(this_arg);
64801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64803         this_arg_conv.is_owned = false;
64804         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
64805         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64806         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64807         return ret_arr;
64808 }
64809
64810 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_request_features"))) TS_Bolt12Invoice_invoice_request_features(uint64_t this_arg) {
64811         LDKBolt12Invoice this_arg_conv;
64812         this_arg_conv.inner = untag_ptr(this_arg);
64813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64815         this_arg_conv.is_owned = false;
64816         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
64817         uint64_t ret_ref = 0;
64818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64820         return ret_ref;
64821 }
64822
64823 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_quantity"))) TS_Bolt12Invoice_quantity(uint64_t this_arg) {
64824         LDKBolt12Invoice this_arg_conv;
64825         this_arg_conv.inner = untag_ptr(this_arg);
64826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64828         this_arg_conv.is_owned = false;
64829         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64830         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
64831         uint64_t ret_ref = tag_ptr(ret_copy, true);
64832         return ret_ref;
64833 }
64834
64835 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_id"))) TS_Bolt12Invoice_payer_id(uint64_t this_arg) {
64836         LDKBolt12Invoice this_arg_conv;
64837         this_arg_conv.inner = untag_ptr(this_arg);
64838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64840         this_arg_conv.is_owned = false;
64841         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64842         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
64843         return ret_arr;
64844 }
64845
64846 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_payer_note"))) TS_Bolt12Invoice_payer_note(uint64_t this_arg) {
64847         LDKBolt12Invoice this_arg_conv;
64848         this_arg_conv.inner = untag_ptr(this_arg);
64849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64851         this_arg_conv.is_owned = false;
64852         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
64853         uint64_t ret_ref = 0;
64854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64856         return ret_ref;
64857 }
64858
64859 int64_t  __attribute__((export_name("TS_Bolt12Invoice_created_at"))) TS_Bolt12Invoice_created_at(uint64_t this_arg) {
64860         LDKBolt12Invoice this_arg_conv;
64861         this_arg_conv.inner = untag_ptr(this_arg);
64862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64864         this_arg_conv.is_owned = false;
64865         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
64866         return ret_conv;
64867 }
64868
64869 int64_t  __attribute__((export_name("TS_Bolt12Invoice_relative_expiry"))) TS_Bolt12Invoice_relative_expiry(uint64_t this_arg) {
64870         LDKBolt12Invoice this_arg_conv;
64871         this_arg_conv.inner = untag_ptr(this_arg);
64872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64874         this_arg_conv.is_owned = false;
64875         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
64876         return ret_conv;
64877 }
64878
64879 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payment_hash"))) TS_Bolt12Invoice_payment_hash(uint64_t this_arg) {
64880         LDKBolt12Invoice this_arg_conv;
64881         this_arg_conv.inner = untag_ptr(this_arg);
64882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64884         this_arg_conv.is_owned = false;
64885         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64886         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
64887         return ret_arr;
64888 }
64889
64890 int64_t  __attribute__((export_name("TS_Bolt12Invoice_amount_msats"))) TS_Bolt12Invoice_amount_msats(uint64_t this_arg) {
64891         LDKBolt12Invoice this_arg_conv;
64892         this_arg_conv.inner = untag_ptr(this_arg);
64893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64895         this_arg_conv.is_owned = false;
64896         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
64897         return ret_conv;
64898 }
64899
64900 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_features"))) TS_Bolt12Invoice_invoice_features(uint64_t this_arg) {
64901         LDKBolt12Invoice this_arg_conv;
64902         this_arg_conv.inner = untag_ptr(this_arg);
64903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64905         this_arg_conv.is_owned = false;
64906         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
64907         uint64_t ret_ref = 0;
64908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64910         return ret_ref;
64911 }
64912
64913 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signing_pubkey"))) TS_Bolt12Invoice_signing_pubkey(uint64_t this_arg) {
64914         LDKBolt12Invoice this_arg_conv;
64915         this_arg_conv.inner = untag_ptr(this_arg);
64916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64918         this_arg_conv.is_owned = false;
64919         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64920         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
64921         return ret_arr;
64922 }
64923
64924 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signature"))) TS_Bolt12Invoice_signature(uint64_t this_arg) {
64925         LDKBolt12Invoice this_arg_conv;
64926         this_arg_conv.inner = untag_ptr(this_arg);
64927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64929         this_arg_conv.is_owned = false;
64930         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
64931         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
64932         return ret_arr;
64933 }
64934
64935 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signable_hash"))) TS_Bolt12Invoice_signable_hash(uint64_t this_arg) {
64936         LDKBolt12Invoice this_arg_conv;
64937         this_arg_conv.inner = untag_ptr(this_arg);
64938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64940         this_arg_conv.is_owned = false;
64941         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64942         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
64943         return ret_arr;
64944 }
64945
64946 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_verify"))) TS_Bolt12Invoice_verify(uint64_t this_arg, uint64_t key) {
64947         LDKBolt12Invoice this_arg_conv;
64948         this_arg_conv.inner = untag_ptr(this_arg);
64949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64951         this_arg_conv.is_owned = false;
64952         LDKExpandedKey key_conv;
64953         key_conv.inner = untag_ptr(key);
64954         key_conv.is_owned = ptr_is_owned(key);
64955         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
64956         key_conv.is_owned = false;
64957         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
64958         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
64959         return tag_ptr(ret_conv, true);
64960 }
64961
64962 int64_t  __attribute__((export_name("TS_Bolt12Invoice_hash"))) TS_Bolt12Invoice_hash(uint64_t o) {
64963         LDKBolt12Invoice o_conv;
64964         o_conv.inner = untag_ptr(o);
64965         o_conv.is_owned = ptr_is_owned(o);
64966         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64967         o_conv.is_owned = false;
64968         int64_t ret_conv = Bolt12Invoice_hash(&o_conv);
64969         return ret_conv;
64970 }
64971
64972 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_write"))) TS_UnsignedBolt12Invoice_write(uint64_t obj) {
64973         LDKUnsignedBolt12Invoice obj_conv;
64974         obj_conv.inner = untag_ptr(obj);
64975         obj_conv.is_owned = ptr_is_owned(obj);
64976         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64977         obj_conv.is_owned = false;
64978         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
64979         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64980         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64981         CVec_u8Z_free(ret_var);
64982         return ret_arr;
64983 }
64984
64985 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_write"))) TS_Bolt12Invoice_write(uint64_t obj) {
64986         LDKBolt12Invoice obj_conv;
64987         obj_conv.inner = untag_ptr(obj);
64988         obj_conv.is_owned = ptr_is_owned(obj);
64989         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64990         obj_conv.is_owned = false;
64991         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
64992         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64993         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64994         CVec_u8Z_free(ret_var);
64995         return ret_arr;
64996 }
64997
64998 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
64999         LDKBlindedPayInfo this_obj_conv;
65000         this_obj_conv.inner = untag_ptr(this_obj);
65001         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65003         BlindedPayInfo_free(this_obj_conv);
65004 }
65005
65006 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
65007         LDKBlindedPayInfo this_ptr_conv;
65008         this_ptr_conv.inner = untag_ptr(this_ptr);
65009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65011         this_ptr_conv.is_owned = false;
65012         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
65013         return ret_conv;
65014 }
65015
65016 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
65017         LDKBlindedPayInfo this_ptr_conv;
65018         this_ptr_conv.inner = untag_ptr(this_ptr);
65019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65021         this_ptr_conv.is_owned = false;
65022         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
65023 }
65024
65025 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
65026         LDKBlindedPayInfo this_ptr_conv;
65027         this_ptr_conv.inner = untag_ptr(this_ptr);
65028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65030         this_ptr_conv.is_owned = false;
65031         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
65032         return ret_conv;
65033 }
65034
65035 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
65036         LDKBlindedPayInfo this_ptr_conv;
65037         this_ptr_conv.inner = untag_ptr(this_ptr);
65038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65040         this_ptr_conv.is_owned = false;
65041         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
65042 }
65043
65044 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
65045         LDKBlindedPayInfo this_ptr_conv;
65046         this_ptr_conv.inner = untag_ptr(this_ptr);
65047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65049         this_ptr_conv.is_owned = false;
65050         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
65051         return ret_conv;
65052 }
65053
65054 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
65055         LDKBlindedPayInfo this_ptr_conv;
65056         this_ptr_conv.inner = untag_ptr(this_ptr);
65057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65059         this_ptr_conv.is_owned = false;
65060         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
65061 }
65062
65063 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
65064         LDKBlindedPayInfo this_ptr_conv;
65065         this_ptr_conv.inner = untag_ptr(this_ptr);
65066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65068         this_ptr_conv.is_owned = false;
65069         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
65070         return ret_conv;
65071 }
65072
65073 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
65074         LDKBlindedPayInfo this_ptr_conv;
65075         this_ptr_conv.inner = untag_ptr(this_ptr);
65076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65078         this_ptr_conv.is_owned = false;
65079         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
65080 }
65081
65082 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
65083         LDKBlindedPayInfo this_ptr_conv;
65084         this_ptr_conv.inner = untag_ptr(this_ptr);
65085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65087         this_ptr_conv.is_owned = false;
65088         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
65089         return ret_conv;
65090 }
65091
65092 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
65093         LDKBlindedPayInfo this_ptr_conv;
65094         this_ptr_conv.inner = untag_ptr(this_ptr);
65095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65097         this_ptr_conv.is_owned = false;
65098         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
65099 }
65100
65101 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
65102         LDKBlindedPayInfo this_ptr_conv;
65103         this_ptr_conv.inner = untag_ptr(this_ptr);
65104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65106         this_ptr_conv.is_owned = false;
65107         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
65108         uint64_t ret_ref = 0;
65109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65111         return ret_ref;
65112 }
65113
65114 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
65115         LDKBlindedPayInfo this_ptr_conv;
65116         this_ptr_conv.inner = untag_ptr(this_ptr);
65117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65119         this_ptr_conv.is_owned = false;
65120         LDKBlindedHopFeatures val_conv;
65121         val_conv.inner = untag_ptr(val);
65122         val_conv.is_owned = ptr_is_owned(val);
65123         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65124         val_conv = BlindedHopFeatures_clone(&val_conv);
65125         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
65126 }
65127
65128 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) {
65129         LDKBlindedHopFeatures features_arg_conv;
65130         features_arg_conv.inner = untag_ptr(features_arg);
65131         features_arg_conv.is_owned = ptr_is_owned(features_arg);
65132         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
65133         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
65134         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);
65135         uint64_t ret_ref = 0;
65136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65138         return ret_ref;
65139 }
65140
65141 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
65142         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
65143         uint64_t ret_ref = 0;
65144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65146         return ret_ref;
65147 }
65148 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
65149         LDKBlindedPayInfo arg_conv;
65150         arg_conv.inner = untag_ptr(arg);
65151         arg_conv.is_owned = ptr_is_owned(arg);
65152         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65153         arg_conv.is_owned = false;
65154         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
65155         return ret_conv;
65156 }
65157
65158 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
65159         LDKBlindedPayInfo orig_conv;
65160         orig_conv.inner = untag_ptr(orig);
65161         orig_conv.is_owned = ptr_is_owned(orig);
65162         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65163         orig_conv.is_owned = false;
65164         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
65165         uint64_t ret_ref = 0;
65166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65168         return ret_ref;
65169 }
65170
65171 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
65172         LDKBlindedPayInfo o_conv;
65173         o_conv.inner = untag_ptr(o);
65174         o_conv.is_owned = ptr_is_owned(o);
65175         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65176         o_conv.is_owned = false;
65177         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
65178         return ret_conv;
65179 }
65180
65181 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
65182         LDKBlindedPayInfo a_conv;
65183         a_conv.inner = untag_ptr(a);
65184         a_conv.is_owned = ptr_is_owned(a);
65185         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65186         a_conv.is_owned = false;
65187         LDKBlindedPayInfo b_conv;
65188         b_conv.inner = untag_ptr(b);
65189         b_conv.is_owned = ptr_is_owned(b);
65190         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65191         b_conv.is_owned = false;
65192         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
65193         return ret_conv;
65194 }
65195
65196 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
65197         LDKBlindedPayInfo obj_conv;
65198         obj_conv.inner = untag_ptr(obj);
65199         obj_conv.is_owned = ptr_is_owned(obj);
65200         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65201         obj_conv.is_owned = false;
65202         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
65203         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65204         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65205         CVec_u8Z_free(ret_var);
65206         return ret_arr;
65207 }
65208
65209 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
65210         LDKu8slice ser_ref;
65211         ser_ref.datalen = ser->arr_len;
65212         ser_ref.data = ser->elems;
65213         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
65214         *ret_conv = BlindedPayInfo_read(ser_ref);
65215         FREE(ser);
65216         return tag_ptr(ret_conv, true);
65217 }
65218
65219 void  __attribute__((export_name("TS_InvoiceError_free"))) TS_InvoiceError_free(uint64_t this_obj) {
65220         LDKInvoiceError this_obj_conv;
65221         this_obj_conv.inner = untag_ptr(this_obj);
65222         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65224         InvoiceError_free(this_obj_conv);
65225 }
65226
65227 uint64_t  __attribute__((export_name("TS_InvoiceError_get_erroneous_field"))) TS_InvoiceError_get_erroneous_field(uint64_t this_ptr) {
65228         LDKInvoiceError this_ptr_conv;
65229         this_ptr_conv.inner = untag_ptr(this_ptr);
65230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65232         this_ptr_conv.is_owned = false;
65233         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
65234         uint64_t ret_ref = 0;
65235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65237         return ret_ref;
65238 }
65239
65240 void  __attribute__((export_name("TS_InvoiceError_set_erroneous_field"))) TS_InvoiceError_set_erroneous_field(uint64_t this_ptr, uint64_t val) {
65241         LDKInvoiceError this_ptr_conv;
65242         this_ptr_conv.inner = untag_ptr(this_ptr);
65243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65245         this_ptr_conv.is_owned = false;
65246         LDKErroneousField val_conv;
65247         val_conv.inner = untag_ptr(val);
65248         val_conv.is_owned = ptr_is_owned(val);
65249         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65250         val_conv = ErroneousField_clone(&val_conv);
65251         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
65252 }
65253
65254 uint64_t  __attribute__((export_name("TS_InvoiceError_get_message"))) TS_InvoiceError_get_message(uint64_t this_ptr) {
65255         LDKInvoiceError this_ptr_conv;
65256         this_ptr_conv.inner = untag_ptr(this_ptr);
65257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65259         this_ptr_conv.is_owned = false;
65260         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
65261         uint64_t ret_ref = 0;
65262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65264         return ret_ref;
65265 }
65266
65267 void  __attribute__((export_name("TS_InvoiceError_set_message"))) TS_InvoiceError_set_message(uint64_t this_ptr, uint64_t val) {
65268         LDKInvoiceError this_ptr_conv;
65269         this_ptr_conv.inner = untag_ptr(this_ptr);
65270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65272         this_ptr_conv.is_owned = false;
65273         LDKUntrustedString val_conv;
65274         val_conv.inner = untag_ptr(val);
65275         val_conv.is_owned = ptr_is_owned(val);
65276         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65277         val_conv = UntrustedString_clone(&val_conv);
65278         InvoiceError_set_message(&this_ptr_conv, val_conv);
65279 }
65280
65281 uint64_t  __attribute__((export_name("TS_InvoiceError_new"))) TS_InvoiceError_new(uint64_t erroneous_field_arg, uint64_t message_arg) {
65282         LDKErroneousField erroneous_field_arg_conv;
65283         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
65284         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
65285         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
65286         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
65287         LDKUntrustedString message_arg_conv;
65288         message_arg_conv.inner = untag_ptr(message_arg);
65289         message_arg_conv.is_owned = ptr_is_owned(message_arg);
65290         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
65291         message_arg_conv = UntrustedString_clone(&message_arg_conv);
65292         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
65293         uint64_t ret_ref = 0;
65294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65296         return ret_ref;
65297 }
65298
65299 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
65300         LDKInvoiceError ret_var = InvoiceError_clone(arg);
65301         uint64_t ret_ref = 0;
65302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65304         return ret_ref;
65305 }
65306 int64_t  __attribute__((export_name("TS_InvoiceError_clone_ptr"))) TS_InvoiceError_clone_ptr(uint64_t arg) {
65307         LDKInvoiceError arg_conv;
65308         arg_conv.inner = untag_ptr(arg);
65309         arg_conv.is_owned = ptr_is_owned(arg);
65310         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65311         arg_conv.is_owned = false;
65312         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
65313         return ret_conv;
65314 }
65315
65316 uint64_t  __attribute__((export_name("TS_InvoiceError_clone"))) TS_InvoiceError_clone(uint64_t orig) {
65317         LDKInvoiceError orig_conv;
65318         orig_conv.inner = untag_ptr(orig);
65319         orig_conv.is_owned = ptr_is_owned(orig);
65320         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65321         orig_conv.is_owned = false;
65322         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
65323         uint64_t ret_ref = 0;
65324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65326         return ret_ref;
65327 }
65328
65329 void  __attribute__((export_name("TS_ErroneousField_free"))) TS_ErroneousField_free(uint64_t this_obj) {
65330         LDKErroneousField this_obj_conv;
65331         this_obj_conv.inner = untag_ptr(this_obj);
65332         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65334         ErroneousField_free(this_obj_conv);
65335 }
65336
65337 int64_t  __attribute__((export_name("TS_ErroneousField_get_tlv_fieldnum"))) TS_ErroneousField_get_tlv_fieldnum(uint64_t this_ptr) {
65338         LDKErroneousField this_ptr_conv;
65339         this_ptr_conv.inner = untag_ptr(this_ptr);
65340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65342         this_ptr_conv.is_owned = false;
65343         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
65344         return ret_conv;
65345 }
65346
65347 void  __attribute__((export_name("TS_ErroneousField_set_tlv_fieldnum"))) TS_ErroneousField_set_tlv_fieldnum(uint64_t this_ptr, int64_t val) {
65348         LDKErroneousField this_ptr_conv;
65349         this_ptr_conv.inner = untag_ptr(this_ptr);
65350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65352         this_ptr_conv.is_owned = false;
65353         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
65354 }
65355
65356 uint64_t  __attribute__((export_name("TS_ErroneousField_get_suggested_value"))) TS_ErroneousField_get_suggested_value(uint64_t this_ptr) {
65357         LDKErroneousField this_ptr_conv;
65358         this_ptr_conv.inner = untag_ptr(this_ptr);
65359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65361         this_ptr_conv.is_owned = false;
65362         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65363         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
65364         uint64_t ret_ref = tag_ptr(ret_copy, true);
65365         return ret_ref;
65366 }
65367
65368 void  __attribute__((export_name("TS_ErroneousField_set_suggested_value"))) TS_ErroneousField_set_suggested_value(uint64_t this_ptr, uint64_t val) {
65369         LDKErroneousField this_ptr_conv;
65370         this_ptr_conv.inner = untag_ptr(this_ptr);
65371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65373         this_ptr_conv.is_owned = false;
65374         void* val_ptr = untag_ptr(val);
65375         CHECK_ACCESS(val_ptr);
65376         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
65377         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
65378         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
65379 }
65380
65381 uint64_t  __attribute__((export_name("TS_ErroneousField_new"))) TS_ErroneousField_new(int64_t tlv_fieldnum_arg, uint64_t suggested_value_arg) {
65382         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
65383         CHECK_ACCESS(suggested_value_arg_ptr);
65384         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
65385         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
65386         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
65387         uint64_t ret_ref = 0;
65388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65390         return ret_ref;
65391 }
65392
65393 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
65394         LDKErroneousField ret_var = ErroneousField_clone(arg);
65395         uint64_t ret_ref = 0;
65396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65398         return ret_ref;
65399 }
65400 int64_t  __attribute__((export_name("TS_ErroneousField_clone_ptr"))) TS_ErroneousField_clone_ptr(uint64_t arg) {
65401         LDKErroneousField arg_conv;
65402         arg_conv.inner = untag_ptr(arg);
65403         arg_conv.is_owned = ptr_is_owned(arg);
65404         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65405         arg_conv.is_owned = false;
65406         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
65407         return ret_conv;
65408 }
65409
65410 uint64_t  __attribute__((export_name("TS_ErroneousField_clone"))) TS_ErroneousField_clone(uint64_t orig) {
65411         LDKErroneousField orig_conv;
65412         orig_conv.inner = untag_ptr(orig);
65413         orig_conv.is_owned = ptr_is_owned(orig);
65414         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65415         orig_conv.is_owned = false;
65416         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
65417         uint64_t ret_ref = 0;
65418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65420         return ret_ref;
65421 }
65422
65423 uint64_t  __attribute__((export_name("TS_InvoiceError_from_string"))) TS_InvoiceError_from_string(jstring s) {
65424         LDKStr s_conv = str_ref_to_owned_c(s);
65425         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
65426         uint64_t ret_ref = 0;
65427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65429         return ret_ref;
65430 }
65431
65432 int8_tArray  __attribute__((export_name("TS_InvoiceError_write"))) TS_InvoiceError_write(uint64_t obj) {
65433         LDKInvoiceError obj_conv;
65434         obj_conv.inner = untag_ptr(obj);
65435         obj_conv.is_owned = ptr_is_owned(obj);
65436         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65437         obj_conv.is_owned = false;
65438         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
65439         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65440         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65441         CVec_u8Z_free(ret_var);
65442         return ret_arr;
65443 }
65444
65445 uint64_t  __attribute__((export_name("TS_InvoiceError_read"))) TS_InvoiceError_read(int8_tArray ser) {
65446         LDKu8slice ser_ref;
65447         ser_ref.datalen = ser->arr_len;
65448         ser_ref.data = ser->elems;
65449         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
65450         *ret_conv = InvoiceError_read(ser_ref);
65451         FREE(ser);
65452         return tag_ptr(ret_conv, true);
65453 }
65454
65455 void  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_free"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_free(uint64_t this_obj) {
65456         LDKInvoiceRequestWithExplicitPayerIdBuilder this_obj_conv;
65457         this_obj_conv.inner = untag_ptr(this_obj);
65458         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65460         InvoiceRequestWithExplicitPayerIdBuilder_free(this_obj_conv);
65461 }
65462
65463 void  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_free"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_free(uint64_t this_obj) {
65464         LDKInvoiceRequestWithDerivedPayerIdBuilder this_obj_conv;
65465         this_obj_conv.inner = untag_ptr(this_obj);
65466         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65468         InvoiceRequestWithDerivedPayerIdBuilder_free(this_obj_conv);
65469 }
65470
65471 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_build"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_build(uint64_t this_arg) {
65472         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65473         this_arg_conv.inner = untag_ptr(this_arg);
65474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65476         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65477         
65478         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
65479         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_build(this_arg_conv);
65480         return tag_ptr(ret_conv, true);
65481 }
65482
65483 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_chain"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_chain(uint64_t this_arg, uint32_t network) {
65484         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65485         this_arg_conv.inner = untag_ptr(this_arg);
65486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65488         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65489         
65490         LDKNetwork network_conv = LDKNetwork_from_js(network);
65491         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65492         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_chain(this_arg_conv, network_conv);
65493         return tag_ptr(ret_conv, true);
65494 }
65495
65496 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_amount_msats"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(uint64_t this_arg, int64_t amount_msats) {
65497         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65498         this_arg_conv.inner = untag_ptr(this_arg);
65499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65501         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65502         
65503         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65504         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
65505         return tag_ptr(ret_conv, true);
65506 }
65507
65508 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_quantity"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_quantity(uint64_t this_arg, int64_t quantity) {
65509         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65510         this_arg_conv.inner = untag_ptr(this_arg);
65511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65513         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65514         
65515         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65516         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_quantity(this_arg_conv, quantity);
65517         return tag_ptr(ret_conv, true);
65518 }
65519
65520 void  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_payer_note"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_payer_note(uint64_t this_arg, jstring payer_note) {
65521         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65522         this_arg_conv.inner = untag_ptr(this_arg);
65523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65525         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65526         
65527         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
65528         InvoiceRequestWithExplicitPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
65529 }
65530
65531 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(uint64_t this_arg) {
65532         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
65533         this_arg_conv.inner = untag_ptr(this_arg);
65534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65536         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
65537         
65538         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
65539         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(this_arg_conv);
65540         return tag_ptr(ret_conv, true);
65541 }
65542
65543 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_chain"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_chain(uint64_t this_arg, uint32_t network) {
65544         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
65545         this_arg_conv.inner = untag_ptr(this_arg);
65546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65548         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
65549         
65550         LDKNetwork network_conv = LDKNetwork_from_js(network);
65551         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65552         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_chain(this_arg_conv, network_conv);
65553         return tag_ptr(ret_conv, true);
65554 }
65555
65556 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_amount_msats"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(uint64_t this_arg, int64_t amount_msats) {
65557         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
65558         this_arg_conv.inner = untag_ptr(this_arg);
65559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65561         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
65562         
65563         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65564         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
65565         return tag_ptr(ret_conv, true);
65566 }
65567
65568 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_quantity"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_quantity(uint64_t this_arg, int64_t quantity) {
65569         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
65570         this_arg_conv.inner = untag_ptr(this_arg);
65571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65573         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
65574         
65575         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65576         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_quantity(this_arg_conv, quantity);
65577         return tag_ptr(ret_conv, true);
65578 }
65579
65580 void  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_payer_note"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_payer_note(uint64_t this_arg, jstring payer_note) {
65581         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
65582         this_arg_conv.inner = untag_ptr(this_arg);
65583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65585         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
65586         
65587         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
65588         InvoiceRequestWithDerivedPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
65589 }
65590
65591 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
65592         LDKUnsignedInvoiceRequest this_obj_conv;
65593         this_obj_conv.inner = untag_ptr(this_obj);
65594         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65596         UnsignedInvoiceRequest_free(this_obj_conv);
65597 }
65598
65599 static inline uint64_t UnsignedInvoiceRequest_clone_ptr(LDKUnsignedInvoiceRequest *NONNULL_PTR arg) {
65600         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(arg);
65601         uint64_t ret_ref = 0;
65602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65604         return ret_ref;
65605 }
65606 int64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_clone_ptr"))) TS_UnsignedInvoiceRequest_clone_ptr(uint64_t arg) {
65607         LDKUnsignedInvoiceRequest arg_conv;
65608         arg_conv.inner = untag_ptr(arg);
65609         arg_conv.is_owned = ptr_is_owned(arg);
65610         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65611         arg_conv.is_owned = false;
65612         int64_t ret_conv = UnsignedInvoiceRequest_clone_ptr(&arg_conv);
65613         return ret_conv;
65614 }
65615
65616 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_clone"))) TS_UnsignedInvoiceRequest_clone(uint64_t orig) {
65617         LDKUnsignedInvoiceRequest orig_conv;
65618         orig_conv.inner = untag_ptr(orig);
65619         orig_conv.is_owned = ptr_is_owned(orig);
65620         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65621         orig_conv.is_owned = false;
65622         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(&orig_conv);
65623         uint64_t ret_ref = 0;
65624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65626         return ret_ref;
65627 }
65628
65629 void  __attribute__((export_name("TS_SignInvoiceRequestFn_free"))) TS_SignInvoiceRequestFn_free(uint64_t this_ptr) {
65630         if (!ptr_is_owned(this_ptr)) return;
65631         void* this_ptr_ptr = untag_ptr(this_ptr);
65632         CHECK_ACCESS(this_ptr_ptr);
65633         LDKSignInvoiceRequestFn this_ptr_conv = *(LDKSignInvoiceRequestFn*)(this_ptr_ptr);
65634         FREE(untag_ptr(this_ptr));
65635         SignInvoiceRequestFn_free(this_ptr_conv);
65636 }
65637
65638 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_tagged_hash"))) TS_UnsignedInvoiceRequest_tagged_hash(uint64_t this_arg) {
65639         LDKUnsignedInvoiceRequest this_arg_conv;
65640         this_arg_conv.inner = untag_ptr(this_arg);
65641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65643         this_arg_conv.is_owned = false;
65644         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
65645         uint64_t ret_ref = 0;
65646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65648         return ret_ref;
65649 }
65650
65651 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
65652         LDKInvoiceRequest this_obj_conv;
65653         this_obj_conv.inner = untag_ptr(this_obj);
65654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65656         InvoiceRequest_free(this_obj_conv);
65657 }
65658
65659 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
65660         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
65661         uint64_t ret_ref = 0;
65662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65664         return ret_ref;
65665 }
65666 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
65667         LDKInvoiceRequest arg_conv;
65668         arg_conv.inner = untag_ptr(arg);
65669         arg_conv.is_owned = ptr_is_owned(arg);
65670         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65671         arg_conv.is_owned = false;
65672         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
65673         return ret_conv;
65674 }
65675
65676 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
65677         LDKInvoiceRequest orig_conv;
65678         orig_conv.inner = untag_ptr(orig);
65679         orig_conv.is_owned = ptr_is_owned(orig);
65680         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65681         orig_conv.is_owned = false;
65682         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
65683         uint64_t ret_ref = 0;
65684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65686         return ret_ref;
65687 }
65688
65689 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_free"))) TS_VerifiedInvoiceRequest_free(uint64_t this_obj) {
65690         LDKVerifiedInvoiceRequest this_obj_conv;
65691         this_obj_conv.inner = untag_ptr(this_obj);
65692         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65694         VerifiedInvoiceRequest_free(this_obj_conv);
65695 }
65696
65697 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_get_offer_id"))) TS_VerifiedInvoiceRequest_get_offer_id(uint64_t this_ptr) {
65698         LDKVerifiedInvoiceRequest this_ptr_conv;
65699         this_ptr_conv.inner = untag_ptr(this_ptr);
65700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65702         this_ptr_conv.is_owned = false;
65703         LDKOfferId ret_var = VerifiedInvoiceRequest_get_offer_id(&this_ptr_conv);
65704         uint64_t ret_ref = 0;
65705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65707         return ret_ref;
65708 }
65709
65710 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_set_offer_id"))) TS_VerifiedInvoiceRequest_set_offer_id(uint64_t this_ptr, uint64_t val) {
65711         LDKVerifiedInvoiceRequest this_ptr_conv;
65712         this_ptr_conv.inner = untag_ptr(this_ptr);
65713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65715         this_ptr_conv.is_owned = false;
65716         LDKOfferId val_conv;
65717         val_conv.inner = untag_ptr(val);
65718         val_conv.is_owned = ptr_is_owned(val);
65719         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65720         val_conv = OfferId_clone(&val_conv);
65721         VerifiedInvoiceRequest_set_offer_id(&this_ptr_conv, val_conv);
65722 }
65723
65724 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_get_keys"))) TS_VerifiedInvoiceRequest_get_keys(uint64_t this_ptr) {
65725         LDKVerifiedInvoiceRequest this_ptr_conv;
65726         this_ptr_conv.inner = untag_ptr(this_ptr);
65727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65729         this_ptr_conv.is_owned = false;
65730         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
65731         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
65732         uint64_t ret_ref = tag_ptr(ret_copy, true);
65733         return ret_ref;
65734 }
65735
65736 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_set_keys"))) TS_VerifiedInvoiceRequest_set_keys(uint64_t this_ptr, uint64_t val) {
65737         LDKVerifiedInvoiceRequest this_ptr_conv;
65738         this_ptr_conv.inner = untag_ptr(this_ptr);
65739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65741         this_ptr_conv.is_owned = false;
65742         void* val_ptr = untag_ptr(val);
65743         CHECK_ACCESS(val_ptr);
65744         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
65745         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
65746         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
65747 }
65748
65749 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
65750         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
65751         uint64_t ret_ref = 0;
65752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65754         return ret_ref;
65755 }
65756 int64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone_ptr"))) TS_VerifiedInvoiceRequest_clone_ptr(uint64_t arg) {
65757         LDKVerifiedInvoiceRequest arg_conv;
65758         arg_conv.inner = untag_ptr(arg);
65759         arg_conv.is_owned = ptr_is_owned(arg);
65760         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65761         arg_conv.is_owned = false;
65762         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
65763         return ret_conv;
65764 }
65765
65766 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone"))) TS_VerifiedInvoiceRequest_clone(uint64_t orig) {
65767         LDKVerifiedInvoiceRequest orig_conv;
65768         orig_conv.inner = untag_ptr(orig);
65769         orig_conv.is_owned = ptr_is_owned(orig);
65770         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65771         orig_conv.is_owned = false;
65772         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
65773         uint64_t ret_ref = 0;
65774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65776         return ret_ref;
65777 }
65778
65779 ptrArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chains"))) TS_UnsignedInvoiceRequest_chains(uint64_t this_arg) {
65780         LDKUnsignedInvoiceRequest this_arg_conv;
65781         this_arg_conv.inner = untag_ptr(this_arg);
65782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65784         this_arg_conv.is_owned = false;
65785         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
65786         ptrArray ret_arr = NULL;
65787         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
65788         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
65789         for (size_t m = 0; m < ret_var.datalen; m++) {
65790                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
65791                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
65792                 ret_arr_ptr[m] = ret_conv_12_arr;
65793         }
65794         
65795         FREE(ret_var.data);
65796         return ret_arr;
65797 }
65798
65799 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_metadata"))) TS_UnsignedInvoiceRequest_metadata(uint64_t this_arg) {
65800         LDKUnsignedInvoiceRequest this_arg_conv;
65801         this_arg_conv.inner = untag_ptr(this_arg);
65802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65804         this_arg_conv.is_owned = false;
65805         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65806         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
65807         uint64_t ret_ref = tag_ptr(ret_copy, true);
65808         return ret_ref;
65809 }
65810
65811 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount"))) TS_UnsignedInvoiceRequest_amount(uint64_t this_arg) {
65812         LDKUnsignedInvoiceRequest this_arg_conv;
65813         this_arg_conv.inner = untag_ptr(this_arg);
65814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65816         this_arg_conv.is_owned = false;
65817         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
65818         *ret_copy = UnsignedInvoiceRequest_amount(&this_arg_conv);
65819         uint64_t ret_ref = tag_ptr(ret_copy, true);
65820         return ret_ref;
65821 }
65822
65823 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_description"))) TS_UnsignedInvoiceRequest_description(uint64_t this_arg) {
65824         LDKUnsignedInvoiceRequest this_arg_conv;
65825         this_arg_conv.inner = untag_ptr(this_arg);
65826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65828         this_arg_conv.is_owned = false;
65829         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
65830         uint64_t ret_ref = 0;
65831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65833         return ret_ref;
65834 }
65835
65836 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_offer_features"))) TS_UnsignedInvoiceRequest_offer_features(uint64_t this_arg) {
65837         LDKUnsignedInvoiceRequest this_arg_conv;
65838         this_arg_conv.inner = untag_ptr(this_arg);
65839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65841         this_arg_conv.is_owned = false;
65842         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
65843         uint64_t ret_ref = 0;
65844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65846         return ret_ref;
65847 }
65848
65849 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_absolute_expiry"))) TS_UnsignedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
65850         LDKUnsignedInvoiceRequest this_arg_conv;
65851         this_arg_conv.inner = untag_ptr(this_arg);
65852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65854         this_arg_conv.is_owned = false;
65855         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65856         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
65857         uint64_t ret_ref = tag_ptr(ret_copy, true);
65858         return ret_ref;
65859 }
65860
65861 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_issuer"))) TS_UnsignedInvoiceRequest_issuer(uint64_t this_arg) {
65862         LDKUnsignedInvoiceRequest this_arg_conv;
65863         this_arg_conv.inner = untag_ptr(this_arg);
65864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65866         this_arg_conv.is_owned = false;
65867         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
65868         uint64_t ret_ref = 0;
65869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65871         return ret_ref;
65872 }
65873
65874 uint64_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_paths"))) TS_UnsignedInvoiceRequest_paths(uint64_t this_arg) {
65875         LDKUnsignedInvoiceRequest this_arg_conv;
65876         this_arg_conv.inner = untag_ptr(this_arg);
65877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65879         this_arg_conv.is_owned = false;
65880         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
65881         uint64_tArray ret_arr = NULL;
65882         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
65883         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
65884         for (size_t n = 0; n < ret_var.datalen; n++) {
65885                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
65886                 uint64_t ret_conv_13_ref = 0;
65887                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
65888                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
65889                 ret_arr_ptr[n] = ret_conv_13_ref;
65890         }
65891         
65892         FREE(ret_var.data);
65893         return ret_arr;
65894 }
65895
65896 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_supported_quantity"))) TS_UnsignedInvoiceRequest_supported_quantity(uint64_t this_arg) {
65897         LDKUnsignedInvoiceRequest this_arg_conv;
65898         this_arg_conv.inner = untag_ptr(this_arg);
65899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65901         this_arg_conv.is_owned = false;
65902         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65903         *ret_copy = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
65904         uint64_t ret_ref = tag_ptr(ret_copy, true);
65905         return ret_ref;
65906 }
65907
65908 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_signing_pubkey"))) TS_UnsignedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
65909         LDKUnsignedInvoiceRequest this_arg_conv;
65910         this_arg_conv.inner = untag_ptr(this_arg);
65911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65913         this_arg_conv.is_owned = false;
65914         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65915         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
65916         return ret_arr;
65917 }
65918
65919 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_metadata"))) TS_UnsignedInvoiceRequest_payer_metadata(uint64_t this_arg) {
65920         LDKUnsignedInvoiceRequest this_arg_conv;
65921         this_arg_conv.inner = untag_ptr(this_arg);
65922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65924         this_arg_conv.is_owned = false;
65925         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
65926         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65927         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65928         return ret_arr;
65929 }
65930
65931 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chain"))) TS_UnsignedInvoiceRequest_chain(uint64_t this_arg) {
65932         LDKUnsignedInvoiceRequest this_arg_conv;
65933         this_arg_conv.inner = untag_ptr(this_arg);
65934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65936         this_arg_conv.is_owned = false;
65937         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65938         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
65939         return ret_arr;
65940 }
65941
65942 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount_msats"))) TS_UnsignedInvoiceRequest_amount_msats(uint64_t this_arg) {
65943         LDKUnsignedInvoiceRequest this_arg_conv;
65944         this_arg_conv.inner = untag_ptr(this_arg);
65945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65947         this_arg_conv.is_owned = false;
65948         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65949         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
65950         uint64_t ret_ref = tag_ptr(ret_copy, true);
65951         return ret_ref;
65952 }
65953
65954 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_invoice_request_features"))) TS_UnsignedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
65955         LDKUnsignedInvoiceRequest this_arg_conv;
65956         this_arg_conv.inner = untag_ptr(this_arg);
65957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65959         this_arg_conv.is_owned = false;
65960         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
65961         uint64_t ret_ref = 0;
65962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65964         return ret_ref;
65965 }
65966
65967 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_quantity"))) TS_UnsignedInvoiceRequest_quantity(uint64_t this_arg) {
65968         LDKUnsignedInvoiceRequest this_arg_conv;
65969         this_arg_conv.inner = untag_ptr(this_arg);
65970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65972         this_arg_conv.is_owned = false;
65973         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65974         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
65975         uint64_t ret_ref = tag_ptr(ret_copy, true);
65976         return ret_ref;
65977 }
65978
65979 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_id"))) TS_UnsignedInvoiceRequest_payer_id(uint64_t this_arg) {
65980         LDKUnsignedInvoiceRequest this_arg_conv;
65981         this_arg_conv.inner = untag_ptr(this_arg);
65982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65984         this_arg_conv.is_owned = false;
65985         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65986         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
65987         return ret_arr;
65988 }
65989
65990 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_note"))) TS_UnsignedInvoiceRequest_payer_note(uint64_t this_arg) {
65991         LDKUnsignedInvoiceRequest this_arg_conv;
65992         this_arg_conv.inner = untag_ptr(this_arg);
65993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65995         this_arg_conv.is_owned = false;
65996         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
65997         uint64_t ret_ref = 0;
65998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66000         return ret_ref;
66001 }
66002
66003 ptrArray  __attribute__((export_name("TS_InvoiceRequest_chains"))) TS_InvoiceRequest_chains(uint64_t this_arg) {
66004         LDKInvoiceRequest this_arg_conv;
66005         this_arg_conv.inner = untag_ptr(this_arg);
66006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66008         this_arg_conv.is_owned = false;
66009         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
66010         ptrArray ret_arr = NULL;
66011         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
66012         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
66013         for (size_t m = 0; m < ret_var.datalen; m++) {
66014                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
66015                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
66016                 ret_arr_ptr[m] = ret_conv_12_arr;
66017         }
66018         
66019         FREE(ret_var.data);
66020         return ret_arr;
66021 }
66022
66023 uint64_t  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
66024         LDKInvoiceRequest this_arg_conv;
66025         this_arg_conv.inner = untag_ptr(this_arg);
66026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66028         this_arg_conv.is_owned = false;
66029         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66030         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
66031         uint64_t ret_ref = tag_ptr(ret_copy, true);
66032         return ret_ref;
66033 }
66034
66035 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount"))) TS_InvoiceRequest_amount(uint64_t this_arg) {
66036         LDKInvoiceRequest this_arg_conv;
66037         this_arg_conv.inner = untag_ptr(this_arg);
66038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66040         this_arg_conv.is_owned = false;
66041         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
66042         *ret_copy = InvoiceRequest_amount(&this_arg_conv);
66043         uint64_t ret_ref = tag_ptr(ret_copy, true);
66044         return ret_ref;
66045 }
66046
66047 uint64_t  __attribute__((export_name("TS_InvoiceRequest_description"))) TS_InvoiceRequest_description(uint64_t this_arg) {
66048         LDKInvoiceRequest this_arg_conv;
66049         this_arg_conv.inner = untag_ptr(this_arg);
66050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66052         this_arg_conv.is_owned = false;
66053         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
66054         uint64_t ret_ref = 0;
66055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66057         return ret_ref;
66058 }
66059
66060 uint64_t  __attribute__((export_name("TS_InvoiceRequest_offer_features"))) TS_InvoiceRequest_offer_features(uint64_t this_arg) {
66061         LDKInvoiceRequest this_arg_conv;
66062         this_arg_conv.inner = untag_ptr(this_arg);
66063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66065         this_arg_conv.is_owned = false;
66066         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
66067         uint64_t ret_ref = 0;
66068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66070         return ret_ref;
66071 }
66072
66073 uint64_t  __attribute__((export_name("TS_InvoiceRequest_absolute_expiry"))) TS_InvoiceRequest_absolute_expiry(uint64_t this_arg) {
66074         LDKInvoiceRequest this_arg_conv;
66075         this_arg_conv.inner = untag_ptr(this_arg);
66076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66078         this_arg_conv.is_owned = false;
66079         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66080         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
66081         uint64_t ret_ref = tag_ptr(ret_copy, true);
66082         return ret_ref;
66083 }
66084
66085 uint64_t  __attribute__((export_name("TS_InvoiceRequest_issuer"))) TS_InvoiceRequest_issuer(uint64_t this_arg) {
66086         LDKInvoiceRequest this_arg_conv;
66087         this_arg_conv.inner = untag_ptr(this_arg);
66088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66090         this_arg_conv.is_owned = false;
66091         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
66092         uint64_t ret_ref = 0;
66093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66095         return ret_ref;
66096 }
66097
66098 uint64_tArray  __attribute__((export_name("TS_InvoiceRequest_paths"))) TS_InvoiceRequest_paths(uint64_t this_arg) {
66099         LDKInvoiceRequest this_arg_conv;
66100         this_arg_conv.inner = untag_ptr(this_arg);
66101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66103         this_arg_conv.is_owned = false;
66104         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
66105         uint64_tArray ret_arr = NULL;
66106         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
66107         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
66108         for (size_t n = 0; n < ret_var.datalen; n++) {
66109                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66110                 uint64_t ret_conv_13_ref = 0;
66111                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66112                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66113                 ret_arr_ptr[n] = ret_conv_13_ref;
66114         }
66115         
66116         FREE(ret_var.data);
66117         return ret_arr;
66118 }
66119
66120 uint64_t  __attribute__((export_name("TS_InvoiceRequest_supported_quantity"))) TS_InvoiceRequest_supported_quantity(uint64_t this_arg) {
66121         LDKInvoiceRequest this_arg_conv;
66122         this_arg_conv.inner = untag_ptr(this_arg);
66123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66125         this_arg_conv.is_owned = false;
66126         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
66127         *ret_copy = InvoiceRequest_supported_quantity(&this_arg_conv);
66128         uint64_t ret_ref = tag_ptr(ret_copy, true);
66129         return ret_ref;
66130 }
66131
66132 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signing_pubkey"))) TS_InvoiceRequest_signing_pubkey(uint64_t this_arg) {
66133         LDKInvoiceRequest this_arg_conv;
66134         this_arg_conv.inner = untag_ptr(this_arg);
66135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66137         this_arg_conv.is_owned = false;
66138         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66139         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
66140         return ret_arr;
66141 }
66142
66143 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_metadata"))) TS_InvoiceRequest_payer_metadata(uint64_t this_arg) {
66144         LDKInvoiceRequest this_arg_conv;
66145         this_arg_conv.inner = untag_ptr(this_arg);
66146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66148         this_arg_conv.is_owned = false;
66149         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
66150         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66151         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66152         return ret_arr;
66153 }
66154
66155 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
66156         LDKInvoiceRequest this_arg_conv;
66157         this_arg_conv.inner = untag_ptr(this_arg);
66158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66160         this_arg_conv.is_owned = false;
66161         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66162         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
66163         return ret_arr;
66164 }
66165
66166 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
66167         LDKInvoiceRequest this_arg_conv;
66168         this_arg_conv.inner = untag_ptr(this_arg);
66169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66171         this_arg_conv.is_owned = false;
66172         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66173         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
66174         uint64_t ret_ref = tag_ptr(ret_copy, true);
66175         return ret_ref;
66176 }
66177
66178 uint64_t  __attribute__((export_name("TS_InvoiceRequest_invoice_request_features"))) TS_InvoiceRequest_invoice_request_features(uint64_t this_arg) {
66179         LDKInvoiceRequest this_arg_conv;
66180         this_arg_conv.inner = untag_ptr(this_arg);
66181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66183         this_arg_conv.is_owned = false;
66184         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
66185         uint64_t ret_ref = 0;
66186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66188         return ret_ref;
66189 }
66190
66191 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
66192         LDKInvoiceRequest this_arg_conv;
66193         this_arg_conv.inner = untag_ptr(this_arg);
66194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66196         this_arg_conv.is_owned = false;
66197         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66198         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
66199         uint64_t ret_ref = tag_ptr(ret_copy, true);
66200         return ret_ref;
66201 }
66202
66203 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
66204         LDKInvoiceRequest this_arg_conv;
66205         this_arg_conv.inner = untag_ptr(this_arg);
66206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66208         this_arg_conv.is_owned = false;
66209         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66210         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
66211         return ret_arr;
66212 }
66213
66214 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
66215         LDKInvoiceRequest this_arg_conv;
66216         this_arg_conv.inner = untag_ptr(this_arg);
66217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66219         this_arg_conv.is_owned = false;
66220         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
66221         uint64_t ret_ref = 0;
66222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66224         return ret_ref;
66225 }
66226
66227 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) {
66228         LDKInvoiceRequest this_arg_conv;
66229         this_arg_conv.inner = untag_ptr(this_arg);
66230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66232         this_arg_conv.is_owned = false;
66233         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
66234         payment_paths_constr.datalen = payment_paths->arr_len;
66235         if (payment_paths_constr.datalen > 0)
66236                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
66237         else
66238                 payment_paths_constr.data = NULL;
66239         uint64_t* payment_paths_vals = payment_paths->elems;
66240         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
66241                 uint64_t payment_paths_conv_37 = payment_paths_vals[l];
66242                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
66243                 CHECK_ACCESS(payment_paths_conv_37_ptr);
66244                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
66245                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
66246                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
66247         }
66248         FREE(payment_paths);
66249         LDKThirtyTwoBytes payment_hash_ref;
66250         CHECK(payment_hash->arr_len == 32);
66251         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66252         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
66253         *ret_conv = InvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
66254         return tag_ptr(ret_conv, true);
66255 }
66256
66257 uint64_t  __attribute__((export_name("TS_InvoiceRequest_verify"))) TS_InvoiceRequest_verify(uint64_t this_arg, uint64_t key) {
66258         LDKInvoiceRequest this_arg_conv;
66259         this_arg_conv.inner = untag_ptr(this_arg);
66260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66262         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
66263         LDKExpandedKey key_conv;
66264         key_conv.inner = untag_ptr(key);
66265         key_conv.is_owned = ptr_is_owned(key);
66266         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
66267         key_conv.is_owned = false;
66268         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
66269         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
66270         return tag_ptr(ret_conv, true);
66271 }
66272
66273 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signature"))) TS_InvoiceRequest_signature(uint64_t this_arg) {
66274         LDKInvoiceRequest this_arg_conv;
66275         this_arg_conv.inner = untag_ptr(this_arg);
66276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66278         this_arg_conv.is_owned = false;
66279         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
66280         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
66281         return ret_arr;
66282 }
66283
66284 ptrArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chains"))) TS_VerifiedInvoiceRequest_chains(uint64_t this_arg) {
66285         LDKVerifiedInvoiceRequest this_arg_conv;
66286         this_arg_conv.inner = untag_ptr(this_arg);
66287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66289         this_arg_conv.is_owned = false;
66290         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
66291         ptrArray ret_arr = NULL;
66292         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
66293         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
66294         for (size_t m = 0; m < ret_var.datalen; m++) {
66295                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
66296                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
66297                 ret_arr_ptr[m] = ret_conv_12_arr;
66298         }
66299         
66300         FREE(ret_var.data);
66301         return ret_arr;
66302 }
66303
66304 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_metadata"))) TS_VerifiedInvoiceRequest_metadata(uint64_t this_arg) {
66305         LDKVerifiedInvoiceRequest this_arg_conv;
66306         this_arg_conv.inner = untag_ptr(this_arg);
66307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66309         this_arg_conv.is_owned = false;
66310         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66311         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
66312         uint64_t ret_ref = tag_ptr(ret_copy, true);
66313         return ret_ref;
66314 }
66315
66316 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount"))) TS_VerifiedInvoiceRequest_amount(uint64_t this_arg) {
66317         LDKVerifiedInvoiceRequest this_arg_conv;
66318         this_arg_conv.inner = untag_ptr(this_arg);
66319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66321         this_arg_conv.is_owned = false;
66322         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
66323         *ret_copy = VerifiedInvoiceRequest_amount(&this_arg_conv);
66324         uint64_t ret_ref = tag_ptr(ret_copy, true);
66325         return ret_ref;
66326 }
66327
66328 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_description"))) TS_VerifiedInvoiceRequest_description(uint64_t this_arg) {
66329         LDKVerifiedInvoiceRequest this_arg_conv;
66330         this_arg_conv.inner = untag_ptr(this_arg);
66331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66333         this_arg_conv.is_owned = false;
66334         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
66335         uint64_t ret_ref = 0;
66336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66338         return ret_ref;
66339 }
66340
66341 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_offer_features"))) TS_VerifiedInvoiceRequest_offer_features(uint64_t this_arg) {
66342         LDKVerifiedInvoiceRequest this_arg_conv;
66343         this_arg_conv.inner = untag_ptr(this_arg);
66344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66346         this_arg_conv.is_owned = false;
66347         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
66348         uint64_t ret_ref = 0;
66349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66351         return ret_ref;
66352 }
66353
66354 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_absolute_expiry"))) TS_VerifiedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
66355         LDKVerifiedInvoiceRequest this_arg_conv;
66356         this_arg_conv.inner = untag_ptr(this_arg);
66357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66359         this_arg_conv.is_owned = false;
66360         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66361         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
66362         uint64_t ret_ref = tag_ptr(ret_copy, true);
66363         return ret_ref;
66364 }
66365
66366 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_issuer"))) TS_VerifiedInvoiceRequest_issuer(uint64_t this_arg) {
66367         LDKVerifiedInvoiceRequest this_arg_conv;
66368         this_arg_conv.inner = untag_ptr(this_arg);
66369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66371         this_arg_conv.is_owned = false;
66372         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
66373         uint64_t ret_ref = 0;
66374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66376         return ret_ref;
66377 }
66378
66379 uint64_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_paths"))) TS_VerifiedInvoiceRequest_paths(uint64_t this_arg) {
66380         LDKVerifiedInvoiceRequest this_arg_conv;
66381         this_arg_conv.inner = untag_ptr(this_arg);
66382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66384         this_arg_conv.is_owned = false;
66385         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
66386         uint64_tArray ret_arr = NULL;
66387         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
66388         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
66389         for (size_t n = 0; n < ret_var.datalen; n++) {
66390                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66391                 uint64_t ret_conv_13_ref = 0;
66392                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66393                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66394                 ret_arr_ptr[n] = ret_conv_13_ref;
66395         }
66396         
66397         FREE(ret_var.data);
66398         return ret_arr;
66399 }
66400
66401 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_supported_quantity"))) TS_VerifiedInvoiceRequest_supported_quantity(uint64_t this_arg) {
66402         LDKVerifiedInvoiceRequest this_arg_conv;
66403         this_arg_conv.inner = untag_ptr(this_arg);
66404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66406         this_arg_conv.is_owned = false;
66407         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
66408         *ret_copy = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
66409         uint64_t ret_ref = tag_ptr(ret_copy, true);
66410         return ret_ref;
66411 }
66412
66413 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_signing_pubkey"))) TS_VerifiedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
66414         LDKVerifiedInvoiceRequest this_arg_conv;
66415         this_arg_conv.inner = untag_ptr(this_arg);
66416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66418         this_arg_conv.is_owned = false;
66419         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66420         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
66421         return ret_arr;
66422 }
66423
66424 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_metadata"))) TS_VerifiedInvoiceRequest_payer_metadata(uint64_t this_arg) {
66425         LDKVerifiedInvoiceRequest this_arg_conv;
66426         this_arg_conv.inner = untag_ptr(this_arg);
66427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66429         this_arg_conv.is_owned = false;
66430         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
66431         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66432         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66433         return ret_arr;
66434 }
66435
66436 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chain"))) TS_VerifiedInvoiceRequest_chain(uint64_t this_arg) {
66437         LDKVerifiedInvoiceRequest this_arg_conv;
66438         this_arg_conv.inner = untag_ptr(this_arg);
66439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66441         this_arg_conv.is_owned = false;
66442         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66443         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
66444         return ret_arr;
66445 }
66446
66447 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount_msats"))) TS_VerifiedInvoiceRequest_amount_msats(uint64_t this_arg) {
66448         LDKVerifiedInvoiceRequest this_arg_conv;
66449         this_arg_conv.inner = untag_ptr(this_arg);
66450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66452         this_arg_conv.is_owned = false;
66453         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66454         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
66455         uint64_t ret_ref = tag_ptr(ret_copy, true);
66456         return ret_ref;
66457 }
66458
66459 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_invoice_request_features"))) TS_VerifiedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
66460         LDKVerifiedInvoiceRequest this_arg_conv;
66461         this_arg_conv.inner = untag_ptr(this_arg);
66462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66464         this_arg_conv.is_owned = false;
66465         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
66466         uint64_t ret_ref = 0;
66467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66469         return ret_ref;
66470 }
66471
66472 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_quantity"))) TS_VerifiedInvoiceRequest_quantity(uint64_t this_arg) {
66473         LDKVerifiedInvoiceRequest this_arg_conv;
66474         this_arg_conv.inner = untag_ptr(this_arg);
66475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66477         this_arg_conv.is_owned = false;
66478         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66479         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
66480         uint64_t ret_ref = tag_ptr(ret_copy, true);
66481         return ret_ref;
66482 }
66483
66484 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_id"))) TS_VerifiedInvoiceRequest_payer_id(uint64_t this_arg) {
66485         LDKVerifiedInvoiceRequest this_arg_conv;
66486         this_arg_conv.inner = untag_ptr(this_arg);
66487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66489         this_arg_conv.is_owned = false;
66490         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66491         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
66492         return ret_arr;
66493 }
66494
66495 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_note"))) TS_VerifiedInvoiceRequest_payer_note(uint64_t this_arg) {
66496         LDKVerifiedInvoiceRequest this_arg_conv;
66497         this_arg_conv.inner = untag_ptr(this_arg);
66498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66500         this_arg_conv.is_owned = false;
66501         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
66502         uint64_t ret_ref = 0;
66503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66505         return ret_ref;
66506 }
66507
66508 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) {
66509         LDKVerifiedInvoiceRequest this_arg_conv;
66510         this_arg_conv.inner = untag_ptr(this_arg);
66511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66513         this_arg_conv.is_owned = false;
66514         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
66515         payment_paths_constr.datalen = payment_paths->arr_len;
66516         if (payment_paths_constr.datalen > 0)
66517                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
66518         else
66519                 payment_paths_constr.data = NULL;
66520         uint64_t* payment_paths_vals = payment_paths->elems;
66521         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
66522                 uint64_t payment_paths_conv_37 = payment_paths_vals[l];
66523                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
66524                 CHECK_ACCESS(payment_paths_conv_37_ptr);
66525                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
66526                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
66527                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
66528         }
66529         FREE(payment_paths);
66530         LDKThirtyTwoBytes payment_hash_ref;
66531         CHECK(payment_hash->arr_len == 32);
66532         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66533         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
66534         *ret_conv = VerifiedInvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
66535         return tag_ptr(ret_conv, true);
66536 }
66537
66538 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) {
66539         LDKVerifiedInvoiceRequest this_arg_conv;
66540         this_arg_conv.inner = untag_ptr(this_arg);
66541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66543         this_arg_conv.is_owned = false;
66544         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
66545         payment_paths_constr.datalen = payment_paths->arr_len;
66546         if (payment_paths_constr.datalen > 0)
66547                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
66548         else
66549                 payment_paths_constr.data = NULL;
66550         uint64_t* payment_paths_vals = payment_paths->elems;
66551         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
66552                 uint64_t payment_paths_conv_37 = payment_paths_vals[l];
66553                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
66554                 CHECK_ACCESS(payment_paths_conv_37_ptr);
66555                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
66556                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
66557                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
66558         }
66559         FREE(payment_paths);
66560         LDKThirtyTwoBytes payment_hash_ref;
66561         CHECK(payment_hash->arr_len == 32);
66562         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66563         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
66564         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
66565         return tag_ptr(ret_conv, true);
66566 }
66567
66568 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_write"))) TS_UnsignedInvoiceRequest_write(uint64_t obj) {
66569         LDKUnsignedInvoiceRequest obj_conv;
66570         obj_conv.inner = untag_ptr(obj);
66571         obj_conv.is_owned = ptr_is_owned(obj);
66572         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66573         obj_conv.is_owned = false;
66574         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
66575         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66576         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66577         CVec_u8Z_free(ret_var);
66578         return ret_arr;
66579 }
66580
66581 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
66582         LDKInvoiceRequest obj_conv;
66583         obj_conv.inner = untag_ptr(obj);
66584         obj_conv.is_owned = ptr_is_owned(obj);
66585         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66586         obj_conv.is_owned = false;
66587         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
66588         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66589         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66590         CVec_u8Z_free(ret_var);
66591         return ret_arr;
66592 }
66593
66594 void  __attribute__((export_name("TS_InvoiceRequestFields_free"))) TS_InvoiceRequestFields_free(uint64_t this_obj) {
66595         LDKInvoiceRequestFields this_obj_conv;
66596         this_obj_conv.inner = untag_ptr(this_obj);
66597         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66599         InvoiceRequestFields_free(this_obj_conv);
66600 }
66601
66602 int8_tArray  __attribute__((export_name("TS_InvoiceRequestFields_get_payer_id"))) TS_InvoiceRequestFields_get_payer_id(uint64_t this_ptr) {
66603         LDKInvoiceRequestFields this_ptr_conv;
66604         this_ptr_conv.inner = untag_ptr(this_ptr);
66605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66607         this_ptr_conv.is_owned = false;
66608         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66609         memcpy(ret_arr->elems, InvoiceRequestFields_get_payer_id(&this_ptr_conv).compressed_form, 33);
66610         return ret_arr;
66611 }
66612
66613 void  __attribute__((export_name("TS_InvoiceRequestFields_set_payer_id"))) TS_InvoiceRequestFields_set_payer_id(uint64_t this_ptr, int8_tArray val) {
66614         LDKInvoiceRequestFields this_ptr_conv;
66615         this_ptr_conv.inner = untag_ptr(this_ptr);
66616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66618         this_ptr_conv.is_owned = false;
66619         LDKPublicKey val_ref;
66620         CHECK(val->arr_len == 33);
66621         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
66622         InvoiceRequestFields_set_payer_id(&this_ptr_conv, val_ref);
66623 }
66624
66625 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_get_quantity"))) TS_InvoiceRequestFields_get_quantity(uint64_t this_ptr) {
66626         LDKInvoiceRequestFields this_ptr_conv;
66627         this_ptr_conv.inner = untag_ptr(this_ptr);
66628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66630         this_ptr_conv.is_owned = false;
66631         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66632         *ret_copy = InvoiceRequestFields_get_quantity(&this_ptr_conv);
66633         uint64_t ret_ref = tag_ptr(ret_copy, true);
66634         return ret_ref;
66635 }
66636
66637 void  __attribute__((export_name("TS_InvoiceRequestFields_set_quantity"))) TS_InvoiceRequestFields_set_quantity(uint64_t this_ptr, uint64_t val) {
66638         LDKInvoiceRequestFields this_ptr_conv;
66639         this_ptr_conv.inner = untag_ptr(this_ptr);
66640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66642         this_ptr_conv.is_owned = false;
66643         void* val_ptr = untag_ptr(val);
66644         CHECK_ACCESS(val_ptr);
66645         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
66646         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
66647         InvoiceRequestFields_set_quantity(&this_ptr_conv, val_conv);
66648 }
66649
66650 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_get_payer_note_truncated"))) TS_InvoiceRequestFields_get_payer_note_truncated(uint64_t this_ptr) {
66651         LDKInvoiceRequestFields this_ptr_conv;
66652         this_ptr_conv.inner = untag_ptr(this_ptr);
66653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66655         this_ptr_conv.is_owned = false;
66656         LDKUntrustedString ret_var = InvoiceRequestFields_get_payer_note_truncated(&this_ptr_conv);
66657         uint64_t ret_ref = 0;
66658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66660         return ret_ref;
66661 }
66662
66663 void  __attribute__((export_name("TS_InvoiceRequestFields_set_payer_note_truncated"))) TS_InvoiceRequestFields_set_payer_note_truncated(uint64_t this_ptr, uint64_t val) {
66664         LDKInvoiceRequestFields this_ptr_conv;
66665         this_ptr_conv.inner = untag_ptr(this_ptr);
66666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66668         this_ptr_conv.is_owned = false;
66669         LDKUntrustedString val_conv;
66670         val_conv.inner = untag_ptr(val);
66671         val_conv.is_owned = ptr_is_owned(val);
66672         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66673         val_conv = UntrustedString_clone(&val_conv);
66674         InvoiceRequestFields_set_payer_note_truncated(&this_ptr_conv, val_conv);
66675 }
66676
66677 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) {
66678         LDKPublicKey payer_id_arg_ref;
66679         CHECK(payer_id_arg->arr_len == 33);
66680         memcpy(payer_id_arg_ref.compressed_form, payer_id_arg->elems, 33); FREE(payer_id_arg);
66681         void* quantity_arg_ptr = untag_ptr(quantity_arg);
66682         CHECK_ACCESS(quantity_arg_ptr);
66683         LDKCOption_u64Z quantity_arg_conv = *(LDKCOption_u64Z*)(quantity_arg_ptr);
66684         quantity_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity_arg));
66685         LDKUntrustedString payer_note_truncated_arg_conv;
66686         payer_note_truncated_arg_conv.inner = untag_ptr(payer_note_truncated_arg);
66687         payer_note_truncated_arg_conv.is_owned = ptr_is_owned(payer_note_truncated_arg);
66688         CHECK_INNER_FIELD_ACCESS_OR_NULL(payer_note_truncated_arg_conv);
66689         payer_note_truncated_arg_conv = UntrustedString_clone(&payer_note_truncated_arg_conv);
66690         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_new(payer_id_arg_ref, quantity_arg_conv, payer_note_truncated_arg_conv);
66691         uint64_t ret_ref = 0;
66692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66694         return ret_ref;
66695 }
66696
66697 static inline uint64_t InvoiceRequestFields_clone_ptr(LDKInvoiceRequestFields *NONNULL_PTR arg) {
66698         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(arg);
66699         uint64_t ret_ref = 0;
66700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66702         return ret_ref;
66703 }
66704 int64_t  __attribute__((export_name("TS_InvoiceRequestFields_clone_ptr"))) TS_InvoiceRequestFields_clone_ptr(uint64_t arg) {
66705         LDKInvoiceRequestFields arg_conv;
66706         arg_conv.inner = untag_ptr(arg);
66707         arg_conv.is_owned = ptr_is_owned(arg);
66708         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66709         arg_conv.is_owned = false;
66710         int64_t ret_conv = InvoiceRequestFields_clone_ptr(&arg_conv);
66711         return ret_conv;
66712 }
66713
66714 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_clone"))) TS_InvoiceRequestFields_clone(uint64_t orig) {
66715         LDKInvoiceRequestFields orig_conv;
66716         orig_conv.inner = untag_ptr(orig);
66717         orig_conv.is_owned = ptr_is_owned(orig);
66718         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66719         orig_conv.is_owned = false;
66720         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(&orig_conv);
66721         uint64_t ret_ref = 0;
66722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66724         return ret_ref;
66725 }
66726
66727 jboolean  __attribute__((export_name("TS_InvoiceRequestFields_eq"))) TS_InvoiceRequestFields_eq(uint64_t a, uint64_t b) {
66728         LDKInvoiceRequestFields a_conv;
66729         a_conv.inner = untag_ptr(a);
66730         a_conv.is_owned = ptr_is_owned(a);
66731         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66732         a_conv.is_owned = false;
66733         LDKInvoiceRequestFields b_conv;
66734         b_conv.inner = untag_ptr(b);
66735         b_conv.is_owned = ptr_is_owned(b);
66736         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66737         b_conv.is_owned = false;
66738         jboolean ret_conv = InvoiceRequestFields_eq(&a_conv, &b_conv);
66739         return ret_conv;
66740 }
66741
66742 int8_tArray  __attribute__((export_name("TS_InvoiceRequestFields_write"))) TS_InvoiceRequestFields_write(uint64_t obj) {
66743         LDKInvoiceRequestFields obj_conv;
66744         obj_conv.inner = untag_ptr(obj);
66745         obj_conv.is_owned = ptr_is_owned(obj);
66746         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66747         obj_conv.is_owned = false;
66748         LDKCVec_u8Z ret_var = InvoiceRequestFields_write(&obj_conv);
66749         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66750         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66751         CVec_u8Z_free(ret_var);
66752         return ret_arr;
66753 }
66754
66755 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_read"))) TS_InvoiceRequestFields_read(int8_tArray ser) {
66756         LDKu8slice ser_ref;
66757         ser_ref.datalen = ser->arr_len;
66758         ser_ref.data = ser->elems;
66759         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
66760         *ret_conv = InvoiceRequestFields_read(ser_ref);
66761         FREE(ser);
66762         return tag_ptr(ret_conv, true);
66763 }
66764
66765 void  __attribute__((export_name("TS_TaggedHash_free"))) TS_TaggedHash_free(uint64_t this_obj) {
66766         LDKTaggedHash this_obj_conv;
66767         this_obj_conv.inner = untag_ptr(this_obj);
66768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66770         TaggedHash_free(this_obj_conv);
66771 }
66772
66773 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
66774         LDKTaggedHash ret_var = TaggedHash_clone(arg);
66775         uint64_t ret_ref = 0;
66776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66778         return ret_ref;
66779 }
66780 int64_t  __attribute__((export_name("TS_TaggedHash_clone_ptr"))) TS_TaggedHash_clone_ptr(uint64_t arg) {
66781         LDKTaggedHash arg_conv;
66782         arg_conv.inner = untag_ptr(arg);
66783         arg_conv.is_owned = ptr_is_owned(arg);
66784         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66785         arg_conv.is_owned = false;
66786         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
66787         return ret_conv;
66788 }
66789
66790 uint64_t  __attribute__((export_name("TS_TaggedHash_clone"))) TS_TaggedHash_clone(uint64_t orig) {
66791         LDKTaggedHash orig_conv;
66792         orig_conv.inner = untag_ptr(orig);
66793         orig_conv.is_owned = ptr_is_owned(orig);
66794         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66795         orig_conv.is_owned = false;
66796         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
66797         uint64_t ret_ref = 0;
66798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66800         return ret_ref;
66801 }
66802
66803 int8_tArray  __attribute__((export_name("TS_TaggedHash_as_digest"))) TS_TaggedHash_as_digest(uint64_t this_arg) {
66804         LDKTaggedHash this_arg_conv;
66805         this_arg_conv.inner = untag_ptr(this_arg);
66806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66808         this_arg_conv.is_owned = false;
66809         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66810         memcpy(ret_arr->elems, *TaggedHash_as_digest(&this_arg_conv), 32);
66811         return ret_arr;
66812 }
66813
66814 jstring  __attribute__((export_name("TS_TaggedHash_tag"))) TS_TaggedHash_tag(uint64_t this_arg) {
66815         LDKTaggedHash this_arg_conv;
66816         this_arg_conv.inner = untag_ptr(this_arg);
66817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66819         this_arg_conv.is_owned = false;
66820         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
66821         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
66822         Str_free(ret_str);
66823         return ret_conv;
66824 }
66825
66826 int8_tArray  __attribute__((export_name("TS_TaggedHash_merkle_root"))) TS_TaggedHash_merkle_root(uint64_t this_arg) {
66827         LDKTaggedHash this_arg_conv;
66828         this_arg_conv.inner = untag_ptr(this_arg);
66829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66831         this_arg_conv.is_owned = false;
66832         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66833         memcpy(ret_arr->elems, TaggedHash_merkle_root(&this_arg_conv).data, 32);
66834         return ret_arr;
66835 }
66836
66837 void  __attribute__((export_name("TS_SignError_free"))) TS_SignError_free(uint64_t this_ptr) {
66838         if (!ptr_is_owned(this_ptr)) return;
66839         void* this_ptr_ptr = untag_ptr(this_ptr);
66840         CHECK_ACCESS(this_ptr_ptr);
66841         LDKSignError this_ptr_conv = *(LDKSignError*)(this_ptr_ptr);
66842         FREE(untag_ptr(this_ptr));
66843         SignError_free(this_ptr_conv);
66844 }
66845
66846 static inline uint64_t SignError_clone_ptr(LDKSignError *NONNULL_PTR arg) {
66847         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
66848         *ret_copy = SignError_clone(arg);
66849         uint64_t ret_ref = tag_ptr(ret_copy, true);
66850         return ret_ref;
66851 }
66852 int64_t  __attribute__((export_name("TS_SignError_clone_ptr"))) TS_SignError_clone_ptr(uint64_t arg) {
66853         LDKSignError* arg_conv = (LDKSignError*)untag_ptr(arg);
66854         int64_t ret_conv = SignError_clone_ptr(arg_conv);
66855         return ret_conv;
66856 }
66857
66858 uint64_t  __attribute__((export_name("TS_SignError_clone"))) TS_SignError_clone(uint64_t orig) {
66859         LDKSignError* orig_conv = (LDKSignError*)untag_ptr(orig);
66860         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
66861         *ret_copy = SignError_clone(orig_conv);
66862         uint64_t ret_ref = tag_ptr(ret_copy, true);
66863         return ret_ref;
66864 }
66865
66866 uint64_t  __attribute__((export_name("TS_SignError_signing"))) TS_SignError_signing() {
66867         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
66868         *ret_copy = SignError_signing();
66869         uint64_t ret_ref = tag_ptr(ret_copy, true);
66870         return ret_ref;
66871 }
66872
66873 uint64_t  __attribute__((export_name("TS_SignError_verification"))) TS_SignError_verification(uint32_t a) {
66874         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
66875         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
66876         *ret_copy = SignError_verification(a_conv);
66877         uint64_t ret_ref = tag_ptr(ret_copy, true);
66878         return ret_ref;
66879 }
66880
66881 void  __attribute__((export_name("TS_Bolt12ParseError_free"))) TS_Bolt12ParseError_free(uint64_t this_obj) {
66882         LDKBolt12ParseError this_obj_conv;
66883         this_obj_conv.inner = untag_ptr(this_obj);
66884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66886         Bolt12ParseError_free(this_obj_conv);
66887 }
66888
66889 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
66890         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
66891         uint64_t ret_ref = 0;
66892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66894         return ret_ref;
66895 }
66896 int64_t  __attribute__((export_name("TS_Bolt12ParseError_clone_ptr"))) TS_Bolt12ParseError_clone_ptr(uint64_t arg) {
66897         LDKBolt12ParseError arg_conv;
66898         arg_conv.inner = untag_ptr(arg);
66899         arg_conv.is_owned = ptr_is_owned(arg);
66900         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66901         arg_conv.is_owned = false;
66902         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
66903         return ret_conv;
66904 }
66905
66906 uint64_t  __attribute__((export_name("TS_Bolt12ParseError_clone"))) TS_Bolt12ParseError_clone(uint64_t orig) {
66907         LDKBolt12ParseError orig_conv;
66908         orig_conv.inner = untag_ptr(orig);
66909         orig_conv.is_owned = ptr_is_owned(orig);
66910         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66911         orig_conv.is_owned = false;
66912         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
66913         uint64_t ret_ref = 0;
66914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66916         return ret_ref;
66917 }
66918
66919 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_clone"))) TS_Bolt12SemanticError_clone(uint64_t orig) {
66920         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
66921         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_clone(orig_conv));
66922         return ret_conv;
66923 }
66924
66925 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_already_expired"))) TS_Bolt12SemanticError_already_expired() {
66926         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_already_expired());
66927         return ret_conv;
66928 }
66929
66930 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_chain"))) TS_Bolt12SemanticError_unsupported_chain() {
66931         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_chain());
66932         return ret_conv;
66933 }
66934
66935 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_chain"))) TS_Bolt12SemanticError_unexpected_chain() {
66936         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_chain());
66937         return ret_conv;
66938 }
66939
66940 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_amount"))) TS_Bolt12SemanticError_missing_amount() {
66941         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_amount());
66942         return ret_conv;
66943 }
66944
66945 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_amount"))) TS_Bolt12SemanticError_invalid_amount() {
66946         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_amount());
66947         return ret_conv;
66948 }
66949
66950 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_insufficient_amount"))) TS_Bolt12SemanticError_insufficient_amount() {
66951         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_insufficient_amount());
66952         return ret_conv;
66953 }
66954
66955 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_amount"))) TS_Bolt12SemanticError_unexpected_amount() {
66956         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_amount());
66957         return ret_conv;
66958 }
66959
66960 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_currency"))) TS_Bolt12SemanticError_unsupported_currency() {
66961         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_currency());
66962         return ret_conv;
66963 }
66964
66965 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unknown_required_features"))) TS_Bolt12SemanticError_unknown_required_features() {
66966         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unknown_required_features());
66967         return ret_conv;
66968 }
66969
66970 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_features"))) TS_Bolt12SemanticError_unexpected_features() {
66971         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_features());
66972         return ret_conv;
66973 }
66974
66975 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_description"))) TS_Bolt12SemanticError_missing_description() {
66976         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_description());
66977         return ret_conv;
66978 }
66979
66980 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signing_pubkey"))) TS_Bolt12SemanticError_missing_signing_pubkey() {
66981         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signing_pubkey());
66982         return ret_conv;
66983 }
66984
66985 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_signing_pubkey"))) TS_Bolt12SemanticError_invalid_signing_pubkey() {
66986         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_signing_pubkey());
66987         return ret_conv;
66988 }
66989
66990 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_signing_pubkey"))) TS_Bolt12SemanticError_unexpected_signing_pubkey() {
66991         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_signing_pubkey());
66992         return ret_conv;
66993 }
66994
66995 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_quantity"))) TS_Bolt12SemanticError_missing_quantity() {
66996         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_quantity());
66997         return ret_conv;
66998 }
66999
67000 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_quantity"))) TS_Bolt12SemanticError_invalid_quantity() {
67001         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_quantity());
67002         return ret_conv;
67003 }
67004
67005 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_quantity"))) TS_Bolt12SemanticError_unexpected_quantity() {
67006         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_quantity());
67007         return ret_conv;
67008 }
67009
67010 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_metadata"))) TS_Bolt12SemanticError_invalid_metadata() {
67011         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_metadata());
67012         return ret_conv;
67013 }
67014
67015 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_metadata"))) TS_Bolt12SemanticError_unexpected_metadata() {
67016         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_metadata());
67017         return ret_conv;
67018 }
67019
67020 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_metadata"))) TS_Bolt12SemanticError_missing_payer_metadata() {
67021         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_metadata());
67022         return ret_conv;
67023 }
67024
67025 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_id"))) TS_Bolt12SemanticError_missing_payer_id() {
67026         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_id());
67027         return ret_conv;
67028 }
67029
67030 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_duplicate_payment_id"))) TS_Bolt12SemanticError_duplicate_payment_id() {
67031         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_duplicate_payment_id());
67032         return ret_conv;
67033 }
67034
67035 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_paths"))) TS_Bolt12SemanticError_missing_paths() {
67036         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_paths());
67037         return ret_conv;
67038 }
67039
67040 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_paths"))) TS_Bolt12SemanticError_unexpected_paths() {
67041         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_paths());
67042         return ret_conv;
67043 }
67044
67045 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_pay_info"))) TS_Bolt12SemanticError_invalid_pay_info() {
67046         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_pay_info());
67047         return ret_conv;
67048 }
67049
67050 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_creation_time"))) TS_Bolt12SemanticError_missing_creation_time() {
67051         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_creation_time());
67052         return ret_conv;
67053 }
67054
67055 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payment_hash"))) TS_Bolt12SemanticError_missing_payment_hash() {
67056         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payment_hash());
67057         return ret_conv;
67058 }
67059
67060 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signature"))) TS_Bolt12SemanticError_missing_signature() {
67061         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signature());
67062         return ret_conv;
67063 }
67064
67065 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_free"))) TS_RefundMaybeWithDerivedMetadataBuilder_free(uint64_t this_obj) {
67066         LDKRefundMaybeWithDerivedMetadataBuilder this_obj_conv;
67067         this_obj_conv.inner = untag_ptr(this_obj);
67068         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67070         RefundMaybeWithDerivedMetadataBuilder_free(this_obj_conv);
67071 }
67072
67073 static inline uint64_t RefundMaybeWithDerivedMetadataBuilder_clone_ptr(LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR arg) {
67074         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(arg);
67075         uint64_t ret_ref = 0;
67076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67078         return ret_ref;
67079 }
67080 int64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_clone_ptr"))) TS_RefundMaybeWithDerivedMetadataBuilder_clone_ptr(uint64_t arg) {
67081         LDKRefundMaybeWithDerivedMetadataBuilder arg_conv;
67082         arg_conv.inner = untag_ptr(arg);
67083         arg_conv.is_owned = ptr_is_owned(arg);
67084         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67085         arg_conv.is_owned = false;
67086         int64_t ret_conv = RefundMaybeWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
67087         return ret_conv;
67088 }
67089
67090 uint64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_clone"))) TS_RefundMaybeWithDerivedMetadataBuilder_clone(uint64_t orig) {
67091         LDKRefundMaybeWithDerivedMetadataBuilder orig_conv;
67092         orig_conv.inner = untag_ptr(orig);
67093         orig_conv.is_owned = ptr_is_owned(orig);
67094         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67095         orig_conv.is_owned = false;
67096         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(&orig_conv);
67097         uint64_t ret_ref = 0;
67098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67100         return ret_ref;
67101 }
67102
67103 uint64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_new"))) TS_RefundMaybeWithDerivedMetadataBuilder_new(int8_tArray metadata, int8_tArray payer_id, int64_t amount_msats) {
67104         LDKCVec_u8Z metadata_ref;
67105         metadata_ref.datalen = metadata->arr_len;
67106         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
67107         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
67108         LDKPublicKey payer_id_ref;
67109         CHECK(payer_id->arr_len == 33);
67110         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
67111         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
67112         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_new(metadata_ref, payer_id_ref, amount_msats);
67113         return tag_ptr(ret_conv, true);
67114 }
67115
67116 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) {
67117         LDKPublicKey node_id_ref;
67118         CHECK(node_id->arr_len == 33);
67119         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
67120         LDKExpandedKey expanded_key_conv;
67121         expanded_key_conv.inner = untag_ptr(expanded_key);
67122         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
67123         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
67124         expanded_key_conv.is_owned = false;
67125         void* entropy_source_ptr = untag_ptr(entropy_source);
67126         CHECK_ACCESS(entropy_source_ptr);
67127         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
67128         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
67129                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67130                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
67131         }
67132         LDKThirtyTwoBytes payment_id_ref;
67133         CHECK(payment_id->arr_len == 32);
67134         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
67135         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
67136         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(node_id_ref, &expanded_key_conv, entropy_source_conv, amount_msats, payment_id_ref);
67137         return tag_ptr(ret_conv, true);
67138 }
67139
67140 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_description"))) TS_RefundMaybeWithDerivedMetadataBuilder_description(uint64_t this_arg, jstring description) {
67141         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67142         this_arg_conv.inner = untag_ptr(this_arg);
67143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67145         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67146         LDKStr description_conv = str_ref_to_owned_c(description);
67147         RefundMaybeWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
67148 }
67149
67150 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_absolute_expiry"))) TS_RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(uint64_t this_arg, int64_t absolute_expiry) {
67151         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67152         this_arg_conv.inner = untag_ptr(this_arg);
67153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67155         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67156         RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
67157 }
67158
67159 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_issuer"))) TS_RefundMaybeWithDerivedMetadataBuilder_issuer(uint64_t this_arg, jstring issuer) {
67160         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67161         this_arg_conv.inner = untag_ptr(this_arg);
67162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67164         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67165         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
67166         RefundMaybeWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
67167 }
67168
67169 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_path"))) TS_RefundMaybeWithDerivedMetadataBuilder_path(uint64_t this_arg, uint64_t path) {
67170         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67171         this_arg_conv.inner = untag_ptr(this_arg);
67172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67174         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67175         LDKBlindedPath path_conv;
67176         path_conv.inner = untag_ptr(path);
67177         path_conv.is_owned = ptr_is_owned(path);
67178         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
67179         path_conv = BlindedPath_clone(&path_conv);
67180         RefundMaybeWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
67181 }
67182
67183 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_chain"))) TS_RefundMaybeWithDerivedMetadataBuilder_chain(uint64_t this_arg, uint32_t network) {
67184         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67185         this_arg_conv.inner = untag_ptr(this_arg);
67186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67188         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67189         LDKNetwork network_conv = LDKNetwork_from_js(network);
67190         RefundMaybeWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
67191 }
67192
67193 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_quantity"))) TS_RefundMaybeWithDerivedMetadataBuilder_quantity(uint64_t this_arg, int64_t quantity) {
67194         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67195         this_arg_conv.inner = untag_ptr(this_arg);
67196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67198         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67199         RefundMaybeWithDerivedMetadataBuilder_quantity(this_arg_conv, quantity);
67200 }
67201
67202 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_payer_note"))) TS_RefundMaybeWithDerivedMetadataBuilder_payer_note(uint64_t this_arg, jstring payer_note) {
67203         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67204         this_arg_conv.inner = untag_ptr(this_arg);
67205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67207         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67208         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
67209         RefundMaybeWithDerivedMetadataBuilder_payer_note(this_arg_conv, payer_note_conv);
67210 }
67211
67212 uint64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_build"))) TS_RefundMaybeWithDerivedMetadataBuilder_build(uint64_t this_arg) {
67213         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67214         this_arg_conv.inner = untag_ptr(this_arg);
67215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67217         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67218         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
67219         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_build(this_arg_conv);
67220         return tag_ptr(ret_conv, true);
67221 }
67222
67223 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
67224         LDKRefund this_obj_conv;
67225         this_obj_conv.inner = untag_ptr(this_obj);
67226         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67228         Refund_free(this_obj_conv);
67229 }
67230
67231 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
67232         LDKRefund ret_var = Refund_clone(arg);
67233         uint64_t ret_ref = 0;
67234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67236         return ret_ref;
67237 }
67238 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
67239         LDKRefund arg_conv;
67240         arg_conv.inner = untag_ptr(arg);
67241         arg_conv.is_owned = ptr_is_owned(arg);
67242         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67243         arg_conv.is_owned = false;
67244         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
67245         return ret_conv;
67246 }
67247
67248 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
67249         LDKRefund orig_conv;
67250         orig_conv.inner = untag_ptr(orig);
67251         orig_conv.is_owned = ptr_is_owned(orig);
67252         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67253         orig_conv.is_owned = false;
67254         LDKRefund ret_var = Refund_clone(&orig_conv);
67255         uint64_t ret_ref = 0;
67256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67258         return ret_ref;
67259 }
67260
67261 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
67262         LDKRefund this_arg_conv;
67263         this_arg_conv.inner = untag_ptr(this_arg);
67264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67266         this_arg_conv.is_owned = false;
67267         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
67268         uint64_t ret_ref = 0;
67269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67271         return ret_ref;
67272 }
67273
67274 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
67275         LDKRefund this_arg_conv;
67276         this_arg_conv.inner = untag_ptr(this_arg);
67277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67279         this_arg_conv.is_owned = false;
67280         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67281         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
67282         uint64_t ret_ref = tag_ptr(ret_copy, true);
67283         return ret_ref;
67284 }
67285
67286 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) {
67287         LDKRefund this_arg_conv;
67288         this_arg_conv.inner = untag_ptr(this_arg);
67289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67291         this_arg_conv.is_owned = false;
67292         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
67293         return ret_conv;
67294 }
67295
67296 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
67297         LDKRefund this_arg_conv;
67298         this_arg_conv.inner = untag_ptr(this_arg);
67299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67301         this_arg_conv.is_owned = false;
67302         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
67303         uint64_t ret_ref = 0;
67304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67306         return ret_ref;
67307 }
67308
67309 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
67310         LDKRefund this_arg_conv;
67311         this_arg_conv.inner = untag_ptr(this_arg);
67312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67314         this_arg_conv.is_owned = false;
67315         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
67316         uint64_tArray ret_arr = NULL;
67317         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
67318         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
67319         for (size_t n = 0; n < ret_var.datalen; n++) {
67320                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
67321                 uint64_t ret_conv_13_ref = 0;
67322                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
67323                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
67324                 ret_arr_ptr[n] = ret_conv_13_ref;
67325         }
67326         
67327         FREE(ret_var.data);
67328         return ret_arr;
67329 }
67330
67331 int8_tArray  __attribute__((export_name("TS_Refund_payer_metadata"))) TS_Refund_payer_metadata(uint64_t this_arg) {
67332         LDKRefund this_arg_conv;
67333         this_arg_conv.inner = untag_ptr(this_arg);
67334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67336         this_arg_conv.is_owned = false;
67337         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
67338         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67339         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67340         return ret_arr;
67341 }
67342
67343 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
67344         LDKRefund this_arg_conv;
67345         this_arg_conv.inner = untag_ptr(this_arg);
67346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67348         this_arg_conv.is_owned = false;
67349         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67350         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
67351         return ret_arr;
67352 }
67353
67354 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
67355         LDKRefund this_arg_conv;
67356         this_arg_conv.inner = untag_ptr(this_arg);
67357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67359         this_arg_conv.is_owned = false;
67360         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
67361         return ret_conv;
67362 }
67363
67364 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
67365         LDKRefund this_arg_conv;
67366         this_arg_conv.inner = untag_ptr(this_arg);
67367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67369         this_arg_conv.is_owned = false;
67370         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
67371         uint64_t ret_ref = 0;
67372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67374         return ret_ref;
67375 }
67376
67377 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
67378         LDKRefund this_arg_conv;
67379         this_arg_conv.inner = untag_ptr(this_arg);
67380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67382         this_arg_conv.is_owned = false;
67383         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67384         *ret_copy = Refund_quantity(&this_arg_conv);
67385         uint64_t ret_ref = tag_ptr(ret_copy, true);
67386         return ret_ref;
67387 }
67388
67389 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
67390         LDKRefund this_arg_conv;
67391         this_arg_conv.inner = untag_ptr(this_arg);
67392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67394         this_arg_conv.is_owned = false;
67395         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67396         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
67397         return ret_arr;
67398 }
67399
67400 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
67401         LDKRefund this_arg_conv;
67402         this_arg_conv.inner = untag_ptr(this_arg);
67403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67405         this_arg_conv.is_owned = false;
67406         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
67407         uint64_t ret_ref = 0;
67408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67410         return ret_ref;
67411 }
67412
67413 int64_t  __attribute__((export_name("TS_Refund_hash"))) TS_Refund_hash(uint64_t o) {
67414         LDKRefund o_conv;
67415         o_conv.inner = untag_ptr(o);
67416         o_conv.is_owned = ptr_is_owned(o);
67417         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67418         o_conv.is_owned = false;
67419         int64_t ret_conv = Refund_hash(&o_conv);
67420         return ret_conv;
67421 }
67422
67423 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
67424         LDKRefund obj_conv;
67425         obj_conv.inner = untag_ptr(obj);
67426         obj_conv.is_owned = ptr_is_owned(obj);
67427         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67428         obj_conv.is_owned = false;
67429         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
67430         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67431         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67432         CVec_u8Z_free(ret_var);
67433         return ret_arr;
67434 }
67435
67436 uint64_t  __attribute__((export_name("TS_Refund_from_str"))) TS_Refund_from_str(jstring s) {
67437         LDKStr s_conv = str_ref_to_owned_c(s);
67438         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
67439         *ret_conv = Refund_from_str(s_conv);
67440         return tag_ptr(ret_conv, true);
67441 }
67442
67443 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
67444         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
67445         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
67446         return ret_conv;
67447 }
67448
67449 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
67450         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
67451         return ret_conv;
67452 }
67453
67454 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
67455         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
67456         return ret_conv;
67457 }
67458
67459 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
67460         if (!ptr_is_owned(this_ptr)) return;
67461         void* this_ptr_ptr = untag_ptr(this_ptr);
67462         CHECK_ACCESS(this_ptr_ptr);
67463         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
67464         FREE(untag_ptr(this_ptr));
67465         UtxoResult_free(this_ptr_conv);
67466 }
67467
67468 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
67469         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67470         *ret_copy = UtxoResult_clone(arg);
67471         uint64_t ret_ref = tag_ptr(ret_copy, true);
67472         return ret_ref;
67473 }
67474 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
67475         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
67476         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
67477         return ret_conv;
67478 }
67479
67480 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
67481         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
67482         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67483         *ret_copy = UtxoResult_clone(orig_conv);
67484         uint64_t ret_ref = tag_ptr(ret_copy, true);
67485         return ret_ref;
67486 }
67487
67488 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
67489         void* a_ptr = untag_ptr(a);
67490         CHECK_ACCESS(a_ptr);
67491         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
67492         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
67493         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67494         *ret_copy = UtxoResult_sync(a_conv);
67495         uint64_t ret_ref = tag_ptr(ret_copy, true);
67496         return ret_ref;
67497 }
67498
67499 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
67500         LDKUtxoFuture a_conv;
67501         a_conv.inner = untag_ptr(a);
67502         a_conv.is_owned = ptr_is_owned(a);
67503         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67504         a_conv = UtxoFuture_clone(&a_conv);
67505         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67506         *ret_copy = UtxoResult_async(a_conv);
67507         uint64_t ret_ref = tag_ptr(ret_copy, true);
67508         return ret_ref;
67509 }
67510
67511 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
67512         if (!ptr_is_owned(this_ptr)) return;
67513         void* this_ptr_ptr = untag_ptr(this_ptr);
67514         CHECK_ACCESS(this_ptr_ptr);
67515         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
67516         FREE(untag_ptr(this_ptr));
67517         UtxoLookup_free(this_ptr_conv);
67518 }
67519
67520 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
67521         LDKUtxoFuture this_obj_conv;
67522         this_obj_conv.inner = untag_ptr(this_obj);
67523         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67525         UtxoFuture_free(this_obj_conv);
67526 }
67527
67528 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
67529         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
67530         uint64_t ret_ref = 0;
67531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67533         return ret_ref;
67534 }
67535 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
67536         LDKUtxoFuture arg_conv;
67537         arg_conv.inner = untag_ptr(arg);
67538         arg_conv.is_owned = ptr_is_owned(arg);
67539         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67540         arg_conv.is_owned = false;
67541         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
67542         return ret_conv;
67543 }
67544
67545 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
67546         LDKUtxoFuture orig_conv;
67547         orig_conv.inner = untag_ptr(orig);
67548         orig_conv.is_owned = ptr_is_owned(orig);
67549         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67550         orig_conv.is_owned = false;
67551         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
67552         uint64_t ret_ref = 0;
67553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67555         return ret_ref;
67556 }
67557
67558 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
67559         LDKUtxoFuture ret_var = UtxoFuture_new();
67560         uint64_t ret_ref = 0;
67561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67563         return ret_ref;
67564 }
67565
67566 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
67567         LDKUtxoFuture this_arg_conv;
67568         this_arg_conv.inner = untag_ptr(this_arg);
67569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67571         this_arg_conv.is_owned = false;
67572         LDKNetworkGraph graph_conv;
67573         graph_conv.inner = untag_ptr(graph);
67574         graph_conv.is_owned = ptr_is_owned(graph);
67575         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
67576         graph_conv.is_owned = false;
67577         void* result_ptr = untag_ptr(result);
67578         CHECK_ACCESS(result_ptr);
67579         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
67580         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
67581 }
67582
67583 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
67584         LDKUtxoFuture this_arg_conv;
67585         this_arg_conv.inner = untag_ptr(this_arg);
67586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67588         this_arg_conv.is_owned = false;
67589         LDKNetworkGraph graph_conv;
67590         graph_conv.inner = untag_ptr(graph);
67591         graph_conv.is_owned = ptr_is_owned(graph);
67592         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
67593         graph_conv.is_owned = false;
67594         LDKP2PGossipSync gossip_conv;
67595         gossip_conv.inner = untag_ptr(gossip);
67596         gossip_conv.is_owned = ptr_is_owned(gossip);
67597         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
67598         gossip_conv.is_owned = false;
67599         void* result_ptr = untag_ptr(result);
67600         CHECK_ACCESS(result_ptr);
67601         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
67602         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
67603 }
67604
67605 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
67606         LDKNodeId this_obj_conv;
67607         this_obj_conv.inner = untag_ptr(this_obj);
67608         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67610         NodeId_free(this_obj_conv);
67611 }
67612
67613 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
67614         LDKNodeId ret_var = NodeId_clone(arg);
67615         uint64_t ret_ref = 0;
67616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67618         return ret_ref;
67619 }
67620 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
67621         LDKNodeId arg_conv;
67622         arg_conv.inner = untag_ptr(arg);
67623         arg_conv.is_owned = ptr_is_owned(arg);
67624         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67625         arg_conv.is_owned = false;
67626         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
67627         return ret_conv;
67628 }
67629
67630 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
67631         LDKNodeId orig_conv;
67632         orig_conv.inner = untag_ptr(orig);
67633         orig_conv.is_owned = ptr_is_owned(orig);
67634         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67635         orig_conv.is_owned = false;
67636         LDKNodeId ret_var = NodeId_clone(&orig_conv);
67637         uint64_t ret_ref = 0;
67638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67640         return ret_ref;
67641 }
67642
67643 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
67644         LDKPublicKey pubkey_ref;
67645         CHECK(pubkey->arr_len == 33);
67646         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
67647         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
67648         uint64_t ret_ref = 0;
67649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67651         return ret_ref;
67652 }
67653
67654 uint64_t  __attribute__((export_name("TS_NodeId_from_slice"))) TS_NodeId_from_slice(int8_tArray bytes) {
67655         LDKu8slice bytes_ref;
67656         bytes_ref.datalen = bytes->arr_len;
67657         bytes_ref.data = bytes->elems;
67658         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
67659         *ret_conv = NodeId_from_slice(bytes_ref);
67660         FREE(bytes);
67661         return tag_ptr(ret_conv, true);
67662 }
67663
67664 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
67665         LDKNodeId this_arg_conv;
67666         this_arg_conv.inner = untag_ptr(this_arg);
67667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67669         this_arg_conv.is_owned = false;
67670         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
67671         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67672         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67673         return ret_arr;
67674 }
67675
67676 int8_tArray  __attribute__((export_name("TS_NodeId_as_array"))) TS_NodeId_as_array(uint64_t this_arg) {
67677         LDKNodeId this_arg_conv;
67678         this_arg_conv.inner = untag_ptr(this_arg);
67679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67681         this_arg_conv.is_owned = false;
67682         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67683         memcpy(ret_arr->elems, *NodeId_as_array(&this_arg_conv), 33);
67684         return ret_arr;
67685 }
67686
67687 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
67688         LDKNodeId this_arg_conv;
67689         this_arg_conv.inner = untag_ptr(this_arg);
67690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67692         this_arg_conv.is_owned = false;
67693         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
67694         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
67695         return tag_ptr(ret_conv, true);
67696 }
67697
67698 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
67699         LDKNodeId o_conv;
67700         o_conv.inner = untag_ptr(o);
67701         o_conv.is_owned = ptr_is_owned(o);
67702         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67703         o_conv.is_owned = false;
67704         int64_t ret_conv = NodeId_hash(&o_conv);
67705         return ret_conv;
67706 }
67707
67708 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
67709         LDKNodeId obj_conv;
67710         obj_conv.inner = untag_ptr(obj);
67711         obj_conv.is_owned = ptr_is_owned(obj);
67712         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67713         obj_conv.is_owned = false;
67714         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
67715         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67716         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67717         CVec_u8Z_free(ret_var);
67718         return ret_arr;
67719 }
67720
67721 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
67722         LDKu8slice ser_ref;
67723         ser_ref.datalen = ser->arr_len;
67724         ser_ref.data = ser->elems;
67725         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
67726         *ret_conv = NodeId_read(ser_ref);
67727         FREE(ser);
67728         return tag_ptr(ret_conv, true);
67729 }
67730
67731 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
67732         LDKNetworkGraph this_obj_conv;
67733         this_obj_conv.inner = untag_ptr(this_obj);
67734         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67736         NetworkGraph_free(this_obj_conv);
67737 }
67738
67739 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
67740         LDKReadOnlyNetworkGraph this_obj_conv;
67741         this_obj_conv.inner = untag_ptr(this_obj);
67742         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67744         ReadOnlyNetworkGraph_free(this_obj_conv);
67745 }
67746
67747 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
67748         if (!ptr_is_owned(this_ptr)) return;
67749         void* this_ptr_ptr = untag_ptr(this_ptr);
67750         CHECK_ACCESS(this_ptr_ptr);
67751         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
67752         FREE(untag_ptr(this_ptr));
67753         NetworkUpdate_free(this_ptr_conv);
67754 }
67755
67756 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
67757         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67758         *ret_copy = NetworkUpdate_clone(arg);
67759         uint64_t ret_ref = tag_ptr(ret_copy, true);
67760         return ret_ref;
67761 }
67762 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
67763         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
67764         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
67765         return ret_conv;
67766 }
67767
67768 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
67769         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
67770         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67771         *ret_copy = NetworkUpdate_clone(orig_conv);
67772         uint64_t ret_ref = tag_ptr(ret_copy, true);
67773         return ret_ref;
67774 }
67775
67776 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
67777         LDKChannelUpdate msg_conv;
67778         msg_conv.inner = untag_ptr(msg);
67779         msg_conv.is_owned = ptr_is_owned(msg);
67780         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
67781         msg_conv = ChannelUpdate_clone(&msg_conv);
67782         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67783         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
67784         uint64_t ret_ref = tag_ptr(ret_copy, true);
67785         return ret_ref;
67786 }
67787
67788 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
67789         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67790         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
67791         uint64_t ret_ref = tag_ptr(ret_copy, true);
67792         return ret_ref;
67793 }
67794
67795 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
67796         LDKPublicKey node_id_ref;
67797         CHECK(node_id->arr_len == 33);
67798         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
67799         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67800         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
67801         uint64_t ret_ref = tag_ptr(ret_copy, true);
67802         return ret_ref;
67803 }
67804
67805 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
67806         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
67807         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
67808         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
67809         return ret_conv;
67810 }
67811
67812 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
67813         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
67814         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
67815         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67816         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67817         CVec_u8Z_free(ret_var);
67818         return ret_arr;
67819 }
67820
67821 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
67822         LDKu8slice ser_ref;
67823         ser_ref.datalen = ser->arr_len;
67824         ser_ref.data = ser->elems;
67825         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
67826         *ret_conv = NetworkUpdate_read(ser_ref);
67827         FREE(ser);
67828         return tag_ptr(ret_conv, true);
67829 }
67830
67831 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
67832         LDKP2PGossipSync this_obj_conv;
67833         this_obj_conv.inner = untag_ptr(this_obj);
67834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67836         P2PGossipSync_free(this_obj_conv);
67837 }
67838
67839 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
67840         LDKNetworkGraph network_graph_conv;
67841         network_graph_conv.inner = untag_ptr(network_graph);
67842         network_graph_conv.is_owned = ptr_is_owned(network_graph);
67843         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
67844         network_graph_conv.is_owned = false;
67845         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
67846         CHECK_ACCESS(utxo_lookup_ptr);
67847         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
67848         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
67849         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
67850                 // Manually implement clone for Java trait instances
67851                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
67852                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67853                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
67854                 }
67855         }
67856         void* logger_ptr = untag_ptr(logger);
67857         CHECK_ACCESS(logger_ptr);
67858         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67859         if (logger_conv.free == LDKLogger_JCalls_free) {
67860                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67861                 LDKLogger_JCalls_cloned(&logger_conv);
67862         }
67863         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
67864         uint64_t ret_ref = 0;
67865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67867         return ret_ref;
67868 }
67869
67870 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
67871         LDKP2PGossipSync this_arg_conv;
67872         this_arg_conv.inner = untag_ptr(this_arg);
67873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67875         this_arg_conv.is_owned = false;
67876         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
67877         CHECK_ACCESS(utxo_lookup_ptr);
67878         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
67879         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
67880         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
67881                 // Manually implement clone for Java trait instances
67882                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
67883                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67884                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
67885                 }
67886         }
67887         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
67888 }
67889
67890 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
67891         LDKNetworkGraph this_arg_conv;
67892         this_arg_conv.inner = untag_ptr(this_arg);
67893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67895         this_arg_conv.is_owned = false;
67896         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
67897         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
67898 }
67899
67900 int8_tArray  __attribute__((export_name("TS_NetworkGraph_get_chain_hash"))) TS_NetworkGraph_get_chain_hash(uint64_t this_arg) {
67901         LDKNetworkGraph this_arg_conv;
67902         this_arg_conv.inner = untag_ptr(this_arg);
67903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67905         this_arg_conv.is_owned = false;
67906         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67907         memcpy(ret_arr->elems, NetworkGraph_get_chain_hash(&this_arg_conv).data, 32);
67908         return ret_arr;
67909 }
67910
67911 uint64_t  __attribute__((export_name("TS_verify_node_announcement"))) TS_verify_node_announcement(uint64_t msg) {
67912         LDKNodeAnnouncement msg_conv;
67913         msg_conv.inner = untag_ptr(msg);
67914         msg_conv.is_owned = ptr_is_owned(msg);
67915         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
67916         msg_conv.is_owned = false;
67917         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
67918         *ret_conv = verify_node_announcement(&msg_conv);
67919         return tag_ptr(ret_conv, true);
67920 }
67921
67922 uint64_t  __attribute__((export_name("TS_verify_channel_announcement"))) TS_verify_channel_announcement(uint64_t msg) {
67923         LDKChannelAnnouncement msg_conv;
67924         msg_conv.inner = untag_ptr(msg);
67925         msg_conv.is_owned = ptr_is_owned(msg);
67926         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
67927         msg_conv.is_owned = false;
67928         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
67929         *ret_conv = verify_channel_announcement(&msg_conv);
67930         return tag_ptr(ret_conv, true);
67931 }
67932
67933 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
67934         LDKP2PGossipSync this_arg_conv;
67935         this_arg_conv.inner = untag_ptr(this_arg);
67936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67938         this_arg_conv.is_owned = false;
67939         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
67940         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
67941         return tag_ptr(ret_ret, true);
67942 }
67943
67944 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
67945         LDKP2PGossipSync this_arg_conv;
67946         this_arg_conv.inner = untag_ptr(this_arg);
67947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67949         this_arg_conv.is_owned = false;
67950         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
67951         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
67952         return tag_ptr(ret_ret, true);
67953 }
67954
67955 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
67956         LDKChannelUpdateInfo this_obj_conv;
67957         this_obj_conv.inner = untag_ptr(this_obj);
67958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67960         ChannelUpdateInfo_free(this_obj_conv);
67961 }
67962
67963 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
67964         LDKChannelUpdateInfo this_ptr_conv;
67965         this_ptr_conv.inner = untag_ptr(this_ptr);
67966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67968         this_ptr_conv.is_owned = false;
67969         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
67970         return ret_conv;
67971 }
67972
67973 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
67974         LDKChannelUpdateInfo this_ptr_conv;
67975         this_ptr_conv.inner = untag_ptr(this_ptr);
67976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67978         this_ptr_conv.is_owned = false;
67979         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
67980 }
67981
67982 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
67983         LDKChannelUpdateInfo this_ptr_conv;
67984         this_ptr_conv.inner = untag_ptr(this_ptr);
67985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67987         this_ptr_conv.is_owned = false;
67988         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
67989         return ret_conv;
67990 }
67991
67992 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
67993         LDKChannelUpdateInfo this_ptr_conv;
67994         this_ptr_conv.inner = untag_ptr(this_ptr);
67995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67997         this_ptr_conv.is_owned = false;
67998         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
67999 }
68000
68001 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
68002         LDKChannelUpdateInfo this_ptr_conv;
68003         this_ptr_conv.inner = untag_ptr(this_ptr);
68004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68006         this_ptr_conv.is_owned = false;
68007         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
68008         return ret_conv;
68009 }
68010
68011 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
68012         LDKChannelUpdateInfo this_ptr_conv;
68013         this_ptr_conv.inner = untag_ptr(this_ptr);
68014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68016         this_ptr_conv.is_owned = false;
68017         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
68018 }
68019
68020 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
68021         LDKChannelUpdateInfo this_ptr_conv;
68022         this_ptr_conv.inner = untag_ptr(this_ptr);
68023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68025         this_ptr_conv.is_owned = false;
68026         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
68027         return ret_conv;
68028 }
68029
68030 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
68031         LDKChannelUpdateInfo this_ptr_conv;
68032         this_ptr_conv.inner = untag_ptr(this_ptr);
68033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68035         this_ptr_conv.is_owned = false;
68036         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
68037 }
68038
68039 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
68040         LDKChannelUpdateInfo this_ptr_conv;
68041         this_ptr_conv.inner = untag_ptr(this_ptr);
68042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68044         this_ptr_conv.is_owned = false;
68045         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
68046         return ret_conv;
68047 }
68048
68049 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
68050         LDKChannelUpdateInfo this_ptr_conv;
68051         this_ptr_conv.inner = untag_ptr(this_ptr);
68052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68054         this_ptr_conv.is_owned = false;
68055         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
68056 }
68057
68058 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
68059         LDKChannelUpdateInfo this_ptr_conv;
68060         this_ptr_conv.inner = untag_ptr(this_ptr);
68061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68063         this_ptr_conv.is_owned = false;
68064         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
68065         uint64_t ret_ref = 0;
68066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68068         return ret_ref;
68069 }
68070
68071 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
68072         LDKChannelUpdateInfo this_ptr_conv;
68073         this_ptr_conv.inner = untag_ptr(this_ptr);
68074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68076         this_ptr_conv.is_owned = false;
68077         LDKRoutingFees val_conv;
68078         val_conv.inner = untag_ptr(val);
68079         val_conv.is_owned = ptr_is_owned(val);
68080         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68081         val_conv = RoutingFees_clone(&val_conv);
68082         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
68083 }
68084
68085 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
68086         LDKChannelUpdateInfo this_ptr_conv;
68087         this_ptr_conv.inner = untag_ptr(this_ptr);
68088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68090         this_ptr_conv.is_owned = false;
68091         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
68092         uint64_t ret_ref = 0;
68093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68095         return ret_ref;
68096 }
68097
68098 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
68099         LDKChannelUpdateInfo this_ptr_conv;
68100         this_ptr_conv.inner = untag_ptr(this_ptr);
68101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68103         this_ptr_conv.is_owned = false;
68104         LDKChannelUpdate val_conv;
68105         val_conv.inner = untag_ptr(val);
68106         val_conv.is_owned = ptr_is_owned(val);
68107         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68108         val_conv = ChannelUpdate_clone(&val_conv);
68109         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
68110 }
68111
68112 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) {
68113         LDKRoutingFees fees_arg_conv;
68114         fees_arg_conv.inner = untag_ptr(fees_arg);
68115         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
68116         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
68117         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
68118         LDKChannelUpdate last_update_message_arg_conv;
68119         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
68120         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
68121         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
68122         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
68123         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);
68124         uint64_t ret_ref = 0;
68125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68127         return ret_ref;
68128 }
68129
68130 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
68131         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
68132         uint64_t ret_ref = 0;
68133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68135         return ret_ref;
68136 }
68137 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
68138         LDKChannelUpdateInfo arg_conv;
68139         arg_conv.inner = untag_ptr(arg);
68140         arg_conv.is_owned = ptr_is_owned(arg);
68141         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68142         arg_conv.is_owned = false;
68143         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
68144         return ret_conv;
68145 }
68146
68147 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
68148         LDKChannelUpdateInfo orig_conv;
68149         orig_conv.inner = untag_ptr(orig);
68150         orig_conv.is_owned = ptr_is_owned(orig);
68151         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68152         orig_conv.is_owned = false;
68153         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
68154         uint64_t ret_ref = 0;
68155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68157         return ret_ref;
68158 }
68159
68160 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
68161         LDKChannelUpdateInfo a_conv;
68162         a_conv.inner = untag_ptr(a);
68163         a_conv.is_owned = ptr_is_owned(a);
68164         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68165         a_conv.is_owned = false;
68166         LDKChannelUpdateInfo b_conv;
68167         b_conv.inner = untag_ptr(b);
68168         b_conv.is_owned = ptr_is_owned(b);
68169         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68170         b_conv.is_owned = false;
68171         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
68172         return ret_conv;
68173 }
68174
68175 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
68176         LDKChannelUpdateInfo obj_conv;
68177         obj_conv.inner = untag_ptr(obj);
68178         obj_conv.is_owned = ptr_is_owned(obj);
68179         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68180         obj_conv.is_owned = false;
68181         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
68182         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68183         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68184         CVec_u8Z_free(ret_var);
68185         return ret_arr;
68186 }
68187
68188 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
68189         LDKu8slice ser_ref;
68190         ser_ref.datalen = ser->arr_len;
68191         ser_ref.data = ser->elems;
68192         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
68193         *ret_conv = ChannelUpdateInfo_read(ser_ref);
68194         FREE(ser);
68195         return tag_ptr(ret_conv, true);
68196 }
68197
68198 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
68199         LDKChannelInfo this_obj_conv;
68200         this_obj_conv.inner = untag_ptr(this_obj);
68201         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68203         ChannelInfo_free(this_obj_conv);
68204 }
68205
68206 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
68207         LDKChannelInfo this_ptr_conv;
68208         this_ptr_conv.inner = untag_ptr(this_ptr);
68209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68211         this_ptr_conv.is_owned = false;
68212         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
68213         uint64_t ret_ref = 0;
68214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68216         return ret_ref;
68217 }
68218
68219 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
68220         LDKChannelInfo this_ptr_conv;
68221         this_ptr_conv.inner = untag_ptr(this_ptr);
68222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68224         this_ptr_conv.is_owned = false;
68225         LDKChannelFeatures val_conv;
68226         val_conv.inner = untag_ptr(val);
68227         val_conv.is_owned = ptr_is_owned(val);
68228         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68229         val_conv = ChannelFeatures_clone(&val_conv);
68230         ChannelInfo_set_features(&this_ptr_conv, val_conv);
68231 }
68232
68233 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
68234         LDKChannelInfo this_ptr_conv;
68235         this_ptr_conv.inner = untag_ptr(this_ptr);
68236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68238         this_ptr_conv.is_owned = false;
68239         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
68240         uint64_t ret_ref = 0;
68241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68243         return ret_ref;
68244 }
68245
68246 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
68247         LDKChannelInfo this_ptr_conv;
68248         this_ptr_conv.inner = untag_ptr(this_ptr);
68249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68251         this_ptr_conv.is_owned = false;
68252         LDKNodeId val_conv;
68253         val_conv.inner = untag_ptr(val);
68254         val_conv.is_owned = ptr_is_owned(val);
68255         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68256         val_conv = NodeId_clone(&val_conv);
68257         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
68258 }
68259
68260 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
68261         LDKChannelInfo this_ptr_conv;
68262         this_ptr_conv.inner = untag_ptr(this_ptr);
68263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68265         this_ptr_conv.is_owned = false;
68266         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
68267         uint64_t ret_ref = 0;
68268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68270         return ret_ref;
68271 }
68272
68273 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
68274         LDKChannelInfo this_ptr_conv;
68275         this_ptr_conv.inner = untag_ptr(this_ptr);
68276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68278         this_ptr_conv.is_owned = false;
68279         LDKChannelUpdateInfo val_conv;
68280         val_conv.inner = untag_ptr(val);
68281         val_conv.is_owned = ptr_is_owned(val);
68282         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68283         val_conv = ChannelUpdateInfo_clone(&val_conv);
68284         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
68285 }
68286
68287 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
68288         LDKChannelInfo this_ptr_conv;
68289         this_ptr_conv.inner = untag_ptr(this_ptr);
68290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68292         this_ptr_conv.is_owned = false;
68293         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
68294         uint64_t ret_ref = 0;
68295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68297         return ret_ref;
68298 }
68299
68300 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
68301         LDKChannelInfo this_ptr_conv;
68302         this_ptr_conv.inner = untag_ptr(this_ptr);
68303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68305         this_ptr_conv.is_owned = false;
68306         LDKNodeId val_conv;
68307         val_conv.inner = untag_ptr(val);
68308         val_conv.is_owned = ptr_is_owned(val);
68309         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68310         val_conv = NodeId_clone(&val_conv);
68311         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
68312 }
68313
68314 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
68315         LDKChannelInfo this_ptr_conv;
68316         this_ptr_conv.inner = untag_ptr(this_ptr);
68317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68319         this_ptr_conv.is_owned = false;
68320         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
68321         uint64_t ret_ref = 0;
68322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68324         return ret_ref;
68325 }
68326
68327 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
68328         LDKChannelInfo this_ptr_conv;
68329         this_ptr_conv.inner = untag_ptr(this_ptr);
68330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68332         this_ptr_conv.is_owned = false;
68333         LDKChannelUpdateInfo val_conv;
68334         val_conv.inner = untag_ptr(val);
68335         val_conv.is_owned = ptr_is_owned(val);
68336         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68337         val_conv = ChannelUpdateInfo_clone(&val_conv);
68338         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
68339 }
68340
68341 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
68342         LDKChannelInfo this_ptr_conv;
68343         this_ptr_conv.inner = untag_ptr(this_ptr);
68344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68346         this_ptr_conv.is_owned = false;
68347         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68348         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
68349         uint64_t ret_ref = tag_ptr(ret_copy, true);
68350         return ret_ref;
68351 }
68352
68353 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
68354         LDKChannelInfo this_ptr_conv;
68355         this_ptr_conv.inner = untag_ptr(this_ptr);
68356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68358         this_ptr_conv.is_owned = false;
68359         void* val_ptr = untag_ptr(val);
68360         CHECK_ACCESS(val_ptr);
68361         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
68362         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
68363         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
68364 }
68365
68366 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
68367         LDKChannelInfo this_ptr_conv;
68368         this_ptr_conv.inner = untag_ptr(this_ptr);
68369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68371         this_ptr_conv.is_owned = false;
68372         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
68373         uint64_t ret_ref = 0;
68374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68376         return ret_ref;
68377 }
68378
68379 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
68380         LDKChannelInfo this_ptr_conv;
68381         this_ptr_conv.inner = untag_ptr(this_ptr);
68382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68384         this_ptr_conv.is_owned = false;
68385         LDKChannelAnnouncement val_conv;
68386         val_conv.inner = untag_ptr(val);
68387         val_conv.is_owned = ptr_is_owned(val);
68388         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68389         val_conv = ChannelAnnouncement_clone(&val_conv);
68390         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
68391 }
68392
68393 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
68394         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
68395         uint64_t ret_ref = 0;
68396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68398         return ret_ref;
68399 }
68400 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
68401         LDKChannelInfo arg_conv;
68402         arg_conv.inner = untag_ptr(arg);
68403         arg_conv.is_owned = ptr_is_owned(arg);
68404         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68405         arg_conv.is_owned = false;
68406         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
68407         return ret_conv;
68408 }
68409
68410 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
68411         LDKChannelInfo orig_conv;
68412         orig_conv.inner = untag_ptr(orig);
68413         orig_conv.is_owned = ptr_is_owned(orig);
68414         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68415         orig_conv.is_owned = false;
68416         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
68417         uint64_t ret_ref = 0;
68418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68420         return ret_ref;
68421 }
68422
68423 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
68424         LDKChannelInfo a_conv;
68425         a_conv.inner = untag_ptr(a);
68426         a_conv.is_owned = ptr_is_owned(a);
68427         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68428         a_conv.is_owned = false;
68429         LDKChannelInfo b_conv;
68430         b_conv.inner = untag_ptr(b);
68431         b_conv.is_owned = ptr_is_owned(b);
68432         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68433         b_conv.is_owned = false;
68434         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
68435         return ret_conv;
68436 }
68437
68438 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
68439         LDKChannelInfo this_arg_conv;
68440         this_arg_conv.inner = untag_ptr(this_arg);
68441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68443         this_arg_conv.is_owned = false;
68444         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
68445         uint64_t ret_ref = 0;
68446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68448         return ret_ref;
68449 }
68450
68451 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
68452         LDKChannelInfo obj_conv;
68453         obj_conv.inner = untag_ptr(obj);
68454         obj_conv.is_owned = ptr_is_owned(obj);
68455         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68456         obj_conv.is_owned = false;
68457         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
68458         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68459         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68460         CVec_u8Z_free(ret_var);
68461         return ret_arr;
68462 }
68463
68464 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
68465         LDKu8slice ser_ref;
68466         ser_ref.datalen = ser->arr_len;
68467         ser_ref.data = ser->elems;
68468         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
68469         *ret_conv = ChannelInfo_read(ser_ref);
68470         FREE(ser);
68471         return tag_ptr(ret_conv, true);
68472 }
68473
68474 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
68475         LDKDirectedChannelInfo this_obj_conv;
68476         this_obj_conv.inner = untag_ptr(this_obj);
68477         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68479         DirectedChannelInfo_free(this_obj_conv);
68480 }
68481
68482 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
68483         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
68484         uint64_t ret_ref = 0;
68485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68487         return ret_ref;
68488 }
68489 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
68490         LDKDirectedChannelInfo arg_conv;
68491         arg_conv.inner = untag_ptr(arg);
68492         arg_conv.is_owned = ptr_is_owned(arg);
68493         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68494         arg_conv.is_owned = false;
68495         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
68496         return ret_conv;
68497 }
68498
68499 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
68500         LDKDirectedChannelInfo orig_conv;
68501         orig_conv.inner = untag_ptr(orig);
68502         orig_conv.is_owned = ptr_is_owned(orig);
68503         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68504         orig_conv.is_owned = false;
68505         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
68506         uint64_t ret_ref = 0;
68507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68509         return ret_ref;
68510 }
68511
68512 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
68513         LDKDirectedChannelInfo this_arg_conv;
68514         this_arg_conv.inner = untag_ptr(this_arg);
68515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68517         this_arg_conv.is_owned = false;
68518         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
68519         uint64_t ret_ref = 0;
68520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68522         return ret_ref;
68523 }
68524
68525 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
68526         LDKDirectedChannelInfo this_arg_conv;
68527         this_arg_conv.inner = untag_ptr(this_arg);
68528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68530         this_arg_conv.is_owned = false;
68531         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68532         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
68533         uint64_t ret_ref = tag_ptr(ret_copy, true);
68534         return ret_ref;
68535 }
68536
68537 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_source"))) TS_DirectedChannelInfo_source(uint64_t this_arg) {
68538         LDKDirectedChannelInfo this_arg_conv;
68539         this_arg_conv.inner = untag_ptr(this_arg);
68540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68542         this_arg_conv.is_owned = false;
68543         LDKNodeId ret_var = DirectedChannelInfo_source(&this_arg_conv);
68544         uint64_t ret_ref = 0;
68545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68547         return ret_ref;
68548 }
68549
68550 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_target"))) TS_DirectedChannelInfo_target(uint64_t this_arg) {
68551         LDKDirectedChannelInfo this_arg_conv;
68552         this_arg_conv.inner = untag_ptr(this_arg);
68553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68555         this_arg_conv.is_owned = false;
68556         LDKNodeId ret_var = DirectedChannelInfo_target(&this_arg_conv);
68557         uint64_t ret_ref = 0;
68558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68560         return ret_ref;
68561 }
68562
68563 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
68564         if (!ptr_is_owned(this_ptr)) return;
68565         void* this_ptr_ptr = untag_ptr(this_ptr);
68566         CHECK_ACCESS(this_ptr_ptr);
68567         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
68568         FREE(untag_ptr(this_ptr));
68569         EffectiveCapacity_free(this_ptr_conv);
68570 }
68571
68572 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
68573         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68574         *ret_copy = EffectiveCapacity_clone(arg);
68575         uint64_t ret_ref = tag_ptr(ret_copy, true);
68576         return ret_ref;
68577 }
68578 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
68579         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
68580         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
68581         return ret_conv;
68582 }
68583
68584 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
68585         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
68586         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68587         *ret_copy = EffectiveCapacity_clone(orig_conv);
68588         uint64_t ret_ref = tag_ptr(ret_copy, true);
68589         return ret_ref;
68590 }
68591
68592 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
68593         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68594         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
68595         uint64_t ret_ref = tag_ptr(ret_copy, true);
68596         return ret_ref;
68597 }
68598
68599 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_advertised_max_htlc"))) TS_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
68600         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68601         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
68602         uint64_t ret_ref = tag_ptr(ret_copy, true);
68603         return ret_ref;
68604 }
68605
68606 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
68607         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68608         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
68609         uint64_t ret_ref = tag_ptr(ret_copy, true);
68610         return ret_ref;
68611 }
68612
68613 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
68614         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68615         *ret_copy = EffectiveCapacity_infinite();
68616         uint64_t ret_ref = tag_ptr(ret_copy, true);
68617         return ret_ref;
68618 }
68619
68620 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_hint_max_htlc"))) TS_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
68621         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68622         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
68623         uint64_t ret_ref = tag_ptr(ret_copy, true);
68624         return ret_ref;
68625 }
68626
68627 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
68628         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68629         *ret_copy = EffectiveCapacity_unknown();
68630         uint64_t ret_ref = tag_ptr(ret_copy, true);
68631         return ret_ref;
68632 }
68633
68634 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
68635         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
68636         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
68637         return ret_conv;
68638 }
68639
68640 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
68641         LDKRoutingFees this_obj_conv;
68642         this_obj_conv.inner = untag_ptr(this_obj);
68643         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68645         RoutingFees_free(this_obj_conv);
68646 }
68647
68648 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
68649         LDKRoutingFees this_ptr_conv;
68650         this_ptr_conv.inner = untag_ptr(this_ptr);
68651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68653         this_ptr_conv.is_owned = false;
68654         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
68655         return ret_conv;
68656 }
68657
68658 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
68659         LDKRoutingFees this_ptr_conv;
68660         this_ptr_conv.inner = untag_ptr(this_ptr);
68661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68663         this_ptr_conv.is_owned = false;
68664         RoutingFees_set_base_msat(&this_ptr_conv, val);
68665 }
68666
68667 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
68668         LDKRoutingFees this_ptr_conv;
68669         this_ptr_conv.inner = untag_ptr(this_ptr);
68670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68672         this_ptr_conv.is_owned = false;
68673         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
68674         return ret_conv;
68675 }
68676
68677 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
68678         LDKRoutingFees this_ptr_conv;
68679         this_ptr_conv.inner = untag_ptr(this_ptr);
68680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68682         this_ptr_conv.is_owned = false;
68683         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
68684 }
68685
68686 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
68687         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
68688         uint64_t ret_ref = 0;
68689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68691         return ret_ref;
68692 }
68693
68694 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
68695         LDKRoutingFees a_conv;
68696         a_conv.inner = untag_ptr(a);
68697         a_conv.is_owned = ptr_is_owned(a);
68698         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68699         a_conv.is_owned = false;
68700         LDKRoutingFees b_conv;
68701         b_conv.inner = untag_ptr(b);
68702         b_conv.is_owned = ptr_is_owned(b);
68703         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68704         b_conv.is_owned = false;
68705         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
68706         return ret_conv;
68707 }
68708
68709 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
68710         LDKRoutingFees ret_var = RoutingFees_clone(arg);
68711         uint64_t ret_ref = 0;
68712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68714         return ret_ref;
68715 }
68716 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
68717         LDKRoutingFees arg_conv;
68718         arg_conv.inner = untag_ptr(arg);
68719         arg_conv.is_owned = ptr_is_owned(arg);
68720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68721         arg_conv.is_owned = false;
68722         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
68723         return ret_conv;
68724 }
68725
68726 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
68727         LDKRoutingFees orig_conv;
68728         orig_conv.inner = untag_ptr(orig);
68729         orig_conv.is_owned = ptr_is_owned(orig);
68730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68731         orig_conv.is_owned = false;
68732         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
68733         uint64_t ret_ref = 0;
68734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68736         return ret_ref;
68737 }
68738
68739 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
68740         LDKRoutingFees o_conv;
68741         o_conv.inner = untag_ptr(o);
68742         o_conv.is_owned = ptr_is_owned(o);
68743         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68744         o_conv.is_owned = false;
68745         int64_t ret_conv = RoutingFees_hash(&o_conv);
68746         return ret_conv;
68747 }
68748
68749 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
68750         LDKRoutingFees obj_conv;
68751         obj_conv.inner = untag_ptr(obj);
68752         obj_conv.is_owned = ptr_is_owned(obj);
68753         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68754         obj_conv.is_owned = false;
68755         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
68756         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68757         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68758         CVec_u8Z_free(ret_var);
68759         return ret_arr;
68760 }
68761
68762 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
68763         LDKu8slice ser_ref;
68764         ser_ref.datalen = ser->arr_len;
68765         ser_ref.data = ser->elems;
68766         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
68767         *ret_conv = RoutingFees_read(ser_ref);
68768         FREE(ser);
68769         return tag_ptr(ret_conv, true);
68770 }
68771
68772 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
68773         LDKNodeAnnouncementInfo this_obj_conv;
68774         this_obj_conv.inner = untag_ptr(this_obj);
68775         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68777         NodeAnnouncementInfo_free(this_obj_conv);
68778 }
68779
68780 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
68781         LDKNodeAnnouncementInfo this_ptr_conv;
68782         this_ptr_conv.inner = untag_ptr(this_ptr);
68783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68785         this_ptr_conv.is_owned = false;
68786         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
68787         uint64_t ret_ref = 0;
68788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68790         return ret_ref;
68791 }
68792
68793 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
68794         LDKNodeAnnouncementInfo this_ptr_conv;
68795         this_ptr_conv.inner = untag_ptr(this_ptr);
68796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68798         this_ptr_conv.is_owned = false;
68799         LDKNodeFeatures val_conv;
68800         val_conv.inner = untag_ptr(val);
68801         val_conv.is_owned = ptr_is_owned(val);
68802         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68803         val_conv = NodeFeatures_clone(&val_conv);
68804         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
68805 }
68806
68807 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
68808         LDKNodeAnnouncementInfo this_ptr_conv;
68809         this_ptr_conv.inner = untag_ptr(this_ptr);
68810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68812         this_ptr_conv.is_owned = false;
68813         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
68814         return ret_conv;
68815 }
68816
68817 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
68818         LDKNodeAnnouncementInfo this_ptr_conv;
68819         this_ptr_conv.inner = untag_ptr(this_ptr);
68820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68822         this_ptr_conv.is_owned = false;
68823         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
68824 }
68825
68826 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
68827         LDKNodeAnnouncementInfo this_ptr_conv;
68828         this_ptr_conv.inner = untag_ptr(this_ptr);
68829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68831         this_ptr_conv.is_owned = false;
68832         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
68833         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
68834         return ret_arr;
68835 }
68836
68837 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
68838         LDKNodeAnnouncementInfo this_ptr_conv;
68839         this_ptr_conv.inner = untag_ptr(this_ptr);
68840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68842         this_ptr_conv.is_owned = false;
68843         LDKThreeBytes val_ref;
68844         CHECK(val->arr_len == 3);
68845         memcpy(val_ref.data, val->elems, 3); FREE(val);
68846         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
68847 }
68848
68849 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
68850         LDKNodeAnnouncementInfo this_ptr_conv;
68851         this_ptr_conv.inner = untag_ptr(this_ptr);
68852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68854         this_ptr_conv.is_owned = false;
68855         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
68856         uint64_t ret_ref = 0;
68857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68859         return ret_ref;
68860 }
68861
68862 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
68863         LDKNodeAnnouncementInfo this_ptr_conv;
68864         this_ptr_conv.inner = untag_ptr(this_ptr);
68865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68867         this_ptr_conv.is_owned = false;
68868         LDKNodeAlias val_conv;
68869         val_conv.inner = untag_ptr(val);
68870         val_conv.is_owned = ptr_is_owned(val);
68871         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68872         val_conv = NodeAlias_clone(&val_conv);
68873         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
68874 }
68875
68876 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
68877         LDKNodeAnnouncementInfo this_ptr_conv;
68878         this_ptr_conv.inner = untag_ptr(this_ptr);
68879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68881         this_ptr_conv.is_owned = false;
68882         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
68883         uint64_t ret_ref = 0;
68884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68886         return ret_ref;
68887 }
68888
68889 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
68890         LDKNodeAnnouncementInfo this_ptr_conv;
68891         this_ptr_conv.inner = untag_ptr(this_ptr);
68892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68894         this_ptr_conv.is_owned = false;
68895         LDKNodeAnnouncement val_conv;
68896         val_conv.inner = untag_ptr(val);
68897         val_conv.is_owned = ptr_is_owned(val);
68898         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68899         val_conv = NodeAnnouncement_clone(&val_conv);
68900         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
68901 }
68902
68903 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) {
68904         LDKNodeFeatures features_arg_conv;
68905         features_arg_conv.inner = untag_ptr(features_arg);
68906         features_arg_conv.is_owned = ptr_is_owned(features_arg);
68907         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
68908         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
68909         LDKThreeBytes rgb_arg_ref;
68910         CHECK(rgb_arg->arr_len == 3);
68911         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
68912         LDKNodeAlias alias_arg_conv;
68913         alias_arg_conv.inner = untag_ptr(alias_arg);
68914         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
68915         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
68916         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
68917         LDKNodeAnnouncement announcement_message_arg_conv;
68918         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
68919         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
68920         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
68921         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
68922         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
68923         uint64_t ret_ref = 0;
68924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68926         return ret_ref;
68927 }
68928
68929 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
68930         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
68931         uint64_t ret_ref = 0;
68932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68934         return ret_ref;
68935 }
68936 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
68937         LDKNodeAnnouncementInfo arg_conv;
68938         arg_conv.inner = untag_ptr(arg);
68939         arg_conv.is_owned = ptr_is_owned(arg);
68940         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68941         arg_conv.is_owned = false;
68942         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
68943         return ret_conv;
68944 }
68945
68946 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
68947         LDKNodeAnnouncementInfo orig_conv;
68948         orig_conv.inner = untag_ptr(orig);
68949         orig_conv.is_owned = ptr_is_owned(orig);
68950         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68951         orig_conv.is_owned = false;
68952         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
68953         uint64_t ret_ref = 0;
68954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68956         return ret_ref;
68957 }
68958
68959 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
68960         LDKNodeAnnouncementInfo a_conv;
68961         a_conv.inner = untag_ptr(a);
68962         a_conv.is_owned = ptr_is_owned(a);
68963         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68964         a_conv.is_owned = false;
68965         LDKNodeAnnouncementInfo b_conv;
68966         b_conv.inner = untag_ptr(b);
68967         b_conv.is_owned = ptr_is_owned(b);
68968         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68969         b_conv.is_owned = false;
68970         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
68971         return ret_conv;
68972 }
68973
68974 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
68975         LDKNodeAnnouncementInfo this_arg_conv;
68976         this_arg_conv.inner = untag_ptr(this_arg);
68977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68979         this_arg_conv.is_owned = false;
68980         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
68981         uint64_tArray ret_arr = NULL;
68982         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
68983         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
68984         for (size_t p = 0; p < ret_var.datalen; p++) {
68985                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
68986                 *ret_conv_15_copy = ret_var.data[p];
68987                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
68988                 ret_arr_ptr[p] = ret_conv_15_ref;
68989         }
68990         
68991         FREE(ret_var.data);
68992         return ret_arr;
68993 }
68994
68995 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
68996         LDKNodeAnnouncementInfo obj_conv;
68997         obj_conv.inner = untag_ptr(obj);
68998         obj_conv.is_owned = ptr_is_owned(obj);
68999         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69000         obj_conv.is_owned = false;
69001         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
69002         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69003         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69004         CVec_u8Z_free(ret_var);
69005         return ret_arr;
69006 }
69007
69008 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
69009         LDKu8slice ser_ref;
69010         ser_ref.datalen = ser->arr_len;
69011         ser_ref.data = ser->elems;
69012         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
69013         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
69014         FREE(ser);
69015         return tag_ptr(ret_conv, true);
69016 }
69017
69018 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
69019         LDKNodeAlias this_obj_conv;
69020         this_obj_conv.inner = untag_ptr(this_obj);
69021         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69023         NodeAlias_free(this_obj_conv);
69024 }
69025
69026 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
69027         LDKNodeAlias this_ptr_conv;
69028         this_ptr_conv.inner = untag_ptr(this_ptr);
69029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69031         this_ptr_conv.is_owned = false;
69032         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69033         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
69034         return ret_arr;
69035 }
69036
69037 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
69038         LDKNodeAlias this_ptr_conv;
69039         this_ptr_conv.inner = untag_ptr(this_ptr);
69040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69042         this_ptr_conv.is_owned = false;
69043         LDKThirtyTwoBytes val_ref;
69044         CHECK(val->arr_len == 32);
69045         memcpy(val_ref.data, val->elems, 32); FREE(val);
69046         NodeAlias_set_a(&this_ptr_conv, val_ref);
69047 }
69048
69049 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
69050         LDKThirtyTwoBytes a_arg_ref;
69051         CHECK(a_arg->arr_len == 32);
69052         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
69053         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
69054         uint64_t ret_ref = 0;
69055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69057         return ret_ref;
69058 }
69059
69060 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
69061         LDKNodeAlias ret_var = NodeAlias_clone(arg);
69062         uint64_t ret_ref = 0;
69063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69065         return ret_ref;
69066 }
69067 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
69068         LDKNodeAlias arg_conv;
69069         arg_conv.inner = untag_ptr(arg);
69070         arg_conv.is_owned = ptr_is_owned(arg);
69071         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69072         arg_conv.is_owned = false;
69073         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
69074         return ret_conv;
69075 }
69076
69077 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
69078         LDKNodeAlias orig_conv;
69079         orig_conv.inner = untag_ptr(orig);
69080         orig_conv.is_owned = ptr_is_owned(orig);
69081         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69082         orig_conv.is_owned = false;
69083         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
69084         uint64_t ret_ref = 0;
69085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69087         return ret_ref;
69088 }
69089
69090 int64_t  __attribute__((export_name("TS_NodeAlias_hash"))) TS_NodeAlias_hash(uint64_t o) {
69091         LDKNodeAlias o_conv;
69092         o_conv.inner = untag_ptr(o);
69093         o_conv.is_owned = ptr_is_owned(o);
69094         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69095         o_conv.is_owned = false;
69096         int64_t ret_conv = NodeAlias_hash(&o_conv);
69097         return ret_conv;
69098 }
69099
69100 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
69101         LDKNodeAlias a_conv;
69102         a_conv.inner = untag_ptr(a);
69103         a_conv.is_owned = ptr_is_owned(a);
69104         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69105         a_conv.is_owned = false;
69106         LDKNodeAlias b_conv;
69107         b_conv.inner = untag_ptr(b);
69108         b_conv.is_owned = ptr_is_owned(b);
69109         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69110         b_conv.is_owned = false;
69111         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
69112         return ret_conv;
69113 }
69114
69115 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
69116         LDKNodeAlias obj_conv;
69117         obj_conv.inner = untag_ptr(obj);
69118         obj_conv.is_owned = ptr_is_owned(obj);
69119         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69120         obj_conv.is_owned = false;
69121         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
69122         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69123         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69124         CVec_u8Z_free(ret_var);
69125         return ret_arr;
69126 }
69127
69128 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
69129         LDKu8slice ser_ref;
69130         ser_ref.datalen = ser->arr_len;
69131         ser_ref.data = ser->elems;
69132         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
69133         *ret_conv = NodeAlias_read(ser_ref);
69134         FREE(ser);
69135         return tag_ptr(ret_conv, true);
69136 }
69137
69138 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
69139         LDKNodeInfo this_obj_conv;
69140         this_obj_conv.inner = untag_ptr(this_obj);
69141         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69143         NodeInfo_free(this_obj_conv);
69144 }
69145
69146 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
69147         LDKNodeInfo this_ptr_conv;
69148         this_ptr_conv.inner = untag_ptr(this_ptr);
69149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69151         this_ptr_conv.is_owned = false;
69152         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
69153         int64_tArray ret_arr = NULL;
69154         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
69155         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
69156         for (size_t i = 0; i < ret_var.datalen; i++) {
69157                 int64_t ret_conv_8_conv = ret_var.data[i];
69158                 ret_arr_ptr[i] = ret_conv_8_conv;
69159         }
69160         
69161         FREE(ret_var.data);
69162         return ret_arr;
69163 }
69164
69165 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
69166         LDKNodeInfo this_ptr_conv;
69167         this_ptr_conv.inner = untag_ptr(this_ptr);
69168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69170         this_ptr_conv.is_owned = false;
69171         LDKCVec_u64Z val_constr;
69172         val_constr.datalen = val->arr_len;
69173         if (val_constr.datalen > 0)
69174                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
69175         else
69176                 val_constr.data = NULL;
69177         int64_t* val_vals = val->elems;
69178         for (size_t i = 0; i < val_constr.datalen; i++) {
69179                 int64_t val_conv_8 = val_vals[i];
69180                 val_constr.data[i] = val_conv_8;
69181         }
69182         FREE(val);
69183         NodeInfo_set_channels(&this_ptr_conv, val_constr);
69184 }
69185
69186 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
69187         LDKNodeInfo this_ptr_conv;
69188         this_ptr_conv.inner = untag_ptr(this_ptr);
69189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69191         this_ptr_conv.is_owned = false;
69192         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
69193         uint64_t ret_ref = 0;
69194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69196         return ret_ref;
69197 }
69198
69199 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
69200         LDKNodeInfo this_ptr_conv;
69201         this_ptr_conv.inner = untag_ptr(this_ptr);
69202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69204         this_ptr_conv.is_owned = false;
69205         LDKNodeAnnouncementInfo val_conv;
69206         val_conv.inner = untag_ptr(val);
69207         val_conv.is_owned = ptr_is_owned(val);
69208         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69209         val_conv = NodeAnnouncementInfo_clone(&val_conv);
69210         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
69211 }
69212
69213 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
69214         LDKCVec_u64Z channels_arg_constr;
69215         channels_arg_constr.datalen = channels_arg->arr_len;
69216         if (channels_arg_constr.datalen > 0)
69217                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
69218         else
69219                 channels_arg_constr.data = NULL;
69220         int64_t* channels_arg_vals = channels_arg->elems;
69221         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
69222                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
69223                 channels_arg_constr.data[i] = channels_arg_conv_8;
69224         }
69225         FREE(channels_arg);
69226         LDKNodeAnnouncementInfo announcement_info_arg_conv;
69227         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
69228         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
69229         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
69230         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
69231         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
69232         uint64_t ret_ref = 0;
69233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69235         return ret_ref;
69236 }
69237
69238 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
69239         LDKNodeInfo ret_var = NodeInfo_clone(arg);
69240         uint64_t ret_ref = 0;
69241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69243         return ret_ref;
69244 }
69245 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
69246         LDKNodeInfo arg_conv;
69247         arg_conv.inner = untag_ptr(arg);
69248         arg_conv.is_owned = ptr_is_owned(arg);
69249         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69250         arg_conv.is_owned = false;
69251         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
69252         return ret_conv;
69253 }
69254
69255 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
69256         LDKNodeInfo orig_conv;
69257         orig_conv.inner = untag_ptr(orig);
69258         orig_conv.is_owned = ptr_is_owned(orig);
69259         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69260         orig_conv.is_owned = false;
69261         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
69262         uint64_t ret_ref = 0;
69263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69265         return ret_ref;
69266 }
69267
69268 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
69269         LDKNodeInfo a_conv;
69270         a_conv.inner = untag_ptr(a);
69271         a_conv.is_owned = ptr_is_owned(a);
69272         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69273         a_conv.is_owned = false;
69274         LDKNodeInfo b_conv;
69275         b_conv.inner = untag_ptr(b);
69276         b_conv.is_owned = ptr_is_owned(b);
69277         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69278         b_conv.is_owned = false;
69279         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
69280         return ret_conv;
69281 }
69282
69283 jboolean  __attribute__((export_name("TS_NodeInfo_is_tor_only"))) TS_NodeInfo_is_tor_only(uint64_t this_arg) {
69284         LDKNodeInfo this_arg_conv;
69285         this_arg_conv.inner = untag_ptr(this_arg);
69286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69288         this_arg_conv.is_owned = false;
69289         jboolean ret_conv = NodeInfo_is_tor_only(&this_arg_conv);
69290         return ret_conv;
69291 }
69292
69293 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
69294         LDKNodeInfo obj_conv;
69295         obj_conv.inner = untag_ptr(obj);
69296         obj_conv.is_owned = ptr_is_owned(obj);
69297         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69298         obj_conv.is_owned = false;
69299         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
69300         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69301         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69302         CVec_u8Z_free(ret_var);
69303         return ret_arr;
69304 }
69305
69306 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
69307         LDKu8slice ser_ref;
69308         ser_ref.datalen = ser->arr_len;
69309         ser_ref.data = ser->elems;
69310         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
69311         *ret_conv = NodeInfo_read(ser_ref);
69312         FREE(ser);
69313         return tag_ptr(ret_conv, true);
69314 }
69315
69316 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
69317         LDKNetworkGraph obj_conv;
69318         obj_conv.inner = untag_ptr(obj);
69319         obj_conv.is_owned = ptr_is_owned(obj);
69320         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69321         obj_conv.is_owned = false;
69322         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
69323         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69324         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69325         CVec_u8Z_free(ret_var);
69326         return ret_arr;
69327 }
69328
69329 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
69330         LDKu8slice ser_ref;
69331         ser_ref.datalen = ser->arr_len;
69332         ser_ref.data = ser->elems;
69333         void* arg_ptr = untag_ptr(arg);
69334         CHECK_ACCESS(arg_ptr);
69335         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
69336         if (arg_conv.free == LDKLogger_JCalls_free) {
69337                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69338                 LDKLogger_JCalls_cloned(&arg_conv);
69339         }
69340         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
69341         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
69342         FREE(ser);
69343         return tag_ptr(ret_conv, true);
69344 }
69345
69346 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
69347         LDKNetwork network_conv = LDKNetwork_from_js(network);
69348         void* logger_ptr = untag_ptr(logger);
69349         CHECK_ACCESS(logger_ptr);
69350         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69351         if (logger_conv.free == LDKLogger_JCalls_free) {
69352                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69353                 LDKLogger_JCalls_cloned(&logger_conv);
69354         }
69355         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
69356         uint64_t ret_ref = 0;
69357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69359         return ret_ref;
69360 }
69361
69362 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
69363         LDKNetworkGraph this_arg_conv;
69364         this_arg_conv.inner = untag_ptr(this_arg);
69365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69367         this_arg_conv.is_owned = false;
69368         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
69369         uint64_t ret_ref = 0;
69370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69372         return ret_ref;
69373 }
69374
69375 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) {
69376         LDKNetworkGraph this_arg_conv;
69377         this_arg_conv.inner = untag_ptr(this_arg);
69378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69380         this_arg_conv.is_owned = false;
69381         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
69382         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
69383         uint64_t ret_ref = tag_ptr(ret_copy, true);
69384         return ret_ref;
69385 }
69386
69387 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) {
69388         LDKNetworkGraph this_arg_conv;
69389         this_arg_conv.inner = untag_ptr(this_arg);
69390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69392         this_arg_conv.is_owned = false;
69393         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
69394 }
69395
69396 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
69397         LDKNetworkGraph this_arg_conv;
69398         this_arg_conv.inner = untag_ptr(this_arg);
69399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69401         this_arg_conv.is_owned = false;
69402         LDKNodeAnnouncement msg_conv;
69403         msg_conv.inner = untag_ptr(msg);
69404         msg_conv.is_owned = ptr_is_owned(msg);
69405         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69406         msg_conv.is_owned = false;
69407         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69408         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
69409         return tag_ptr(ret_conv, true);
69410 }
69411
69412 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) {
69413         LDKNetworkGraph this_arg_conv;
69414         this_arg_conv.inner = untag_ptr(this_arg);
69415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69417         this_arg_conv.is_owned = false;
69418         LDKUnsignedNodeAnnouncement msg_conv;
69419         msg_conv.inner = untag_ptr(msg);
69420         msg_conv.is_owned = ptr_is_owned(msg);
69421         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69422         msg_conv.is_owned = false;
69423         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69424         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
69425         return tag_ptr(ret_conv, true);
69426 }
69427
69428 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) {
69429         LDKNetworkGraph this_arg_conv;
69430         this_arg_conv.inner = untag_ptr(this_arg);
69431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69433         this_arg_conv.is_owned = false;
69434         LDKChannelAnnouncement msg_conv;
69435         msg_conv.inner = untag_ptr(msg);
69436         msg_conv.is_owned = ptr_is_owned(msg);
69437         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69438         msg_conv.is_owned = false;
69439         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69440         CHECK_ACCESS(utxo_lookup_ptr);
69441         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69442         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69443         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69444                 // Manually implement clone for Java trait instances
69445                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69446                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69447                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69448                 }
69449         }
69450         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69451         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
69452         return tag_ptr(ret_conv, true);
69453 }
69454
69455 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) {
69456         LDKNetworkGraph this_arg_conv;
69457         this_arg_conv.inner = untag_ptr(this_arg);
69458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69460         this_arg_conv.is_owned = false;
69461         LDKChannelAnnouncement msg_conv;
69462         msg_conv.inner = untag_ptr(msg);
69463         msg_conv.is_owned = ptr_is_owned(msg);
69464         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69465         msg_conv.is_owned = false;
69466         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69467         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
69468         return tag_ptr(ret_conv, true);
69469 }
69470
69471 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) {
69472         LDKNetworkGraph this_arg_conv;
69473         this_arg_conv.inner = untag_ptr(this_arg);
69474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69476         this_arg_conv.is_owned = false;
69477         LDKUnsignedChannelAnnouncement msg_conv;
69478         msg_conv.inner = untag_ptr(msg);
69479         msg_conv.is_owned = ptr_is_owned(msg);
69480         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69481         msg_conv.is_owned = false;
69482         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69483         CHECK_ACCESS(utxo_lookup_ptr);
69484         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69485         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69486         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69487                 // Manually implement clone for Java trait instances
69488                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69489                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69490                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69491                 }
69492         }
69493         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69494         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
69495         return tag_ptr(ret_conv, true);
69496 }
69497
69498 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) {
69499         LDKNetworkGraph this_arg_conv;
69500         this_arg_conv.inner = untag_ptr(this_arg);
69501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69503         this_arg_conv.is_owned = false;
69504         LDKChannelFeatures features_conv;
69505         features_conv.inner = untag_ptr(features);
69506         features_conv.is_owned = ptr_is_owned(features);
69507         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
69508         features_conv = ChannelFeatures_clone(&features_conv);
69509         LDKPublicKey node_id_1_ref;
69510         CHECK(node_id_1->arr_len == 33);
69511         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
69512         LDKPublicKey node_id_2_ref;
69513         CHECK(node_id_2->arr_len == 33);
69514         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
69515         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69516         *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);
69517         return tag_ptr(ret_conv, true);
69518 }
69519
69520 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
69521         LDKNetworkGraph this_arg_conv;
69522         this_arg_conv.inner = untag_ptr(this_arg);
69523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69525         this_arg_conv.is_owned = false;
69526         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
69527 }
69528
69529 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
69530         LDKNetworkGraph this_arg_conv;
69531         this_arg_conv.inner = untag_ptr(this_arg);
69532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69534         this_arg_conv.is_owned = false;
69535         LDKPublicKey node_id_ref;
69536         CHECK(node_id->arr_len == 33);
69537         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
69538         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
69539 }
69540
69541 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) {
69542         LDKNetworkGraph this_arg_conv;
69543         this_arg_conv.inner = untag_ptr(this_arg);
69544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69546         this_arg_conv.is_owned = false;
69547         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
69548 }
69549
69550 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
69551         LDKNetworkGraph this_arg_conv;
69552         this_arg_conv.inner = untag_ptr(this_arg);
69553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69555         this_arg_conv.is_owned = false;
69556         LDKChannelUpdate msg_conv;
69557         msg_conv.inner = untag_ptr(msg);
69558         msg_conv.is_owned = ptr_is_owned(msg);
69559         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69560         msg_conv.is_owned = false;
69561         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69562         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
69563         return tag_ptr(ret_conv, true);
69564 }
69565
69566 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
69567         LDKNetworkGraph this_arg_conv;
69568         this_arg_conv.inner = untag_ptr(this_arg);
69569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69571         this_arg_conv.is_owned = false;
69572         LDKUnsignedChannelUpdate msg_conv;
69573         msg_conv.inner = untag_ptr(msg);
69574         msg_conv.is_owned = ptr_is_owned(msg);
69575         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69576         msg_conv.is_owned = false;
69577         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69578         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
69579         return tag_ptr(ret_conv, true);
69580 }
69581
69582 uint64_t  __attribute__((export_name("TS_NetworkGraph_verify_channel_update"))) TS_NetworkGraph_verify_channel_update(uint64_t this_arg, uint64_t msg) {
69583         LDKNetworkGraph this_arg_conv;
69584         this_arg_conv.inner = untag_ptr(this_arg);
69585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69587         this_arg_conv.is_owned = false;
69588         LDKChannelUpdate msg_conv;
69589         msg_conv.inner = untag_ptr(msg);
69590         msg_conv.is_owned = ptr_is_owned(msg);
69591         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69592         msg_conv.is_owned = false;
69593         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69594         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
69595         return tag_ptr(ret_conv, true);
69596 }
69597
69598 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
69599         LDKReadOnlyNetworkGraph this_arg_conv;
69600         this_arg_conv.inner = untag_ptr(this_arg);
69601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69603         this_arg_conv.is_owned = false;
69604         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
69605         uint64_t ret_ref = 0;
69606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69608         return ret_ref;
69609 }
69610
69611 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
69612         LDKReadOnlyNetworkGraph this_arg_conv;
69613         this_arg_conv.inner = untag_ptr(this_arg);
69614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69616         this_arg_conv.is_owned = false;
69617         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
69618         int64_tArray ret_arr = NULL;
69619         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
69620         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
69621         for (size_t i = 0; i < ret_var.datalen; i++) {
69622                 int64_t ret_conv_8_conv = ret_var.data[i];
69623                 ret_arr_ptr[i] = ret_conv_8_conv;
69624         }
69625         
69626         FREE(ret_var.data);
69627         return ret_arr;
69628 }
69629
69630 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
69631         LDKReadOnlyNetworkGraph this_arg_conv;
69632         this_arg_conv.inner = untag_ptr(this_arg);
69633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69635         this_arg_conv.is_owned = false;
69636         LDKNodeId node_id_conv;
69637         node_id_conv.inner = untag_ptr(node_id);
69638         node_id_conv.is_owned = ptr_is_owned(node_id);
69639         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
69640         node_id_conv.is_owned = false;
69641         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
69642         uint64_t ret_ref = 0;
69643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69645         return ret_ref;
69646 }
69647
69648 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
69649         LDKReadOnlyNetworkGraph this_arg_conv;
69650         this_arg_conv.inner = untag_ptr(this_arg);
69651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69653         this_arg_conv.is_owned = false;
69654         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
69655         uint64_tArray ret_arr = NULL;
69656         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
69657         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
69658         for (size_t i = 0; i < ret_var.datalen; i++) {
69659                 LDKNodeId ret_conv_8_var = ret_var.data[i];
69660                 uint64_t ret_conv_8_ref = 0;
69661                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
69662                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
69663                 ret_arr_ptr[i] = ret_conv_8_ref;
69664         }
69665         
69666         FREE(ret_var.data);
69667         return ret_arr;
69668 }
69669
69670 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
69671         LDKReadOnlyNetworkGraph this_arg_conv;
69672         this_arg_conv.inner = untag_ptr(this_arg);
69673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69675         this_arg_conv.is_owned = false;
69676         LDKPublicKey pubkey_ref;
69677         CHECK(pubkey->arr_len == 33);
69678         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
69679         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
69680         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
69681         uint64_t ret_ref = tag_ptr(ret_copy, true);
69682         return ret_ref;
69683 }
69684
69685 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
69686         LDKDefaultRouter this_obj_conv;
69687         this_obj_conv.inner = untag_ptr(this_obj);
69688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69690         DefaultRouter_free(this_obj_conv);
69691 }
69692
69693 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) {
69694         LDKNetworkGraph network_graph_conv;
69695         network_graph_conv.inner = untag_ptr(network_graph);
69696         network_graph_conv.is_owned = ptr_is_owned(network_graph);
69697         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
69698         network_graph_conv.is_owned = false;
69699         void* logger_ptr = untag_ptr(logger);
69700         CHECK_ACCESS(logger_ptr);
69701         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69702         if (logger_conv.free == LDKLogger_JCalls_free) {
69703                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69704                 LDKLogger_JCalls_cloned(&logger_conv);
69705         }
69706         void* entropy_source_ptr = untag_ptr(entropy_source);
69707         CHECK_ACCESS(entropy_source_ptr);
69708         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69709         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69710                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69711                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69712         }
69713         void* scorer_ptr = untag_ptr(scorer);
69714         CHECK_ACCESS(scorer_ptr);
69715         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
69716         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
69717                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69718                 LDKLockableScore_JCalls_cloned(&scorer_conv);
69719         }
69720         LDKProbabilisticScoringFeeParameters score_params_conv;
69721         score_params_conv.inner = untag_ptr(score_params);
69722         score_params_conv.is_owned = ptr_is_owned(score_params);
69723         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
69724         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
69725         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
69726         uint64_t ret_ref = 0;
69727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69729         return ret_ref;
69730 }
69731
69732 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
69733         LDKDefaultRouter this_arg_conv;
69734         this_arg_conv.inner = untag_ptr(this_arg);
69735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69737         this_arg_conv.is_owned = false;
69738         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
69739         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
69740         return tag_ptr(ret_ret, true);
69741 }
69742
69743 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_MessageRouter"))) TS_DefaultRouter_as_MessageRouter(uint64_t this_arg) {
69744         LDKDefaultRouter this_arg_conv;
69745         this_arg_conv.inner = untag_ptr(this_arg);
69746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69748         this_arg_conv.is_owned = false;
69749         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
69750         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
69751         return tag_ptr(ret_ret, true);
69752 }
69753
69754 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
69755         if (!ptr_is_owned(this_ptr)) return;
69756         void* this_ptr_ptr = untag_ptr(this_ptr);
69757         CHECK_ACCESS(this_ptr_ptr);
69758         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
69759         FREE(untag_ptr(this_ptr));
69760         Router_free(this_ptr_conv);
69761 }
69762
69763 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
69764         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
69765         this_obj_conv.inner = untag_ptr(this_obj);
69766         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69768         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
69769 }
69770
69771 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
69772         void* scorer_ptr = untag_ptr(scorer);
69773         CHECK_ACCESS(scorer_ptr);
69774         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
69775         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
69776                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69777                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
69778         }
69779         LDKInFlightHtlcs inflight_htlcs_conv;
69780         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
69781         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
69782         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
69783         inflight_htlcs_conv.is_owned = false;
69784         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
69785         uint64_t ret_ref = 0;
69786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69788         return ret_ref;
69789 }
69790
69791 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp"))) TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(uint64_t this_arg) {
69792         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
69793         this_arg_conv.inner = untag_ptr(this_arg);
69794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69796         this_arg_conv.is_owned = false;
69797         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
69798         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
69799         return tag_ptr(ret_ret, true);
69800 }
69801
69802 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
69803         LDKInFlightHtlcs this_obj_conv;
69804         this_obj_conv.inner = untag_ptr(this_obj);
69805         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69807         InFlightHtlcs_free(this_obj_conv);
69808 }
69809
69810 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
69811         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
69812         uint64_t ret_ref = 0;
69813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69815         return ret_ref;
69816 }
69817 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
69818         LDKInFlightHtlcs arg_conv;
69819         arg_conv.inner = untag_ptr(arg);
69820         arg_conv.is_owned = ptr_is_owned(arg);
69821         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69822         arg_conv.is_owned = false;
69823         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
69824         return ret_conv;
69825 }
69826
69827 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
69828         LDKInFlightHtlcs orig_conv;
69829         orig_conv.inner = untag_ptr(orig);
69830         orig_conv.is_owned = ptr_is_owned(orig);
69831         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69832         orig_conv.is_owned = false;
69833         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
69834         uint64_t ret_ref = 0;
69835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69837         return ret_ref;
69838 }
69839
69840 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
69841         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
69842         uint64_t ret_ref = 0;
69843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69845         return ret_ref;
69846 }
69847
69848 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
69849         LDKInFlightHtlcs this_arg_conv;
69850         this_arg_conv.inner = untag_ptr(this_arg);
69851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69853         this_arg_conv.is_owned = false;
69854         LDKPath path_conv;
69855         path_conv.inner = untag_ptr(path);
69856         path_conv.is_owned = ptr_is_owned(path);
69857         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69858         path_conv.is_owned = false;
69859         LDKPublicKey payer_node_id_ref;
69860         CHECK(payer_node_id->arr_len == 33);
69861         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
69862         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
69863 }
69864
69865 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) {
69866         LDKInFlightHtlcs this_arg_conv;
69867         this_arg_conv.inner = untag_ptr(this_arg);
69868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69870         this_arg_conv.is_owned = false;
69871         LDKNodeId source_conv;
69872         source_conv.inner = untag_ptr(source);
69873         source_conv.is_owned = ptr_is_owned(source);
69874         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
69875         source_conv.is_owned = false;
69876         LDKNodeId target_conv;
69877         target_conv.inner = untag_ptr(target);
69878         target_conv.is_owned = ptr_is_owned(target);
69879         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
69880         target_conv.is_owned = false;
69881         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
69882 }
69883
69884 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) {
69885         LDKInFlightHtlcs this_arg_conv;
69886         this_arg_conv.inner = untag_ptr(this_arg);
69887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69889         this_arg_conv.is_owned = false;
69890         LDKNodeId source_conv;
69891         source_conv.inner = untag_ptr(source);
69892         source_conv.is_owned = ptr_is_owned(source);
69893         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
69894         source_conv.is_owned = false;
69895         LDKNodeId target_conv;
69896         target_conv.inner = untag_ptr(target);
69897         target_conv.is_owned = ptr_is_owned(target);
69898         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
69899         target_conv.is_owned = false;
69900         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69901         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
69902         uint64_t ret_ref = tag_ptr(ret_copy, true);
69903         return ret_ref;
69904 }
69905
69906 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
69907         LDKInFlightHtlcs obj_conv;
69908         obj_conv.inner = untag_ptr(obj);
69909         obj_conv.is_owned = ptr_is_owned(obj);
69910         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69911         obj_conv.is_owned = false;
69912         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
69913         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69914         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69915         CVec_u8Z_free(ret_var);
69916         return ret_arr;
69917 }
69918
69919 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
69920         LDKu8slice ser_ref;
69921         ser_ref.datalen = ser->arr_len;
69922         ser_ref.data = ser->elems;
69923         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
69924         *ret_conv = InFlightHtlcs_read(ser_ref);
69925         FREE(ser);
69926         return tag_ptr(ret_conv, true);
69927 }
69928
69929 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
69930         LDKRouteHop this_obj_conv;
69931         this_obj_conv.inner = untag_ptr(this_obj);
69932         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69934         RouteHop_free(this_obj_conv);
69935 }
69936
69937 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
69938         LDKRouteHop this_ptr_conv;
69939         this_ptr_conv.inner = untag_ptr(this_ptr);
69940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69942         this_ptr_conv.is_owned = false;
69943         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
69944         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
69945         return ret_arr;
69946 }
69947
69948 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
69949         LDKRouteHop this_ptr_conv;
69950         this_ptr_conv.inner = untag_ptr(this_ptr);
69951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69953         this_ptr_conv.is_owned = false;
69954         LDKPublicKey val_ref;
69955         CHECK(val->arr_len == 33);
69956         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
69957         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
69958 }
69959
69960 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
69961         LDKRouteHop this_ptr_conv;
69962         this_ptr_conv.inner = untag_ptr(this_ptr);
69963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69965         this_ptr_conv.is_owned = false;
69966         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
69967         uint64_t ret_ref = 0;
69968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69970         return ret_ref;
69971 }
69972
69973 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
69974         LDKRouteHop this_ptr_conv;
69975         this_ptr_conv.inner = untag_ptr(this_ptr);
69976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69978         this_ptr_conv.is_owned = false;
69979         LDKNodeFeatures val_conv;
69980         val_conv.inner = untag_ptr(val);
69981         val_conv.is_owned = ptr_is_owned(val);
69982         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69983         val_conv = NodeFeatures_clone(&val_conv);
69984         RouteHop_set_node_features(&this_ptr_conv, val_conv);
69985 }
69986
69987 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
69988         LDKRouteHop this_ptr_conv;
69989         this_ptr_conv.inner = untag_ptr(this_ptr);
69990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69992         this_ptr_conv.is_owned = false;
69993         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
69994         return ret_conv;
69995 }
69996
69997 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
69998         LDKRouteHop this_ptr_conv;
69999         this_ptr_conv.inner = untag_ptr(this_ptr);
70000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70002         this_ptr_conv.is_owned = false;
70003         RouteHop_set_short_channel_id(&this_ptr_conv, val);
70004 }
70005
70006 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
70007         LDKRouteHop this_ptr_conv;
70008         this_ptr_conv.inner = untag_ptr(this_ptr);
70009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70011         this_ptr_conv.is_owned = false;
70012         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
70013         uint64_t ret_ref = 0;
70014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70016         return ret_ref;
70017 }
70018
70019 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
70020         LDKRouteHop this_ptr_conv;
70021         this_ptr_conv.inner = untag_ptr(this_ptr);
70022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70024         this_ptr_conv.is_owned = false;
70025         LDKChannelFeatures val_conv;
70026         val_conv.inner = untag_ptr(val);
70027         val_conv.is_owned = ptr_is_owned(val);
70028         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70029         val_conv = ChannelFeatures_clone(&val_conv);
70030         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
70031 }
70032
70033 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
70034         LDKRouteHop this_ptr_conv;
70035         this_ptr_conv.inner = untag_ptr(this_ptr);
70036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70038         this_ptr_conv.is_owned = false;
70039         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
70040         return ret_conv;
70041 }
70042
70043 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
70044         LDKRouteHop this_ptr_conv;
70045         this_ptr_conv.inner = untag_ptr(this_ptr);
70046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70048         this_ptr_conv.is_owned = false;
70049         RouteHop_set_fee_msat(&this_ptr_conv, val);
70050 }
70051
70052 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
70053         LDKRouteHop this_ptr_conv;
70054         this_ptr_conv.inner = untag_ptr(this_ptr);
70055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70057         this_ptr_conv.is_owned = false;
70058         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
70059         return ret_conv;
70060 }
70061
70062 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
70063         LDKRouteHop this_ptr_conv;
70064         this_ptr_conv.inner = untag_ptr(this_ptr);
70065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70067         this_ptr_conv.is_owned = false;
70068         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
70069 }
70070
70071 jboolean  __attribute__((export_name("TS_RouteHop_get_maybe_announced_channel"))) TS_RouteHop_get_maybe_announced_channel(uint64_t this_ptr) {
70072         LDKRouteHop this_ptr_conv;
70073         this_ptr_conv.inner = untag_ptr(this_ptr);
70074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70076         this_ptr_conv.is_owned = false;
70077         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
70078         return ret_conv;
70079 }
70080
70081 void  __attribute__((export_name("TS_RouteHop_set_maybe_announced_channel"))) TS_RouteHop_set_maybe_announced_channel(uint64_t this_ptr, jboolean val) {
70082         LDKRouteHop this_ptr_conv;
70083         this_ptr_conv.inner = untag_ptr(this_ptr);
70084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70086         this_ptr_conv.is_owned = false;
70087         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
70088 }
70089
70090 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) {
70091         LDKPublicKey pubkey_arg_ref;
70092         CHECK(pubkey_arg->arr_len == 33);
70093         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
70094         LDKNodeFeatures node_features_arg_conv;
70095         node_features_arg_conv.inner = untag_ptr(node_features_arg);
70096         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
70097         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
70098         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
70099         LDKChannelFeatures channel_features_arg_conv;
70100         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
70101         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
70102         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
70103         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
70104         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);
70105         uint64_t ret_ref = 0;
70106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70108         return ret_ref;
70109 }
70110
70111 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
70112         LDKRouteHop ret_var = RouteHop_clone(arg);
70113         uint64_t ret_ref = 0;
70114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70116         return ret_ref;
70117 }
70118 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
70119         LDKRouteHop arg_conv;
70120         arg_conv.inner = untag_ptr(arg);
70121         arg_conv.is_owned = ptr_is_owned(arg);
70122         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70123         arg_conv.is_owned = false;
70124         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
70125         return ret_conv;
70126 }
70127
70128 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
70129         LDKRouteHop orig_conv;
70130         orig_conv.inner = untag_ptr(orig);
70131         orig_conv.is_owned = ptr_is_owned(orig);
70132         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70133         orig_conv.is_owned = false;
70134         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
70135         uint64_t ret_ref = 0;
70136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70138         return ret_ref;
70139 }
70140
70141 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
70142         LDKRouteHop o_conv;
70143         o_conv.inner = untag_ptr(o);
70144         o_conv.is_owned = ptr_is_owned(o);
70145         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70146         o_conv.is_owned = false;
70147         int64_t ret_conv = RouteHop_hash(&o_conv);
70148         return ret_conv;
70149 }
70150
70151 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
70152         LDKRouteHop a_conv;
70153         a_conv.inner = untag_ptr(a);
70154         a_conv.is_owned = ptr_is_owned(a);
70155         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70156         a_conv.is_owned = false;
70157         LDKRouteHop b_conv;
70158         b_conv.inner = untag_ptr(b);
70159         b_conv.is_owned = ptr_is_owned(b);
70160         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70161         b_conv.is_owned = false;
70162         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
70163         return ret_conv;
70164 }
70165
70166 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
70167         LDKRouteHop obj_conv;
70168         obj_conv.inner = untag_ptr(obj);
70169         obj_conv.is_owned = ptr_is_owned(obj);
70170         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70171         obj_conv.is_owned = false;
70172         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
70173         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70174         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70175         CVec_u8Z_free(ret_var);
70176         return ret_arr;
70177 }
70178
70179 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
70180         LDKu8slice ser_ref;
70181         ser_ref.datalen = ser->arr_len;
70182         ser_ref.data = ser->elems;
70183         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
70184         *ret_conv = RouteHop_read(ser_ref);
70185         FREE(ser);
70186         return tag_ptr(ret_conv, true);
70187 }
70188
70189 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
70190         LDKBlindedTail this_obj_conv;
70191         this_obj_conv.inner = untag_ptr(this_obj);
70192         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70194         BlindedTail_free(this_obj_conv);
70195 }
70196
70197 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
70198         LDKBlindedTail this_ptr_conv;
70199         this_ptr_conv.inner = untag_ptr(this_ptr);
70200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70202         this_ptr_conv.is_owned = false;
70203         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
70204         uint64_tArray ret_arr = NULL;
70205         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
70206         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
70207         for (size_t m = 0; m < ret_var.datalen; m++) {
70208                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
70209                 uint64_t ret_conv_12_ref = 0;
70210                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
70211                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
70212                 ret_arr_ptr[m] = ret_conv_12_ref;
70213         }
70214         
70215         FREE(ret_var.data);
70216         return ret_arr;
70217 }
70218
70219 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
70220         LDKBlindedTail this_ptr_conv;
70221         this_ptr_conv.inner = untag_ptr(this_ptr);
70222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70224         this_ptr_conv.is_owned = false;
70225         LDKCVec_BlindedHopZ val_constr;
70226         val_constr.datalen = val->arr_len;
70227         if (val_constr.datalen > 0)
70228                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70229         else
70230                 val_constr.data = NULL;
70231         uint64_t* val_vals = val->elems;
70232         for (size_t m = 0; m < val_constr.datalen; m++) {
70233                 uint64_t val_conv_12 = val_vals[m];
70234                 LDKBlindedHop val_conv_12_conv;
70235                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
70236                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
70237                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
70238                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
70239                 val_constr.data[m] = val_conv_12_conv;
70240         }
70241         FREE(val);
70242         BlindedTail_set_hops(&this_ptr_conv, val_constr);
70243 }
70244
70245 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
70246         LDKBlindedTail this_ptr_conv;
70247         this_ptr_conv.inner = untag_ptr(this_ptr);
70248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70250         this_ptr_conv.is_owned = false;
70251         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70252         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
70253         return ret_arr;
70254 }
70255
70256 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
70257         LDKBlindedTail this_ptr_conv;
70258         this_ptr_conv.inner = untag_ptr(this_ptr);
70259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70261         this_ptr_conv.is_owned = false;
70262         LDKPublicKey val_ref;
70263         CHECK(val->arr_len == 33);
70264         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70265         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
70266 }
70267
70268 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) {
70269         LDKBlindedTail this_ptr_conv;
70270         this_ptr_conv.inner = untag_ptr(this_ptr);
70271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70273         this_ptr_conv.is_owned = false;
70274         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
70275         return ret_conv;
70276 }
70277
70278 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) {
70279         LDKBlindedTail this_ptr_conv;
70280         this_ptr_conv.inner = untag_ptr(this_ptr);
70281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70283         this_ptr_conv.is_owned = false;
70284         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
70285 }
70286
70287 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
70288         LDKBlindedTail this_ptr_conv;
70289         this_ptr_conv.inner = untag_ptr(this_ptr);
70290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70292         this_ptr_conv.is_owned = false;
70293         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
70294         return ret_conv;
70295 }
70296
70297 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
70298         LDKBlindedTail this_ptr_conv;
70299         this_ptr_conv.inner = untag_ptr(this_ptr);
70300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70302         this_ptr_conv.is_owned = false;
70303         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
70304 }
70305
70306 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) {
70307         LDKCVec_BlindedHopZ hops_arg_constr;
70308         hops_arg_constr.datalen = hops_arg->arr_len;
70309         if (hops_arg_constr.datalen > 0)
70310                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70311         else
70312                 hops_arg_constr.data = NULL;
70313         uint64_t* hops_arg_vals = hops_arg->elems;
70314         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
70315                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
70316                 LDKBlindedHop hops_arg_conv_12_conv;
70317                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
70318                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
70319                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
70320                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
70321                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
70322         }
70323         FREE(hops_arg);
70324         LDKPublicKey blinding_point_arg_ref;
70325         CHECK(blinding_point_arg->arr_len == 33);
70326         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
70327         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
70328         uint64_t ret_ref = 0;
70329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70331         return ret_ref;
70332 }
70333
70334 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
70335         LDKBlindedTail ret_var = BlindedTail_clone(arg);
70336         uint64_t ret_ref = 0;
70337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70339         return ret_ref;
70340 }
70341 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
70342         LDKBlindedTail arg_conv;
70343         arg_conv.inner = untag_ptr(arg);
70344         arg_conv.is_owned = ptr_is_owned(arg);
70345         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70346         arg_conv.is_owned = false;
70347         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
70348         return ret_conv;
70349 }
70350
70351 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
70352         LDKBlindedTail orig_conv;
70353         orig_conv.inner = untag_ptr(orig);
70354         orig_conv.is_owned = ptr_is_owned(orig);
70355         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70356         orig_conv.is_owned = false;
70357         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
70358         uint64_t ret_ref = 0;
70359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70361         return ret_ref;
70362 }
70363
70364 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
70365         LDKBlindedTail o_conv;
70366         o_conv.inner = untag_ptr(o);
70367         o_conv.is_owned = ptr_is_owned(o);
70368         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70369         o_conv.is_owned = false;
70370         int64_t ret_conv = BlindedTail_hash(&o_conv);
70371         return ret_conv;
70372 }
70373
70374 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
70375         LDKBlindedTail a_conv;
70376         a_conv.inner = untag_ptr(a);
70377         a_conv.is_owned = ptr_is_owned(a);
70378         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70379         a_conv.is_owned = false;
70380         LDKBlindedTail b_conv;
70381         b_conv.inner = untag_ptr(b);
70382         b_conv.is_owned = ptr_is_owned(b);
70383         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70384         b_conv.is_owned = false;
70385         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
70386         return ret_conv;
70387 }
70388
70389 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
70390         LDKBlindedTail obj_conv;
70391         obj_conv.inner = untag_ptr(obj);
70392         obj_conv.is_owned = ptr_is_owned(obj);
70393         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70394         obj_conv.is_owned = false;
70395         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
70396         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70397         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70398         CVec_u8Z_free(ret_var);
70399         return ret_arr;
70400 }
70401
70402 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
70403         LDKu8slice ser_ref;
70404         ser_ref.datalen = ser->arr_len;
70405         ser_ref.data = ser->elems;
70406         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
70407         *ret_conv = BlindedTail_read(ser_ref);
70408         FREE(ser);
70409         return tag_ptr(ret_conv, true);
70410 }
70411
70412 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
70413         LDKPath this_obj_conv;
70414         this_obj_conv.inner = untag_ptr(this_obj);
70415         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70417         Path_free(this_obj_conv);
70418 }
70419
70420 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
70421         LDKPath this_ptr_conv;
70422         this_ptr_conv.inner = untag_ptr(this_ptr);
70423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70425         this_ptr_conv.is_owned = false;
70426         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
70427         uint64_tArray ret_arr = NULL;
70428         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
70429         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
70430         for (size_t k = 0; k < ret_var.datalen; k++) {
70431                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
70432                 uint64_t ret_conv_10_ref = 0;
70433                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
70434                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
70435                 ret_arr_ptr[k] = ret_conv_10_ref;
70436         }
70437         
70438         FREE(ret_var.data);
70439         return ret_arr;
70440 }
70441
70442 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
70443         LDKPath this_ptr_conv;
70444         this_ptr_conv.inner = untag_ptr(this_ptr);
70445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70447         this_ptr_conv.is_owned = false;
70448         LDKCVec_RouteHopZ val_constr;
70449         val_constr.datalen = val->arr_len;
70450         if (val_constr.datalen > 0)
70451                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
70452         else
70453                 val_constr.data = NULL;
70454         uint64_t* val_vals = val->elems;
70455         for (size_t k = 0; k < val_constr.datalen; k++) {
70456                 uint64_t val_conv_10 = val_vals[k];
70457                 LDKRouteHop val_conv_10_conv;
70458                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
70459                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
70460                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
70461                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
70462                 val_constr.data[k] = val_conv_10_conv;
70463         }
70464         FREE(val);
70465         Path_set_hops(&this_ptr_conv, val_constr);
70466 }
70467
70468 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
70469         LDKPath this_ptr_conv;
70470         this_ptr_conv.inner = untag_ptr(this_ptr);
70471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70473         this_ptr_conv.is_owned = false;
70474         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
70475         uint64_t ret_ref = 0;
70476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70478         return ret_ref;
70479 }
70480
70481 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
70482         LDKPath this_ptr_conv;
70483         this_ptr_conv.inner = untag_ptr(this_ptr);
70484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70486         this_ptr_conv.is_owned = false;
70487         LDKBlindedTail val_conv;
70488         val_conv.inner = untag_ptr(val);
70489         val_conv.is_owned = ptr_is_owned(val);
70490         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70491         val_conv = BlindedTail_clone(&val_conv);
70492         Path_set_blinded_tail(&this_ptr_conv, val_conv);
70493 }
70494
70495 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
70496         LDKCVec_RouteHopZ hops_arg_constr;
70497         hops_arg_constr.datalen = hops_arg->arr_len;
70498         if (hops_arg_constr.datalen > 0)
70499                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
70500         else
70501                 hops_arg_constr.data = NULL;
70502         uint64_t* hops_arg_vals = hops_arg->elems;
70503         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
70504                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
70505                 LDKRouteHop hops_arg_conv_10_conv;
70506                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
70507                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
70508                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
70509                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
70510                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
70511         }
70512         FREE(hops_arg);
70513         LDKBlindedTail blinded_tail_arg_conv;
70514         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
70515         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
70516         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
70517         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
70518         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
70519         uint64_t ret_ref = 0;
70520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70522         return ret_ref;
70523 }
70524
70525 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
70526         LDKPath ret_var = Path_clone(arg);
70527         uint64_t ret_ref = 0;
70528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70530         return ret_ref;
70531 }
70532 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
70533         LDKPath arg_conv;
70534         arg_conv.inner = untag_ptr(arg);
70535         arg_conv.is_owned = ptr_is_owned(arg);
70536         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70537         arg_conv.is_owned = false;
70538         int64_t ret_conv = Path_clone_ptr(&arg_conv);
70539         return ret_conv;
70540 }
70541
70542 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
70543         LDKPath orig_conv;
70544         orig_conv.inner = untag_ptr(orig);
70545         orig_conv.is_owned = ptr_is_owned(orig);
70546         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70547         orig_conv.is_owned = false;
70548         LDKPath ret_var = Path_clone(&orig_conv);
70549         uint64_t ret_ref = 0;
70550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70552         return ret_ref;
70553 }
70554
70555 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
70556         LDKPath o_conv;
70557         o_conv.inner = untag_ptr(o);
70558         o_conv.is_owned = ptr_is_owned(o);
70559         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70560         o_conv.is_owned = false;
70561         int64_t ret_conv = Path_hash(&o_conv);
70562         return ret_conv;
70563 }
70564
70565 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
70566         LDKPath a_conv;
70567         a_conv.inner = untag_ptr(a);
70568         a_conv.is_owned = ptr_is_owned(a);
70569         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70570         a_conv.is_owned = false;
70571         LDKPath b_conv;
70572         b_conv.inner = untag_ptr(b);
70573         b_conv.is_owned = ptr_is_owned(b);
70574         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70575         b_conv.is_owned = false;
70576         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
70577         return ret_conv;
70578 }
70579
70580 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
70581         LDKPath this_arg_conv;
70582         this_arg_conv.inner = untag_ptr(this_arg);
70583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70585         this_arg_conv.is_owned = false;
70586         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
70587         return ret_conv;
70588 }
70589
70590 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
70591         LDKPath this_arg_conv;
70592         this_arg_conv.inner = untag_ptr(this_arg);
70593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70595         this_arg_conv.is_owned = false;
70596         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
70597         return ret_conv;
70598 }
70599
70600 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
70601         LDKPath this_arg_conv;
70602         this_arg_conv.inner = untag_ptr(this_arg);
70603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70605         this_arg_conv.is_owned = false;
70606         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
70607         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
70608         uint64_t ret_ref = tag_ptr(ret_copy, true);
70609         return ret_ref;
70610 }
70611
70612 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
70613         LDKRoute this_obj_conv;
70614         this_obj_conv.inner = untag_ptr(this_obj);
70615         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70617         Route_free(this_obj_conv);
70618 }
70619
70620 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
70621         LDKRoute this_ptr_conv;
70622         this_ptr_conv.inner = untag_ptr(this_ptr);
70623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70625         this_ptr_conv.is_owned = false;
70626         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
70627         uint64_tArray ret_arr = NULL;
70628         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
70629         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
70630         for (size_t g = 0; g < ret_var.datalen; g++) {
70631                 LDKPath ret_conv_6_var = ret_var.data[g];
70632                 uint64_t ret_conv_6_ref = 0;
70633                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
70634                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
70635                 ret_arr_ptr[g] = ret_conv_6_ref;
70636         }
70637         
70638         FREE(ret_var.data);
70639         return ret_arr;
70640 }
70641
70642 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
70643         LDKRoute this_ptr_conv;
70644         this_ptr_conv.inner = untag_ptr(this_ptr);
70645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70647         this_ptr_conv.is_owned = false;
70648         LDKCVec_PathZ val_constr;
70649         val_constr.datalen = val->arr_len;
70650         if (val_constr.datalen > 0)
70651                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
70652         else
70653                 val_constr.data = NULL;
70654         uint64_t* val_vals = val->elems;
70655         for (size_t g = 0; g < val_constr.datalen; g++) {
70656                 uint64_t val_conv_6 = val_vals[g];
70657                 LDKPath val_conv_6_conv;
70658                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
70659                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
70660                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
70661                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
70662                 val_constr.data[g] = val_conv_6_conv;
70663         }
70664         FREE(val);
70665         Route_set_paths(&this_ptr_conv, val_constr);
70666 }
70667
70668 uint64_t  __attribute__((export_name("TS_Route_get_route_params"))) TS_Route_get_route_params(uint64_t this_ptr) {
70669         LDKRoute this_ptr_conv;
70670         this_ptr_conv.inner = untag_ptr(this_ptr);
70671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70673         this_ptr_conv.is_owned = false;
70674         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
70675         uint64_t ret_ref = 0;
70676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70678         return ret_ref;
70679 }
70680
70681 void  __attribute__((export_name("TS_Route_set_route_params"))) TS_Route_set_route_params(uint64_t this_ptr, uint64_t val) {
70682         LDKRoute this_ptr_conv;
70683         this_ptr_conv.inner = untag_ptr(this_ptr);
70684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70686         this_ptr_conv.is_owned = false;
70687         LDKRouteParameters val_conv;
70688         val_conv.inner = untag_ptr(val);
70689         val_conv.is_owned = ptr_is_owned(val);
70690         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70691         val_conv = RouteParameters_clone(&val_conv);
70692         Route_set_route_params(&this_ptr_conv, val_conv);
70693 }
70694
70695 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t route_params_arg) {
70696         LDKCVec_PathZ paths_arg_constr;
70697         paths_arg_constr.datalen = paths_arg->arr_len;
70698         if (paths_arg_constr.datalen > 0)
70699                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
70700         else
70701                 paths_arg_constr.data = NULL;
70702         uint64_t* paths_arg_vals = paths_arg->elems;
70703         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
70704                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
70705                 LDKPath paths_arg_conv_6_conv;
70706                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
70707                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
70708                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
70709                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
70710                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
70711         }
70712         FREE(paths_arg);
70713         LDKRouteParameters route_params_arg_conv;
70714         route_params_arg_conv.inner = untag_ptr(route_params_arg);
70715         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
70716         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
70717         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
70718         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
70719         uint64_t ret_ref = 0;
70720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70722         return ret_ref;
70723 }
70724
70725 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
70726         LDKRoute ret_var = Route_clone(arg);
70727         uint64_t ret_ref = 0;
70728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70730         return ret_ref;
70731 }
70732 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
70733         LDKRoute arg_conv;
70734         arg_conv.inner = untag_ptr(arg);
70735         arg_conv.is_owned = ptr_is_owned(arg);
70736         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70737         arg_conv.is_owned = false;
70738         int64_t ret_conv = Route_clone_ptr(&arg_conv);
70739         return ret_conv;
70740 }
70741
70742 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
70743         LDKRoute orig_conv;
70744         orig_conv.inner = untag_ptr(orig);
70745         orig_conv.is_owned = ptr_is_owned(orig);
70746         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70747         orig_conv.is_owned = false;
70748         LDKRoute ret_var = Route_clone(&orig_conv);
70749         uint64_t ret_ref = 0;
70750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70752         return ret_ref;
70753 }
70754
70755 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
70756         LDKRoute o_conv;
70757         o_conv.inner = untag_ptr(o);
70758         o_conv.is_owned = ptr_is_owned(o);
70759         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70760         o_conv.is_owned = false;
70761         int64_t ret_conv = Route_hash(&o_conv);
70762         return ret_conv;
70763 }
70764
70765 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
70766         LDKRoute a_conv;
70767         a_conv.inner = untag_ptr(a);
70768         a_conv.is_owned = ptr_is_owned(a);
70769         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70770         a_conv.is_owned = false;
70771         LDKRoute b_conv;
70772         b_conv.inner = untag_ptr(b);
70773         b_conv.is_owned = ptr_is_owned(b);
70774         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70775         b_conv.is_owned = false;
70776         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
70777         return ret_conv;
70778 }
70779
70780 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
70781         LDKRoute this_arg_conv;
70782         this_arg_conv.inner = untag_ptr(this_arg);
70783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70785         this_arg_conv.is_owned = false;
70786         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
70787         return ret_conv;
70788 }
70789
70790 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
70791         LDKRoute this_arg_conv;
70792         this_arg_conv.inner = untag_ptr(this_arg);
70793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70795         this_arg_conv.is_owned = false;
70796         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
70797         return ret_conv;
70798 }
70799
70800 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
70801         LDKRoute obj_conv;
70802         obj_conv.inner = untag_ptr(obj);
70803         obj_conv.is_owned = ptr_is_owned(obj);
70804         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70805         obj_conv.is_owned = false;
70806         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
70807         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70808         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70809         CVec_u8Z_free(ret_var);
70810         return ret_arr;
70811 }
70812
70813 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
70814         LDKu8slice ser_ref;
70815         ser_ref.datalen = ser->arr_len;
70816         ser_ref.data = ser->elems;
70817         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
70818         *ret_conv = Route_read(ser_ref);
70819         FREE(ser);
70820         return tag_ptr(ret_conv, true);
70821 }
70822
70823 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
70824         LDKRouteParameters this_obj_conv;
70825         this_obj_conv.inner = untag_ptr(this_obj);
70826         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70828         RouteParameters_free(this_obj_conv);
70829 }
70830
70831 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
70832         LDKRouteParameters this_ptr_conv;
70833         this_ptr_conv.inner = untag_ptr(this_ptr);
70834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70836         this_ptr_conv.is_owned = false;
70837         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
70838         uint64_t ret_ref = 0;
70839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70841         return ret_ref;
70842 }
70843
70844 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
70845         LDKRouteParameters this_ptr_conv;
70846         this_ptr_conv.inner = untag_ptr(this_ptr);
70847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70849         this_ptr_conv.is_owned = false;
70850         LDKPaymentParameters val_conv;
70851         val_conv.inner = untag_ptr(val);
70852         val_conv.is_owned = ptr_is_owned(val);
70853         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70854         val_conv = PaymentParameters_clone(&val_conv);
70855         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
70856 }
70857
70858 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
70859         LDKRouteParameters this_ptr_conv;
70860         this_ptr_conv.inner = untag_ptr(this_ptr);
70861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70863         this_ptr_conv.is_owned = false;
70864         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
70865         return ret_conv;
70866 }
70867
70868 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
70869         LDKRouteParameters this_ptr_conv;
70870         this_ptr_conv.inner = untag_ptr(this_ptr);
70871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70873         this_ptr_conv.is_owned = false;
70874         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
70875 }
70876
70877 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) {
70878         LDKRouteParameters this_ptr_conv;
70879         this_ptr_conv.inner = untag_ptr(this_ptr);
70880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70882         this_ptr_conv.is_owned = false;
70883         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70884         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
70885         uint64_t ret_ref = tag_ptr(ret_copy, true);
70886         return ret_ref;
70887 }
70888
70889 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) {
70890         LDKRouteParameters this_ptr_conv;
70891         this_ptr_conv.inner = untag_ptr(this_ptr);
70892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70894         this_ptr_conv.is_owned = false;
70895         void* val_ptr = untag_ptr(val);
70896         CHECK_ACCESS(val_ptr);
70897         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
70898         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
70899         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
70900 }
70901
70902 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) {
70903         LDKPaymentParameters payment_params_arg_conv;
70904         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
70905         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
70906         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
70907         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
70908         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
70909         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
70910         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
70911         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
70912         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
70913         uint64_t ret_ref = 0;
70914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70916         return ret_ref;
70917 }
70918
70919 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
70920         LDKRouteParameters ret_var = RouteParameters_clone(arg);
70921         uint64_t ret_ref = 0;
70922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70924         return ret_ref;
70925 }
70926 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
70927         LDKRouteParameters arg_conv;
70928         arg_conv.inner = untag_ptr(arg);
70929         arg_conv.is_owned = ptr_is_owned(arg);
70930         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70931         arg_conv.is_owned = false;
70932         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
70933         return ret_conv;
70934 }
70935
70936 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
70937         LDKRouteParameters orig_conv;
70938         orig_conv.inner = untag_ptr(orig);
70939         orig_conv.is_owned = ptr_is_owned(orig);
70940         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70941         orig_conv.is_owned = false;
70942         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
70943         uint64_t ret_ref = 0;
70944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70946         return ret_ref;
70947 }
70948
70949 int64_t  __attribute__((export_name("TS_RouteParameters_hash"))) TS_RouteParameters_hash(uint64_t o) {
70950         LDKRouteParameters o_conv;
70951         o_conv.inner = untag_ptr(o);
70952         o_conv.is_owned = ptr_is_owned(o);
70953         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70954         o_conv.is_owned = false;
70955         int64_t ret_conv = RouteParameters_hash(&o_conv);
70956         return ret_conv;
70957 }
70958
70959 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
70960         LDKRouteParameters a_conv;
70961         a_conv.inner = untag_ptr(a);
70962         a_conv.is_owned = ptr_is_owned(a);
70963         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70964         a_conv.is_owned = false;
70965         LDKRouteParameters b_conv;
70966         b_conv.inner = untag_ptr(b);
70967         b_conv.is_owned = ptr_is_owned(b);
70968         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70969         b_conv.is_owned = false;
70970         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
70971         return ret_conv;
70972 }
70973
70974 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) {
70975         LDKPaymentParameters payment_params_conv;
70976         payment_params_conv.inner = untag_ptr(payment_params);
70977         payment_params_conv.is_owned = ptr_is_owned(payment_params);
70978         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
70979         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
70980         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
70981         uint64_t ret_ref = 0;
70982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70984         return ret_ref;
70985 }
70986
70987 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
70988         LDKRouteParameters obj_conv;
70989         obj_conv.inner = untag_ptr(obj);
70990         obj_conv.is_owned = ptr_is_owned(obj);
70991         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70992         obj_conv.is_owned = false;
70993         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
70994         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70995         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70996         CVec_u8Z_free(ret_var);
70997         return ret_arr;
70998 }
70999
71000 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
71001         LDKu8slice ser_ref;
71002         ser_ref.datalen = ser->arr_len;
71003         ser_ref.data = ser->elems;
71004         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
71005         *ret_conv = RouteParameters_read(ser_ref);
71006         FREE(ser);
71007         return tag_ptr(ret_conv, true);
71008 }
71009
71010 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
71011         LDKPaymentParameters this_obj_conv;
71012         this_obj_conv.inner = untag_ptr(this_obj);
71013         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71015         PaymentParameters_free(this_obj_conv);
71016 }
71017
71018 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_payee"))) TS_PaymentParameters_get_payee(uint64_t this_ptr) {
71019         LDKPaymentParameters this_ptr_conv;
71020         this_ptr_conv.inner = untag_ptr(this_ptr);
71021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71023         this_ptr_conv.is_owned = false;
71024         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71025         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
71026         uint64_t ret_ref = tag_ptr(ret_copy, true);
71027         return ret_ref;
71028 }
71029
71030 void  __attribute__((export_name("TS_PaymentParameters_set_payee"))) TS_PaymentParameters_set_payee(uint64_t this_ptr, uint64_t val) {
71031         LDKPaymentParameters this_ptr_conv;
71032         this_ptr_conv.inner = untag_ptr(this_ptr);
71033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71035         this_ptr_conv.is_owned = false;
71036         void* val_ptr = untag_ptr(val);
71037         CHECK_ACCESS(val_ptr);
71038         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
71039         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
71040         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
71041 }
71042
71043 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
71044         LDKPaymentParameters this_ptr_conv;
71045         this_ptr_conv.inner = untag_ptr(this_ptr);
71046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71048         this_ptr_conv.is_owned = false;
71049         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71050         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
71051         uint64_t ret_ref = tag_ptr(ret_copy, true);
71052         return ret_ref;
71053 }
71054
71055 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
71056         LDKPaymentParameters this_ptr_conv;
71057         this_ptr_conv.inner = untag_ptr(this_ptr);
71058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71060         this_ptr_conv.is_owned = false;
71061         void* val_ptr = untag_ptr(val);
71062         CHECK_ACCESS(val_ptr);
71063         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
71064         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
71065         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
71066 }
71067
71068 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) {
71069         LDKPaymentParameters this_ptr_conv;
71070         this_ptr_conv.inner = untag_ptr(this_ptr);
71071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71073         this_ptr_conv.is_owned = false;
71074         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
71075         return ret_conv;
71076 }
71077
71078 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) {
71079         LDKPaymentParameters this_ptr_conv;
71080         this_ptr_conv.inner = untag_ptr(this_ptr);
71081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71083         this_ptr_conv.is_owned = false;
71084         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
71085 }
71086
71087 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
71088         LDKPaymentParameters this_ptr_conv;
71089         this_ptr_conv.inner = untag_ptr(this_ptr);
71090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71092         this_ptr_conv.is_owned = false;
71093         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
71094         return ret_conv;
71095 }
71096
71097 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
71098         LDKPaymentParameters this_ptr_conv;
71099         this_ptr_conv.inner = untag_ptr(this_ptr);
71100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71102         this_ptr_conv.is_owned = false;
71103         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
71104 }
71105
71106 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) {
71107         LDKPaymentParameters this_ptr_conv;
71108         this_ptr_conv.inner = untag_ptr(this_ptr);
71109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71111         this_ptr_conv.is_owned = false;
71112         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
71113         return ret_conv;
71114 }
71115
71116 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) {
71117         LDKPaymentParameters this_ptr_conv;
71118         this_ptr_conv.inner = untag_ptr(this_ptr);
71119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71121         this_ptr_conv.is_owned = false;
71122         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
71123 }
71124
71125 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
71126         LDKPaymentParameters this_ptr_conv;
71127         this_ptr_conv.inner = untag_ptr(this_ptr);
71128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71130         this_ptr_conv.is_owned = false;
71131         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
71132         int64_tArray ret_arr = NULL;
71133         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
71134         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
71135         for (size_t i = 0; i < ret_var.datalen; i++) {
71136                 int64_t ret_conv_8_conv = ret_var.data[i];
71137                 ret_arr_ptr[i] = ret_conv_8_conv;
71138         }
71139         
71140         FREE(ret_var.data);
71141         return ret_arr;
71142 }
71143
71144 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
71145         LDKPaymentParameters this_ptr_conv;
71146         this_ptr_conv.inner = untag_ptr(this_ptr);
71147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71149         this_ptr_conv.is_owned = false;
71150         LDKCVec_u64Z val_constr;
71151         val_constr.datalen = val->arr_len;
71152         if (val_constr.datalen > 0)
71153                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71154         else
71155                 val_constr.data = NULL;
71156         int64_t* val_vals = val->elems;
71157         for (size_t i = 0; i < val_constr.datalen; i++) {
71158                 int64_t val_conv_8 = val_vals[i];
71159                 val_constr.data[i] = val_conv_8;
71160         }
71161         FREE(val);
71162         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
71163 }
71164
71165 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) {
71166         LDKPaymentParameters this_ptr_conv;
71167         this_ptr_conv.inner = untag_ptr(this_ptr);
71168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71170         this_ptr_conv.is_owned = false;
71171         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
71172         int64_tArray ret_arr = NULL;
71173         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
71174         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
71175         for (size_t i = 0; i < ret_var.datalen; i++) {
71176                 int64_t ret_conv_8_conv = ret_var.data[i];
71177                 ret_arr_ptr[i] = ret_conv_8_conv;
71178         }
71179         
71180         FREE(ret_var.data);
71181         return ret_arr;
71182 }
71183
71184 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) {
71185         LDKPaymentParameters this_ptr_conv;
71186         this_ptr_conv.inner = untag_ptr(this_ptr);
71187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71189         this_ptr_conv.is_owned = false;
71190         LDKCVec_u64Z val_constr;
71191         val_constr.datalen = val->arr_len;
71192         if (val_constr.datalen > 0)
71193                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71194         else
71195                 val_constr.data = NULL;
71196         int64_t* val_vals = val->elems;
71197         for (size_t i = 0; i < val_constr.datalen; i++) {
71198                 int64_t val_conv_8 = val_vals[i];
71199                 val_constr.data[i] = val_conv_8;
71200         }
71201         FREE(val);
71202         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
71203 }
71204
71205 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) {
71206         void* payee_arg_ptr = untag_ptr(payee_arg);
71207         CHECK_ACCESS(payee_arg_ptr);
71208         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
71209         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
71210         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
71211         CHECK_ACCESS(expiry_time_arg_ptr);
71212         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
71213         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
71214         LDKCVec_u64Z previously_failed_channels_arg_constr;
71215         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
71216         if (previously_failed_channels_arg_constr.datalen > 0)
71217                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71218         else
71219                 previously_failed_channels_arg_constr.data = NULL;
71220         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
71221         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
71222                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
71223                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
71224         }
71225         FREE(previously_failed_channels_arg);
71226         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
71227         previously_failed_blinded_path_idxs_arg_constr.datalen = previously_failed_blinded_path_idxs_arg->arr_len;
71228         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
71229                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71230         else
71231                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
71232         int64_t* previously_failed_blinded_path_idxs_arg_vals = previously_failed_blinded_path_idxs_arg->elems;
71233         for (size_t i = 0; i < previously_failed_blinded_path_idxs_arg_constr.datalen; i++) {
71234                 int64_t previously_failed_blinded_path_idxs_arg_conv_8 = previously_failed_blinded_path_idxs_arg_vals[i];
71235                 previously_failed_blinded_path_idxs_arg_constr.data[i] = previously_failed_blinded_path_idxs_arg_conv_8;
71236         }
71237         FREE(previously_failed_blinded_path_idxs_arg);
71238         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);
71239         uint64_t ret_ref = 0;
71240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71242         return ret_ref;
71243 }
71244
71245 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
71246         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
71247         uint64_t ret_ref = 0;
71248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71250         return ret_ref;
71251 }
71252 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
71253         LDKPaymentParameters arg_conv;
71254         arg_conv.inner = untag_ptr(arg);
71255         arg_conv.is_owned = ptr_is_owned(arg);
71256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71257         arg_conv.is_owned = false;
71258         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
71259         return ret_conv;
71260 }
71261
71262 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
71263         LDKPaymentParameters orig_conv;
71264         orig_conv.inner = untag_ptr(orig);
71265         orig_conv.is_owned = ptr_is_owned(orig);
71266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71267         orig_conv.is_owned = false;
71268         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
71269         uint64_t ret_ref = 0;
71270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71272         return ret_ref;
71273 }
71274
71275 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
71276         LDKPaymentParameters o_conv;
71277         o_conv.inner = untag_ptr(o);
71278         o_conv.is_owned = ptr_is_owned(o);
71279         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71280         o_conv.is_owned = false;
71281         int64_t ret_conv = PaymentParameters_hash(&o_conv);
71282         return ret_conv;
71283 }
71284
71285 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
71286         LDKPaymentParameters a_conv;
71287         a_conv.inner = untag_ptr(a);
71288         a_conv.is_owned = ptr_is_owned(a);
71289         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71290         a_conv.is_owned = false;
71291         LDKPaymentParameters b_conv;
71292         b_conv.inner = untag_ptr(b);
71293         b_conv.is_owned = ptr_is_owned(b);
71294         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71295         b_conv.is_owned = false;
71296         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
71297         return ret_conv;
71298 }
71299
71300 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
71301         LDKPaymentParameters obj_conv;
71302         obj_conv.inner = untag_ptr(obj);
71303         obj_conv.is_owned = ptr_is_owned(obj);
71304         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71305         obj_conv.is_owned = false;
71306         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
71307         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71308         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71309         CVec_u8Z_free(ret_var);
71310         return ret_arr;
71311 }
71312
71313 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
71314         LDKu8slice ser_ref;
71315         ser_ref.datalen = ser->arr_len;
71316         ser_ref.data = ser->elems;
71317         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
71318         *ret_conv = PaymentParameters_read(ser_ref, arg);
71319         FREE(ser);
71320         return tag_ptr(ret_conv, true);
71321 }
71322
71323 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) {
71324         LDKPublicKey payee_pubkey_ref;
71325         CHECK(payee_pubkey->arr_len == 33);
71326         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
71327         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
71328         uint64_t ret_ref = 0;
71329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71331         return ret_ref;
71332 }
71333
71334 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) {
71335         LDKPublicKey payee_pubkey_ref;
71336         CHECK(payee_pubkey->arr_len == 33);
71337         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
71338         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
71339         uint64_t ret_ref = 0;
71340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71342         return ret_ref;
71343 }
71344
71345 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_bolt12_invoice"))) TS_PaymentParameters_from_bolt12_invoice(uint64_t invoice) {
71346         LDKBolt12Invoice invoice_conv;
71347         invoice_conv.inner = untag_ptr(invoice);
71348         invoice_conv.is_owned = ptr_is_owned(invoice);
71349         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
71350         invoice_conv.is_owned = false;
71351         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
71352         uint64_t ret_ref = 0;
71353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71355         return ret_ref;
71356 }
71357
71358 uint64_t  __attribute__((export_name("TS_PaymentParameters_blinded"))) TS_PaymentParameters_blinded(uint64_tArray blinded_route_hints) {
71359         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
71360         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
71361         if (blinded_route_hints_constr.datalen > 0)
71362                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
71363         else
71364                 blinded_route_hints_constr.data = NULL;
71365         uint64_t* blinded_route_hints_vals = blinded_route_hints->elems;
71366         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
71367                 uint64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
71368                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
71369                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
71370                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
71371                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
71372                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
71373         }
71374         FREE(blinded_route_hints);
71375         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
71376         uint64_t ret_ref = 0;
71377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71379         return ret_ref;
71380 }
71381
71382 void  __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint64_t this_ptr) {
71383         if (!ptr_is_owned(this_ptr)) return;
71384         void* this_ptr_ptr = untag_ptr(this_ptr);
71385         CHECK_ACCESS(this_ptr_ptr);
71386         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
71387         FREE(untag_ptr(this_ptr));
71388         Payee_free(this_ptr_conv);
71389 }
71390
71391 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
71392         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71393         *ret_copy = Payee_clone(arg);
71394         uint64_t ret_ref = tag_ptr(ret_copy, true);
71395         return ret_ref;
71396 }
71397 int64_t  __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint64_t arg) {
71398         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
71399         int64_t ret_conv = Payee_clone_ptr(arg_conv);
71400         return ret_conv;
71401 }
71402
71403 uint64_t  __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint64_t orig) {
71404         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
71405         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71406         *ret_copy = Payee_clone(orig_conv);
71407         uint64_t ret_ref = tag_ptr(ret_copy, true);
71408         return ret_ref;
71409 }
71410
71411 uint64_t  __attribute__((export_name("TS_Payee_blinded"))) TS_Payee_blinded(uint64_tArray route_hints, uint64_t features) {
71412         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
71413         route_hints_constr.datalen = route_hints->arr_len;
71414         if (route_hints_constr.datalen > 0)
71415                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
71416         else
71417                 route_hints_constr.data = NULL;
71418         uint64_t* route_hints_vals = route_hints->elems;
71419         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
71420                 uint64_t route_hints_conv_37 = route_hints_vals[l];
71421                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
71422                 CHECK_ACCESS(route_hints_conv_37_ptr);
71423                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
71424                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
71425                 route_hints_constr.data[l] = route_hints_conv_37_conv;
71426         }
71427         FREE(route_hints);
71428         LDKBolt12InvoiceFeatures features_conv;
71429         features_conv.inner = untag_ptr(features);
71430         features_conv.is_owned = ptr_is_owned(features);
71431         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
71432         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
71433         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71434         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
71435         uint64_t ret_ref = tag_ptr(ret_copy, true);
71436         return ret_ref;
71437 }
71438
71439 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) {
71440         LDKPublicKey node_id_ref;
71441         CHECK(node_id->arr_len == 33);
71442         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
71443         LDKCVec_RouteHintZ route_hints_constr;
71444         route_hints_constr.datalen = route_hints->arr_len;
71445         if (route_hints_constr.datalen > 0)
71446                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
71447         else
71448                 route_hints_constr.data = NULL;
71449         uint64_t* route_hints_vals = route_hints->elems;
71450         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
71451                 uint64_t route_hints_conv_11 = route_hints_vals[l];
71452                 LDKRouteHint route_hints_conv_11_conv;
71453                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
71454                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
71455                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
71456                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
71457                 route_hints_constr.data[l] = route_hints_conv_11_conv;
71458         }
71459         FREE(route_hints);
71460         LDKBolt11InvoiceFeatures features_conv;
71461         features_conv.inner = untag_ptr(features);
71462         features_conv.is_owned = ptr_is_owned(features);
71463         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
71464         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
71465         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71466         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
71467         uint64_t ret_ref = tag_ptr(ret_copy, true);
71468         return ret_ref;
71469 }
71470
71471 int64_t  __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint64_t o) {
71472         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
71473         int64_t ret_conv = Payee_hash(o_conv);
71474         return ret_conv;
71475 }
71476
71477 jboolean  __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint64_t a, uint64_t b) {
71478         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
71479         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
71480         jboolean ret_conv = Payee_eq(a_conv, b_conv);
71481         return ret_conv;
71482 }
71483
71484 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
71485         LDKRouteHint this_obj_conv;
71486         this_obj_conv.inner = untag_ptr(this_obj);
71487         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71489         RouteHint_free(this_obj_conv);
71490 }
71491
71492 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
71493         LDKRouteHint this_ptr_conv;
71494         this_ptr_conv.inner = untag_ptr(this_ptr);
71495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71497         this_ptr_conv.is_owned = false;
71498         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
71499         uint64_tArray ret_arr = NULL;
71500         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
71501         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
71502         for (size_t o = 0; o < ret_var.datalen; o++) {
71503                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
71504                 uint64_t ret_conv_14_ref = 0;
71505                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
71506                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
71507                 ret_arr_ptr[o] = ret_conv_14_ref;
71508         }
71509         
71510         FREE(ret_var.data);
71511         return ret_arr;
71512 }
71513
71514 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
71515         LDKRouteHint this_ptr_conv;
71516         this_ptr_conv.inner = untag_ptr(this_ptr);
71517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71519         this_ptr_conv.is_owned = false;
71520         LDKCVec_RouteHintHopZ val_constr;
71521         val_constr.datalen = val->arr_len;
71522         if (val_constr.datalen > 0)
71523                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
71524         else
71525                 val_constr.data = NULL;
71526         uint64_t* val_vals = val->elems;
71527         for (size_t o = 0; o < val_constr.datalen; o++) {
71528                 uint64_t val_conv_14 = val_vals[o];
71529                 LDKRouteHintHop val_conv_14_conv;
71530                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
71531                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
71532                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
71533                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
71534                 val_constr.data[o] = val_conv_14_conv;
71535         }
71536         FREE(val);
71537         RouteHint_set_a(&this_ptr_conv, val_constr);
71538 }
71539
71540 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
71541         LDKCVec_RouteHintHopZ a_arg_constr;
71542         a_arg_constr.datalen = a_arg->arr_len;
71543         if (a_arg_constr.datalen > 0)
71544                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
71545         else
71546                 a_arg_constr.data = NULL;
71547         uint64_t* a_arg_vals = a_arg->elems;
71548         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
71549                 uint64_t a_arg_conv_14 = a_arg_vals[o];
71550                 LDKRouteHintHop a_arg_conv_14_conv;
71551                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
71552                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
71553                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
71554                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
71555                 a_arg_constr.data[o] = a_arg_conv_14_conv;
71556         }
71557         FREE(a_arg);
71558         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
71559         uint64_t ret_ref = 0;
71560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71562         return ret_ref;
71563 }
71564
71565 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
71566         LDKRouteHint ret_var = RouteHint_clone(arg);
71567         uint64_t ret_ref = 0;
71568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71570         return ret_ref;
71571 }
71572 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
71573         LDKRouteHint arg_conv;
71574         arg_conv.inner = untag_ptr(arg);
71575         arg_conv.is_owned = ptr_is_owned(arg);
71576         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71577         arg_conv.is_owned = false;
71578         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
71579         return ret_conv;
71580 }
71581
71582 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
71583         LDKRouteHint orig_conv;
71584         orig_conv.inner = untag_ptr(orig);
71585         orig_conv.is_owned = ptr_is_owned(orig);
71586         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71587         orig_conv.is_owned = false;
71588         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
71589         uint64_t ret_ref = 0;
71590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71592         return ret_ref;
71593 }
71594
71595 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
71596         LDKRouteHint o_conv;
71597         o_conv.inner = untag_ptr(o);
71598         o_conv.is_owned = ptr_is_owned(o);
71599         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71600         o_conv.is_owned = false;
71601         int64_t ret_conv = RouteHint_hash(&o_conv);
71602         return ret_conv;
71603 }
71604
71605 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
71606         LDKRouteHint a_conv;
71607         a_conv.inner = untag_ptr(a);
71608         a_conv.is_owned = ptr_is_owned(a);
71609         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71610         a_conv.is_owned = false;
71611         LDKRouteHint b_conv;
71612         b_conv.inner = untag_ptr(b);
71613         b_conv.is_owned = ptr_is_owned(b);
71614         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71615         b_conv.is_owned = false;
71616         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
71617         return ret_conv;
71618 }
71619
71620 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
71621         LDKRouteHint obj_conv;
71622         obj_conv.inner = untag_ptr(obj);
71623         obj_conv.is_owned = ptr_is_owned(obj);
71624         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71625         obj_conv.is_owned = false;
71626         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
71627         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71628         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71629         CVec_u8Z_free(ret_var);
71630         return ret_arr;
71631 }
71632
71633 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
71634         LDKu8slice ser_ref;
71635         ser_ref.datalen = ser->arr_len;
71636         ser_ref.data = ser->elems;
71637         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
71638         *ret_conv = RouteHint_read(ser_ref);
71639         FREE(ser);
71640         return tag_ptr(ret_conv, true);
71641 }
71642
71643 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
71644         LDKRouteHintHop this_obj_conv;
71645         this_obj_conv.inner = untag_ptr(this_obj);
71646         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71648         RouteHintHop_free(this_obj_conv);
71649 }
71650
71651 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
71652         LDKRouteHintHop this_ptr_conv;
71653         this_ptr_conv.inner = untag_ptr(this_ptr);
71654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71656         this_ptr_conv.is_owned = false;
71657         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
71658         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
71659         return ret_arr;
71660 }
71661
71662 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
71663         LDKRouteHintHop this_ptr_conv;
71664         this_ptr_conv.inner = untag_ptr(this_ptr);
71665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71667         this_ptr_conv.is_owned = false;
71668         LDKPublicKey val_ref;
71669         CHECK(val->arr_len == 33);
71670         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
71671         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
71672 }
71673
71674 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
71675         LDKRouteHintHop this_ptr_conv;
71676         this_ptr_conv.inner = untag_ptr(this_ptr);
71677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71679         this_ptr_conv.is_owned = false;
71680         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
71681         return ret_conv;
71682 }
71683
71684 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
71685         LDKRouteHintHop this_ptr_conv;
71686         this_ptr_conv.inner = untag_ptr(this_ptr);
71687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71689         this_ptr_conv.is_owned = false;
71690         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
71691 }
71692
71693 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
71694         LDKRouteHintHop this_ptr_conv;
71695         this_ptr_conv.inner = untag_ptr(this_ptr);
71696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71698         this_ptr_conv.is_owned = false;
71699         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
71700         uint64_t ret_ref = 0;
71701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71703         return ret_ref;
71704 }
71705
71706 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
71707         LDKRouteHintHop this_ptr_conv;
71708         this_ptr_conv.inner = untag_ptr(this_ptr);
71709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71711         this_ptr_conv.is_owned = false;
71712         LDKRoutingFees val_conv;
71713         val_conv.inner = untag_ptr(val);
71714         val_conv.is_owned = ptr_is_owned(val);
71715         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71716         val_conv = RoutingFees_clone(&val_conv);
71717         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
71718 }
71719
71720 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
71721         LDKRouteHintHop this_ptr_conv;
71722         this_ptr_conv.inner = untag_ptr(this_ptr);
71723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71725         this_ptr_conv.is_owned = false;
71726         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
71727         return ret_conv;
71728 }
71729
71730 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
71731         LDKRouteHintHop this_ptr_conv;
71732         this_ptr_conv.inner = untag_ptr(this_ptr);
71733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71735         this_ptr_conv.is_owned = false;
71736         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
71737 }
71738
71739 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
71740         LDKRouteHintHop this_ptr_conv;
71741         this_ptr_conv.inner = untag_ptr(this_ptr);
71742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71744         this_ptr_conv.is_owned = false;
71745         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71746         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
71747         uint64_t ret_ref = tag_ptr(ret_copy, true);
71748         return ret_ref;
71749 }
71750
71751 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
71752         LDKRouteHintHop this_ptr_conv;
71753         this_ptr_conv.inner = untag_ptr(this_ptr);
71754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71756         this_ptr_conv.is_owned = false;
71757         void* val_ptr = untag_ptr(val);
71758         CHECK_ACCESS(val_ptr);
71759         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
71760         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
71761         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
71762 }
71763
71764 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
71765         LDKRouteHintHop this_ptr_conv;
71766         this_ptr_conv.inner = untag_ptr(this_ptr);
71767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71769         this_ptr_conv.is_owned = false;
71770         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71771         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
71772         uint64_t ret_ref = tag_ptr(ret_copy, true);
71773         return ret_ref;
71774 }
71775
71776 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
71777         LDKRouteHintHop this_ptr_conv;
71778         this_ptr_conv.inner = untag_ptr(this_ptr);
71779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71781         this_ptr_conv.is_owned = false;
71782         void* val_ptr = untag_ptr(val);
71783         CHECK_ACCESS(val_ptr);
71784         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
71785         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
71786         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
71787 }
71788
71789 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) {
71790         LDKPublicKey src_node_id_arg_ref;
71791         CHECK(src_node_id_arg->arr_len == 33);
71792         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
71793         LDKRoutingFees fees_arg_conv;
71794         fees_arg_conv.inner = untag_ptr(fees_arg);
71795         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
71796         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
71797         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
71798         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
71799         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
71800         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
71801         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
71802         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
71803         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
71804         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
71805         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
71806         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);
71807         uint64_t ret_ref = 0;
71808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71810         return ret_ref;
71811 }
71812
71813 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
71814         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
71815         uint64_t ret_ref = 0;
71816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71818         return ret_ref;
71819 }
71820 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
71821         LDKRouteHintHop arg_conv;
71822         arg_conv.inner = untag_ptr(arg);
71823         arg_conv.is_owned = ptr_is_owned(arg);
71824         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71825         arg_conv.is_owned = false;
71826         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
71827         return ret_conv;
71828 }
71829
71830 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
71831         LDKRouteHintHop orig_conv;
71832         orig_conv.inner = untag_ptr(orig);
71833         orig_conv.is_owned = ptr_is_owned(orig);
71834         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71835         orig_conv.is_owned = false;
71836         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
71837         uint64_t ret_ref = 0;
71838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71840         return ret_ref;
71841 }
71842
71843 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
71844         LDKRouteHintHop o_conv;
71845         o_conv.inner = untag_ptr(o);
71846         o_conv.is_owned = ptr_is_owned(o);
71847         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71848         o_conv.is_owned = false;
71849         int64_t ret_conv = RouteHintHop_hash(&o_conv);
71850         return ret_conv;
71851 }
71852
71853 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
71854         LDKRouteHintHop a_conv;
71855         a_conv.inner = untag_ptr(a);
71856         a_conv.is_owned = ptr_is_owned(a);
71857         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71858         a_conv.is_owned = false;
71859         LDKRouteHintHop b_conv;
71860         b_conv.inner = untag_ptr(b);
71861         b_conv.is_owned = ptr_is_owned(b);
71862         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71863         b_conv.is_owned = false;
71864         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
71865         return ret_conv;
71866 }
71867
71868 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
71869         LDKRouteHintHop obj_conv;
71870         obj_conv.inner = untag_ptr(obj);
71871         obj_conv.is_owned = ptr_is_owned(obj);
71872         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71873         obj_conv.is_owned = false;
71874         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
71875         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71876         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71877         CVec_u8Z_free(ret_var);
71878         return ret_arr;
71879 }
71880
71881 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
71882         LDKu8slice ser_ref;
71883         ser_ref.datalen = ser->arr_len;
71884         ser_ref.data = ser->elems;
71885         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
71886         *ret_conv = RouteHintHop_read(ser_ref);
71887         FREE(ser);
71888         return tag_ptr(ret_conv, true);
71889 }
71890
71891 void  __attribute__((export_name("TS_FirstHopCandidate_free"))) TS_FirstHopCandidate_free(uint64_t this_obj) {
71892         LDKFirstHopCandidate this_obj_conv;
71893         this_obj_conv.inner = untag_ptr(this_obj);
71894         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71896         FirstHopCandidate_free(this_obj_conv);
71897 }
71898
71899 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
71900         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
71901         uint64_t ret_ref = 0;
71902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71904         return ret_ref;
71905 }
71906 int64_t  __attribute__((export_name("TS_FirstHopCandidate_clone_ptr"))) TS_FirstHopCandidate_clone_ptr(uint64_t arg) {
71907         LDKFirstHopCandidate arg_conv;
71908         arg_conv.inner = untag_ptr(arg);
71909         arg_conv.is_owned = ptr_is_owned(arg);
71910         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71911         arg_conv.is_owned = false;
71912         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
71913         return ret_conv;
71914 }
71915
71916 uint64_t  __attribute__((export_name("TS_FirstHopCandidate_clone"))) TS_FirstHopCandidate_clone(uint64_t orig) {
71917         LDKFirstHopCandidate orig_conv;
71918         orig_conv.inner = untag_ptr(orig);
71919         orig_conv.is_owned = ptr_is_owned(orig);
71920         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71921         orig_conv.is_owned = false;
71922         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
71923         uint64_t ret_ref = 0;
71924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71926         return ret_ref;
71927 }
71928
71929 void  __attribute__((export_name("TS_PublicHopCandidate_free"))) TS_PublicHopCandidate_free(uint64_t this_obj) {
71930         LDKPublicHopCandidate this_obj_conv;
71931         this_obj_conv.inner = untag_ptr(this_obj);
71932         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71934         PublicHopCandidate_free(this_obj_conv);
71935 }
71936
71937 int64_t  __attribute__((export_name("TS_PublicHopCandidate_get_short_channel_id"))) TS_PublicHopCandidate_get_short_channel_id(uint64_t this_ptr) {
71938         LDKPublicHopCandidate this_ptr_conv;
71939         this_ptr_conv.inner = untag_ptr(this_ptr);
71940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71942         this_ptr_conv.is_owned = false;
71943         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
71944         return ret_conv;
71945 }
71946
71947 void  __attribute__((export_name("TS_PublicHopCandidate_set_short_channel_id"))) TS_PublicHopCandidate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
71948         LDKPublicHopCandidate this_ptr_conv;
71949         this_ptr_conv.inner = untag_ptr(this_ptr);
71950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71952         this_ptr_conv.is_owned = false;
71953         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
71954 }
71955
71956 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
71957         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
71958         uint64_t ret_ref = 0;
71959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71961         return ret_ref;
71962 }
71963 int64_t  __attribute__((export_name("TS_PublicHopCandidate_clone_ptr"))) TS_PublicHopCandidate_clone_ptr(uint64_t arg) {
71964         LDKPublicHopCandidate arg_conv;
71965         arg_conv.inner = untag_ptr(arg);
71966         arg_conv.is_owned = ptr_is_owned(arg);
71967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71968         arg_conv.is_owned = false;
71969         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
71970         return ret_conv;
71971 }
71972
71973 uint64_t  __attribute__((export_name("TS_PublicHopCandidate_clone"))) TS_PublicHopCandidate_clone(uint64_t orig) {
71974         LDKPublicHopCandidate orig_conv;
71975         orig_conv.inner = untag_ptr(orig);
71976         orig_conv.is_owned = ptr_is_owned(orig);
71977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71978         orig_conv.is_owned = false;
71979         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
71980         uint64_t ret_ref = 0;
71981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71983         return ret_ref;
71984 }
71985
71986 void  __attribute__((export_name("TS_PrivateHopCandidate_free"))) TS_PrivateHopCandidate_free(uint64_t this_obj) {
71987         LDKPrivateHopCandidate this_obj_conv;
71988         this_obj_conv.inner = untag_ptr(this_obj);
71989         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71991         PrivateHopCandidate_free(this_obj_conv);
71992 }
71993
71994 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
71995         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
71996         uint64_t ret_ref = 0;
71997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71999         return ret_ref;
72000 }
72001 int64_t  __attribute__((export_name("TS_PrivateHopCandidate_clone_ptr"))) TS_PrivateHopCandidate_clone_ptr(uint64_t arg) {
72002         LDKPrivateHopCandidate arg_conv;
72003         arg_conv.inner = untag_ptr(arg);
72004         arg_conv.is_owned = ptr_is_owned(arg);
72005         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72006         arg_conv.is_owned = false;
72007         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
72008         return ret_conv;
72009 }
72010
72011 uint64_t  __attribute__((export_name("TS_PrivateHopCandidate_clone"))) TS_PrivateHopCandidate_clone(uint64_t orig) {
72012         LDKPrivateHopCandidate orig_conv;
72013         orig_conv.inner = untag_ptr(orig);
72014         orig_conv.is_owned = ptr_is_owned(orig);
72015         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72016         orig_conv.is_owned = false;
72017         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
72018         uint64_t ret_ref = 0;
72019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72021         return ret_ref;
72022 }
72023
72024 void  __attribute__((export_name("TS_BlindedPathCandidate_free"))) TS_BlindedPathCandidate_free(uint64_t this_obj) {
72025         LDKBlindedPathCandidate this_obj_conv;
72026         this_obj_conv.inner = untag_ptr(this_obj);
72027         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72029         BlindedPathCandidate_free(this_obj_conv);
72030 }
72031
72032 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
72033         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
72034         uint64_t ret_ref = 0;
72035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72037         return ret_ref;
72038 }
72039 int64_t  __attribute__((export_name("TS_BlindedPathCandidate_clone_ptr"))) TS_BlindedPathCandidate_clone_ptr(uint64_t arg) {
72040         LDKBlindedPathCandidate arg_conv;
72041         arg_conv.inner = untag_ptr(arg);
72042         arg_conv.is_owned = ptr_is_owned(arg);
72043         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72044         arg_conv.is_owned = false;
72045         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
72046         return ret_conv;
72047 }
72048
72049 uint64_t  __attribute__((export_name("TS_BlindedPathCandidate_clone"))) TS_BlindedPathCandidate_clone(uint64_t orig) {
72050         LDKBlindedPathCandidate orig_conv;
72051         orig_conv.inner = untag_ptr(orig);
72052         orig_conv.is_owned = ptr_is_owned(orig);
72053         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72054         orig_conv.is_owned = false;
72055         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
72056         uint64_t ret_ref = 0;
72057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72059         return ret_ref;
72060 }
72061
72062 void  __attribute__((export_name("TS_OneHopBlindedPathCandidate_free"))) TS_OneHopBlindedPathCandidate_free(uint64_t this_obj) {
72063         LDKOneHopBlindedPathCandidate this_obj_conv;
72064         this_obj_conv.inner = untag_ptr(this_obj);
72065         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72067         OneHopBlindedPathCandidate_free(this_obj_conv);
72068 }
72069
72070 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
72071         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
72072         uint64_t ret_ref = 0;
72073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72075         return ret_ref;
72076 }
72077 int64_t  __attribute__((export_name("TS_OneHopBlindedPathCandidate_clone_ptr"))) TS_OneHopBlindedPathCandidate_clone_ptr(uint64_t arg) {
72078         LDKOneHopBlindedPathCandidate arg_conv;
72079         arg_conv.inner = untag_ptr(arg);
72080         arg_conv.is_owned = ptr_is_owned(arg);
72081         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72082         arg_conv.is_owned = false;
72083         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
72084         return ret_conv;
72085 }
72086
72087 uint64_t  __attribute__((export_name("TS_OneHopBlindedPathCandidate_clone"))) TS_OneHopBlindedPathCandidate_clone(uint64_t orig) {
72088         LDKOneHopBlindedPathCandidate orig_conv;
72089         orig_conv.inner = untag_ptr(orig);
72090         orig_conv.is_owned = ptr_is_owned(orig);
72091         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72092         orig_conv.is_owned = false;
72093         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
72094         uint64_t ret_ref = 0;
72095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72097         return ret_ref;
72098 }
72099
72100 void  __attribute__((export_name("TS_CandidateRouteHop_free"))) TS_CandidateRouteHop_free(uint64_t this_ptr) {
72101         if (!ptr_is_owned(this_ptr)) return;
72102         void* this_ptr_ptr = untag_ptr(this_ptr);
72103         CHECK_ACCESS(this_ptr_ptr);
72104         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
72105         FREE(untag_ptr(this_ptr));
72106         CandidateRouteHop_free(this_ptr_conv);
72107 }
72108
72109 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
72110         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72111         *ret_copy = CandidateRouteHop_clone(arg);
72112         uint64_t ret_ref = tag_ptr(ret_copy, true);
72113         return ret_ref;
72114 }
72115 int64_t  __attribute__((export_name("TS_CandidateRouteHop_clone_ptr"))) TS_CandidateRouteHop_clone_ptr(uint64_t arg) {
72116         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
72117         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
72118         return ret_conv;
72119 }
72120
72121 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_clone"))) TS_CandidateRouteHop_clone(uint64_t orig) {
72122         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
72123         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72124         *ret_copy = CandidateRouteHop_clone(orig_conv);
72125         uint64_t ret_ref = tag_ptr(ret_copy, true);
72126         return ret_ref;
72127 }
72128
72129 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_first_hop"))) TS_CandidateRouteHop_first_hop(uint64_t a) {
72130         LDKFirstHopCandidate a_conv;
72131         a_conv.inner = untag_ptr(a);
72132         a_conv.is_owned = ptr_is_owned(a);
72133         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72134         a_conv = FirstHopCandidate_clone(&a_conv);
72135         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72136         *ret_copy = CandidateRouteHop_first_hop(a_conv);
72137         uint64_t ret_ref = tag_ptr(ret_copy, true);
72138         return ret_ref;
72139 }
72140
72141 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_public_hop"))) TS_CandidateRouteHop_public_hop(uint64_t a) {
72142         LDKPublicHopCandidate a_conv;
72143         a_conv.inner = untag_ptr(a);
72144         a_conv.is_owned = ptr_is_owned(a);
72145         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72146         a_conv = PublicHopCandidate_clone(&a_conv);
72147         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72148         *ret_copy = CandidateRouteHop_public_hop(a_conv);
72149         uint64_t ret_ref = tag_ptr(ret_copy, true);
72150         return ret_ref;
72151 }
72152
72153 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_private_hop"))) TS_CandidateRouteHop_private_hop(uint64_t a) {
72154         LDKPrivateHopCandidate a_conv;
72155         a_conv.inner = untag_ptr(a);
72156         a_conv.is_owned = ptr_is_owned(a);
72157         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72158         a_conv = PrivateHopCandidate_clone(&a_conv);
72159         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72160         *ret_copy = CandidateRouteHop_private_hop(a_conv);
72161         uint64_t ret_ref = tag_ptr(ret_copy, true);
72162         return ret_ref;
72163 }
72164
72165 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_blinded"))) TS_CandidateRouteHop_blinded(uint64_t a) {
72166         LDKBlindedPathCandidate a_conv;
72167         a_conv.inner = untag_ptr(a);
72168         a_conv.is_owned = ptr_is_owned(a);
72169         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72170         a_conv = BlindedPathCandidate_clone(&a_conv);
72171         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72172         *ret_copy = CandidateRouteHop_blinded(a_conv);
72173         uint64_t ret_ref = tag_ptr(ret_copy, true);
72174         return ret_ref;
72175 }
72176
72177 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_one_hop_blinded"))) TS_CandidateRouteHop_one_hop_blinded(uint64_t a) {
72178         LDKOneHopBlindedPathCandidate a_conv;
72179         a_conv.inner = untag_ptr(a);
72180         a_conv.is_owned = ptr_is_owned(a);
72181         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72182         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
72183         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72184         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
72185         uint64_t ret_ref = tag_ptr(ret_copy, true);
72186         return ret_ref;
72187 }
72188
72189 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_globally_unique_short_channel_id"))) TS_CandidateRouteHop_globally_unique_short_channel_id(uint64_t this_arg) {
72190         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72191         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72192         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
72193         uint64_t ret_ref = tag_ptr(ret_copy, true);
72194         return ret_ref;
72195 }
72196
72197 int32_t  __attribute__((export_name("TS_CandidateRouteHop_cltv_expiry_delta"))) TS_CandidateRouteHop_cltv_expiry_delta(uint64_t this_arg) {
72198         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72199         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
72200         return ret_conv;
72201 }
72202
72203 int64_t  __attribute__((export_name("TS_CandidateRouteHop_htlc_minimum_msat"))) TS_CandidateRouteHop_htlc_minimum_msat(uint64_t this_arg) {
72204         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72205         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
72206         return ret_conv;
72207 }
72208
72209 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_fees"))) TS_CandidateRouteHop_fees(uint64_t this_arg) {
72210         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72211         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
72212         uint64_t ret_ref = 0;
72213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72215         return ret_ref;
72216 }
72217
72218 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_source"))) TS_CandidateRouteHop_source(uint64_t this_arg) {
72219         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72220         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
72221         uint64_t ret_ref = 0;
72222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72224         return ret_ref;
72225 }
72226
72227 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_target"))) TS_CandidateRouteHop_target(uint64_t this_arg) {
72228         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72229         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
72230         uint64_t ret_ref = 0;
72231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72233         return ret_ref;
72234 }
72235
72236 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) {
72237         LDKPublicKey our_node_pubkey_ref;
72238         CHECK(our_node_pubkey->arr_len == 33);
72239         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
72240         LDKRouteParameters route_params_conv;
72241         route_params_conv.inner = untag_ptr(route_params);
72242         route_params_conv.is_owned = ptr_is_owned(route_params);
72243         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
72244         route_params_conv.is_owned = false;
72245         LDKNetworkGraph network_graph_conv;
72246         network_graph_conv.inner = untag_ptr(network_graph);
72247         network_graph_conv.is_owned = ptr_is_owned(network_graph);
72248         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
72249         network_graph_conv.is_owned = false;
72250         LDKCVec_ChannelDetailsZ first_hops_constr;
72251         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
72252         if (first_hops != 0) {
72253                 first_hops_constr.datalen = first_hops->arr_len;
72254                 if (first_hops_constr.datalen > 0)
72255                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
72256                 else
72257                         first_hops_constr.data = NULL;
72258                 uint64_t* first_hops_vals = first_hops->elems;
72259                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
72260                         uint64_t first_hops_conv_16 = first_hops_vals[q];
72261                         LDKChannelDetails first_hops_conv_16_conv;
72262                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
72263                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
72264                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
72265                         first_hops_conv_16_conv.is_owned = false;
72266                         first_hops_constr.data[q] = first_hops_conv_16_conv;
72267                 }
72268                 FREE(first_hops);
72269                 first_hops_ptr = &first_hops_constr;
72270         }
72271         void* logger_ptr = untag_ptr(logger);
72272         CHECK_ACCESS(logger_ptr);
72273         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72274         if (logger_conv.free == LDKLogger_JCalls_free) {
72275                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72276                 LDKLogger_JCalls_cloned(&logger_conv);
72277         }
72278         void* scorer_ptr = untag_ptr(scorer);
72279         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
72280         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
72281         LDKProbabilisticScoringFeeParameters score_params_conv;
72282         score_params_conv.inner = untag_ptr(score_params);
72283         score_params_conv.is_owned = ptr_is_owned(score_params);
72284         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
72285         score_params_conv.is_owned = false;
72286         uint8_t random_seed_bytes_arr[32];
72287         CHECK(random_seed_bytes->arr_len == 32);
72288         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
72289         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
72290         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
72291         *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);
72292         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
72293         return tag_ptr(ret_conv, true);
72294 }
72295
72296 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) {
72297         LDKPublicKey our_node_pubkey_ref;
72298         CHECK(our_node_pubkey->arr_len == 33);
72299         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
72300         LDKCVec_PublicKeyZ hops_constr;
72301         hops_constr.datalen = hops->arr_len;
72302         if (hops_constr.datalen > 0)
72303                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
72304         else
72305                 hops_constr.data = NULL;
72306         int8_tArray* hops_vals = (void*) hops->elems;
72307         for (size_t m = 0; m < hops_constr.datalen; m++) {
72308                 int8_tArray hops_conv_12 = hops_vals[m];
72309                 LDKPublicKey hops_conv_12_ref;
72310                 CHECK(hops_conv_12->arr_len == 33);
72311                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
72312                 hops_constr.data[m] = hops_conv_12_ref;
72313         }
72314         FREE(hops);
72315         LDKRouteParameters route_params_conv;
72316         route_params_conv.inner = untag_ptr(route_params);
72317         route_params_conv.is_owned = ptr_is_owned(route_params);
72318         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
72319         route_params_conv.is_owned = false;
72320         LDKNetworkGraph network_graph_conv;
72321         network_graph_conv.inner = untag_ptr(network_graph);
72322         network_graph_conv.is_owned = ptr_is_owned(network_graph);
72323         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
72324         network_graph_conv.is_owned = false;
72325         void* logger_ptr = untag_ptr(logger);
72326         CHECK_ACCESS(logger_ptr);
72327         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72328         if (logger_conv.free == LDKLogger_JCalls_free) {
72329                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72330                 LDKLogger_JCalls_cloned(&logger_conv);
72331         }
72332         uint8_t random_seed_bytes_arr[32];
72333         CHECK(random_seed_bytes->arr_len == 32);
72334         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
72335         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
72336         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
72337         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
72338         return tag_ptr(ret_conv, true);
72339 }
72340
72341 void  __attribute__((export_name("TS_ScoreLookUp_free"))) TS_ScoreLookUp_free(uint64_t this_ptr) {
72342         if (!ptr_is_owned(this_ptr)) return;
72343         void* this_ptr_ptr = untag_ptr(this_ptr);
72344         CHECK_ACCESS(this_ptr_ptr);
72345         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
72346         FREE(untag_ptr(this_ptr));
72347         ScoreLookUp_free(this_ptr_conv);
72348 }
72349
72350 void  __attribute__((export_name("TS_ScoreUpdate_free"))) TS_ScoreUpdate_free(uint64_t this_ptr) {
72351         if (!ptr_is_owned(this_ptr)) return;
72352         void* this_ptr_ptr = untag_ptr(this_ptr);
72353         CHECK_ACCESS(this_ptr_ptr);
72354         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
72355         FREE(untag_ptr(this_ptr));
72356         ScoreUpdate_free(this_ptr_conv);
72357 }
72358
72359 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
72360         if (!ptr_is_owned(this_ptr)) return;
72361         void* this_ptr_ptr = untag_ptr(this_ptr);
72362         CHECK_ACCESS(this_ptr_ptr);
72363         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
72364         FREE(untag_ptr(this_ptr));
72365         Score_free(this_ptr_conv);
72366 }
72367
72368 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
72369         if (!ptr_is_owned(this_ptr)) return;
72370         void* this_ptr_ptr = untag_ptr(this_ptr);
72371         CHECK_ACCESS(this_ptr_ptr);
72372         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
72373         FREE(untag_ptr(this_ptr));
72374         LockableScore_free(this_ptr_conv);
72375 }
72376
72377 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
72378         if (!ptr_is_owned(this_ptr)) return;
72379         void* this_ptr_ptr = untag_ptr(this_ptr);
72380         CHECK_ACCESS(this_ptr_ptr);
72381         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
72382         FREE(untag_ptr(this_ptr));
72383         WriteableScore_free(this_ptr_conv);
72384 }
72385
72386 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
72387         LDKMultiThreadedLockableScore this_obj_conv;
72388         this_obj_conv.inner = untag_ptr(this_obj);
72389         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72391         MultiThreadedLockableScore_free(this_obj_conv);
72392 }
72393
72394 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
72395         LDKMultiThreadedLockableScore this_arg_conv;
72396         this_arg_conv.inner = untag_ptr(this_arg);
72397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72399         this_arg_conv.is_owned = false;
72400         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
72401         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
72402         return tag_ptr(ret_ret, true);
72403 }
72404
72405 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
72406         LDKMultiThreadedLockableScore obj_conv;
72407         obj_conv.inner = untag_ptr(obj);
72408         obj_conv.is_owned = ptr_is_owned(obj);
72409         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72410         obj_conv.is_owned = false;
72411         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
72412         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72413         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72414         CVec_u8Z_free(ret_var);
72415         return ret_arr;
72416 }
72417
72418 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
72419         LDKMultiThreadedLockableScore this_arg_conv;
72420         this_arg_conv.inner = untag_ptr(this_arg);
72421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72423         this_arg_conv.is_owned = false;
72424         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
72425         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
72426         return tag_ptr(ret_ret, true);
72427 }
72428
72429 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
72430         void* score_ptr = untag_ptr(score);
72431         CHECK_ACCESS(score_ptr);
72432         LDKScore score_conv = *(LDKScore*)(score_ptr);
72433         if (score_conv.free == LDKScore_JCalls_free) {
72434                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72435                 LDKScore_JCalls_cloned(&score_conv);
72436         }
72437         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
72438         uint64_t ret_ref = 0;
72439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72441         return ret_ref;
72442 }
72443
72444 void  __attribute__((export_name("TS_MultiThreadedScoreLockRead_free"))) TS_MultiThreadedScoreLockRead_free(uint64_t this_obj) {
72445         LDKMultiThreadedScoreLockRead this_obj_conv;
72446         this_obj_conv.inner = untag_ptr(this_obj);
72447         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72449         MultiThreadedScoreLockRead_free(this_obj_conv);
72450 }
72451
72452 void  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_free"))) TS_MultiThreadedScoreLockWrite_free(uint64_t this_obj) {
72453         LDKMultiThreadedScoreLockWrite this_obj_conv;
72454         this_obj_conv.inner = untag_ptr(this_obj);
72455         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72457         MultiThreadedScoreLockWrite_free(this_obj_conv);
72458 }
72459
72460 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockRead_as_ScoreLookUp"))) TS_MultiThreadedScoreLockRead_as_ScoreLookUp(uint64_t this_arg) {
72461         LDKMultiThreadedScoreLockRead this_arg_conv;
72462         this_arg_conv.inner = untag_ptr(this_arg);
72463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72465         this_arg_conv.is_owned = false;
72466         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
72467         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
72468         return tag_ptr(ret_ret, true);
72469 }
72470
72471 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_write"))) TS_MultiThreadedScoreLockWrite_write(uint64_t obj) {
72472         LDKMultiThreadedScoreLockWrite obj_conv;
72473         obj_conv.inner = untag_ptr(obj);
72474         obj_conv.is_owned = ptr_is_owned(obj);
72475         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72476         obj_conv.is_owned = false;
72477         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
72478         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72479         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72480         CVec_u8Z_free(ret_var);
72481         return ret_arr;
72482 }
72483
72484 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_as_ScoreUpdate"))) TS_MultiThreadedScoreLockWrite_as_ScoreUpdate(uint64_t this_arg) {
72485         LDKMultiThreadedScoreLockWrite this_arg_conv;
72486         this_arg_conv.inner = untag_ptr(this_arg);
72487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72489         this_arg_conv.is_owned = false;
72490         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
72491         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
72492         return tag_ptr(ret_ret, true);
72493 }
72494
72495 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
72496         LDKChannelUsage this_obj_conv;
72497         this_obj_conv.inner = untag_ptr(this_obj);
72498         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72500         ChannelUsage_free(this_obj_conv);
72501 }
72502
72503 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
72504         LDKChannelUsage this_ptr_conv;
72505         this_ptr_conv.inner = untag_ptr(this_ptr);
72506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72508         this_ptr_conv.is_owned = false;
72509         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
72510         return ret_conv;
72511 }
72512
72513 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
72514         LDKChannelUsage this_ptr_conv;
72515         this_ptr_conv.inner = untag_ptr(this_ptr);
72516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72518         this_ptr_conv.is_owned = false;
72519         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
72520 }
72521
72522 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
72523         LDKChannelUsage this_ptr_conv;
72524         this_ptr_conv.inner = untag_ptr(this_ptr);
72525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72527         this_ptr_conv.is_owned = false;
72528         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
72529         return ret_conv;
72530 }
72531
72532 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
72533         LDKChannelUsage this_ptr_conv;
72534         this_ptr_conv.inner = untag_ptr(this_ptr);
72535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72537         this_ptr_conv.is_owned = false;
72538         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
72539 }
72540
72541 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
72542         LDKChannelUsage this_ptr_conv;
72543         this_ptr_conv.inner = untag_ptr(this_ptr);
72544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72546         this_ptr_conv.is_owned = false;
72547         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
72548         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
72549         uint64_t ret_ref = tag_ptr(ret_copy, true);
72550         return ret_ref;
72551 }
72552
72553 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
72554         LDKChannelUsage this_ptr_conv;
72555         this_ptr_conv.inner = untag_ptr(this_ptr);
72556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72558         this_ptr_conv.is_owned = false;
72559         void* val_ptr = untag_ptr(val);
72560         CHECK_ACCESS(val_ptr);
72561         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
72562         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
72563         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
72564 }
72565
72566 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) {
72567         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
72568         CHECK_ACCESS(effective_capacity_arg_ptr);
72569         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
72570         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
72571         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
72572         uint64_t ret_ref = 0;
72573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72575         return ret_ref;
72576 }
72577
72578 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
72579         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
72580         uint64_t ret_ref = 0;
72581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72583         return ret_ref;
72584 }
72585 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
72586         LDKChannelUsage arg_conv;
72587         arg_conv.inner = untag_ptr(arg);
72588         arg_conv.is_owned = ptr_is_owned(arg);
72589         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72590         arg_conv.is_owned = false;
72591         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
72592         return ret_conv;
72593 }
72594
72595 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
72596         LDKChannelUsage orig_conv;
72597         orig_conv.inner = untag_ptr(orig);
72598         orig_conv.is_owned = ptr_is_owned(orig);
72599         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72600         orig_conv.is_owned = false;
72601         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
72602         uint64_t ret_ref = 0;
72603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72605         return ret_ref;
72606 }
72607
72608 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
72609         LDKFixedPenaltyScorer this_obj_conv;
72610         this_obj_conv.inner = untag_ptr(this_obj);
72611         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72613         FixedPenaltyScorer_free(this_obj_conv);
72614 }
72615
72616 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
72617         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
72618         uint64_t ret_ref = 0;
72619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72621         return ret_ref;
72622 }
72623 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
72624         LDKFixedPenaltyScorer arg_conv;
72625         arg_conv.inner = untag_ptr(arg);
72626         arg_conv.is_owned = ptr_is_owned(arg);
72627         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72628         arg_conv.is_owned = false;
72629         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
72630         return ret_conv;
72631 }
72632
72633 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
72634         LDKFixedPenaltyScorer orig_conv;
72635         orig_conv.inner = untag_ptr(orig);
72636         orig_conv.is_owned = ptr_is_owned(orig);
72637         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72638         orig_conv.is_owned = false;
72639         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
72640         uint64_t ret_ref = 0;
72641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72643         return ret_ref;
72644 }
72645
72646 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
72647         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
72648         uint64_t ret_ref = 0;
72649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72651         return ret_ref;
72652 }
72653
72654 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreLookUp"))) TS_FixedPenaltyScorer_as_ScoreLookUp(uint64_t this_arg) {
72655         LDKFixedPenaltyScorer this_arg_conv;
72656         this_arg_conv.inner = untag_ptr(this_arg);
72657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72659         this_arg_conv.is_owned = false;
72660         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
72661         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
72662         return tag_ptr(ret_ret, true);
72663 }
72664
72665 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreUpdate"))) TS_FixedPenaltyScorer_as_ScoreUpdate(uint64_t this_arg) {
72666         LDKFixedPenaltyScorer this_arg_conv;
72667         this_arg_conv.inner = untag_ptr(this_arg);
72668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72670         this_arg_conv.is_owned = false;
72671         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
72672         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
72673         return tag_ptr(ret_ret, true);
72674 }
72675
72676 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
72677         LDKFixedPenaltyScorer obj_conv;
72678         obj_conv.inner = untag_ptr(obj);
72679         obj_conv.is_owned = ptr_is_owned(obj);
72680         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72681         obj_conv.is_owned = false;
72682         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
72683         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72684         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72685         CVec_u8Z_free(ret_var);
72686         return ret_arr;
72687 }
72688
72689 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
72690         LDKu8slice ser_ref;
72691         ser_ref.datalen = ser->arr_len;
72692         ser_ref.data = ser->elems;
72693         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
72694         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
72695         FREE(ser);
72696         return tag_ptr(ret_conv, true);
72697 }
72698
72699 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
72700         LDKProbabilisticScorer this_obj_conv;
72701         this_obj_conv.inner = untag_ptr(this_obj);
72702         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72704         ProbabilisticScorer_free(this_obj_conv);
72705 }
72706
72707 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_free"))) TS_ProbabilisticScoringFeeParameters_free(uint64_t this_obj) {
72708         LDKProbabilisticScoringFeeParameters this_obj_conv;
72709         this_obj_conv.inner = untag_ptr(this_obj);
72710         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72712         ProbabilisticScoringFeeParameters_free(this_obj_conv);
72713 }
72714
72715 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat(uint64_t this_ptr) {
72716         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72717         this_ptr_conv.inner = untag_ptr(this_ptr);
72718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72720         this_ptr_conv.is_owned = false;
72721         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
72722         return ret_conv;
72723 }
72724
72725 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
72726         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72727         this_ptr_conv.inner = untag_ptr(this_ptr);
72728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72730         this_ptr_conv.is_owned = false;
72731         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
72732 }
72733
72734 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) {
72735         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72736         this_ptr_conv.inner = untag_ptr(this_ptr);
72737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72739         this_ptr_conv.is_owned = false;
72740         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
72741         return ret_conv;
72742 }
72743
72744 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) {
72745         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72746         this_ptr_conv.inner = untag_ptr(this_ptr);
72747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72749         this_ptr_conv.is_owned = false;
72750         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
72751 }
72752
72753 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
72754         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72755         this_ptr_conv.inner = untag_ptr(this_ptr);
72756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72758         this_ptr_conv.is_owned = false;
72759         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
72760         return ret_conv;
72761 }
72762
72763 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) {
72764         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72765         this_ptr_conv.inner = untag_ptr(this_ptr);
72766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72768         this_ptr_conv.is_owned = false;
72769         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
72770 }
72771
72772 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) {
72773         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72774         this_ptr_conv.inner = untag_ptr(this_ptr);
72775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72777         this_ptr_conv.is_owned = false;
72778         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
72779         return ret_conv;
72780 }
72781
72782 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) {
72783         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72784         this_ptr_conv.inner = untag_ptr(this_ptr);
72785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72787         this_ptr_conv.is_owned = false;
72788         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
72789 }
72790
72791 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) {
72792         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72793         this_ptr_conv.inner = untag_ptr(this_ptr);
72794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72796         this_ptr_conv.is_owned = false;
72797         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
72798         return ret_conv;
72799 }
72800
72801 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) {
72802         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72803         this_ptr_conv.inner = untag_ptr(this_ptr);
72804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72806         this_ptr_conv.is_owned = false;
72807         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
72808 }
72809
72810 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) {
72811         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72812         this_ptr_conv.inner = untag_ptr(this_ptr);
72813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72815         this_ptr_conv.is_owned = false;
72816         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
72817         return ret_conv;
72818 }
72819
72820 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) {
72821         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72822         this_ptr_conv.inner = untag_ptr(this_ptr);
72823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72825         this_ptr_conv.is_owned = false;
72826         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
72827 }
72828
72829 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
72830         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72831         this_ptr_conv.inner = untag_ptr(this_ptr);
72832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72834         this_ptr_conv.is_owned = false;
72835         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
72836         return ret_conv;
72837 }
72838
72839 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) {
72840         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72841         this_ptr_conv.inner = untag_ptr(this_ptr);
72842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72844         this_ptr_conv.is_owned = false;
72845         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
72846 }
72847
72848 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
72849         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72850         this_ptr_conv.inner = untag_ptr(this_ptr);
72851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72853         this_ptr_conv.is_owned = false;
72854         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
72855         return ret_conv;
72856 }
72857
72858 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) {
72859         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72860         this_ptr_conv.inner = untag_ptr(this_ptr);
72861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72863         this_ptr_conv.is_owned = false;
72864         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
72865 }
72866
72867 jboolean  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_get_linear_success_probability(uint64_t this_ptr) {
72868         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72869         this_ptr_conv.inner = untag_ptr(this_ptr);
72870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72872         this_ptr_conv.is_owned = false;
72873         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
72874         return ret_conv;
72875 }
72876
72877 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_set_linear_success_probability(uint64_t this_ptr, jboolean val) {
72878         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72879         this_ptr_conv.inner = untag_ptr(this_ptr);
72880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72882         this_ptr_conv.is_owned = false;
72883         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
72884 }
72885
72886 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
72887         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
72888         uint64_t ret_ref = 0;
72889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72891         return ret_ref;
72892 }
72893 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone_ptr"))) TS_ProbabilisticScoringFeeParameters_clone_ptr(uint64_t arg) {
72894         LDKProbabilisticScoringFeeParameters arg_conv;
72895         arg_conv.inner = untag_ptr(arg);
72896         arg_conv.is_owned = ptr_is_owned(arg);
72897         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72898         arg_conv.is_owned = false;
72899         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
72900         return ret_conv;
72901 }
72902
72903 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone"))) TS_ProbabilisticScoringFeeParameters_clone(uint64_t orig) {
72904         LDKProbabilisticScoringFeeParameters orig_conv;
72905         orig_conv.inner = untag_ptr(orig);
72906         orig_conv.is_owned = ptr_is_owned(orig);
72907         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72908         orig_conv.is_owned = false;
72909         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
72910         uint64_t ret_ref = 0;
72911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72913         return ret_ref;
72914 }
72915
72916 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_default"))) TS_ProbabilisticScoringFeeParameters_default() {
72917         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
72918         uint64_t ret_ref = 0;
72919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72921         return ret_ref;
72922 }
72923
72924 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned"))) TS_ProbabilisticScoringFeeParameters_add_banned(uint64_t this_arg, uint64_t node_id) {
72925         LDKProbabilisticScoringFeeParameters this_arg_conv;
72926         this_arg_conv.inner = untag_ptr(this_arg);
72927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72929         this_arg_conv.is_owned = false;
72930         LDKNodeId node_id_conv;
72931         node_id_conv.inner = untag_ptr(node_id);
72932         node_id_conv.is_owned = ptr_is_owned(node_id);
72933         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72934         node_id_conv.is_owned = false;
72935         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
72936 }
72937
72938 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned_from_list"))) TS_ProbabilisticScoringFeeParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
72939         LDKProbabilisticScoringFeeParameters this_arg_conv;
72940         this_arg_conv.inner = untag_ptr(this_arg);
72941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72943         this_arg_conv.is_owned = false;
72944         LDKCVec_NodeIdZ node_ids_constr;
72945         node_ids_constr.datalen = node_ids->arr_len;
72946         if (node_ids_constr.datalen > 0)
72947                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
72948         else
72949                 node_ids_constr.data = NULL;
72950         uint64_t* node_ids_vals = node_ids->elems;
72951         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
72952                 uint64_t node_ids_conv_8 = node_ids_vals[i];
72953                 LDKNodeId node_ids_conv_8_conv;
72954                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
72955                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
72956                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
72957                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
72958                 node_ids_constr.data[i] = node_ids_conv_8_conv;
72959         }
72960         FREE(node_ids);
72961         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
72962 }
72963
72964 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_banned"))) TS_ProbabilisticScoringFeeParameters_remove_banned(uint64_t this_arg, uint64_t node_id) {
72965         LDKProbabilisticScoringFeeParameters this_arg_conv;
72966         this_arg_conv.inner = untag_ptr(this_arg);
72967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72969         this_arg_conv.is_owned = false;
72970         LDKNodeId node_id_conv;
72971         node_id_conv.inner = untag_ptr(node_id);
72972         node_id_conv.is_owned = ptr_is_owned(node_id);
72973         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72974         node_id_conv.is_owned = false;
72975         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
72976 }
72977
72978 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) {
72979         LDKProbabilisticScoringFeeParameters this_arg_conv;
72980         this_arg_conv.inner = untag_ptr(this_arg);
72981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72983         this_arg_conv.is_owned = false;
72984         LDKNodeId node_id_conv;
72985         node_id_conv.inner = untag_ptr(node_id);
72986         node_id_conv.is_owned = ptr_is_owned(node_id);
72987         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72988         node_id_conv.is_owned = false;
72989         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
72990 }
72991
72992 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_manual_penalty"))) TS_ProbabilisticScoringFeeParameters_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
72993         LDKProbabilisticScoringFeeParameters this_arg_conv;
72994         this_arg_conv.inner = untag_ptr(this_arg);
72995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72997         this_arg_conv.is_owned = false;
72998         LDKNodeId node_id_conv;
72999         node_id_conv.inner = untag_ptr(node_id);
73000         node_id_conv.is_owned = ptr_is_owned(node_id);
73001         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
73002         node_id_conv.is_owned = false;
73003         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
73004 }
73005
73006 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clear_manual_penalties"))) TS_ProbabilisticScoringFeeParameters_clear_manual_penalties(uint64_t this_arg) {
73007         LDKProbabilisticScoringFeeParameters this_arg_conv;
73008         this_arg_conv.inner = untag_ptr(this_arg);
73009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73011         this_arg_conv.is_owned = false;
73012         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
73013 }
73014
73015 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_free"))) TS_ProbabilisticScoringDecayParameters_free(uint64_t this_obj) {
73016         LDKProbabilisticScoringDecayParameters this_obj_conv;
73017         this_obj_conv.inner = untag_ptr(this_obj);
73018         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73020         ProbabilisticScoringDecayParameters_free(this_obj_conv);
73021 }
73022
73023 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) {
73024         LDKProbabilisticScoringDecayParameters this_ptr_conv;
73025         this_ptr_conv.inner = untag_ptr(this_ptr);
73026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73028         this_ptr_conv.is_owned = false;
73029         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
73030         return ret_conv;
73031 }
73032
73033 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) {
73034         LDKProbabilisticScoringDecayParameters this_ptr_conv;
73035         this_ptr_conv.inner = untag_ptr(this_ptr);
73036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73038         this_ptr_conv.is_owned = false;
73039         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
73040 }
73041
73042 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
73043         LDKProbabilisticScoringDecayParameters this_ptr_conv;
73044         this_ptr_conv.inner = untag_ptr(this_ptr);
73045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73047         this_ptr_conv.is_owned = false;
73048         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
73049         return ret_conv;
73050 }
73051
73052 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) {
73053         LDKProbabilisticScoringDecayParameters this_ptr_conv;
73054         this_ptr_conv.inner = untag_ptr(this_ptr);
73055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73057         this_ptr_conv.is_owned = false;
73058         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
73059 }
73060
73061 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) {
73062         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
73063         uint64_t ret_ref = 0;
73064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73066         return ret_ref;
73067 }
73068
73069 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
73070         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
73071         uint64_t ret_ref = 0;
73072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73074         return ret_ref;
73075 }
73076 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone_ptr"))) TS_ProbabilisticScoringDecayParameters_clone_ptr(uint64_t arg) {
73077         LDKProbabilisticScoringDecayParameters arg_conv;
73078         arg_conv.inner = untag_ptr(arg);
73079         arg_conv.is_owned = ptr_is_owned(arg);
73080         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73081         arg_conv.is_owned = false;
73082         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
73083         return ret_conv;
73084 }
73085
73086 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone"))) TS_ProbabilisticScoringDecayParameters_clone(uint64_t orig) {
73087         LDKProbabilisticScoringDecayParameters orig_conv;
73088         orig_conv.inner = untag_ptr(orig);
73089         orig_conv.is_owned = ptr_is_owned(orig);
73090         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73091         orig_conv.is_owned = false;
73092         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
73093         uint64_t ret_ref = 0;
73094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73096         return ret_ref;
73097 }
73098
73099 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_default"))) TS_ProbabilisticScoringDecayParameters_default() {
73100         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
73101         uint64_t ret_ref = 0;
73102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73104         return ret_ref;
73105 }
73106
73107 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t decay_params, uint64_t network_graph, uint64_t logger) {
73108         LDKProbabilisticScoringDecayParameters decay_params_conv;
73109         decay_params_conv.inner = untag_ptr(decay_params);
73110         decay_params_conv.is_owned = ptr_is_owned(decay_params);
73111         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
73112         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
73113         LDKNetworkGraph network_graph_conv;
73114         network_graph_conv.inner = untag_ptr(network_graph);
73115         network_graph_conv.is_owned = ptr_is_owned(network_graph);
73116         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
73117         network_graph_conv.is_owned = false;
73118         void* logger_ptr = untag_ptr(logger);
73119         CHECK_ACCESS(logger_ptr);
73120         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73121         if (logger_conv.free == LDKLogger_JCalls_free) {
73122                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73123                 LDKLogger_JCalls_cloned(&logger_conv);
73124         }
73125         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
73126         uint64_t ret_ref = 0;
73127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73129         return ret_ref;
73130 }
73131
73132 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
73133         LDKProbabilisticScorer this_arg_conv;
73134         this_arg_conv.inner = untag_ptr(this_arg);
73135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73137         this_arg_conv.is_owned = false;
73138         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
73139 }
73140
73141 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) {
73142         LDKProbabilisticScorer this_arg_conv;
73143         this_arg_conv.inner = untag_ptr(this_arg);
73144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73146         this_arg_conv.is_owned = false;
73147         LDKNodeId target_conv;
73148         target_conv.inner = untag_ptr(target);
73149         target_conv.is_owned = ptr_is_owned(target);
73150         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
73151         target_conv.is_owned = false;
73152         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
73153         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
73154         uint64_t ret_ref = tag_ptr(ret_copy, true);
73155         return ret_ref;
73156 }
73157
73158 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) {
73159         LDKProbabilisticScorer this_arg_conv;
73160         this_arg_conv.inner = untag_ptr(this_arg);
73161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73163         this_arg_conv.is_owned = false;
73164         LDKNodeId target_conv;
73165         target_conv.inner = untag_ptr(target);
73166         target_conv.is_owned = ptr_is_owned(target);
73167         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
73168         target_conv.is_owned = false;
73169         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
73170         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
73171         uint64_t ret_ref = tag_ptr(ret_copy, true);
73172         return ret_ref;
73173 }
73174
73175 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) {
73176         LDKProbabilisticScorer this_arg_conv;
73177         this_arg_conv.inner = untag_ptr(this_arg);
73178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73180         this_arg_conv.is_owned = false;
73181         LDKNodeId target_conv;
73182         target_conv.inner = untag_ptr(target);
73183         target_conv.is_owned = ptr_is_owned(target);
73184         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
73185         target_conv.is_owned = false;
73186         LDKProbabilisticScoringFeeParameters params_conv;
73187         params_conv.inner = untag_ptr(params);
73188         params_conv.is_owned = ptr_is_owned(params);
73189         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
73190         params_conv.is_owned = false;
73191         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
73192         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
73193         uint64_t ret_ref = tag_ptr(ret_copy, true);
73194         return ret_ref;
73195 }
73196
73197 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreLookUp"))) TS_ProbabilisticScorer_as_ScoreLookUp(uint64_t this_arg) {
73198         LDKProbabilisticScorer this_arg_conv;
73199         this_arg_conv.inner = untag_ptr(this_arg);
73200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73202         this_arg_conv.is_owned = false;
73203         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
73204         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
73205         return tag_ptr(ret_ret, true);
73206 }
73207
73208 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreUpdate"))) TS_ProbabilisticScorer_as_ScoreUpdate(uint64_t this_arg) {
73209         LDKProbabilisticScorer this_arg_conv;
73210         this_arg_conv.inner = untag_ptr(this_arg);
73211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73213         this_arg_conv.is_owned = false;
73214         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
73215         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
73216         return tag_ptr(ret_ret, true);
73217 }
73218
73219 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
73220         LDKProbabilisticScorer this_arg_conv;
73221         this_arg_conv.inner = untag_ptr(this_arg);
73222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73224         this_arg_conv.is_owned = false;
73225         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
73226         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
73227         return tag_ptr(ret_ret, true);
73228 }
73229
73230 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
73231         LDKProbabilisticScorer obj_conv;
73232         obj_conv.inner = untag_ptr(obj);
73233         obj_conv.is_owned = ptr_is_owned(obj);
73234         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73235         obj_conv.is_owned = false;
73236         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
73237         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73238         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73239         CVec_u8Z_free(ret_var);
73240         return ret_arr;
73241 }
73242
73243 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) {
73244         LDKu8slice ser_ref;
73245         ser_ref.datalen = ser->arr_len;
73246         ser_ref.data = ser->elems;
73247         LDKProbabilisticScoringDecayParameters arg_a_conv;
73248         arg_a_conv.inner = untag_ptr(arg_a);
73249         arg_a_conv.is_owned = ptr_is_owned(arg_a);
73250         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
73251         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
73252         LDKNetworkGraph arg_b_conv;
73253         arg_b_conv.inner = untag_ptr(arg_b);
73254         arg_b_conv.is_owned = ptr_is_owned(arg_b);
73255         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
73256         arg_b_conv.is_owned = false;
73257         void* arg_c_ptr = untag_ptr(arg_c);
73258         CHECK_ACCESS(arg_c_ptr);
73259         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
73260         if (arg_c_conv.free == LDKLogger_JCalls_free) {
73261                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73262                 LDKLogger_JCalls_cloned(&arg_c_conv);
73263         }
73264         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
73265         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
73266         FREE(ser);
73267         return tag_ptr(ret_conv, true);
73268 }
73269
73270 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
73271         LDKDelayedPaymentOutputDescriptor this_obj_conv;
73272         this_obj_conv.inner = untag_ptr(this_obj);
73273         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73275         DelayedPaymentOutputDescriptor_free(this_obj_conv);
73276 }
73277
73278 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
73279         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73280         this_ptr_conv.inner = untag_ptr(this_ptr);
73281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73283         this_ptr_conv.is_owned = false;
73284         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
73285         uint64_t ret_ref = 0;
73286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73288         return ret_ref;
73289 }
73290
73291 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
73292         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73293         this_ptr_conv.inner = untag_ptr(this_ptr);
73294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73296         this_ptr_conv.is_owned = false;
73297         LDKOutPoint val_conv;
73298         val_conv.inner = untag_ptr(val);
73299         val_conv.is_owned = ptr_is_owned(val);
73300         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73301         val_conv = OutPoint_clone(&val_conv);
73302         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73303 }
73304
73305 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
73306         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73307         this_ptr_conv.inner = untag_ptr(this_ptr);
73308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73310         this_ptr_conv.is_owned = false;
73311         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
73312         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
73313         return ret_arr;
73314 }
73315
73316 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
73317         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73318         this_ptr_conv.inner = untag_ptr(this_ptr);
73319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73321         this_ptr_conv.is_owned = false;
73322         LDKPublicKey val_ref;
73323         CHECK(val->arr_len == 33);
73324         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
73325         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
73326 }
73327
73328 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
73329         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73330         this_ptr_conv.inner = untag_ptr(this_ptr);
73331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73333         this_ptr_conv.is_owned = false;
73334         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
73335         return ret_conv;
73336 }
73337
73338 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
73339         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73340         this_ptr_conv.inner = untag_ptr(this_ptr);
73341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73343         this_ptr_conv.is_owned = false;
73344         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
73345 }
73346
73347 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
73348         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73349         this_ptr_conv.inner = untag_ptr(this_ptr);
73350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73352         this_ptr_conv.is_owned = false;
73353         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73354         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
73355         return tag_ptr(ret_ref, true);
73356 }
73357
73358 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
73359         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73360         this_ptr_conv.inner = untag_ptr(this_ptr);
73361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73363         this_ptr_conv.is_owned = false;
73364         void* val_ptr = untag_ptr(val);
73365         CHECK_ACCESS(val_ptr);
73366         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73367         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73368         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
73369 }
73370
73371 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
73372         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73373         this_ptr_conv.inner = untag_ptr(this_ptr);
73374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73376         this_ptr_conv.is_owned = false;
73377         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
73378         uint64_t ret_ref = 0;
73379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73381         return ret_ref;
73382 }
73383
73384 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, uint64_t val) {
73385         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73386         this_ptr_conv.inner = untag_ptr(this_ptr);
73387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73389         this_ptr_conv.is_owned = false;
73390         LDKRevocationKey val_conv;
73391         val_conv.inner = untag_ptr(val);
73392         val_conv.is_owned = ptr_is_owned(val);
73393         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73394         val_conv = RevocationKey_clone(&val_conv);
73395         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
73396 }
73397
73398 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
73399         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73400         this_ptr_conv.inner = untag_ptr(this_ptr);
73401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73403         this_ptr_conv.is_owned = false;
73404         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
73405         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
73406         return ret_arr;
73407 }
73408
73409 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
73410         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73411         this_ptr_conv.inner = untag_ptr(this_ptr);
73412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73414         this_ptr_conv.is_owned = false;
73415         LDKThirtyTwoBytes val_ref;
73416         CHECK(val->arr_len == 32);
73417         memcpy(val_ref.data, val->elems, 32); FREE(val);
73418         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
73419 }
73420
73421 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
73422         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73423         this_ptr_conv.inner = untag_ptr(this_ptr);
73424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73426         this_ptr_conv.is_owned = false;
73427         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
73428         return ret_conv;
73429 }
73430
73431 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
73432         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73433         this_ptr_conv.inner = untag_ptr(this_ptr);
73434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73436         this_ptr_conv.is_owned = false;
73437         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
73438 }
73439
73440 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_transaction_parameters"))) TS_DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(uint64_t this_ptr) {
73441         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73442         this_ptr_conv.inner = untag_ptr(this_ptr);
73443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73445         this_ptr_conv.is_owned = false;
73446         LDKChannelTransactionParameters ret_var = DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
73447         uint64_t ret_ref = 0;
73448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73450         return ret_ref;
73451 }
73452
73453 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_transaction_parameters"))) TS_DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(uint64_t this_ptr, uint64_t val) {
73454         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73455         this_ptr_conv.inner = untag_ptr(this_ptr);
73456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73458         this_ptr_conv.is_owned = false;
73459         LDKChannelTransactionParameters val_conv;
73460         val_conv.inner = untag_ptr(val);
73461         val_conv.is_owned = ptr_is_owned(val);
73462         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73463         val_conv = ChannelTransactionParameters_clone(&val_conv);
73464         DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
73465 }
73466
73467 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) {
73468         LDKOutPoint outpoint_arg_conv;
73469         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73470         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73471         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73472         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73473         LDKPublicKey per_commitment_point_arg_ref;
73474         CHECK(per_commitment_point_arg->arr_len == 33);
73475         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
73476         void* output_arg_ptr = untag_ptr(output_arg);
73477         CHECK_ACCESS(output_arg_ptr);
73478         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
73479         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
73480         LDKRevocationKey revocation_pubkey_arg_conv;
73481         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
73482         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
73483         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
73484         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
73485         LDKThirtyTwoBytes channel_keys_id_arg_ref;
73486         CHECK(channel_keys_id_arg->arr_len == 32);
73487         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
73488         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
73489         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
73490         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
73491         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
73492         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
73493         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);
73494         uint64_t ret_ref = 0;
73495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73497         return ret_ref;
73498 }
73499
73500 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
73501         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
73502         uint64_t ret_ref = 0;
73503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73505         return ret_ref;
73506 }
73507 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
73508         LDKDelayedPaymentOutputDescriptor arg_conv;
73509         arg_conv.inner = untag_ptr(arg);
73510         arg_conv.is_owned = ptr_is_owned(arg);
73511         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73512         arg_conv.is_owned = false;
73513         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
73514         return ret_conv;
73515 }
73516
73517 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
73518         LDKDelayedPaymentOutputDescriptor orig_conv;
73519         orig_conv.inner = untag_ptr(orig);
73520         orig_conv.is_owned = ptr_is_owned(orig);
73521         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73522         orig_conv.is_owned = false;
73523         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
73524         uint64_t ret_ref = 0;
73525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73527         return ret_ref;
73528 }
73529
73530 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_hash"))) TS_DelayedPaymentOutputDescriptor_hash(uint64_t o) {
73531         LDKDelayedPaymentOutputDescriptor o_conv;
73532         o_conv.inner = untag_ptr(o);
73533         o_conv.is_owned = ptr_is_owned(o);
73534         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73535         o_conv.is_owned = false;
73536         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
73537         return ret_conv;
73538 }
73539
73540 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
73541         LDKDelayedPaymentOutputDescriptor a_conv;
73542         a_conv.inner = untag_ptr(a);
73543         a_conv.is_owned = ptr_is_owned(a);
73544         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73545         a_conv.is_owned = false;
73546         LDKDelayedPaymentOutputDescriptor b_conv;
73547         b_conv.inner = untag_ptr(b);
73548         b_conv.is_owned = ptr_is_owned(b);
73549         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73550         b_conv.is_owned = false;
73551         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
73552         return ret_conv;
73553 }
73554
73555 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
73556         LDKDelayedPaymentOutputDescriptor obj_conv;
73557         obj_conv.inner = untag_ptr(obj);
73558         obj_conv.is_owned = ptr_is_owned(obj);
73559         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73560         obj_conv.is_owned = false;
73561         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
73562         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73563         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73564         CVec_u8Z_free(ret_var);
73565         return ret_arr;
73566 }
73567
73568 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
73569         LDKu8slice ser_ref;
73570         ser_ref.datalen = ser->arr_len;
73571         ser_ref.data = ser->elems;
73572         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
73573         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
73574         FREE(ser);
73575         return tag_ptr(ret_conv, true);
73576 }
73577
73578 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
73579         LDKStaticPaymentOutputDescriptor this_obj_conv;
73580         this_obj_conv.inner = untag_ptr(this_obj);
73581         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73583         StaticPaymentOutputDescriptor_free(this_obj_conv);
73584 }
73585
73586 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
73587         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73588         this_ptr_conv.inner = untag_ptr(this_ptr);
73589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73591         this_ptr_conv.is_owned = false;
73592         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
73593         uint64_t ret_ref = 0;
73594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73596         return ret_ref;
73597 }
73598
73599 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
73600         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73601         this_ptr_conv.inner = untag_ptr(this_ptr);
73602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73604         this_ptr_conv.is_owned = false;
73605         LDKOutPoint val_conv;
73606         val_conv.inner = untag_ptr(val);
73607         val_conv.is_owned = ptr_is_owned(val);
73608         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73609         val_conv = OutPoint_clone(&val_conv);
73610         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73611 }
73612
73613 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
73614         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73615         this_ptr_conv.inner = untag_ptr(this_ptr);
73616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73618         this_ptr_conv.is_owned = false;
73619         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73620         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
73621         return tag_ptr(ret_ref, true);
73622 }
73623
73624 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
73625         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73626         this_ptr_conv.inner = untag_ptr(this_ptr);
73627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73629         this_ptr_conv.is_owned = false;
73630         void* val_ptr = untag_ptr(val);
73631         CHECK_ACCESS(val_ptr);
73632         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73633         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73634         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
73635 }
73636
73637 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
73638         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73639         this_ptr_conv.inner = untag_ptr(this_ptr);
73640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73642         this_ptr_conv.is_owned = false;
73643         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
73644         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
73645         return ret_arr;
73646 }
73647
73648 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
73649         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73650         this_ptr_conv.inner = untag_ptr(this_ptr);
73651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73653         this_ptr_conv.is_owned = false;
73654         LDKThirtyTwoBytes val_ref;
73655         CHECK(val->arr_len == 32);
73656         memcpy(val_ref.data, val->elems, 32); FREE(val);
73657         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
73658 }
73659
73660 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
73661         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73662         this_ptr_conv.inner = untag_ptr(this_ptr);
73663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73665         this_ptr_conv.is_owned = false;
73666         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
73667         return ret_conv;
73668 }
73669
73670 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
73671         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73672         this_ptr_conv.inner = untag_ptr(this_ptr);
73673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73675         this_ptr_conv.is_owned = false;
73676         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
73677 }
73678
73679 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(uint64_t this_ptr) {
73680         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73681         this_ptr_conv.inner = untag_ptr(this_ptr);
73682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73684         this_ptr_conv.is_owned = false;
73685         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
73686         uint64_t ret_ref = 0;
73687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73689         return ret_ref;
73690 }
73691
73692 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(uint64_t this_ptr, uint64_t val) {
73693         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73694         this_ptr_conv.inner = untag_ptr(this_ptr);
73695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73697         this_ptr_conv.is_owned = false;
73698         LDKChannelTransactionParameters val_conv;
73699         val_conv.inner = untag_ptr(val);
73700         val_conv.is_owned = ptr_is_owned(val);
73701         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73702         val_conv = ChannelTransactionParameters_clone(&val_conv);
73703         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
73704 }
73705
73706 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) {
73707         LDKOutPoint outpoint_arg_conv;
73708         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73709         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73710         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73711         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73712         void* output_arg_ptr = untag_ptr(output_arg);
73713         CHECK_ACCESS(output_arg_ptr);
73714         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
73715         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
73716         LDKThirtyTwoBytes channel_keys_id_arg_ref;
73717         CHECK(channel_keys_id_arg->arr_len == 32);
73718         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
73719         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
73720         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
73721         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
73722         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
73723         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
73724         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);
73725         uint64_t ret_ref = 0;
73726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73728         return ret_ref;
73729 }
73730
73731 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
73732         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
73733         uint64_t ret_ref = 0;
73734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73736         return ret_ref;
73737 }
73738 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
73739         LDKStaticPaymentOutputDescriptor arg_conv;
73740         arg_conv.inner = untag_ptr(arg);
73741         arg_conv.is_owned = ptr_is_owned(arg);
73742         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73743         arg_conv.is_owned = false;
73744         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
73745         return ret_conv;
73746 }
73747
73748 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
73749         LDKStaticPaymentOutputDescriptor orig_conv;
73750         orig_conv.inner = untag_ptr(orig);
73751         orig_conv.is_owned = ptr_is_owned(orig);
73752         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73753         orig_conv.is_owned = false;
73754         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
73755         uint64_t ret_ref = 0;
73756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73758         return ret_ref;
73759 }
73760
73761 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_hash"))) TS_StaticPaymentOutputDescriptor_hash(uint64_t o) {
73762         LDKStaticPaymentOutputDescriptor o_conv;
73763         o_conv.inner = untag_ptr(o);
73764         o_conv.is_owned = ptr_is_owned(o);
73765         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73766         o_conv.is_owned = false;
73767         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
73768         return ret_conv;
73769 }
73770
73771 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
73772         LDKStaticPaymentOutputDescriptor a_conv;
73773         a_conv.inner = untag_ptr(a);
73774         a_conv.is_owned = ptr_is_owned(a);
73775         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73776         a_conv.is_owned = false;
73777         LDKStaticPaymentOutputDescriptor b_conv;
73778         b_conv.inner = untag_ptr(b);
73779         b_conv.is_owned = ptr_is_owned(b);
73780         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73781         b_conv.is_owned = false;
73782         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
73783         return ret_conv;
73784 }
73785
73786 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_witness_script"))) TS_StaticPaymentOutputDescriptor_witness_script(uint64_t this_arg) {
73787         LDKStaticPaymentOutputDescriptor this_arg_conv;
73788         this_arg_conv.inner = untag_ptr(this_arg);
73789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73791         this_arg_conv.is_owned = false;
73792         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
73793         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
73794         uint64_t ret_ref = tag_ptr(ret_copy, true);
73795         return ret_ref;
73796 }
73797
73798 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_max_witness_length"))) TS_StaticPaymentOutputDescriptor_max_witness_length(uint64_t this_arg) {
73799         LDKStaticPaymentOutputDescriptor this_arg_conv;
73800         this_arg_conv.inner = untag_ptr(this_arg);
73801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73803         this_arg_conv.is_owned = false;
73804         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
73805         return ret_conv;
73806 }
73807
73808 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
73809         LDKStaticPaymentOutputDescriptor obj_conv;
73810         obj_conv.inner = untag_ptr(obj);
73811         obj_conv.is_owned = ptr_is_owned(obj);
73812         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73813         obj_conv.is_owned = false;
73814         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
73815         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73816         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73817         CVec_u8Z_free(ret_var);
73818         return ret_arr;
73819 }
73820
73821 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
73822         LDKu8slice ser_ref;
73823         ser_ref.datalen = ser->arr_len;
73824         ser_ref.data = ser->elems;
73825         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
73826         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
73827         FREE(ser);
73828         return tag_ptr(ret_conv, true);
73829 }
73830
73831 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
73832         if (!ptr_is_owned(this_ptr)) return;
73833         void* this_ptr_ptr = untag_ptr(this_ptr);
73834         CHECK_ACCESS(this_ptr_ptr);
73835         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
73836         FREE(untag_ptr(this_ptr));
73837         SpendableOutputDescriptor_free(this_ptr_conv);
73838 }
73839
73840 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
73841         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73842         *ret_copy = SpendableOutputDescriptor_clone(arg);
73843         uint64_t ret_ref = tag_ptr(ret_copy, true);
73844         return ret_ref;
73845 }
73846 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
73847         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
73848         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
73849         return ret_conv;
73850 }
73851
73852 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
73853         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
73854         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73855         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
73856         uint64_t ret_ref = tag_ptr(ret_copy, true);
73857         return ret_ref;
73858 }
73859
73860 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output, int8_tArray channel_keys_id) {
73861         LDKOutPoint outpoint_conv;
73862         outpoint_conv.inner = untag_ptr(outpoint);
73863         outpoint_conv.is_owned = ptr_is_owned(outpoint);
73864         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
73865         outpoint_conv = OutPoint_clone(&outpoint_conv);
73866         void* output_ptr = untag_ptr(output);
73867         CHECK_ACCESS(output_ptr);
73868         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
73869         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
73870         LDKThirtyTwoBytes channel_keys_id_ref;
73871         CHECK(channel_keys_id->arr_len == 32);
73872         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
73873         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73874         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
73875         uint64_t ret_ref = tag_ptr(ret_copy, true);
73876         return ret_ref;
73877 }
73878
73879 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
73880         LDKDelayedPaymentOutputDescriptor a_conv;
73881         a_conv.inner = untag_ptr(a);
73882         a_conv.is_owned = ptr_is_owned(a);
73883         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73884         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
73885         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73886         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
73887         uint64_t ret_ref = tag_ptr(ret_copy, true);
73888         return ret_ref;
73889 }
73890
73891 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
73892         LDKStaticPaymentOutputDescriptor a_conv;
73893         a_conv.inner = untag_ptr(a);
73894         a_conv.is_owned = ptr_is_owned(a);
73895         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73896         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
73897         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73898         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
73899         uint64_t ret_ref = tag_ptr(ret_copy, true);
73900         return ret_ref;
73901 }
73902
73903 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_hash"))) TS_SpendableOutputDescriptor_hash(uint64_t o) {
73904         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
73905         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
73906         return ret_conv;
73907 }
73908
73909 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
73910         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
73911         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
73912         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
73913         return ret_conv;
73914 }
73915
73916 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
73917         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
73918         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
73919         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73920         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73921         CVec_u8Z_free(ret_var);
73922         return ret_arr;
73923 }
73924
73925 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
73926         LDKu8slice ser_ref;
73927         ser_ref.datalen = ser->arr_len;
73928         ser_ref.data = ser->elems;
73929         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
73930         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
73931         FREE(ser);
73932         return tag_ptr(ret_conv, true);
73933 }
73934
73935 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) {
73936         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
73937         descriptors_constr.datalen = descriptors->arr_len;
73938         if (descriptors_constr.datalen > 0)
73939                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
73940         else
73941                 descriptors_constr.data = NULL;
73942         uint64_t* descriptors_vals = descriptors->elems;
73943         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
73944                 uint64_t descriptors_conv_27 = descriptors_vals[b];
73945                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
73946                 CHECK_ACCESS(descriptors_conv_27_ptr);
73947                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
73948                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
73949                 descriptors_constr.data[b] = descriptors_conv_27_conv;
73950         }
73951         FREE(descriptors);
73952         LDKCVec_TxOutZ outputs_constr;
73953         outputs_constr.datalen = outputs->arr_len;
73954         if (outputs_constr.datalen > 0)
73955                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
73956         else
73957                 outputs_constr.data = NULL;
73958         uint64_t* outputs_vals = outputs->elems;
73959         for (size_t h = 0; h < outputs_constr.datalen; h++) {
73960                 uint64_t outputs_conv_7 = outputs_vals[h];
73961                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
73962                 CHECK_ACCESS(outputs_conv_7_ptr);
73963                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
73964                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
73965                 outputs_constr.data[h] = outputs_conv_7_conv;
73966         }
73967         FREE(outputs);
73968         LDKCVec_u8Z change_destination_script_ref;
73969         change_destination_script_ref.datalen = change_destination_script->arr_len;
73970         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
73971         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
73972         void* locktime_ptr = untag_ptr(locktime);
73973         CHECK_ACCESS(locktime_ptr);
73974         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
73975         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
73976         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
73977         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
73978         return tag_ptr(ret_conv, true);
73979 }
73980
73981 void  __attribute__((export_name("TS_ChannelDerivationParameters_free"))) TS_ChannelDerivationParameters_free(uint64_t this_obj) {
73982         LDKChannelDerivationParameters this_obj_conv;
73983         this_obj_conv.inner = untag_ptr(this_obj);
73984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73986         ChannelDerivationParameters_free(this_obj_conv);
73987 }
73988
73989 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_value_satoshis"))) TS_ChannelDerivationParameters_get_value_satoshis(uint64_t this_ptr) {
73990         LDKChannelDerivationParameters this_ptr_conv;
73991         this_ptr_conv.inner = untag_ptr(this_ptr);
73992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73994         this_ptr_conv.is_owned = false;
73995         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
73996         return ret_conv;
73997 }
73998
73999 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_value_satoshis"))) TS_ChannelDerivationParameters_set_value_satoshis(uint64_t this_ptr, int64_t val) {
74000         LDKChannelDerivationParameters this_ptr_conv;
74001         this_ptr_conv.inner = untag_ptr(this_ptr);
74002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74004         this_ptr_conv.is_owned = false;
74005         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
74006 }
74007
74008 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_get_keys_id"))) TS_ChannelDerivationParameters_get_keys_id(uint64_t this_ptr) {
74009         LDKChannelDerivationParameters this_ptr_conv;
74010         this_ptr_conv.inner = untag_ptr(this_ptr);
74011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74013         this_ptr_conv.is_owned = false;
74014         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74015         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
74016         return ret_arr;
74017 }
74018
74019 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_keys_id"))) TS_ChannelDerivationParameters_set_keys_id(uint64_t this_ptr, int8_tArray val) {
74020         LDKChannelDerivationParameters this_ptr_conv;
74021         this_ptr_conv.inner = untag_ptr(this_ptr);
74022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74024         this_ptr_conv.is_owned = false;
74025         LDKThirtyTwoBytes val_ref;
74026         CHECK(val->arr_len == 32);
74027         memcpy(val_ref.data, val->elems, 32); FREE(val);
74028         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
74029 }
74030
74031 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_transaction_parameters"))) TS_ChannelDerivationParameters_get_transaction_parameters(uint64_t this_ptr) {
74032         LDKChannelDerivationParameters this_ptr_conv;
74033         this_ptr_conv.inner = untag_ptr(this_ptr);
74034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74036         this_ptr_conv.is_owned = false;
74037         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
74038         uint64_t ret_ref = 0;
74039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74041         return ret_ref;
74042 }
74043
74044 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_transaction_parameters"))) TS_ChannelDerivationParameters_set_transaction_parameters(uint64_t this_ptr, uint64_t val) {
74045         LDKChannelDerivationParameters this_ptr_conv;
74046         this_ptr_conv.inner = untag_ptr(this_ptr);
74047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74049         this_ptr_conv.is_owned = false;
74050         LDKChannelTransactionParameters val_conv;
74051         val_conv.inner = untag_ptr(val);
74052         val_conv.is_owned = ptr_is_owned(val);
74053         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74054         val_conv = ChannelTransactionParameters_clone(&val_conv);
74055         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
74056 }
74057
74058 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) {
74059         LDKThirtyTwoBytes keys_id_arg_ref;
74060         CHECK(keys_id_arg->arr_len == 32);
74061         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
74062         LDKChannelTransactionParameters transaction_parameters_arg_conv;
74063         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
74064         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
74065         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
74066         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
74067         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
74068         uint64_t ret_ref = 0;
74069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74071         return ret_ref;
74072 }
74073
74074 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
74075         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
74076         uint64_t ret_ref = 0;
74077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74079         return ret_ref;
74080 }
74081 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone_ptr"))) TS_ChannelDerivationParameters_clone_ptr(uint64_t arg) {
74082         LDKChannelDerivationParameters arg_conv;
74083         arg_conv.inner = untag_ptr(arg);
74084         arg_conv.is_owned = ptr_is_owned(arg);
74085         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74086         arg_conv.is_owned = false;
74087         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
74088         return ret_conv;
74089 }
74090
74091 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone"))) TS_ChannelDerivationParameters_clone(uint64_t orig) {
74092         LDKChannelDerivationParameters orig_conv;
74093         orig_conv.inner = untag_ptr(orig);
74094         orig_conv.is_owned = ptr_is_owned(orig);
74095         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74096         orig_conv.is_owned = false;
74097         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
74098         uint64_t ret_ref = 0;
74099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74101         return ret_ref;
74102 }
74103
74104 jboolean  __attribute__((export_name("TS_ChannelDerivationParameters_eq"))) TS_ChannelDerivationParameters_eq(uint64_t a, uint64_t b) {
74105         LDKChannelDerivationParameters a_conv;
74106         a_conv.inner = untag_ptr(a);
74107         a_conv.is_owned = ptr_is_owned(a);
74108         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74109         a_conv.is_owned = false;
74110         LDKChannelDerivationParameters b_conv;
74111         b_conv.inner = untag_ptr(b);
74112         b_conv.is_owned = ptr_is_owned(b);
74113         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74114         b_conv.is_owned = false;
74115         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
74116         return ret_conv;
74117 }
74118
74119 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_write"))) TS_ChannelDerivationParameters_write(uint64_t obj) {
74120         LDKChannelDerivationParameters obj_conv;
74121         obj_conv.inner = untag_ptr(obj);
74122         obj_conv.is_owned = ptr_is_owned(obj);
74123         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74124         obj_conv.is_owned = false;
74125         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
74126         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74127         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74128         CVec_u8Z_free(ret_var);
74129         return ret_arr;
74130 }
74131
74132 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_read"))) TS_ChannelDerivationParameters_read(int8_tArray ser) {
74133         LDKu8slice ser_ref;
74134         ser_ref.datalen = ser->arr_len;
74135         ser_ref.data = ser->elems;
74136         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
74137         *ret_conv = ChannelDerivationParameters_read(ser_ref);
74138         FREE(ser);
74139         return tag_ptr(ret_conv, true);
74140 }
74141
74142 void  __attribute__((export_name("TS_HTLCDescriptor_free"))) TS_HTLCDescriptor_free(uint64_t this_obj) {
74143         LDKHTLCDescriptor this_obj_conv;
74144         this_obj_conv.inner = untag_ptr(this_obj);
74145         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74147         HTLCDescriptor_free(this_obj_conv);
74148 }
74149
74150 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_channel_derivation_parameters"))) TS_HTLCDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
74151         LDKHTLCDescriptor this_ptr_conv;
74152         this_ptr_conv.inner = untag_ptr(this_ptr);
74153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74155         this_ptr_conv.is_owned = false;
74156         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
74157         uint64_t ret_ref = 0;
74158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74160         return ret_ref;
74161 }
74162
74163 void  __attribute__((export_name("TS_HTLCDescriptor_set_channel_derivation_parameters"))) TS_HTLCDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
74164         LDKHTLCDescriptor this_ptr_conv;
74165         this_ptr_conv.inner = untag_ptr(this_ptr);
74166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74168         this_ptr_conv.is_owned = false;
74169         LDKChannelDerivationParameters val_conv;
74170         val_conv.inner = untag_ptr(val);
74171         val_conv.is_owned = ptr_is_owned(val);
74172         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74173         val_conv = ChannelDerivationParameters_clone(&val_conv);
74174         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
74175 }
74176
74177 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_commitment_txid"))) TS_HTLCDescriptor_get_commitment_txid(uint64_t this_ptr) {
74178         LDKHTLCDescriptor this_ptr_conv;
74179         this_ptr_conv.inner = untag_ptr(this_ptr);
74180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74182         this_ptr_conv.is_owned = false;
74183         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74184         memcpy(ret_arr->elems, *HTLCDescriptor_get_commitment_txid(&this_ptr_conv), 32);
74185         return ret_arr;
74186 }
74187
74188 void  __attribute__((export_name("TS_HTLCDescriptor_set_commitment_txid"))) TS_HTLCDescriptor_set_commitment_txid(uint64_t this_ptr, int8_tArray val) {
74189         LDKHTLCDescriptor this_ptr_conv;
74190         this_ptr_conv.inner = untag_ptr(this_ptr);
74191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74193         this_ptr_conv.is_owned = false;
74194         LDKThirtyTwoBytes val_ref;
74195         CHECK(val->arr_len == 32);
74196         memcpy(val_ref.data, val->elems, 32); FREE(val);
74197         HTLCDescriptor_set_commitment_txid(&this_ptr_conv, val_ref);
74198 }
74199
74200 int64_t  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_number"))) TS_HTLCDescriptor_get_per_commitment_number(uint64_t this_ptr) {
74201         LDKHTLCDescriptor this_ptr_conv;
74202         this_ptr_conv.inner = untag_ptr(this_ptr);
74203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74205         this_ptr_conv.is_owned = false;
74206         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
74207         return ret_conv;
74208 }
74209
74210 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_number"))) TS_HTLCDescriptor_set_per_commitment_number(uint64_t this_ptr, int64_t val) {
74211         LDKHTLCDescriptor this_ptr_conv;
74212         this_ptr_conv.inner = untag_ptr(this_ptr);
74213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74215         this_ptr_conv.is_owned = false;
74216         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
74217 }
74218
74219 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_point"))) TS_HTLCDescriptor_get_per_commitment_point(uint64_t this_ptr) {
74220         LDKHTLCDescriptor this_ptr_conv;
74221         this_ptr_conv.inner = untag_ptr(this_ptr);
74222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74224         this_ptr_conv.is_owned = false;
74225         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
74226         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
74227         return ret_arr;
74228 }
74229
74230 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_point"))) TS_HTLCDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
74231         LDKHTLCDescriptor this_ptr_conv;
74232         this_ptr_conv.inner = untag_ptr(this_ptr);
74233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74235         this_ptr_conv.is_owned = false;
74236         LDKPublicKey val_ref;
74237         CHECK(val->arr_len == 33);
74238         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
74239         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
74240 }
74241
74242 int32_t  __attribute__((export_name("TS_HTLCDescriptor_get_feerate_per_kw"))) TS_HTLCDescriptor_get_feerate_per_kw(uint64_t this_ptr) {
74243         LDKHTLCDescriptor this_ptr_conv;
74244         this_ptr_conv.inner = untag_ptr(this_ptr);
74245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74247         this_ptr_conv.is_owned = false;
74248         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
74249         return ret_conv;
74250 }
74251
74252 void  __attribute__((export_name("TS_HTLCDescriptor_set_feerate_per_kw"))) TS_HTLCDescriptor_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
74253         LDKHTLCDescriptor this_ptr_conv;
74254         this_ptr_conv.inner = untag_ptr(this_ptr);
74255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74257         this_ptr_conv.is_owned = false;
74258         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
74259 }
74260
74261 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_htlc"))) TS_HTLCDescriptor_get_htlc(uint64_t this_ptr) {
74262         LDKHTLCDescriptor this_ptr_conv;
74263         this_ptr_conv.inner = untag_ptr(this_ptr);
74264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74266         this_ptr_conv.is_owned = false;
74267         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
74268         uint64_t ret_ref = 0;
74269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74271         return ret_ref;
74272 }
74273
74274 void  __attribute__((export_name("TS_HTLCDescriptor_set_htlc"))) TS_HTLCDescriptor_set_htlc(uint64_t this_ptr, uint64_t val) {
74275         LDKHTLCDescriptor this_ptr_conv;
74276         this_ptr_conv.inner = untag_ptr(this_ptr);
74277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74279         this_ptr_conv.is_owned = false;
74280         LDKHTLCOutputInCommitment val_conv;
74281         val_conv.inner = untag_ptr(val);
74282         val_conv.is_owned = ptr_is_owned(val);
74283         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74284         val_conv = HTLCOutputInCommitment_clone(&val_conv);
74285         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
74286 }
74287
74288 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_preimage"))) TS_HTLCDescriptor_get_preimage(uint64_t this_ptr) {
74289         LDKHTLCDescriptor this_ptr_conv;
74290         this_ptr_conv.inner = untag_ptr(this_ptr);
74291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74293         this_ptr_conv.is_owned = false;
74294         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
74295         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
74296         uint64_t ret_ref = tag_ptr(ret_copy, true);
74297         return ret_ref;
74298 }
74299
74300 void  __attribute__((export_name("TS_HTLCDescriptor_set_preimage"))) TS_HTLCDescriptor_set_preimage(uint64_t this_ptr, uint64_t val) {
74301         LDKHTLCDescriptor this_ptr_conv;
74302         this_ptr_conv.inner = untag_ptr(this_ptr);
74303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74305         this_ptr_conv.is_owned = false;
74306         void* val_ptr = untag_ptr(val);
74307         CHECK_ACCESS(val_ptr);
74308         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
74309         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
74310         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
74311 }
74312
74313 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_counterparty_sig"))) TS_HTLCDescriptor_get_counterparty_sig(uint64_t this_ptr) {
74314         LDKHTLCDescriptor this_ptr_conv;
74315         this_ptr_conv.inner = untag_ptr(this_ptr);
74316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74318         this_ptr_conv.is_owned = false;
74319         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
74320         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
74321         return ret_arr;
74322 }
74323
74324 void  __attribute__((export_name("TS_HTLCDescriptor_set_counterparty_sig"))) TS_HTLCDescriptor_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
74325         LDKHTLCDescriptor this_ptr_conv;
74326         this_ptr_conv.inner = untag_ptr(this_ptr);
74327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74329         this_ptr_conv.is_owned = false;
74330         LDKECDSASignature val_ref;
74331         CHECK(val->arr_len == 64);
74332         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
74333         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
74334 }
74335
74336 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) {
74337         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
74338         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
74339         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
74340         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
74341         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
74342         LDKThirtyTwoBytes commitment_txid_arg_ref;
74343         CHECK(commitment_txid_arg->arr_len == 32);
74344         memcpy(commitment_txid_arg_ref.data, commitment_txid_arg->elems, 32); FREE(commitment_txid_arg);
74345         LDKPublicKey per_commitment_point_arg_ref;
74346         CHECK(per_commitment_point_arg->arr_len == 33);
74347         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
74348         LDKHTLCOutputInCommitment htlc_arg_conv;
74349         htlc_arg_conv.inner = untag_ptr(htlc_arg);
74350         htlc_arg_conv.is_owned = ptr_is_owned(htlc_arg);
74351         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_arg_conv);
74352         htlc_arg_conv = HTLCOutputInCommitment_clone(&htlc_arg_conv);
74353         void* preimage_arg_ptr = untag_ptr(preimage_arg);
74354         CHECK_ACCESS(preimage_arg_ptr);
74355         LDKCOption_ThirtyTwoBytesZ preimage_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_arg_ptr);
74356         preimage_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage_arg));
74357         LDKECDSASignature counterparty_sig_arg_ref;
74358         CHECK(counterparty_sig_arg->arr_len == 64);
74359         memcpy(counterparty_sig_arg_ref.compact_form, counterparty_sig_arg->elems, 64); FREE(counterparty_sig_arg);
74360         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);
74361         uint64_t ret_ref = 0;
74362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74364         return ret_ref;
74365 }
74366
74367 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
74368         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
74369         uint64_t ret_ref = 0;
74370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74372         return ret_ref;
74373 }
74374 int64_t  __attribute__((export_name("TS_HTLCDescriptor_clone_ptr"))) TS_HTLCDescriptor_clone_ptr(uint64_t arg) {
74375         LDKHTLCDescriptor arg_conv;
74376         arg_conv.inner = untag_ptr(arg);
74377         arg_conv.is_owned = ptr_is_owned(arg);
74378         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74379         arg_conv.is_owned = false;
74380         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
74381         return ret_conv;
74382 }
74383
74384 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_clone"))) TS_HTLCDescriptor_clone(uint64_t orig) {
74385         LDKHTLCDescriptor orig_conv;
74386         orig_conv.inner = untag_ptr(orig);
74387         orig_conv.is_owned = ptr_is_owned(orig);
74388         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74389         orig_conv.is_owned = false;
74390         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
74391         uint64_t ret_ref = 0;
74392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74394         return ret_ref;
74395 }
74396
74397 jboolean  __attribute__((export_name("TS_HTLCDescriptor_eq"))) TS_HTLCDescriptor_eq(uint64_t a, uint64_t b) {
74398         LDKHTLCDescriptor a_conv;
74399         a_conv.inner = untag_ptr(a);
74400         a_conv.is_owned = ptr_is_owned(a);
74401         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74402         a_conv.is_owned = false;
74403         LDKHTLCDescriptor b_conv;
74404         b_conv.inner = untag_ptr(b);
74405         b_conv.is_owned = ptr_is_owned(b);
74406         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74407         b_conv.is_owned = false;
74408         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
74409         return ret_conv;
74410 }
74411
74412 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_write"))) TS_HTLCDescriptor_write(uint64_t obj) {
74413         LDKHTLCDescriptor obj_conv;
74414         obj_conv.inner = untag_ptr(obj);
74415         obj_conv.is_owned = ptr_is_owned(obj);
74416         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74417         obj_conv.is_owned = false;
74418         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
74419         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74420         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74421         CVec_u8Z_free(ret_var);
74422         return ret_arr;
74423 }
74424
74425 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_read"))) TS_HTLCDescriptor_read(int8_tArray ser) {
74426         LDKu8slice ser_ref;
74427         ser_ref.datalen = ser->arr_len;
74428         ser_ref.data = ser->elems;
74429         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
74430         *ret_conv = HTLCDescriptor_read(ser_ref);
74431         FREE(ser);
74432         return tag_ptr(ret_conv, true);
74433 }
74434
74435 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_outpoint"))) TS_HTLCDescriptor_outpoint(uint64_t this_arg) {
74436         LDKHTLCDescriptor this_arg_conv;
74437         this_arg_conv.inner = untag_ptr(this_arg);
74438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74440         this_arg_conv.is_owned = false;
74441         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
74442         uint64_t ret_ref = 0;
74443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74445         return ret_ref;
74446 }
74447
74448 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_previous_utxo"))) TS_HTLCDescriptor_previous_utxo(uint64_t this_arg) {
74449         LDKHTLCDescriptor this_arg_conv;
74450         this_arg_conv.inner = untag_ptr(this_arg);
74451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74453         this_arg_conv.is_owned = false;
74454         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74455         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
74456         return tag_ptr(ret_ref, true);
74457 }
74458
74459 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_unsigned_tx_input"))) TS_HTLCDescriptor_unsigned_tx_input(uint64_t this_arg) {
74460         LDKHTLCDescriptor this_arg_conv;
74461         this_arg_conv.inner = untag_ptr(this_arg);
74462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74464         this_arg_conv.is_owned = false;
74465         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
74466         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
74467         return tag_ptr(ret_ref, true);
74468 }
74469
74470 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_tx_output"))) TS_HTLCDescriptor_tx_output(uint64_t this_arg) {
74471         LDKHTLCDescriptor this_arg_conv;
74472         this_arg_conv.inner = untag_ptr(this_arg);
74473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74475         this_arg_conv.is_owned = false;
74476         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74477         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
74478         return tag_ptr(ret_ref, true);
74479 }
74480
74481 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_witness_script"))) TS_HTLCDescriptor_witness_script(uint64_t this_arg) {
74482         LDKHTLCDescriptor this_arg_conv;
74483         this_arg_conv.inner = untag_ptr(this_arg);
74484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74486         this_arg_conv.is_owned = false;
74487         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
74488         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74489         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74490         CVec_u8Z_free(ret_var);
74491         return ret_arr;
74492 }
74493
74494 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) {
74495         LDKHTLCDescriptor this_arg_conv;
74496         this_arg_conv.inner = untag_ptr(this_arg);
74497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74499         this_arg_conv.is_owned = false;
74500         LDKECDSASignature signature_ref;
74501         CHECK(signature->arr_len == 64);
74502         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
74503         LDKu8slice witness_script_ref;
74504         witness_script_ref.datalen = witness_script->arr_len;
74505         witness_script_ref.data = witness_script->elems;
74506         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
74507         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74508         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74509         Witness_free(ret_var);
74510         FREE(witness_script);
74511         return ret_arr;
74512 }
74513
74514 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_derive_channel_signer"))) TS_HTLCDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
74515         LDKHTLCDescriptor this_arg_conv;
74516         this_arg_conv.inner = untag_ptr(this_arg);
74517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74519         this_arg_conv.is_owned = false;
74520         void* signer_provider_ptr = untag_ptr(signer_provider);
74521         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
74522         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
74523         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
74524         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
74525         return tag_ptr(ret_ret, true);
74526 }
74527
74528 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
74529         if (!ptr_is_owned(this_ptr)) return;
74530         void* this_ptr_ptr = untag_ptr(this_ptr);
74531         CHECK_ACCESS(this_ptr_ptr);
74532         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
74533         FREE(untag_ptr(this_ptr));
74534         ChannelSigner_free(this_ptr_conv);
74535 }
74536
74537 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
74538         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
74539         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
74540         return ret_conv;
74541 }
74542
74543 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
74544         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
74545         return ret_conv;
74546 }
74547
74548 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
74549         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
74550         return ret_conv;
74551 }
74552
74553 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
74554         if (!ptr_is_owned(this_ptr)) return;
74555         void* this_ptr_ptr = untag_ptr(this_ptr);
74556         CHECK_ACCESS(this_ptr_ptr);
74557         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
74558         FREE(untag_ptr(this_ptr));
74559         EntropySource_free(this_ptr_conv);
74560 }
74561
74562 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
74563         if (!ptr_is_owned(this_ptr)) return;
74564         void* this_ptr_ptr = untag_ptr(this_ptr);
74565         CHECK_ACCESS(this_ptr_ptr);
74566         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
74567         FREE(untag_ptr(this_ptr));
74568         NodeSigner_free(this_ptr_conv);
74569 }
74570
74571 void  __attribute__((export_name("TS_OutputSpender_free"))) TS_OutputSpender_free(uint64_t this_ptr) {
74572         if (!ptr_is_owned(this_ptr)) return;
74573         void* this_ptr_ptr = untag_ptr(this_ptr);
74574         CHECK_ACCESS(this_ptr_ptr);
74575         LDKOutputSpender this_ptr_conv = *(LDKOutputSpender*)(this_ptr_ptr);
74576         FREE(untag_ptr(this_ptr));
74577         OutputSpender_free(this_ptr_conv);
74578 }
74579
74580 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
74581         if (!ptr_is_owned(this_ptr)) return;
74582         void* this_ptr_ptr = untag_ptr(this_ptr);
74583         CHECK_ACCESS(this_ptr_ptr);
74584         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
74585         FREE(untag_ptr(this_ptr));
74586         SignerProvider_free(this_ptr_conv);
74587 }
74588
74589 void  __attribute__((export_name("TS_ChangeDestinationSource_free"))) TS_ChangeDestinationSource_free(uint64_t this_ptr) {
74590         if (!ptr_is_owned(this_ptr)) return;
74591         void* this_ptr_ptr = untag_ptr(this_ptr);
74592         CHECK_ACCESS(this_ptr_ptr);
74593         LDKChangeDestinationSource this_ptr_conv = *(LDKChangeDestinationSource*)(this_ptr_ptr);
74594         FREE(untag_ptr(this_ptr));
74595         ChangeDestinationSource_free(this_ptr_conv);
74596 }
74597
74598 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
74599         LDKInMemorySigner this_obj_conv;
74600         this_obj_conv.inner = untag_ptr(this_obj);
74601         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74603         InMemorySigner_free(this_obj_conv);
74604 }
74605
74606 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
74607         LDKInMemorySigner this_ptr_conv;
74608         this_ptr_conv.inner = untag_ptr(this_ptr);
74609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74611         this_ptr_conv.is_owned = false;
74612         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74613         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
74614         return ret_arr;
74615 }
74616
74617 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
74618         LDKInMemorySigner this_ptr_conv;
74619         this_ptr_conv.inner = untag_ptr(this_ptr);
74620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74622         this_ptr_conv.is_owned = false;
74623         LDKSecretKey val_ref;
74624         CHECK(val->arr_len == 32);
74625         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
74626         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
74627 }
74628
74629 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
74630         LDKInMemorySigner this_ptr_conv;
74631         this_ptr_conv.inner = untag_ptr(this_ptr);
74632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74634         this_ptr_conv.is_owned = false;
74635         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74636         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
74637         return ret_arr;
74638 }
74639
74640 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
74641         LDKInMemorySigner this_ptr_conv;
74642         this_ptr_conv.inner = untag_ptr(this_ptr);
74643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74645         this_ptr_conv.is_owned = false;
74646         LDKSecretKey val_ref;
74647         CHECK(val->arr_len == 32);
74648         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
74649         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
74650 }
74651
74652 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
74653         LDKInMemorySigner this_ptr_conv;
74654         this_ptr_conv.inner = untag_ptr(this_ptr);
74655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74657         this_ptr_conv.is_owned = false;
74658         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74659         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
74660         return ret_arr;
74661 }
74662
74663 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
74664         LDKInMemorySigner this_ptr_conv;
74665         this_ptr_conv.inner = untag_ptr(this_ptr);
74666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74668         this_ptr_conv.is_owned = false;
74669         LDKSecretKey val_ref;
74670         CHECK(val->arr_len == 32);
74671         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
74672         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
74673 }
74674
74675 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
74676         LDKInMemorySigner this_ptr_conv;
74677         this_ptr_conv.inner = untag_ptr(this_ptr);
74678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74680         this_ptr_conv.is_owned = false;
74681         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74682         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
74683         return ret_arr;
74684 }
74685
74686 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) {
74687         LDKInMemorySigner this_ptr_conv;
74688         this_ptr_conv.inner = untag_ptr(this_ptr);
74689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74691         this_ptr_conv.is_owned = false;
74692         LDKSecretKey val_ref;
74693         CHECK(val->arr_len == 32);
74694         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
74695         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
74696 }
74697
74698 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
74699         LDKInMemorySigner this_ptr_conv;
74700         this_ptr_conv.inner = untag_ptr(this_ptr);
74701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74703         this_ptr_conv.is_owned = false;
74704         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74705         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
74706         return ret_arr;
74707 }
74708
74709 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
74710         LDKInMemorySigner this_ptr_conv;
74711         this_ptr_conv.inner = untag_ptr(this_ptr);
74712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74714         this_ptr_conv.is_owned = false;
74715         LDKSecretKey val_ref;
74716         CHECK(val->arr_len == 32);
74717         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
74718         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
74719 }
74720
74721 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
74722         LDKInMemorySigner this_ptr_conv;
74723         this_ptr_conv.inner = untag_ptr(this_ptr);
74724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74726         this_ptr_conv.is_owned = false;
74727         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74728         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
74729         return ret_arr;
74730 }
74731
74732 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
74733         LDKInMemorySigner this_ptr_conv;
74734         this_ptr_conv.inner = untag_ptr(this_ptr);
74735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74737         this_ptr_conv.is_owned = false;
74738         LDKThirtyTwoBytes val_ref;
74739         CHECK(val->arr_len == 32);
74740         memcpy(val_ref.data, val->elems, 32); FREE(val);
74741         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
74742 }
74743
74744 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
74745         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
74746         uint64_t ret_ref = 0;
74747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74749         return ret_ref;
74750 }
74751 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
74752         LDKInMemorySigner arg_conv;
74753         arg_conv.inner = untag_ptr(arg);
74754         arg_conv.is_owned = ptr_is_owned(arg);
74755         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74756         arg_conv.is_owned = false;
74757         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
74758         return ret_conv;
74759 }
74760
74761 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
74762         LDKInMemorySigner orig_conv;
74763         orig_conv.inner = untag_ptr(orig);
74764         orig_conv.is_owned = ptr_is_owned(orig);
74765         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74766         orig_conv.is_owned = false;
74767         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
74768         uint64_t ret_ref = 0;
74769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74771         return ret_ref;
74772 }
74773
74774 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) {
74775         LDKSecretKey funding_key_ref;
74776         CHECK(funding_key->arr_len == 32);
74777         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
74778         LDKSecretKey revocation_base_key_ref;
74779         CHECK(revocation_base_key->arr_len == 32);
74780         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
74781         LDKSecretKey payment_key_ref;
74782         CHECK(payment_key->arr_len == 32);
74783         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
74784         LDKSecretKey delayed_payment_base_key_ref;
74785         CHECK(delayed_payment_base_key->arr_len == 32);
74786         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
74787         LDKSecretKey htlc_base_key_ref;
74788         CHECK(htlc_base_key->arr_len == 32);
74789         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
74790         LDKThirtyTwoBytes commitment_seed_ref;
74791         CHECK(commitment_seed->arr_len == 32);
74792         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
74793         LDKThirtyTwoBytes channel_keys_id_ref;
74794         CHECK(channel_keys_id->arr_len == 32);
74795         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
74796         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
74797         CHECK(rand_bytes_unique_start->arr_len == 32);
74798         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
74799         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);
74800         uint64_t ret_ref = 0;
74801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74803         return ret_ref;
74804 }
74805
74806 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
74807         LDKInMemorySigner this_arg_conv;
74808         this_arg_conv.inner = untag_ptr(this_arg);
74809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74811         this_arg_conv.is_owned = false;
74812         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
74813         uint64_t ret_ref = 0;
74814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74816         return ret_ref;
74817 }
74818
74819 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
74820         LDKInMemorySigner this_arg_conv;
74821         this_arg_conv.inner = untag_ptr(this_arg);
74822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74824         this_arg_conv.is_owned = false;
74825         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
74826         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
74827         uint64_t ret_ref = tag_ptr(ret_copy, true);
74828         return ret_ref;
74829 }
74830
74831 uint64_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
74832         LDKInMemorySigner this_arg_conv;
74833         this_arg_conv.inner = untag_ptr(this_arg);
74834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74836         this_arg_conv.is_owned = false;
74837         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
74838         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
74839         uint64_t ret_ref = tag_ptr(ret_copy, true);
74840         return ret_ref;
74841 }
74842
74843 uint64_t  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
74844         LDKInMemorySigner this_arg_conv;
74845         this_arg_conv.inner = untag_ptr(this_arg);
74846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74848         this_arg_conv.is_owned = false;
74849         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
74850         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
74851         uint64_t ret_ref = tag_ptr(ret_copy, true);
74852         return ret_ref;
74853 }
74854
74855 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
74856         LDKInMemorySigner this_arg_conv;
74857         this_arg_conv.inner = untag_ptr(this_arg);
74858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74860         this_arg_conv.is_owned = false;
74861         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
74862         uint64_t ret_ref = 0;
74863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74865         return ret_ref;
74866 }
74867
74868 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
74869         LDKInMemorySigner this_arg_conv;
74870         this_arg_conv.inner = untag_ptr(this_arg);
74871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74873         this_arg_conv.is_owned = false;
74874         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
74875         uint64_t ret_ref = 0;
74876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74878         return ret_ref;
74879 }
74880
74881 uint64_t  __attribute__((export_name("TS_InMemorySigner_channel_type_features"))) TS_InMemorySigner_channel_type_features(uint64_t this_arg) {
74882         LDKInMemorySigner this_arg_conv;
74883         this_arg_conv.inner = untag_ptr(this_arg);
74884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74886         this_arg_conv.is_owned = false;
74887         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
74888         uint64_t ret_ref = 0;
74889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74891         return ret_ref;
74892 }
74893
74894 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) {
74895         LDKInMemorySigner this_arg_conv;
74896         this_arg_conv.inner = untag_ptr(this_arg);
74897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74899         this_arg_conv.is_owned = false;
74900         LDKTransaction spend_tx_ref;
74901         spend_tx_ref.datalen = spend_tx->arr_len;
74902         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
74903         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
74904         spend_tx_ref.data_is_owned = true;
74905         LDKStaticPaymentOutputDescriptor descriptor_conv;
74906         descriptor_conv.inner = untag_ptr(descriptor);
74907         descriptor_conv.is_owned = ptr_is_owned(descriptor);
74908         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
74909         descriptor_conv.is_owned = false;
74910         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
74911         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
74912         return tag_ptr(ret_conv, true);
74913 }
74914
74915 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) {
74916         LDKInMemorySigner this_arg_conv;
74917         this_arg_conv.inner = untag_ptr(this_arg);
74918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74920         this_arg_conv.is_owned = false;
74921         LDKTransaction spend_tx_ref;
74922         spend_tx_ref.datalen = spend_tx->arr_len;
74923         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
74924         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
74925         spend_tx_ref.data_is_owned = true;
74926         LDKDelayedPaymentOutputDescriptor descriptor_conv;
74927         descriptor_conv.inner = untag_ptr(descriptor);
74928         descriptor_conv.is_owned = ptr_is_owned(descriptor);
74929         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
74930         descriptor_conv.is_owned = false;
74931         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
74932         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
74933         return tag_ptr(ret_conv, true);
74934 }
74935
74936 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
74937         LDKInMemorySigner this_arg_conv;
74938         this_arg_conv.inner = untag_ptr(this_arg);
74939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74941         this_arg_conv.is_owned = false;
74942         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
74943         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
74944         return tag_ptr(ret_ret, true);
74945 }
74946
74947 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
74948         LDKInMemorySigner this_arg_conv;
74949         this_arg_conv.inner = untag_ptr(this_arg);
74950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74952         this_arg_conv.is_owned = false;
74953         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
74954         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
74955         return tag_ptr(ret_ret, true);
74956 }
74957
74958 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
74959         LDKInMemorySigner this_arg_conv;
74960         this_arg_conv.inner = untag_ptr(this_arg);
74961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74963         this_arg_conv.is_owned = false;
74964         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
74965         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
74966         return tag_ptr(ret_ret, true);
74967 }
74968
74969 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
74970         LDKInMemorySigner this_arg_conv;
74971         this_arg_conv.inner = untag_ptr(this_arg);
74972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74974         this_arg_conv.is_owned = false;
74975         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
74976         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
74977         return tag_ptr(ret_ret, true);
74978 }
74979
74980 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
74981         LDKInMemorySigner obj_conv;
74982         obj_conv.inner = untag_ptr(obj);
74983         obj_conv.is_owned = ptr_is_owned(obj);
74984         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74985         obj_conv.is_owned = false;
74986         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
74987         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74988         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74989         CVec_u8Z_free(ret_var);
74990         return ret_arr;
74991 }
74992
74993 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
74994         LDKu8slice ser_ref;
74995         ser_ref.datalen = ser->arr_len;
74996         ser_ref.data = ser->elems;
74997         void* arg_ptr = untag_ptr(arg);
74998         CHECK_ACCESS(arg_ptr);
74999         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
75000         if (arg_conv.free == LDKEntropySource_JCalls_free) {
75001                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75002                 LDKEntropySource_JCalls_cloned(&arg_conv);
75003         }
75004         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
75005         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
75006         FREE(ser);
75007         return tag_ptr(ret_conv, true);
75008 }
75009
75010 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
75011         LDKKeysManager this_obj_conv;
75012         this_obj_conv.inner = untag_ptr(this_obj);
75013         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75015         KeysManager_free(this_obj_conv);
75016 }
75017
75018 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
75019         uint8_t seed_arr[32];
75020         CHECK(seed->arr_len == 32);
75021         memcpy(seed_arr, seed->elems, 32); FREE(seed);
75022         uint8_t (*seed_ref)[32] = &seed_arr;
75023         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
75024         uint64_t ret_ref = 0;
75025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75027         return ret_ref;
75028 }
75029
75030 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
75031         LDKKeysManager this_arg_conv;
75032         this_arg_conv.inner = untag_ptr(this_arg);
75033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75035         this_arg_conv.is_owned = false;
75036         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75037         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
75038         return ret_arr;
75039 }
75040
75041 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) {
75042         LDKKeysManager this_arg_conv;
75043         this_arg_conv.inner = untag_ptr(this_arg);
75044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75046         this_arg_conv.is_owned = false;
75047         uint8_t params_arr[32];
75048         CHECK(params->arr_len == 32);
75049         memcpy(params_arr, params->elems, 32); FREE(params);
75050         uint8_t (*params_ref)[32] = &params_arr;
75051         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
75052         uint64_t ret_ref = 0;
75053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75055         return ret_ref;
75056 }
75057
75058 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) {
75059         LDKKeysManager this_arg_conv;
75060         this_arg_conv.inner = untag_ptr(this_arg);
75061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75063         this_arg_conv.is_owned = false;
75064         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
75065         descriptors_constr.datalen = descriptors->arr_len;
75066         if (descriptors_constr.datalen > 0)
75067                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
75068         else
75069                 descriptors_constr.data = NULL;
75070         uint64_t* descriptors_vals = descriptors->elems;
75071         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
75072                 uint64_t descriptors_conv_27 = descriptors_vals[b];
75073                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
75074                 CHECK_ACCESS(descriptors_conv_27_ptr);
75075                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
75076                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
75077                 descriptors_constr.data[b] = descriptors_conv_27_conv;
75078         }
75079         FREE(descriptors);
75080         LDKCVec_u8Z psbt_ref;
75081         psbt_ref.datalen = psbt->arr_len;
75082         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
75083         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
75084         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
75085         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
75086         return tag_ptr(ret_conv, true);
75087 }
75088
75089 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
75090         LDKKeysManager this_arg_conv;
75091         this_arg_conv.inner = untag_ptr(this_arg);
75092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75094         this_arg_conv.is_owned = false;
75095         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
75096         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
75097         return tag_ptr(ret_ret, true);
75098 }
75099
75100 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
75101         LDKKeysManager this_arg_conv;
75102         this_arg_conv.inner = untag_ptr(this_arg);
75103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75105         this_arg_conv.is_owned = false;
75106         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
75107         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
75108         return tag_ptr(ret_ret, true);
75109 }
75110
75111 uint64_t  __attribute__((export_name("TS_KeysManager_as_OutputSpender"))) TS_KeysManager_as_OutputSpender(uint64_t this_arg) {
75112         LDKKeysManager this_arg_conv;
75113         this_arg_conv.inner = untag_ptr(this_arg);
75114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75116         this_arg_conv.is_owned = false;
75117         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
75118         *ret_ret = KeysManager_as_OutputSpender(&this_arg_conv);
75119         return tag_ptr(ret_ret, true);
75120 }
75121
75122 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
75123         LDKKeysManager this_arg_conv;
75124         this_arg_conv.inner = untag_ptr(this_arg);
75125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75127         this_arg_conv.is_owned = false;
75128         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
75129         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
75130         return tag_ptr(ret_ret, true);
75131 }
75132
75133 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
75134         LDKPhantomKeysManager this_obj_conv;
75135         this_obj_conv.inner = untag_ptr(this_obj);
75136         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75138         PhantomKeysManager_free(this_obj_conv);
75139 }
75140
75141 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
75142         LDKPhantomKeysManager this_arg_conv;
75143         this_arg_conv.inner = untag_ptr(this_arg);
75144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75146         this_arg_conv.is_owned = false;
75147         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
75148         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
75149         return tag_ptr(ret_ret, true);
75150 }
75151
75152 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
75153         LDKPhantomKeysManager this_arg_conv;
75154         this_arg_conv.inner = untag_ptr(this_arg);
75155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75157         this_arg_conv.is_owned = false;
75158         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
75159         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
75160         return tag_ptr(ret_ret, true);
75161 }
75162
75163 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_OutputSpender"))) TS_PhantomKeysManager_as_OutputSpender(uint64_t this_arg) {
75164         LDKPhantomKeysManager this_arg_conv;
75165         this_arg_conv.inner = untag_ptr(this_arg);
75166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75168         this_arg_conv.is_owned = false;
75169         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
75170         *ret_ret = PhantomKeysManager_as_OutputSpender(&this_arg_conv);
75171         return tag_ptr(ret_ret, true);
75172 }
75173
75174 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
75175         LDKPhantomKeysManager this_arg_conv;
75176         this_arg_conv.inner = untag_ptr(this_arg);
75177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75179         this_arg_conv.is_owned = false;
75180         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
75181         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
75182         return tag_ptr(ret_ret, true);
75183 }
75184
75185 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) {
75186         uint8_t seed_arr[32];
75187         CHECK(seed->arr_len == 32);
75188         memcpy(seed_arr, seed->elems, 32); FREE(seed);
75189         uint8_t (*seed_ref)[32] = &seed_arr;
75190         uint8_t cross_node_seed_arr[32];
75191         CHECK(cross_node_seed->arr_len == 32);
75192         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
75193         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
75194         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
75195         uint64_t ret_ref = 0;
75196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75198         return ret_ref;
75199 }
75200
75201 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) {
75202         LDKPhantomKeysManager this_arg_conv;
75203         this_arg_conv.inner = untag_ptr(this_arg);
75204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75206         this_arg_conv.is_owned = false;
75207         uint8_t params_arr[32];
75208         CHECK(params->arr_len == 32);
75209         memcpy(params_arr, params->elems, 32); FREE(params);
75210         uint8_t (*params_ref)[32] = &params_arr;
75211         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
75212         uint64_t ret_ref = 0;
75213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75215         return ret_ref;
75216 }
75217
75218 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
75219         LDKPhantomKeysManager this_arg_conv;
75220         this_arg_conv.inner = untag_ptr(this_arg);
75221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75223         this_arg_conv.is_owned = false;
75224         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75225         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
75226         return ret_arr;
75227 }
75228
75229 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
75230         LDKPhantomKeysManager this_arg_conv;
75231         this_arg_conv.inner = untag_ptr(this_arg);
75232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75234         this_arg_conv.is_owned = false;
75235         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75236         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
75237         return ret_arr;
75238 }
75239
75240 void  __attribute__((export_name("TS_RandomBytes_free"))) TS_RandomBytes_free(uint64_t this_obj) {
75241         LDKRandomBytes this_obj_conv;
75242         this_obj_conv.inner = untag_ptr(this_obj);
75243         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75245         RandomBytes_free(this_obj_conv);
75246 }
75247
75248 uint64_t  __attribute__((export_name("TS_RandomBytes_new"))) TS_RandomBytes_new(int8_tArray seed) {
75249         LDKThirtyTwoBytes seed_ref;
75250         CHECK(seed->arr_len == 32);
75251         memcpy(seed_ref.data, seed->elems, 32); FREE(seed);
75252         LDKRandomBytes ret_var = RandomBytes_new(seed_ref);
75253         uint64_t ret_ref = 0;
75254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75256         return ret_ref;
75257 }
75258
75259 uint64_t  __attribute__((export_name("TS_RandomBytes_as_EntropySource"))) TS_RandomBytes_as_EntropySource(uint64_t this_arg) {
75260         LDKRandomBytes this_arg_conv;
75261         this_arg_conv.inner = untag_ptr(this_arg);
75262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75264         this_arg_conv.is_owned = false;
75265         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
75266         *ret_ret = RandomBytes_as_EntropySource(&this_arg_conv);
75267         return tag_ptr(ret_ret, true);
75268 }
75269
75270 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
75271         if (!ptr_is_owned(this_ptr)) return;
75272         void* this_ptr_ptr = untag_ptr(this_ptr);
75273         CHECK_ACCESS(this_ptr_ptr);
75274         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
75275         FREE(untag_ptr(this_ptr));
75276         EcdsaChannelSigner_free(this_ptr_conv);
75277 }
75278
75279 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
75280         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
75281         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
75282         return tag_ptr(ret_ret, true);
75283 }
75284 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
75285         void* arg_ptr = untag_ptr(arg);
75286         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
75287         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
75288         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
75289         return ret_conv;
75290 }
75291
75292 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
75293         void* orig_ptr = untag_ptr(orig);
75294         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
75295         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
75296         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
75297         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
75298         return tag_ptr(ret_ret, true);
75299 }
75300
75301 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
75302         if (!ptr_is_owned(this_ptr)) return;
75303         void* this_ptr_ptr = untag_ptr(this_ptr);
75304         CHECK_ACCESS(this_ptr_ptr);
75305         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
75306         FREE(untag_ptr(this_ptr));
75307         WriteableEcdsaChannelSigner_free(this_ptr_conv);
75308 }
75309
75310 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
75311         LDKOnionMessenger this_obj_conv;
75312         this_obj_conv.inner = untag_ptr(this_obj);
75313         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75315         OnionMessenger_free(this_obj_conv);
75316 }
75317
75318 void  __attribute__((export_name("TS_MessageRouter_free"))) TS_MessageRouter_free(uint64_t this_ptr) {
75319         if (!ptr_is_owned(this_ptr)) return;
75320         void* this_ptr_ptr = untag_ptr(this_ptr);
75321         CHECK_ACCESS(this_ptr_ptr);
75322         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
75323         FREE(untag_ptr(this_ptr));
75324         MessageRouter_free(this_ptr_conv);
75325 }
75326
75327 void  __attribute__((export_name("TS_DefaultMessageRouter_free"))) TS_DefaultMessageRouter_free(uint64_t this_obj) {
75328         LDKDefaultMessageRouter this_obj_conv;
75329         this_obj_conv.inner = untag_ptr(this_obj);
75330         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75332         DefaultMessageRouter_free(this_obj_conv);
75333 }
75334
75335 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_new"))) TS_DefaultMessageRouter_new(uint64_t network_graph, uint64_t entropy_source) {
75336         LDKNetworkGraph network_graph_conv;
75337         network_graph_conv.inner = untag_ptr(network_graph);
75338         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75339         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75340         network_graph_conv.is_owned = false;
75341         void* entropy_source_ptr = untag_ptr(entropy_source);
75342         CHECK_ACCESS(entropy_source_ptr);
75343         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75344         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75345                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75346                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75347         }
75348         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
75349         uint64_t ret_ref = 0;
75350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75352         return ret_ref;
75353 }
75354
75355 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_as_MessageRouter"))) TS_DefaultMessageRouter_as_MessageRouter(uint64_t this_arg) {
75356         LDKDefaultMessageRouter this_arg_conv;
75357         this_arg_conv.inner = untag_ptr(this_arg);
75358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75360         this_arg_conv.is_owned = false;
75361         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
75362         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
75363         return tag_ptr(ret_ret, true);
75364 }
75365
75366 void  __attribute__((export_name("TS_OnionMessagePath_free"))) TS_OnionMessagePath_free(uint64_t this_obj) {
75367         LDKOnionMessagePath this_obj_conv;
75368         this_obj_conv.inner = untag_ptr(this_obj);
75369         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75371         OnionMessagePath_free(this_obj_conv);
75372 }
75373
75374 ptrArray  __attribute__((export_name("TS_OnionMessagePath_get_intermediate_nodes"))) TS_OnionMessagePath_get_intermediate_nodes(uint64_t this_ptr) {
75375         LDKOnionMessagePath this_ptr_conv;
75376         this_ptr_conv.inner = untag_ptr(this_ptr);
75377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75379         this_ptr_conv.is_owned = false;
75380         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
75381         ptrArray ret_arr = NULL;
75382         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
75383         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
75384         for (size_t m = 0; m < ret_var.datalen; m++) {
75385                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
75386                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
75387                 ret_arr_ptr[m] = ret_conv_12_arr;
75388         }
75389         
75390         FREE(ret_var.data);
75391         return ret_arr;
75392 }
75393
75394 void  __attribute__((export_name("TS_OnionMessagePath_set_intermediate_nodes"))) TS_OnionMessagePath_set_intermediate_nodes(uint64_t this_ptr, ptrArray val) {
75395         LDKOnionMessagePath this_ptr_conv;
75396         this_ptr_conv.inner = untag_ptr(this_ptr);
75397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75399         this_ptr_conv.is_owned = false;
75400         LDKCVec_PublicKeyZ val_constr;
75401         val_constr.datalen = val->arr_len;
75402         if (val_constr.datalen > 0)
75403                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
75404         else
75405                 val_constr.data = NULL;
75406         int8_tArray* val_vals = (void*) val->elems;
75407         for (size_t m = 0; m < val_constr.datalen; m++) {
75408                 int8_tArray val_conv_12 = val_vals[m];
75409                 LDKPublicKey val_conv_12_ref;
75410                 CHECK(val_conv_12->arr_len == 33);
75411                 memcpy(val_conv_12_ref.compressed_form, val_conv_12->elems, 33); FREE(val_conv_12);
75412                 val_constr.data[m] = val_conv_12_ref;
75413         }
75414         FREE(val);
75415         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
75416 }
75417
75418 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_destination"))) TS_OnionMessagePath_get_destination(uint64_t this_ptr) {
75419         LDKOnionMessagePath this_ptr_conv;
75420         this_ptr_conv.inner = untag_ptr(this_ptr);
75421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75423         this_ptr_conv.is_owned = false;
75424         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75425         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
75426         uint64_t ret_ref = tag_ptr(ret_copy, true);
75427         return ret_ref;
75428 }
75429
75430 void  __attribute__((export_name("TS_OnionMessagePath_set_destination"))) TS_OnionMessagePath_set_destination(uint64_t this_ptr, uint64_t val) {
75431         LDKOnionMessagePath this_ptr_conv;
75432         this_ptr_conv.inner = untag_ptr(this_ptr);
75433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75435         this_ptr_conv.is_owned = false;
75436         void* val_ptr = untag_ptr(val);
75437         CHECK_ACCESS(val_ptr);
75438         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
75439         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
75440         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
75441 }
75442
75443 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_first_node_addresses"))) TS_OnionMessagePath_get_first_node_addresses(uint64_t this_ptr) {
75444         LDKOnionMessagePath this_ptr_conv;
75445         this_ptr_conv.inner = untag_ptr(this_ptr);
75446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75448         this_ptr_conv.is_owned = false;
75449         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
75450         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
75451         uint64_t ret_ref = tag_ptr(ret_copy, true);
75452         return ret_ref;
75453 }
75454
75455 void  __attribute__((export_name("TS_OnionMessagePath_set_first_node_addresses"))) TS_OnionMessagePath_set_first_node_addresses(uint64_t this_ptr, uint64_t val) {
75456         LDKOnionMessagePath this_ptr_conv;
75457         this_ptr_conv.inner = untag_ptr(this_ptr);
75458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75460         this_ptr_conv.is_owned = false;
75461         void* val_ptr = untag_ptr(val);
75462         CHECK_ACCESS(val_ptr);
75463         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
75464         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
75465         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
75466 }
75467
75468 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) {
75469         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
75470         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
75471         if (intermediate_nodes_arg_constr.datalen > 0)
75472                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
75473         else
75474                 intermediate_nodes_arg_constr.data = NULL;
75475         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
75476         for (size_t m = 0; m < intermediate_nodes_arg_constr.datalen; m++) {
75477                 int8_tArray intermediate_nodes_arg_conv_12 = intermediate_nodes_arg_vals[m];
75478                 LDKPublicKey intermediate_nodes_arg_conv_12_ref;
75479                 CHECK(intermediate_nodes_arg_conv_12->arr_len == 33);
75480                 memcpy(intermediate_nodes_arg_conv_12_ref.compressed_form, intermediate_nodes_arg_conv_12->elems, 33); FREE(intermediate_nodes_arg_conv_12);
75481                 intermediate_nodes_arg_constr.data[m] = intermediate_nodes_arg_conv_12_ref;
75482         }
75483         FREE(intermediate_nodes_arg);
75484         void* destination_arg_ptr = untag_ptr(destination_arg);
75485         CHECK_ACCESS(destination_arg_ptr);
75486         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
75487         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
75488         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
75489         CHECK_ACCESS(first_node_addresses_arg_ptr);
75490         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
75491         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
75492         uint64_t ret_ref = 0;
75493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75495         return ret_ref;
75496 }
75497
75498 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
75499         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
75500         uint64_t ret_ref = 0;
75501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75503         return ret_ref;
75504 }
75505 int64_t  __attribute__((export_name("TS_OnionMessagePath_clone_ptr"))) TS_OnionMessagePath_clone_ptr(uint64_t arg) {
75506         LDKOnionMessagePath arg_conv;
75507         arg_conv.inner = untag_ptr(arg);
75508         arg_conv.is_owned = ptr_is_owned(arg);
75509         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75510         arg_conv.is_owned = false;
75511         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
75512         return ret_conv;
75513 }
75514
75515 uint64_t  __attribute__((export_name("TS_OnionMessagePath_clone"))) TS_OnionMessagePath_clone(uint64_t orig) {
75516         LDKOnionMessagePath orig_conv;
75517         orig_conv.inner = untag_ptr(orig);
75518         orig_conv.is_owned = ptr_is_owned(orig);
75519         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75520         orig_conv.is_owned = false;
75521         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
75522         uint64_t ret_ref = 0;
75523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75525         return ret_ref;
75526 }
75527
75528 int8_tArray  __attribute__((export_name("TS_OnionMessagePath_first_node"))) TS_OnionMessagePath_first_node(uint64_t this_arg) {
75529         LDKOnionMessagePath this_arg_conv;
75530         this_arg_conv.inner = untag_ptr(this_arg);
75531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75533         this_arg_conv.is_owned = false;
75534         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
75535         memcpy(ret_arr->elems, OnionMessagePath_first_node(&this_arg_conv).compressed_form, 33);
75536         return ret_arr;
75537 }
75538
75539 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
75540         if (!ptr_is_owned(this_ptr)) return;
75541         void* this_ptr_ptr = untag_ptr(this_ptr);
75542         CHECK_ACCESS(this_ptr_ptr);
75543         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
75544         FREE(untag_ptr(this_ptr));
75545         Destination_free(this_ptr_conv);
75546 }
75547
75548 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
75549         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75550         *ret_copy = Destination_clone(arg);
75551         uint64_t ret_ref = tag_ptr(ret_copy, true);
75552         return ret_ref;
75553 }
75554 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
75555         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
75556         int64_t ret_conv = Destination_clone_ptr(arg_conv);
75557         return ret_conv;
75558 }
75559
75560 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
75561         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
75562         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75563         *ret_copy = Destination_clone(orig_conv);
75564         uint64_t ret_ref = tag_ptr(ret_copy, true);
75565         return ret_ref;
75566 }
75567
75568 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
75569         LDKPublicKey a_ref;
75570         CHECK(a->arr_len == 33);
75571         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
75572         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75573         *ret_copy = Destination_node(a_ref);
75574         uint64_t ret_ref = tag_ptr(ret_copy, true);
75575         return ret_ref;
75576 }
75577
75578 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
75579         LDKBlindedPath a_conv;
75580         a_conv.inner = untag_ptr(a);
75581         a_conv.is_owned = ptr_is_owned(a);
75582         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75583         a_conv = BlindedPath_clone(&a_conv);
75584         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75585         *ret_copy = Destination_blinded_path(a_conv);
75586         uint64_t ret_ref = tag_ptr(ret_copy, true);
75587         return ret_ref;
75588 }
75589
75590 int64_t  __attribute__((export_name("TS_Destination_hash"))) TS_Destination_hash(uint64_t o) {
75591         LDKDestination* o_conv = (LDKDestination*)untag_ptr(o);
75592         int64_t ret_conv = Destination_hash(o_conv);
75593         return ret_conv;
75594 }
75595
75596 jboolean  __attribute__((export_name("TS_Destination_eq"))) TS_Destination_eq(uint64_t a, uint64_t b) {
75597         LDKDestination* a_conv = (LDKDestination*)untag_ptr(a);
75598         LDKDestination* b_conv = (LDKDestination*)untag_ptr(b);
75599         jboolean ret_conv = Destination_eq(a_conv, b_conv);
75600         return ret_conv;
75601 }
75602
75603 void  __attribute__((export_name("TS_Destination_resolve"))) TS_Destination_resolve(uint64_t this_arg, uint64_t network_graph) {
75604         LDKDestination* this_arg_conv = (LDKDestination*)untag_ptr(this_arg);
75605         LDKReadOnlyNetworkGraph network_graph_conv;
75606         network_graph_conv.inner = untag_ptr(network_graph);
75607         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75608         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75609         network_graph_conv.is_owned = false;
75610         Destination_resolve(this_arg_conv, &network_graph_conv);
75611 }
75612
75613 void  __attribute__((export_name("TS_SendSuccess_free"))) TS_SendSuccess_free(uint64_t this_ptr) {
75614         if (!ptr_is_owned(this_ptr)) return;
75615         void* this_ptr_ptr = untag_ptr(this_ptr);
75616         CHECK_ACCESS(this_ptr_ptr);
75617         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
75618         FREE(untag_ptr(this_ptr));
75619         SendSuccess_free(this_ptr_conv);
75620 }
75621
75622 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
75623         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75624         *ret_copy = SendSuccess_clone(arg);
75625         uint64_t ret_ref = tag_ptr(ret_copy, true);
75626         return ret_ref;
75627 }
75628 int64_t  __attribute__((export_name("TS_SendSuccess_clone_ptr"))) TS_SendSuccess_clone_ptr(uint64_t arg) {
75629         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
75630         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
75631         return ret_conv;
75632 }
75633
75634 uint64_t  __attribute__((export_name("TS_SendSuccess_clone"))) TS_SendSuccess_clone(uint64_t orig) {
75635         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
75636         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75637         *ret_copy = SendSuccess_clone(orig_conv);
75638         uint64_t ret_ref = tag_ptr(ret_copy, true);
75639         return ret_ref;
75640 }
75641
75642 uint64_t  __attribute__((export_name("TS_SendSuccess_buffered"))) TS_SendSuccess_buffered() {
75643         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75644         *ret_copy = SendSuccess_buffered();
75645         uint64_t ret_ref = tag_ptr(ret_copy, true);
75646         return ret_ref;
75647 }
75648
75649 uint64_t  __attribute__((export_name("TS_SendSuccess_buffered_awaiting_connection"))) TS_SendSuccess_buffered_awaiting_connection(int8_tArray a) {
75650         LDKPublicKey a_ref;
75651         CHECK(a->arr_len == 33);
75652         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
75653         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75654         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
75655         uint64_t ret_ref = tag_ptr(ret_copy, true);
75656         return ret_ref;
75657 }
75658
75659 int64_t  __attribute__((export_name("TS_SendSuccess_hash"))) TS_SendSuccess_hash(uint64_t o) {
75660         LDKSendSuccess* o_conv = (LDKSendSuccess*)untag_ptr(o);
75661         int64_t ret_conv = SendSuccess_hash(o_conv);
75662         return ret_conv;
75663 }
75664
75665 jboolean  __attribute__((export_name("TS_SendSuccess_eq"))) TS_SendSuccess_eq(uint64_t a, uint64_t b) {
75666         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
75667         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
75668         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
75669         return ret_conv;
75670 }
75671
75672 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
75673         if (!ptr_is_owned(this_ptr)) return;
75674         void* this_ptr_ptr = untag_ptr(this_ptr);
75675         CHECK_ACCESS(this_ptr_ptr);
75676         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
75677         FREE(untag_ptr(this_ptr));
75678         SendError_free(this_ptr_conv);
75679 }
75680
75681 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
75682         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75683         *ret_copy = SendError_clone(arg);
75684         uint64_t ret_ref = tag_ptr(ret_copy, true);
75685         return ret_ref;
75686 }
75687 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
75688         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
75689         int64_t ret_conv = SendError_clone_ptr(arg_conv);
75690         return ret_conv;
75691 }
75692
75693 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
75694         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
75695         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75696         *ret_copy = SendError_clone(orig_conv);
75697         uint64_t ret_ref = tag_ptr(ret_copy, true);
75698         return ret_ref;
75699 }
75700
75701 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
75702         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
75703         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75704         *ret_copy = SendError_secp256k1(a_conv);
75705         uint64_t ret_ref = tag_ptr(ret_copy, true);
75706         return ret_ref;
75707 }
75708
75709 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
75710         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75711         *ret_copy = SendError_too_big_packet();
75712         uint64_t ret_ref = tag_ptr(ret_copy, true);
75713         return ret_ref;
75714 }
75715
75716 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
75717         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75718         *ret_copy = SendError_too_few_blinded_hops();
75719         uint64_t ret_ref = tag_ptr(ret_copy, true);
75720         return ret_ref;
75721 }
75722
75723 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop(int8_tArray a) {
75724         LDKPublicKey a_ref;
75725         CHECK(a->arr_len == 33);
75726         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
75727         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75728         *ret_copy = SendError_invalid_first_hop(a_ref);
75729         uint64_t ret_ref = tag_ptr(ret_copy, true);
75730         return ret_ref;
75731 }
75732
75733 uint64_t  __attribute__((export_name("TS_SendError_path_not_found"))) TS_SendError_path_not_found() {
75734         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75735         *ret_copy = SendError_path_not_found();
75736         uint64_t ret_ref = tag_ptr(ret_copy, true);
75737         return ret_ref;
75738 }
75739
75740 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
75741         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75742         *ret_copy = SendError_invalid_message();
75743         uint64_t ret_ref = tag_ptr(ret_copy, true);
75744         return ret_ref;
75745 }
75746
75747 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
75748         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75749         *ret_copy = SendError_buffer_full();
75750         uint64_t ret_ref = tag_ptr(ret_copy, true);
75751         return ret_ref;
75752 }
75753
75754 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
75755         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75756         *ret_copy = SendError_get_node_id_failed();
75757         uint64_t ret_ref = tag_ptr(ret_copy, true);
75758         return ret_ref;
75759 }
75760
75761 uint64_t  __attribute__((export_name("TS_SendError_unresolved_introduction_node"))) TS_SendError_unresolved_introduction_node() {
75762         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75763         *ret_copy = SendError_unresolved_introduction_node();
75764         uint64_t ret_ref = tag_ptr(ret_copy, true);
75765         return ret_ref;
75766 }
75767
75768 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
75769         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75770         *ret_copy = SendError_blinded_path_advance_failed();
75771         uint64_t ret_ref = tag_ptr(ret_copy, true);
75772         return ret_ref;
75773 }
75774
75775 int64_t  __attribute__((export_name("TS_SendError_hash"))) TS_SendError_hash(uint64_t o) {
75776         LDKSendError* o_conv = (LDKSendError*)untag_ptr(o);
75777         int64_t ret_conv = SendError_hash(o_conv);
75778         return ret_conv;
75779 }
75780
75781 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
75782         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
75783         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
75784         jboolean ret_conv = SendError_eq(a_conv, b_conv);
75785         return ret_conv;
75786 }
75787
75788 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
75789         if (!ptr_is_owned(this_ptr)) return;
75790         void* this_ptr_ptr = untag_ptr(this_ptr);
75791         CHECK_ACCESS(this_ptr_ptr);
75792         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
75793         FREE(untag_ptr(this_ptr));
75794         CustomOnionMessageHandler_free(this_ptr_conv);
75795 }
75796
75797 void  __attribute__((export_name("TS_PeeledOnion_free"))) TS_PeeledOnion_free(uint64_t this_ptr) {
75798         if (!ptr_is_owned(this_ptr)) return;
75799         void* this_ptr_ptr = untag_ptr(this_ptr);
75800         CHECK_ACCESS(this_ptr_ptr);
75801         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
75802         FREE(untag_ptr(this_ptr));
75803         PeeledOnion_free(this_ptr_conv);
75804 }
75805
75806 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
75807         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75808         *ret_copy = PeeledOnion_clone(arg);
75809         uint64_t ret_ref = tag_ptr(ret_copy, true);
75810         return ret_ref;
75811 }
75812 int64_t  __attribute__((export_name("TS_PeeledOnion_clone_ptr"))) TS_PeeledOnion_clone_ptr(uint64_t arg) {
75813         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
75814         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
75815         return ret_conv;
75816 }
75817
75818 uint64_t  __attribute__((export_name("TS_PeeledOnion_clone"))) TS_PeeledOnion_clone(uint64_t orig) {
75819         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
75820         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75821         *ret_copy = PeeledOnion_clone(orig_conv);
75822         uint64_t ret_ref = tag_ptr(ret_copy, true);
75823         return ret_ref;
75824 }
75825
75826 uint64_t  __attribute__((export_name("TS_PeeledOnion_forward"))) TS_PeeledOnion_forward(uint64_t a, uint64_t b) {
75827         void* a_ptr = untag_ptr(a);
75828         CHECK_ACCESS(a_ptr);
75829         LDKNextMessageHop a_conv = *(LDKNextMessageHop*)(a_ptr);
75830         a_conv = NextMessageHop_clone((LDKNextMessageHop*)untag_ptr(a));
75831         LDKOnionMessage b_conv;
75832         b_conv.inner = untag_ptr(b);
75833         b_conv.is_owned = ptr_is_owned(b);
75834         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75835         b_conv = OnionMessage_clone(&b_conv);
75836         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75837         *ret_copy = PeeledOnion_forward(a_conv, b_conv);
75838         uint64_t ret_ref = tag_ptr(ret_copy, true);
75839         return ret_ref;
75840 }
75841
75842 uint64_t  __attribute__((export_name("TS_PeeledOnion_receive"))) TS_PeeledOnion_receive(uint64_t a, int8_tArray b, uint64_t c) {
75843         void* a_ptr = untag_ptr(a);
75844         CHECK_ACCESS(a_ptr);
75845         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
75846         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
75847         LDKThirtyTwoBytes b_ref;
75848         CHECK(b->arr_len == 32);
75849         memcpy(b_ref.data, b->elems, 32); FREE(b);
75850         LDKBlindedPath c_conv;
75851         c_conv.inner = untag_ptr(c);
75852         c_conv.is_owned = ptr_is_owned(c);
75853         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
75854         c_conv = BlindedPath_clone(&c_conv);
75855         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75856         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
75857         uint64_t ret_ref = tag_ptr(ret_copy, true);
75858         return ret_ref;
75859 }
75860
75861 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) {
75862         void* entropy_source_ptr = untag_ptr(entropy_source);
75863         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
75864         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
75865         void* node_signer_ptr = untag_ptr(node_signer);
75866         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
75867         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
75868         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
75869         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
75870         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
75871         LDKReadOnlyNetworkGraph network_graph_conv;
75872         network_graph_conv.inner = untag_ptr(network_graph);
75873         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75874         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75875         network_graph_conv.is_owned = false;
75876         LDKOnionMessagePath path_conv;
75877         path_conv.inner = untag_ptr(path);
75878         path_conv.is_owned = ptr_is_owned(path);
75879         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
75880         path_conv = OnionMessagePath_clone(&path_conv);
75881         void* contents_ptr = untag_ptr(contents);
75882         CHECK_ACCESS(contents_ptr);
75883         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
75884         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
75885                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75886                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
75887         }
75888         LDKBlindedPath reply_path_conv;
75889         reply_path_conv.inner = untag_ptr(reply_path);
75890         reply_path_conv.is_owned = ptr_is_owned(reply_path);
75891         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
75892         reply_path_conv = BlindedPath_clone(&reply_path_conv);
75893         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
75894         *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);
75895         return tag_ptr(ret_conv, true);
75896 }
75897
75898 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) {
75899         void* entropy_source_ptr = untag_ptr(entropy_source);
75900         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
75901         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
75902         void* node_signer_ptr = untag_ptr(node_signer);
75903         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
75904         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
75905         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
75906         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
75907         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
75908         LDKOnionMessagePath path_conv;
75909         path_conv.inner = untag_ptr(path);
75910         path_conv.is_owned = ptr_is_owned(path);
75911         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
75912         path_conv = OnionMessagePath_clone(&path_conv);
75913         void* contents_ptr = untag_ptr(contents);
75914         CHECK_ACCESS(contents_ptr);
75915         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
75916         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
75917                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75918                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
75919         }
75920         LDKBlindedPath reply_path_conv;
75921         reply_path_conv.inner = untag_ptr(reply_path);
75922         reply_path_conv.is_owned = ptr_is_owned(reply_path);
75923         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
75924         reply_path_conv = BlindedPath_clone(&reply_path_conv);
75925         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
75926         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, node_id_lookup_conv, path_conv, contents_conv, reply_path_conv);
75927         return tag_ptr(ret_conv, true);
75928 }
75929
75930 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) {
75931         LDKOnionMessage msg_conv;
75932         msg_conv.inner = untag_ptr(msg);
75933         msg_conv.is_owned = ptr_is_owned(msg);
75934         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75935         msg_conv.is_owned = false;
75936         void* node_signer_ptr = untag_ptr(node_signer);
75937         CHECK_ACCESS(node_signer_ptr);
75938         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75939         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75940                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75941                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75942         }
75943         void* logger_ptr = untag_ptr(logger);
75944         CHECK_ACCESS(logger_ptr);
75945         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75946         if (logger_conv.free == LDKLogger_JCalls_free) {
75947                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75948                 LDKLogger_JCalls_cloned(&logger_conv);
75949         }
75950         void* custom_handler_ptr = untag_ptr(custom_handler);
75951         CHECK_ACCESS(custom_handler_ptr);
75952         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
75953         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
75954                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75955                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
75956         }
75957         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
75958         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
75959         return tag_ptr(ret_conv, true);
75960 }
75961
75962 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) {
75963         void* entropy_source_ptr = untag_ptr(entropy_source);
75964         CHECK_ACCESS(entropy_source_ptr);
75965         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75966         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75967                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75968                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75969         }
75970         void* node_signer_ptr = untag_ptr(node_signer);
75971         CHECK_ACCESS(node_signer_ptr);
75972         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75973         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75974                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75975                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75976         }
75977         void* logger_ptr = untag_ptr(logger);
75978         CHECK_ACCESS(logger_ptr);
75979         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75980         if (logger_conv.free == LDKLogger_JCalls_free) {
75981                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75982                 LDKLogger_JCalls_cloned(&logger_conv);
75983         }
75984         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
75985         CHECK_ACCESS(node_id_lookup_ptr);
75986         LDKNodeIdLookUp node_id_lookup_conv = *(LDKNodeIdLookUp*)(node_id_lookup_ptr);
75987         if (node_id_lookup_conv.free == LDKNodeIdLookUp_JCalls_free) {
75988                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75989                 LDKNodeIdLookUp_JCalls_cloned(&node_id_lookup_conv);
75990         }
75991         void* message_router_ptr = untag_ptr(message_router);
75992         CHECK_ACCESS(message_router_ptr);
75993         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
75994         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
75995                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75996                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
75997         }
75998         void* offers_handler_ptr = untag_ptr(offers_handler);
75999         CHECK_ACCESS(offers_handler_ptr);
76000         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
76001         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
76002                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76003                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
76004         }
76005         void* custom_handler_ptr = untag_ptr(custom_handler);
76006         CHECK_ACCESS(custom_handler_ptr);
76007         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
76008         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
76009                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76010                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
76011         }
76012         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);
76013         uint64_t ret_ref = 0;
76014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76016         return ret_ref;
76017 }
76018
76019 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) {
76020         LDKOnionMessenger this_arg_conv;
76021         this_arg_conv.inner = untag_ptr(this_arg);
76022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76024         this_arg_conv.is_owned = false;
76025         void* contents_ptr = untag_ptr(contents);
76026         CHECK_ACCESS(contents_ptr);
76027         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
76028         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
76029                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76030                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
76031         }
76032         void* destination_ptr = untag_ptr(destination);
76033         CHECK_ACCESS(destination_ptr);
76034         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
76035         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
76036         LDKBlindedPath reply_path_conv;
76037         reply_path_conv.inner = untag_ptr(reply_path);
76038         reply_path_conv.is_owned = ptr_is_owned(reply_path);
76039         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
76040         reply_path_conv = BlindedPath_clone(&reply_path_conv);
76041         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
76042         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
76043         return tag_ptr(ret_conv, true);
76044 }
76045
76046 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
76047         LDKOnionMessenger this_arg_conv;
76048         this_arg_conv.inner = untag_ptr(this_arg);
76049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76051         this_arg_conv.is_owned = false;
76052         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
76053         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
76054         return tag_ptr(ret_ret, true);
76055 }
76056
76057 void  __attribute__((export_name("TS_OffersMessageHandler_free"))) TS_OffersMessageHandler_free(uint64_t this_ptr) {
76058         if (!ptr_is_owned(this_ptr)) return;
76059         void* this_ptr_ptr = untag_ptr(this_ptr);
76060         CHECK_ACCESS(this_ptr_ptr);
76061         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
76062         FREE(untag_ptr(this_ptr));
76063         OffersMessageHandler_free(this_ptr_conv);
76064 }
76065
76066 void  __attribute__((export_name("TS_OffersMessage_free"))) TS_OffersMessage_free(uint64_t this_ptr) {
76067         if (!ptr_is_owned(this_ptr)) return;
76068         void* this_ptr_ptr = untag_ptr(this_ptr);
76069         CHECK_ACCESS(this_ptr_ptr);
76070         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
76071         FREE(untag_ptr(this_ptr));
76072         OffersMessage_free(this_ptr_conv);
76073 }
76074
76075 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
76076         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76077         *ret_copy = OffersMessage_clone(arg);
76078         uint64_t ret_ref = tag_ptr(ret_copy, true);
76079         return ret_ref;
76080 }
76081 int64_t  __attribute__((export_name("TS_OffersMessage_clone_ptr"))) TS_OffersMessage_clone_ptr(uint64_t arg) {
76082         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
76083         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
76084         return ret_conv;
76085 }
76086
76087 uint64_t  __attribute__((export_name("TS_OffersMessage_clone"))) TS_OffersMessage_clone(uint64_t orig) {
76088         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
76089         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76090         *ret_copy = OffersMessage_clone(orig_conv);
76091         uint64_t ret_ref = tag_ptr(ret_copy, true);
76092         return ret_ref;
76093 }
76094
76095 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_request"))) TS_OffersMessage_invoice_request(uint64_t a) {
76096         LDKInvoiceRequest a_conv;
76097         a_conv.inner = untag_ptr(a);
76098         a_conv.is_owned = ptr_is_owned(a);
76099         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76100         a_conv = InvoiceRequest_clone(&a_conv);
76101         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76102         *ret_copy = OffersMessage_invoice_request(a_conv);
76103         uint64_t ret_ref = tag_ptr(ret_copy, true);
76104         return ret_ref;
76105 }
76106
76107 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice"))) TS_OffersMessage_invoice(uint64_t a) {
76108         LDKBolt12Invoice a_conv;
76109         a_conv.inner = untag_ptr(a);
76110         a_conv.is_owned = ptr_is_owned(a);
76111         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76112         a_conv = Bolt12Invoice_clone(&a_conv);
76113         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76114         *ret_copy = OffersMessage_invoice(a_conv);
76115         uint64_t ret_ref = tag_ptr(ret_copy, true);
76116         return ret_ref;
76117 }
76118
76119 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_error"))) TS_OffersMessage_invoice_error(uint64_t a) {
76120         LDKInvoiceError a_conv;
76121         a_conv.inner = untag_ptr(a);
76122         a_conv.is_owned = ptr_is_owned(a);
76123         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76124         a_conv = InvoiceError_clone(&a_conv);
76125         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76126         *ret_copy = OffersMessage_invoice_error(a_conv);
76127         uint64_t ret_ref = tag_ptr(ret_copy, true);
76128         return ret_ref;
76129 }
76130
76131 jboolean  __attribute__((export_name("TS_OffersMessage_is_known_type"))) TS_OffersMessage_is_known_type(int64_t tlv_type) {
76132         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
76133         return ret_conv;
76134 }
76135
76136 uint64_t  __attribute__((export_name("TS_OffersMessage_as_OnionMessageContents"))) TS_OffersMessage_as_OnionMessageContents(uint64_t this_arg) {
76137         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
76138         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76139         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
76140         return tag_ptr(ret_ret, true);
76141 }
76142
76143 int8_tArray  __attribute__((export_name("TS_OffersMessage_write"))) TS_OffersMessage_write(uint64_t obj) {
76144         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
76145         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
76146         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76147         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76148         CVec_u8Z_free(ret_var);
76149         return ret_arr;
76150 }
76151
76152 uint64_t  __attribute__((export_name("TS_OffersMessage_read"))) TS_OffersMessage_read(int8_tArray ser, int64_t arg_a, uint64_t arg_b) {
76153         LDKu8slice ser_ref;
76154         ser_ref.datalen = ser->arr_len;
76155         ser_ref.data = ser->elems;
76156         void* arg_b_ptr = untag_ptr(arg_b);
76157         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
76158         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
76159         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
76160         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
76161         FREE(ser);
76162         return tag_ptr(ret_conv, true);
76163 }
76164
76165 void  __attribute__((export_name("TS_Packet_free"))) TS_Packet_free(uint64_t this_obj) {
76166         LDKPacket this_obj_conv;
76167         this_obj_conv.inner = untag_ptr(this_obj);
76168         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76170         Packet_free(this_obj_conv);
76171 }
76172
76173 int8_t  __attribute__((export_name("TS_Packet_get_version"))) TS_Packet_get_version(uint64_t this_ptr) {
76174         LDKPacket this_ptr_conv;
76175         this_ptr_conv.inner = untag_ptr(this_ptr);
76176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76178         this_ptr_conv.is_owned = false;
76179         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
76180         return ret_conv;
76181 }
76182
76183 void  __attribute__((export_name("TS_Packet_set_version"))) TS_Packet_set_version(uint64_t this_ptr, int8_t val) {
76184         LDKPacket this_ptr_conv;
76185         this_ptr_conv.inner = untag_ptr(this_ptr);
76186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76188         this_ptr_conv.is_owned = false;
76189         Packet_set_version(&this_ptr_conv, val);
76190 }
76191
76192 int8_tArray  __attribute__((export_name("TS_Packet_get_public_key"))) TS_Packet_get_public_key(uint64_t this_ptr) {
76193         LDKPacket this_ptr_conv;
76194         this_ptr_conv.inner = untag_ptr(this_ptr);
76195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76197         this_ptr_conv.is_owned = false;
76198         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76199         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
76200         return ret_arr;
76201 }
76202
76203 void  __attribute__((export_name("TS_Packet_set_public_key"))) TS_Packet_set_public_key(uint64_t this_ptr, int8_tArray val) {
76204         LDKPacket this_ptr_conv;
76205         this_ptr_conv.inner = untag_ptr(this_ptr);
76206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76208         this_ptr_conv.is_owned = false;
76209         LDKPublicKey val_ref;
76210         CHECK(val->arr_len == 33);
76211         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
76212         Packet_set_public_key(&this_ptr_conv, val_ref);
76213 }
76214
76215 int8_tArray  __attribute__((export_name("TS_Packet_get_hop_data"))) TS_Packet_get_hop_data(uint64_t this_ptr) {
76216         LDKPacket this_ptr_conv;
76217         this_ptr_conv.inner = untag_ptr(this_ptr);
76218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76220         this_ptr_conv.is_owned = false;
76221         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
76222         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76223         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76224         CVec_u8Z_free(ret_var);
76225         return ret_arr;
76226 }
76227
76228 void  __attribute__((export_name("TS_Packet_set_hop_data"))) TS_Packet_set_hop_data(uint64_t this_ptr, int8_tArray val) {
76229         LDKPacket this_ptr_conv;
76230         this_ptr_conv.inner = untag_ptr(this_ptr);
76231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76233         this_ptr_conv.is_owned = false;
76234         LDKCVec_u8Z val_ref;
76235         val_ref.datalen = val->arr_len;
76236         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
76237         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
76238         Packet_set_hop_data(&this_ptr_conv, val_ref);
76239 }
76240
76241 int8_tArray  __attribute__((export_name("TS_Packet_get_hmac"))) TS_Packet_get_hmac(uint64_t this_ptr) {
76242         LDKPacket this_ptr_conv;
76243         this_ptr_conv.inner = untag_ptr(this_ptr);
76244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76246         this_ptr_conv.is_owned = false;
76247         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76248         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
76249         return ret_arr;
76250 }
76251
76252 void  __attribute__((export_name("TS_Packet_set_hmac"))) TS_Packet_set_hmac(uint64_t this_ptr, int8_tArray val) {
76253         LDKPacket this_ptr_conv;
76254         this_ptr_conv.inner = untag_ptr(this_ptr);
76255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76257         this_ptr_conv.is_owned = false;
76258         LDKThirtyTwoBytes val_ref;
76259         CHECK(val->arr_len == 32);
76260         memcpy(val_ref.data, val->elems, 32); FREE(val);
76261         Packet_set_hmac(&this_ptr_conv, val_ref);
76262 }
76263
76264 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) {
76265         LDKPublicKey public_key_arg_ref;
76266         CHECK(public_key_arg->arr_len == 33);
76267         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
76268         LDKCVec_u8Z hop_data_arg_ref;
76269         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
76270         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
76271         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
76272         LDKThirtyTwoBytes hmac_arg_ref;
76273         CHECK(hmac_arg->arr_len == 32);
76274         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
76275         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
76276         uint64_t ret_ref = 0;
76277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76279         return ret_ref;
76280 }
76281
76282 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
76283         LDKPacket ret_var = Packet_clone(arg);
76284         uint64_t ret_ref = 0;
76285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76287         return ret_ref;
76288 }
76289 int64_t  __attribute__((export_name("TS_Packet_clone_ptr"))) TS_Packet_clone_ptr(uint64_t arg) {
76290         LDKPacket arg_conv;
76291         arg_conv.inner = untag_ptr(arg);
76292         arg_conv.is_owned = ptr_is_owned(arg);
76293         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76294         arg_conv.is_owned = false;
76295         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
76296         return ret_conv;
76297 }
76298
76299 uint64_t  __attribute__((export_name("TS_Packet_clone"))) TS_Packet_clone(uint64_t orig) {
76300         LDKPacket orig_conv;
76301         orig_conv.inner = untag_ptr(orig);
76302         orig_conv.is_owned = ptr_is_owned(orig);
76303         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76304         orig_conv.is_owned = false;
76305         LDKPacket ret_var = Packet_clone(&orig_conv);
76306         uint64_t ret_ref = 0;
76307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76309         return ret_ref;
76310 }
76311
76312 int64_t  __attribute__((export_name("TS_Packet_hash"))) TS_Packet_hash(uint64_t o) {
76313         LDKPacket o_conv;
76314         o_conv.inner = untag_ptr(o);
76315         o_conv.is_owned = ptr_is_owned(o);
76316         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76317         o_conv.is_owned = false;
76318         int64_t ret_conv = Packet_hash(&o_conv);
76319         return ret_conv;
76320 }
76321
76322 jboolean  __attribute__((export_name("TS_Packet_eq"))) TS_Packet_eq(uint64_t a, uint64_t b) {
76323         LDKPacket a_conv;
76324         a_conv.inner = untag_ptr(a);
76325         a_conv.is_owned = ptr_is_owned(a);
76326         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76327         a_conv.is_owned = false;
76328         LDKPacket b_conv;
76329         b_conv.inner = untag_ptr(b);
76330         b_conv.is_owned = ptr_is_owned(b);
76331         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76332         b_conv.is_owned = false;
76333         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
76334         return ret_conv;
76335 }
76336
76337 int8_tArray  __attribute__((export_name("TS_Packet_write"))) TS_Packet_write(uint64_t obj) {
76338         LDKPacket obj_conv;
76339         obj_conv.inner = untag_ptr(obj);
76340         obj_conv.is_owned = ptr_is_owned(obj);
76341         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76342         obj_conv.is_owned = false;
76343         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
76344         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76345         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76346         CVec_u8Z_free(ret_var);
76347         return ret_arr;
76348 }
76349
76350 void  __attribute__((export_name("TS_ParsedOnionMessageContents_free"))) TS_ParsedOnionMessageContents_free(uint64_t this_ptr) {
76351         if (!ptr_is_owned(this_ptr)) return;
76352         void* this_ptr_ptr = untag_ptr(this_ptr);
76353         CHECK_ACCESS(this_ptr_ptr);
76354         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
76355         FREE(untag_ptr(this_ptr));
76356         ParsedOnionMessageContents_free(this_ptr_conv);
76357 }
76358
76359 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
76360         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76361         *ret_copy = ParsedOnionMessageContents_clone(arg);
76362         uint64_t ret_ref = tag_ptr(ret_copy, true);
76363         return ret_ref;
76364 }
76365 int64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone_ptr"))) TS_ParsedOnionMessageContents_clone_ptr(uint64_t arg) {
76366         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
76367         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
76368         return ret_conv;
76369 }
76370
76371 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone"))) TS_ParsedOnionMessageContents_clone(uint64_t orig) {
76372         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
76373         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76374         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
76375         uint64_t ret_ref = tag_ptr(ret_copy, true);
76376         return ret_ref;
76377 }
76378
76379 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_offers"))) TS_ParsedOnionMessageContents_offers(uint64_t a) {
76380         void* a_ptr = untag_ptr(a);
76381         CHECK_ACCESS(a_ptr);
76382         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
76383         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
76384         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76385         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
76386         uint64_t ret_ref = tag_ptr(ret_copy, true);
76387         return ret_ref;
76388 }
76389
76390 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_custom"))) TS_ParsedOnionMessageContents_custom(uint64_t a) {
76391         void* a_ptr = untag_ptr(a);
76392         CHECK_ACCESS(a_ptr);
76393         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
76394         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
76395                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76396                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
76397         }
76398         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76399         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
76400         uint64_t ret_ref = tag_ptr(ret_copy, true);
76401         return ret_ref;
76402 }
76403
76404 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_as_OnionMessageContents"))) TS_ParsedOnionMessageContents_as_OnionMessageContents(uint64_t this_arg) {
76405         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
76406         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76407         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
76408         return tag_ptr(ret_ret, true);
76409 }
76410
76411 int8_tArray  __attribute__((export_name("TS_ParsedOnionMessageContents_write"))) TS_ParsedOnionMessageContents_write(uint64_t obj) {
76412         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
76413         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
76414         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76415         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76416         CVec_u8Z_free(ret_var);
76417         return ret_arr;
76418 }
76419
76420 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
76421         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76422         *ret_ret = OnionMessageContents_clone(arg);
76423         return tag_ptr(ret_ret, true);
76424 }
76425 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
76426         void* arg_ptr = untag_ptr(arg);
76427         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
76428         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
76429         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
76430         return ret_conv;
76431 }
76432
76433 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
76434         void* orig_ptr = untag_ptr(orig);
76435         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
76436         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
76437         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76438         *ret_ret = OnionMessageContents_clone(orig_conv);
76439         return tag_ptr(ret_ret, true);
76440 }
76441
76442 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
76443         if (!ptr_is_owned(this_ptr)) return;
76444         void* this_ptr_ptr = untag_ptr(this_ptr);
76445         CHECK_ACCESS(this_ptr_ptr);
76446         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
76447         FREE(untag_ptr(this_ptr));
76448         OnionMessageContents_free(this_ptr_conv);
76449 }
76450
76451 void  __attribute__((export_name("TS_NextMessageHop_free"))) TS_NextMessageHop_free(uint64_t this_ptr) {
76452         if (!ptr_is_owned(this_ptr)) return;
76453         void* this_ptr_ptr = untag_ptr(this_ptr);
76454         CHECK_ACCESS(this_ptr_ptr);
76455         LDKNextMessageHop this_ptr_conv = *(LDKNextMessageHop*)(this_ptr_ptr);
76456         FREE(untag_ptr(this_ptr));
76457         NextMessageHop_free(this_ptr_conv);
76458 }
76459
76460 static inline uint64_t NextMessageHop_clone_ptr(LDKNextMessageHop *NONNULL_PTR arg) {
76461         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
76462         *ret_copy = NextMessageHop_clone(arg);
76463         uint64_t ret_ref = tag_ptr(ret_copy, true);
76464         return ret_ref;
76465 }
76466 int64_t  __attribute__((export_name("TS_NextMessageHop_clone_ptr"))) TS_NextMessageHop_clone_ptr(uint64_t arg) {
76467         LDKNextMessageHop* arg_conv = (LDKNextMessageHop*)untag_ptr(arg);
76468         int64_t ret_conv = NextMessageHop_clone_ptr(arg_conv);
76469         return ret_conv;
76470 }
76471
76472 uint64_t  __attribute__((export_name("TS_NextMessageHop_clone"))) TS_NextMessageHop_clone(uint64_t orig) {
76473         LDKNextMessageHop* orig_conv = (LDKNextMessageHop*)untag_ptr(orig);
76474         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
76475         *ret_copy = NextMessageHop_clone(orig_conv);
76476         uint64_t ret_ref = tag_ptr(ret_copy, true);
76477         return ret_ref;
76478 }
76479
76480 uint64_t  __attribute__((export_name("TS_NextMessageHop_node_id"))) TS_NextMessageHop_node_id(int8_tArray a) {
76481         LDKPublicKey a_ref;
76482         CHECK(a->arr_len == 33);
76483         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
76484         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
76485         *ret_copy = NextMessageHop_node_id(a_ref);
76486         uint64_t ret_ref = tag_ptr(ret_copy, true);
76487         return ret_ref;
76488 }
76489
76490 uint64_t  __attribute__((export_name("TS_NextMessageHop_short_channel_id"))) TS_NextMessageHop_short_channel_id(int64_t a) {
76491         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
76492         *ret_copy = NextMessageHop_short_channel_id(a);
76493         uint64_t ret_ref = tag_ptr(ret_copy, true);
76494         return ret_ref;
76495 }
76496
76497 int64_t  __attribute__((export_name("TS_NextMessageHop_hash"))) TS_NextMessageHop_hash(uint64_t o) {
76498         LDKNextMessageHop* o_conv = (LDKNextMessageHop*)untag_ptr(o);
76499         int64_t ret_conv = NextMessageHop_hash(o_conv);
76500         return ret_conv;
76501 }
76502
76503 jboolean  __attribute__((export_name("TS_NextMessageHop_eq"))) TS_NextMessageHop_eq(uint64_t a, uint64_t b) {
76504         LDKNextMessageHop* a_conv = (LDKNextMessageHop*)untag_ptr(a);
76505         LDKNextMessageHop* b_conv = (LDKNextMessageHop*)untag_ptr(b);
76506         jboolean ret_conv = NextMessageHop_eq(a_conv, b_conv);
76507         return ret_conv;
76508 }
76509
76510 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
76511         LDKBlindedPath this_obj_conv;
76512         this_obj_conv.inner = untag_ptr(this_obj);
76513         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76515         BlindedPath_free(this_obj_conv);
76516 }
76517
76518 uint64_t  __attribute__((export_name("TS_BlindedPath_get_introduction_node"))) TS_BlindedPath_get_introduction_node(uint64_t this_ptr) {
76519         LDKBlindedPath this_ptr_conv;
76520         this_ptr_conv.inner = untag_ptr(this_ptr);
76521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76523         this_ptr_conv.is_owned = false;
76524         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
76525         *ret_copy = BlindedPath_get_introduction_node(&this_ptr_conv);
76526         uint64_t ret_ref = tag_ptr(ret_copy, true);
76527         return ret_ref;
76528 }
76529
76530 void  __attribute__((export_name("TS_BlindedPath_set_introduction_node"))) TS_BlindedPath_set_introduction_node(uint64_t this_ptr, uint64_t val) {
76531         LDKBlindedPath this_ptr_conv;
76532         this_ptr_conv.inner = untag_ptr(this_ptr);
76533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76535         this_ptr_conv.is_owned = false;
76536         void* val_ptr = untag_ptr(val);
76537         CHECK_ACCESS(val_ptr);
76538         LDKIntroductionNode val_conv = *(LDKIntroductionNode*)(val_ptr);
76539         val_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(val));
76540         BlindedPath_set_introduction_node(&this_ptr_conv, val_conv);
76541 }
76542
76543 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_blinding_point"))) TS_BlindedPath_get_blinding_point(uint64_t this_ptr) {
76544         LDKBlindedPath this_ptr_conv;
76545         this_ptr_conv.inner = untag_ptr(this_ptr);
76546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76548         this_ptr_conv.is_owned = false;
76549         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76550         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
76551         return ret_arr;
76552 }
76553
76554 void  __attribute__((export_name("TS_BlindedPath_set_blinding_point"))) TS_BlindedPath_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
76555         LDKBlindedPath this_ptr_conv;
76556         this_ptr_conv.inner = untag_ptr(this_ptr);
76557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76559         this_ptr_conv.is_owned = false;
76560         LDKPublicKey val_ref;
76561         CHECK(val->arr_len == 33);
76562         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
76563         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
76564 }
76565
76566 uint64_tArray  __attribute__((export_name("TS_BlindedPath_get_blinded_hops"))) TS_BlindedPath_get_blinded_hops(uint64_t this_ptr) {
76567         LDKBlindedPath this_ptr_conv;
76568         this_ptr_conv.inner = untag_ptr(this_ptr);
76569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76571         this_ptr_conv.is_owned = false;
76572         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
76573         uint64_tArray ret_arr = NULL;
76574         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
76575         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
76576         for (size_t m = 0; m < ret_var.datalen; m++) {
76577                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
76578                 uint64_t ret_conv_12_ref = 0;
76579                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
76580                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
76581                 ret_arr_ptr[m] = ret_conv_12_ref;
76582         }
76583         
76584         FREE(ret_var.data);
76585         return ret_arr;
76586 }
76587
76588 void  __attribute__((export_name("TS_BlindedPath_set_blinded_hops"))) TS_BlindedPath_set_blinded_hops(uint64_t this_ptr, uint64_tArray val) {
76589         LDKBlindedPath this_ptr_conv;
76590         this_ptr_conv.inner = untag_ptr(this_ptr);
76591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76593         this_ptr_conv.is_owned = false;
76594         LDKCVec_BlindedHopZ val_constr;
76595         val_constr.datalen = val->arr_len;
76596         if (val_constr.datalen > 0)
76597                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
76598         else
76599                 val_constr.data = NULL;
76600         uint64_t* val_vals = val->elems;
76601         for (size_t m = 0; m < val_constr.datalen; m++) {
76602                 uint64_t val_conv_12 = val_vals[m];
76603                 LDKBlindedHop val_conv_12_conv;
76604                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
76605                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
76606                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
76607                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
76608                 val_constr.data[m] = val_conv_12_conv;
76609         }
76610         FREE(val);
76611         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
76612 }
76613
76614 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) {
76615         void* introduction_node_arg_ptr = untag_ptr(introduction_node_arg);
76616         CHECK_ACCESS(introduction_node_arg_ptr);
76617         LDKIntroductionNode introduction_node_arg_conv = *(LDKIntroductionNode*)(introduction_node_arg_ptr);
76618         introduction_node_arg_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(introduction_node_arg));
76619         LDKPublicKey blinding_point_arg_ref;
76620         CHECK(blinding_point_arg->arr_len == 33);
76621         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
76622         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
76623         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
76624         if (blinded_hops_arg_constr.datalen > 0)
76625                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
76626         else
76627                 blinded_hops_arg_constr.data = NULL;
76628         uint64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
76629         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
76630                 uint64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
76631                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
76632                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
76633                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
76634                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
76635                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
76636                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
76637         }
76638         FREE(blinded_hops_arg);
76639         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_arg_conv, blinding_point_arg_ref, blinded_hops_arg_constr);
76640         uint64_t ret_ref = 0;
76641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76643         return ret_ref;
76644 }
76645
76646 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
76647         LDKBlindedPath ret_var = BlindedPath_clone(arg);
76648         uint64_t ret_ref = 0;
76649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76651         return ret_ref;
76652 }
76653 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
76654         LDKBlindedPath arg_conv;
76655         arg_conv.inner = untag_ptr(arg);
76656         arg_conv.is_owned = ptr_is_owned(arg);
76657         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76658         arg_conv.is_owned = false;
76659         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
76660         return ret_conv;
76661 }
76662
76663 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
76664         LDKBlindedPath orig_conv;
76665         orig_conv.inner = untag_ptr(orig);
76666         orig_conv.is_owned = ptr_is_owned(orig);
76667         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76668         orig_conv.is_owned = false;
76669         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
76670         uint64_t ret_ref = 0;
76671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76673         return ret_ref;
76674 }
76675
76676 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
76677         LDKBlindedPath o_conv;
76678         o_conv.inner = untag_ptr(o);
76679         o_conv.is_owned = ptr_is_owned(o);
76680         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76681         o_conv.is_owned = false;
76682         int64_t ret_conv = BlindedPath_hash(&o_conv);
76683         return ret_conv;
76684 }
76685
76686 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
76687         LDKBlindedPath a_conv;
76688         a_conv.inner = untag_ptr(a);
76689         a_conv.is_owned = ptr_is_owned(a);
76690         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76691         a_conv.is_owned = false;
76692         LDKBlindedPath b_conv;
76693         b_conv.inner = untag_ptr(b);
76694         b_conv.is_owned = ptr_is_owned(b);
76695         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76696         b_conv.is_owned = false;
76697         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
76698         return ret_conv;
76699 }
76700
76701 void  __attribute__((export_name("TS_IntroductionNode_free"))) TS_IntroductionNode_free(uint64_t this_ptr) {
76702         if (!ptr_is_owned(this_ptr)) return;
76703         void* this_ptr_ptr = untag_ptr(this_ptr);
76704         CHECK_ACCESS(this_ptr_ptr);
76705         LDKIntroductionNode this_ptr_conv = *(LDKIntroductionNode*)(this_ptr_ptr);
76706         FREE(untag_ptr(this_ptr));
76707         IntroductionNode_free(this_ptr_conv);
76708 }
76709
76710 static inline uint64_t IntroductionNode_clone_ptr(LDKIntroductionNode *NONNULL_PTR arg) {
76711         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
76712         *ret_copy = IntroductionNode_clone(arg);
76713         uint64_t ret_ref = tag_ptr(ret_copy, true);
76714         return ret_ref;
76715 }
76716 int64_t  __attribute__((export_name("TS_IntroductionNode_clone_ptr"))) TS_IntroductionNode_clone_ptr(uint64_t arg) {
76717         LDKIntroductionNode* arg_conv = (LDKIntroductionNode*)untag_ptr(arg);
76718         int64_t ret_conv = IntroductionNode_clone_ptr(arg_conv);
76719         return ret_conv;
76720 }
76721
76722 uint64_t  __attribute__((export_name("TS_IntroductionNode_clone"))) TS_IntroductionNode_clone(uint64_t orig) {
76723         LDKIntroductionNode* orig_conv = (LDKIntroductionNode*)untag_ptr(orig);
76724         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
76725         *ret_copy = IntroductionNode_clone(orig_conv);
76726         uint64_t ret_ref = tag_ptr(ret_copy, true);
76727         return ret_ref;
76728 }
76729
76730 uint64_t  __attribute__((export_name("TS_IntroductionNode_node_id"))) TS_IntroductionNode_node_id(int8_tArray a) {
76731         LDKPublicKey a_ref;
76732         CHECK(a->arr_len == 33);
76733         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
76734         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
76735         *ret_copy = IntroductionNode_node_id(a_ref);
76736         uint64_t ret_ref = tag_ptr(ret_copy, true);
76737         return ret_ref;
76738 }
76739
76740 uint64_t  __attribute__((export_name("TS_IntroductionNode_directed_short_channel_id"))) TS_IntroductionNode_directed_short_channel_id(uint32_t a, int64_t b) {
76741         LDKDirection a_conv = LDKDirection_from_js(a);
76742         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
76743         *ret_copy = IntroductionNode_directed_short_channel_id(a_conv, b);
76744         uint64_t ret_ref = tag_ptr(ret_copy, true);
76745         return ret_ref;
76746 }
76747
76748 int64_t  __attribute__((export_name("TS_IntroductionNode_hash"))) TS_IntroductionNode_hash(uint64_t o) {
76749         LDKIntroductionNode* o_conv = (LDKIntroductionNode*)untag_ptr(o);
76750         int64_t ret_conv = IntroductionNode_hash(o_conv);
76751         return ret_conv;
76752 }
76753
76754 jboolean  __attribute__((export_name("TS_IntroductionNode_eq"))) TS_IntroductionNode_eq(uint64_t a, uint64_t b) {
76755         LDKIntroductionNode* a_conv = (LDKIntroductionNode*)untag_ptr(a);
76756         LDKIntroductionNode* b_conv = (LDKIntroductionNode*)untag_ptr(b);
76757         jboolean ret_conv = IntroductionNode_eq(a_conv, b_conv);
76758         return ret_conv;
76759 }
76760
76761 uint32_t  __attribute__((export_name("TS_Direction_clone"))) TS_Direction_clone(uint64_t orig) {
76762         LDKDirection* orig_conv = (LDKDirection*)untag_ptr(orig);
76763         uint32_t ret_conv = LDKDirection_to_js(Direction_clone(orig_conv));
76764         return ret_conv;
76765 }
76766
76767 uint32_t  __attribute__((export_name("TS_Direction_node_one"))) TS_Direction_node_one() {
76768         uint32_t ret_conv = LDKDirection_to_js(Direction_node_one());
76769         return ret_conv;
76770 }
76771
76772 uint32_t  __attribute__((export_name("TS_Direction_node_two"))) TS_Direction_node_two() {
76773         uint32_t ret_conv = LDKDirection_to_js(Direction_node_two());
76774         return ret_conv;
76775 }
76776
76777 int64_t  __attribute__((export_name("TS_Direction_hash"))) TS_Direction_hash(uint64_t o) {
76778         LDKDirection* o_conv = (LDKDirection*)untag_ptr(o);
76779         int64_t ret_conv = Direction_hash(o_conv);
76780         return ret_conv;
76781 }
76782
76783 jboolean  __attribute__((export_name("TS_Direction_eq"))) TS_Direction_eq(uint64_t a, uint64_t b) {
76784         LDKDirection* a_conv = (LDKDirection*)untag_ptr(a);
76785         LDKDirection* b_conv = (LDKDirection*)untag_ptr(b);
76786         jboolean ret_conv = Direction_eq(a_conv, b_conv);
76787         return ret_conv;
76788 }
76789
76790 void  __attribute__((export_name("TS_NodeIdLookUp_free"))) TS_NodeIdLookUp_free(uint64_t this_ptr) {
76791         if (!ptr_is_owned(this_ptr)) return;
76792         void* this_ptr_ptr = untag_ptr(this_ptr);
76793         CHECK_ACCESS(this_ptr_ptr);
76794         LDKNodeIdLookUp this_ptr_conv = *(LDKNodeIdLookUp*)(this_ptr_ptr);
76795         FREE(untag_ptr(this_ptr));
76796         NodeIdLookUp_free(this_ptr_conv);
76797 }
76798
76799 void  __attribute__((export_name("TS_EmptyNodeIdLookUp_free"))) TS_EmptyNodeIdLookUp_free(uint64_t this_obj) {
76800         LDKEmptyNodeIdLookUp this_obj_conv;
76801         this_obj_conv.inner = untag_ptr(this_obj);
76802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76804         EmptyNodeIdLookUp_free(this_obj_conv);
76805 }
76806
76807 uint64_t  __attribute__((export_name("TS_EmptyNodeIdLookUp_new"))) TS_EmptyNodeIdLookUp_new() {
76808         LDKEmptyNodeIdLookUp ret_var = EmptyNodeIdLookUp_new();
76809         uint64_t ret_ref = 0;
76810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76812         return ret_ref;
76813 }
76814
76815 uint64_t  __attribute__((export_name("TS_EmptyNodeIdLookUp_as_NodeIdLookUp"))) TS_EmptyNodeIdLookUp_as_NodeIdLookUp(uint64_t this_arg) {
76816         LDKEmptyNodeIdLookUp this_arg_conv;
76817         this_arg_conv.inner = untag_ptr(this_arg);
76818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76820         this_arg_conv.is_owned = false;
76821         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
76822         *ret_ret = EmptyNodeIdLookUp_as_NodeIdLookUp(&this_arg_conv);
76823         return tag_ptr(ret_ret, true);
76824 }
76825
76826 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
76827         LDKBlindedHop this_obj_conv;
76828         this_obj_conv.inner = untag_ptr(this_obj);
76829         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76831         BlindedHop_free(this_obj_conv);
76832 }
76833
76834 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_blinded_node_id"))) TS_BlindedHop_get_blinded_node_id(uint64_t this_ptr) {
76835         LDKBlindedHop this_ptr_conv;
76836         this_ptr_conv.inner = untag_ptr(this_ptr);
76837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76839         this_ptr_conv.is_owned = false;
76840         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76841         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
76842         return ret_arr;
76843 }
76844
76845 void  __attribute__((export_name("TS_BlindedHop_set_blinded_node_id"))) TS_BlindedHop_set_blinded_node_id(uint64_t this_ptr, int8_tArray val) {
76846         LDKBlindedHop this_ptr_conv;
76847         this_ptr_conv.inner = untag_ptr(this_ptr);
76848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76850         this_ptr_conv.is_owned = false;
76851         LDKPublicKey val_ref;
76852         CHECK(val->arr_len == 33);
76853         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
76854         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
76855 }
76856
76857 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_encrypted_payload"))) TS_BlindedHop_get_encrypted_payload(uint64_t this_ptr) {
76858         LDKBlindedHop this_ptr_conv;
76859         this_ptr_conv.inner = untag_ptr(this_ptr);
76860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76862         this_ptr_conv.is_owned = false;
76863         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
76864         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76865         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76866         CVec_u8Z_free(ret_var);
76867         return ret_arr;
76868 }
76869
76870 void  __attribute__((export_name("TS_BlindedHop_set_encrypted_payload"))) TS_BlindedHop_set_encrypted_payload(uint64_t this_ptr, int8_tArray val) {
76871         LDKBlindedHop this_ptr_conv;
76872         this_ptr_conv.inner = untag_ptr(this_ptr);
76873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76875         this_ptr_conv.is_owned = false;
76876         LDKCVec_u8Z val_ref;
76877         val_ref.datalen = val->arr_len;
76878         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
76879         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
76880         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
76881 }
76882
76883 uint64_t  __attribute__((export_name("TS_BlindedHop_new"))) TS_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
76884         LDKPublicKey blinded_node_id_arg_ref;
76885         CHECK(blinded_node_id_arg->arr_len == 33);
76886         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
76887         LDKCVec_u8Z encrypted_payload_arg_ref;
76888         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
76889         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
76890         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
76891         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
76892         uint64_t ret_ref = 0;
76893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76895         return ret_ref;
76896 }
76897
76898 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
76899         LDKBlindedHop ret_var = BlindedHop_clone(arg);
76900         uint64_t ret_ref = 0;
76901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76903         return ret_ref;
76904 }
76905 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
76906         LDKBlindedHop arg_conv;
76907         arg_conv.inner = untag_ptr(arg);
76908         arg_conv.is_owned = ptr_is_owned(arg);
76909         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76910         arg_conv.is_owned = false;
76911         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
76912         return ret_conv;
76913 }
76914
76915 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
76916         LDKBlindedHop orig_conv;
76917         orig_conv.inner = untag_ptr(orig);
76918         orig_conv.is_owned = ptr_is_owned(orig);
76919         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76920         orig_conv.is_owned = false;
76921         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
76922         uint64_t ret_ref = 0;
76923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76925         return ret_ref;
76926 }
76927
76928 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
76929         LDKBlindedHop o_conv;
76930         o_conv.inner = untag_ptr(o);
76931         o_conv.is_owned = ptr_is_owned(o);
76932         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76933         o_conv.is_owned = false;
76934         int64_t ret_conv = BlindedHop_hash(&o_conv);
76935         return ret_conv;
76936 }
76937
76938 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
76939         LDKBlindedHop a_conv;
76940         a_conv.inner = untag_ptr(a);
76941         a_conv.is_owned = ptr_is_owned(a);
76942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76943         a_conv.is_owned = false;
76944         LDKBlindedHop b_conv;
76945         b_conv.inner = untag_ptr(b);
76946         b_conv.is_owned = ptr_is_owned(b);
76947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76948         b_conv.is_owned = false;
76949         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
76950         return ret_conv;
76951 }
76952
76953 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) {
76954         LDKPublicKey recipient_node_id_ref;
76955         CHECK(recipient_node_id->arr_len == 33);
76956         memcpy(recipient_node_id_ref.compressed_form, recipient_node_id->elems, 33); FREE(recipient_node_id);
76957         void* entropy_source_ptr = untag_ptr(entropy_source);
76958         CHECK_ACCESS(entropy_source_ptr);
76959         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76960         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76961                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76962                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76963         }
76964         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
76965         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
76966         return tag_ptr(ret_conv, true);
76967 }
76968
76969 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
76970         LDKCVec_PublicKeyZ node_pks_constr;
76971         node_pks_constr.datalen = node_pks->arr_len;
76972         if (node_pks_constr.datalen > 0)
76973                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
76974         else
76975                 node_pks_constr.data = NULL;
76976         int8_tArray* node_pks_vals = (void*) node_pks->elems;
76977         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
76978                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
76979                 LDKPublicKey node_pks_conv_12_ref;
76980                 CHECK(node_pks_conv_12->arr_len == 33);
76981                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
76982                 node_pks_constr.data[m] = node_pks_conv_12_ref;
76983         }
76984         FREE(node_pks);
76985         void* entropy_source_ptr = untag_ptr(entropy_source);
76986         CHECK_ACCESS(entropy_source_ptr);
76987         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76988         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76989                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76990                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76991         }
76992         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
76993         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
76994         return tag_ptr(ret_conv, true);
76995 }
76996
76997 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) {
76998         LDKPublicKey payee_node_id_ref;
76999         CHECK(payee_node_id->arr_len == 33);
77000         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
77001         LDKReceiveTlvs payee_tlvs_conv;
77002         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
77003         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
77004         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
77005         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
77006         void* entropy_source_ptr = untag_ptr(entropy_source);
77007         CHECK_ACCESS(entropy_source_ptr);
77008         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
77009         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
77010                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77011                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
77012         }
77013         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
77014         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, min_final_cltv_expiry_delta, entropy_source_conv);
77015         return tag_ptr(ret_conv, true);
77016 }
77017
77018 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) {
77019         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
77020         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
77021         if (intermediate_nodes_constr.datalen > 0)
77022                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
77023         else
77024                 intermediate_nodes_constr.data = NULL;
77025         uint64_t* intermediate_nodes_vals = intermediate_nodes->elems;
77026         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
77027                 uint64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
77028                 LDKForwardNode intermediate_nodes_conv_13_conv;
77029                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
77030                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
77031                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
77032                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
77033                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
77034         }
77035         FREE(intermediate_nodes);
77036         LDKPublicKey payee_node_id_ref;
77037         CHECK(payee_node_id->arr_len == 33);
77038         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
77039         LDKReceiveTlvs payee_tlvs_conv;
77040         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
77041         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
77042         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
77043         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
77044         void* entropy_source_ptr = untag_ptr(entropy_source);
77045         CHECK_ACCESS(entropy_source_ptr);
77046         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
77047         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
77048                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77049                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
77050         }
77051         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
77052         *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);
77053         return tag_ptr(ret_conv, true);
77054 }
77055
77056 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) {
77057         LDKBlindedPath this_arg_conv;
77058         this_arg_conv.inner = untag_ptr(this_arg);
77059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77061         this_arg_conv.is_owned = false;
77062         LDKReadOnlyNetworkGraph network_graph_conv;
77063         network_graph_conv.inner = untag_ptr(network_graph);
77064         network_graph_conv.is_owned = ptr_is_owned(network_graph);
77065         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
77066         network_graph_conv.is_owned = false;
77067         LDKNodeId ret_var = BlindedPath_public_introduction_node_id(&this_arg_conv, &network_graph_conv);
77068         uint64_t ret_ref = 0;
77069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77071         return ret_ref;
77072 }
77073
77074 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
77075         LDKBlindedPath obj_conv;
77076         obj_conv.inner = untag_ptr(obj);
77077         obj_conv.is_owned = ptr_is_owned(obj);
77078         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77079         obj_conv.is_owned = false;
77080         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
77081         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
77082         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
77083         CVec_u8Z_free(ret_var);
77084         return ret_arr;
77085 }
77086
77087 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
77088         LDKu8slice ser_ref;
77089         ser_ref.datalen = ser->arr_len;
77090         ser_ref.data = ser->elems;
77091         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
77092         *ret_conv = BlindedPath_read(ser_ref);
77093         FREE(ser);
77094         return tag_ptr(ret_conv, true);
77095 }
77096
77097 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
77098         LDKBlindedHop obj_conv;
77099         obj_conv.inner = untag_ptr(obj);
77100         obj_conv.is_owned = ptr_is_owned(obj);
77101         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77102         obj_conv.is_owned = false;
77103         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
77104         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
77105         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
77106         CVec_u8Z_free(ret_var);
77107         return ret_arr;
77108 }
77109
77110 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
77111         LDKu8slice ser_ref;
77112         ser_ref.datalen = ser->arr_len;
77113         ser_ref.data = ser->elems;
77114         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
77115         *ret_conv = BlindedHop_read(ser_ref);
77116         FREE(ser);
77117         return tag_ptr(ret_conv, true);
77118 }
77119
77120 void  __attribute__((export_name("TS_ForwardNode_free"))) TS_ForwardNode_free(uint64_t this_obj) {
77121         LDKForwardNode this_obj_conv;
77122         this_obj_conv.inner = untag_ptr(this_obj);
77123         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77125         ForwardNode_free(this_obj_conv);
77126 }
77127
77128 uint64_t  __attribute__((export_name("TS_ForwardNode_get_tlvs"))) TS_ForwardNode_get_tlvs(uint64_t this_ptr) {
77129         LDKForwardNode this_ptr_conv;
77130         this_ptr_conv.inner = untag_ptr(this_ptr);
77131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77133         this_ptr_conv.is_owned = false;
77134         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
77135         uint64_t ret_ref = 0;
77136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77138         return ret_ref;
77139 }
77140
77141 void  __attribute__((export_name("TS_ForwardNode_set_tlvs"))) TS_ForwardNode_set_tlvs(uint64_t this_ptr, uint64_t val) {
77142         LDKForwardNode this_ptr_conv;
77143         this_ptr_conv.inner = untag_ptr(this_ptr);
77144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77146         this_ptr_conv.is_owned = false;
77147         LDKForwardTlvs val_conv;
77148         val_conv.inner = untag_ptr(val);
77149         val_conv.is_owned = ptr_is_owned(val);
77150         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77151         val_conv = ForwardTlvs_clone(&val_conv);
77152         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
77153 }
77154
77155 int8_tArray  __attribute__((export_name("TS_ForwardNode_get_node_id"))) TS_ForwardNode_get_node_id(uint64_t this_ptr) {
77156         LDKForwardNode this_ptr_conv;
77157         this_ptr_conv.inner = untag_ptr(this_ptr);
77158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77160         this_ptr_conv.is_owned = false;
77161         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
77162         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
77163         return ret_arr;
77164 }
77165
77166 void  __attribute__((export_name("TS_ForwardNode_set_node_id"))) TS_ForwardNode_set_node_id(uint64_t this_ptr, int8_tArray val) {
77167         LDKForwardNode this_ptr_conv;
77168         this_ptr_conv.inner = untag_ptr(this_ptr);
77169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77171         this_ptr_conv.is_owned = false;
77172         LDKPublicKey val_ref;
77173         CHECK(val->arr_len == 33);
77174         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
77175         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
77176 }
77177
77178 int64_t  __attribute__((export_name("TS_ForwardNode_get_htlc_maximum_msat"))) TS_ForwardNode_get_htlc_maximum_msat(uint64_t this_ptr) {
77179         LDKForwardNode this_ptr_conv;
77180         this_ptr_conv.inner = untag_ptr(this_ptr);
77181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77183         this_ptr_conv.is_owned = false;
77184         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
77185         return ret_conv;
77186 }
77187
77188 void  __attribute__((export_name("TS_ForwardNode_set_htlc_maximum_msat"))) TS_ForwardNode_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
77189         LDKForwardNode this_ptr_conv;
77190         this_ptr_conv.inner = untag_ptr(this_ptr);
77191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77193         this_ptr_conv.is_owned = false;
77194         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
77195 }
77196
77197 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) {
77198         LDKForwardTlvs tlvs_arg_conv;
77199         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
77200         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
77201         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
77202         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
77203         LDKPublicKey node_id_arg_ref;
77204         CHECK(node_id_arg->arr_len == 33);
77205         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
77206         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
77207         uint64_t ret_ref = 0;
77208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77210         return ret_ref;
77211 }
77212
77213 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
77214         LDKForwardNode ret_var = ForwardNode_clone(arg);
77215         uint64_t ret_ref = 0;
77216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77218         return ret_ref;
77219 }
77220 int64_t  __attribute__((export_name("TS_ForwardNode_clone_ptr"))) TS_ForwardNode_clone_ptr(uint64_t arg) {
77221         LDKForwardNode arg_conv;
77222         arg_conv.inner = untag_ptr(arg);
77223         arg_conv.is_owned = ptr_is_owned(arg);
77224         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77225         arg_conv.is_owned = false;
77226         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
77227         return ret_conv;
77228 }
77229
77230 uint64_t  __attribute__((export_name("TS_ForwardNode_clone"))) TS_ForwardNode_clone(uint64_t orig) {
77231         LDKForwardNode orig_conv;
77232         orig_conv.inner = untag_ptr(orig);
77233         orig_conv.is_owned = ptr_is_owned(orig);
77234         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77235         orig_conv.is_owned = false;
77236         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
77237         uint64_t ret_ref = 0;
77238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77240         return ret_ref;
77241 }
77242
77243 void  __attribute__((export_name("TS_ForwardTlvs_free"))) TS_ForwardTlvs_free(uint64_t this_obj) {
77244         LDKForwardTlvs this_obj_conv;
77245         this_obj_conv.inner = untag_ptr(this_obj);
77246         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77248         ForwardTlvs_free(this_obj_conv);
77249 }
77250
77251 int64_t  __attribute__((export_name("TS_ForwardTlvs_get_short_channel_id"))) TS_ForwardTlvs_get_short_channel_id(uint64_t this_ptr) {
77252         LDKForwardTlvs this_ptr_conv;
77253         this_ptr_conv.inner = untag_ptr(this_ptr);
77254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77256         this_ptr_conv.is_owned = false;
77257         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
77258         return ret_conv;
77259 }
77260
77261 void  __attribute__((export_name("TS_ForwardTlvs_set_short_channel_id"))) TS_ForwardTlvs_set_short_channel_id(uint64_t this_ptr, int64_t val) {
77262         LDKForwardTlvs this_ptr_conv;
77263         this_ptr_conv.inner = untag_ptr(this_ptr);
77264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77266         this_ptr_conv.is_owned = false;
77267         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
77268 }
77269
77270 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_relay"))) TS_ForwardTlvs_get_payment_relay(uint64_t this_ptr) {
77271         LDKForwardTlvs this_ptr_conv;
77272         this_ptr_conv.inner = untag_ptr(this_ptr);
77273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77275         this_ptr_conv.is_owned = false;
77276         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
77277         uint64_t ret_ref = 0;
77278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77280         return ret_ref;
77281 }
77282
77283 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_relay"))) TS_ForwardTlvs_set_payment_relay(uint64_t this_ptr, uint64_t val) {
77284         LDKForwardTlvs this_ptr_conv;
77285         this_ptr_conv.inner = untag_ptr(this_ptr);
77286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77288         this_ptr_conv.is_owned = false;
77289         LDKPaymentRelay val_conv;
77290         val_conv.inner = untag_ptr(val);
77291         val_conv.is_owned = ptr_is_owned(val);
77292         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77293         val_conv = PaymentRelay_clone(&val_conv);
77294         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
77295 }
77296
77297 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_constraints"))) TS_ForwardTlvs_get_payment_constraints(uint64_t this_ptr) {
77298         LDKForwardTlvs this_ptr_conv;
77299         this_ptr_conv.inner = untag_ptr(this_ptr);
77300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77302         this_ptr_conv.is_owned = false;
77303         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
77304         uint64_t ret_ref = 0;
77305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77307         return ret_ref;
77308 }
77309
77310 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_constraints"))) TS_ForwardTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
77311         LDKForwardTlvs this_ptr_conv;
77312         this_ptr_conv.inner = untag_ptr(this_ptr);
77313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77315         this_ptr_conv.is_owned = false;
77316         LDKPaymentConstraints val_conv;
77317         val_conv.inner = untag_ptr(val);
77318         val_conv.is_owned = ptr_is_owned(val);
77319         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77320         val_conv = PaymentConstraints_clone(&val_conv);
77321         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
77322 }
77323
77324 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_features"))) TS_ForwardTlvs_get_features(uint64_t this_ptr) {
77325         LDKForwardTlvs this_ptr_conv;
77326         this_ptr_conv.inner = untag_ptr(this_ptr);
77327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77329         this_ptr_conv.is_owned = false;
77330         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
77331         uint64_t ret_ref = 0;
77332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77334         return ret_ref;
77335 }
77336
77337 void  __attribute__((export_name("TS_ForwardTlvs_set_features"))) TS_ForwardTlvs_set_features(uint64_t this_ptr, uint64_t val) {
77338         LDKForwardTlvs this_ptr_conv;
77339         this_ptr_conv.inner = untag_ptr(this_ptr);
77340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77342         this_ptr_conv.is_owned = false;
77343         LDKBlindedHopFeatures val_conv;
77344         val_conv.inner = untag_ptr(val);
77345         val_conv.is_owned = ptr_is_owned(val);
77346         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77347         val_conv = BlindedHopFeatures_clone(&val_conv);
77348         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
77349 }
77350
77351 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) {
77352         LDKPaymentRelay payment_relay_arg_conv;
77353         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
77354         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
77355         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
77356         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
77357         LDKPaymentConstraints payment_constraints_arg_conv;
77358         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
77359         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
77360         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
77361         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
77362         LDKBlindedHopFeatures features_arg_conv;
77363         features_arg_conv.inner = untag_ptr(features_arg);
77364         features_arg_conv.is_owned = ptr_is_owned(features_arg);
77365         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
77366         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
77367         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
77368         uint64_t ret_ref = 0;
77369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77371         return ret_ref;
77372 }
77373
77374 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
77375         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
77376         uint64_t ret_ref = 0;
77377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77379         return ret_ref;
77380 }
77381 int64_t  __attribute__((export_name("TS_ForwardTlvs_clone_ptr"))) TS_ForwardTlvs_clone_ptr(uint64_t arg) {
77382         LDKForwardTlvs arg_conv;
77383         arg_conv.inner = untag_ptr(arg);
77384         arg_conv.is_owned = ptr_is_owned(arg);
77385         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77386         arg_conv.is_owned = false;
77387         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
77388         return ret_conv;
77389 }
77390
77391 uint64_t  __attribute__((export_name("TS_ForwardTlvs_clone"))) TS_ForwardTlvs_clone(uint64_t orig) {
77392         LDKForwardTlvs orig_conv;
77393         orig_conv.inner = untag_ptr(orig);
77394         orig_conv.is_owned = ptr_is_owned(orig);
77395         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77396         orig_conv.is_owned = false;
77397         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
77398         uint64_t ret_ref = 0;
77399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77401         return ret_ref;
77402 }
77403
77404 void  __attribute__((export_name("TS_ReceiveTlvs_free"))) TS_ReceiveTlvs_free(uint64_t this_obj) {
77405         LDKReceiveTlvs this_obj_conv;
77406         this_obj_conv.inner = untag_ptr(this_obj);
77407         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77409         ReceiveTlvs_free(this_obj_conv);
77410 }
77411
77412 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_get_payment_secret"))) TS_ReceiveTlvs_get_payment_secret(uint64_t this_ptr) {
77413         LDKReceiveTlvs this_ptr_conv;
77414         this_ptr_conv.inner = untag_ptr(this_ptr);
77415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77417         this_ptr_conv.is_owned = false;
77418         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
77419         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
77420         return ret_arr;
77421 }
77422
77423 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_secret"))) TS_ReceiveTlvs_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
77424         LDKReceiveTlvs this_ptr_conv;
77425         this_ptr_conv.inner = untag_ptr(this_ptr);
77426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77428         this_ptr_conv.is_owned = false;
77429         LDKThirtyTwoBytes val_ref;
77430         CHECK(val->arr_len == 32);
77431         memcpy(val_ref.data, val->elems, 32); FREE(val);
77432         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
77433 }
77434
77435 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_get_payment_constraints"))) TS_ReceiveTlvs_get_payment_constraints(uint64_t this_ptr) {
77436         LDKReceiveTlvs this_ptr_conv;
77437         this_ptr_conv.inner = untag_ptr(this_ptr);
77438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77440         this_ptr_conv.is_owned = false;
77441         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
77442         uint64_t ret_ref = 0;
77443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77445         return ret_ref;
77446 }
77447
77448 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_constraints"))) TS_ReceiveTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
77449         LDKReceiveTlvs this_ptr_conv;
77450         this_ptr_conv.inner = untag_ptr(this_ptr);
77451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77453         this_ptr_conv.is_owned = false;
77454         LDKPaymentConstraints val_conv;
77455         val_conv.inner = untag_ptr(val);
77456         val_conv.is_owned = ptr_is_owned(val);
77457         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77458         val_conv = PaymentConstraints_clone(&val_conv);
77459         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
77460 }
77461
77462 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_get_payment_context"))) TS_ReceiveTlvs_get_payment_context(uint64_t this_ptr) {
77463         LDKReceiveTlvs this_ptr_conv;
77464         this_ptr_conv.inner = untag_ptr(this_ptr);
77465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77467         this_ptr_conv.is_owned = false;
77468         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
77469         *ret_copy = ReceiveTlvs_get_payment_context(&this_ptr_conv);
77470         uint64_t ret_ref = tag_ptr(ret_copy, true);
77471         return ret_ref;
77472 }
77473
77474 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_context"))) TS_ReceiveTlvs_set_payment_context(uint64_t this_ptr, uint64_t val) {
77475         LDKReceiveTlvs this_ptr_conv;
77476         this_ptr_conv.inner = untag_ptr(this_ptr);
77477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77479         this_ptr_conv.is_owned = false;
77480         void* val_ptr = untag_ptr(val);
77481         CHECK_ACCESS(val_ptr);
77482         LDKPaymentContext val_conv = *(LDKPaymentContext*)(val_ptr);
77483         val_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(val));
77484         ReceiveTlvs_set_payment_context(&this_ptr_conv, val_conv);
77485 }
77486
77487 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) {
77488         LDKThirtyTwoBytes payment_secret_arg_ref;
77489         CHECK(payment_secret_arg->arr_len == 32);
77490         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
77491         LDKPaymentConstraints payment_constraints_arg_conv;
77492         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
77493         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
77494         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
77495         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
77496         void* payment_context_arg_ptr = untag_ptr(payment_context_arg);
77497         CHECK_ACCESS(payment_context_arg_ptr);
77498         LDKPaymentContext payment_context_arg_conv = *(LDKPaymentContext*)(payment_context_arg_ptr);
77499         payment_context_arg_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(payment_context_arg));
77500         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv, payment_context_arg_conv);
77501         uint64_t ret_ref = 0;
77502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77504         return ret_ref;
77505 }
77506
77507 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
77508         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
77509         uint64_t ret_ref = 0;
77510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77512         return ret_ref;
77513 }
77514 int64_t  __attribute__((export_name("TS_ReceiveTlvs_clone_ptr"))) TS_ReceiveTlvs_clone_ptr(uint64_t arg) {
77515         LDKReceiveTlvs arg_conv;
77516         arg_conv.inner = untag_ptr(arg);
77517         arg_conv.is_owned = ptr_is_owned(arg);
77518         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77519         arg_conv.is_owned = false;
77520         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
77521         return ret_conv;
77522 }
77523
77524 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_clone"))) TS_ReceiveTlvs_clone(uint64_t orig) {
77525         LDKReceiveTlvs orig_conv;
77526         orig_conv.inner = untag_ptr(orig);
77527         orig_conv.is_owned = ptr_is_owned(orig);
77528         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77529         orig_conv.is_owned = false;
77530         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
77531         uint64_t ret_ref = 0;
77532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77534         return ret_ref;
77535 }
77536
77537 void  __attribute__((export_name("TS_PaymentRelay_free"))) TS_PaymentRelay_free(uint64_t this_obj) {
77538         LDKPaymentRelay this_obj_conv;
77539         this_obj_conv.inner = untag_ptr(this_obj);
77540         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77542         PaymentRelay_free(this_obj_conv);
77543 }
77544
77545 int16_t  __attribute__((export_name("TS_PaymentRelay_get_cltv_expiry_delta"))) TS_PaymentRelay_get_cltv_expiry_delta(uint64_t this_ptr) {
77546         LDKPaymentRelay this_ptr_conv;
77547         this_ptr_conv.inner = untag_ptr(this_ptr);
77548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77550         this_ptr_conv.is_owned = false;
77551         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
77552         return ret_conv;
77553 }
77554
77555 void  __attribute__((export_name("TS_PaymentRelay_set_cltv_expiry_delta"))) TS_PaymentRelay_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
77556         LDKPaymentRelay this_ptr_conv;
77557         this_ptr_conv.inner = untag_ptr(this_ptr);
77558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77560         this_ptr_conv.is_owned = false;
77561         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
77562 }
77563
77564 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_proportional_millionths"))) TS_PaymentRelay_get_fee_proportional_millionths(uint64_t this_ptr) {
77565         LDKPaymentRelay this_ptr_conv;
77566         this_ptr_conv.inner = untag_ptr(this_ptr);
77567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77569         this_ptr_conv.is_owned = false;
77570         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
77571         return ret_conv;
77572 }
77573
77574 void  __attribute__((export_name("TS_PaymentRelay_set_fee_proportional_millionths"))) TS_PaymentRelay_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
77575         LDKPaymentRelay this_ptr_conv;
77576         this_ptr_conv.inner = untag_ptr(this_ptr);
77577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77579         this_ptr_conv.is_owned = false;
77580         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
77581 }
77582
77583 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_base_msat"))) TS_PaymentRelay_get_fee_base_msat(uint64_t this_ptr) {
77584         LDKPaymentRelay this_ptr_conv;
77585         this_ptr_conv.inner = untag_ptr(this_ptr);
77586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77588         this_ptr_conv.is_owned = false;
77589         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
77590         return ret_conv;
77591 }
77592
77593 void  __attribute__((export_name("TS_PaymentRelay_set_fee_base_msat"))) TS_PaymentRelay_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
77594         LDKPaymentRelay this_ptr_conv;
77595         this_ptr_conv.inner = untag_ptr(this_ptr);
77596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77598         this_ptr_conv.is_owned = false;
77599         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
77600 }
77601
77602 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) {
77603         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
77604         uint64_t ret_ref = 0;
77605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77607         return ret_ref;
77608 }
77609
77610 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
77611         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
77612         uint64_t ret_ref = 0;
77613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77615         return ret_ref;
77616 }
77617 int64_t  __attribute__((export_name("TS_PaymentRelay_clone_ptr"))) TS_PaymentRelay_clone_ptr(uint64_t arg) {
77618         LDKPaymentRelay arg_conv;
77619         arg_conv.inner = untag_ptr(arg);
77620         arg_conv.is_owned = ptr_is_owned(arg);
77621         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77622         arg_conv.is_owned = false;
77623         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
77624         return ret_conv;
77625 }
77626
77627 uint64_t  __attribute__((export_name("TS_PaymentRelay_clone"))) TS_PaymentRelay_clone(uint64_t orig) {
77628         LDKPaymentRelay orig_conv;
77629         orig_conv.inner = untag_ptr(orig);
77630         orig_conv.is_owned = ptr_is_owned(orig);
77631         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77632         orig_conv.is_owned = false;
77633         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
77634         uint64_t ret_ref = 0;
77635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77637         return ret_ref;
77638 }
77639
77640 void  __attribute__((export_name("TS_PaymentConstraints_free"))) TS_PaymentConstraints_free(uint64_t this_obj) {
77641         LDKPaymentConstraints this_obj_conv;
77642         this_obj_conv.inner = untag_ptr(this_obj);
77643         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77645         PaymentConstraints_free(this_obj_conv);
77646 }
77647
77648 int32_t  __attribute__((export_name("TS_PaymentConstraints_get_max_cltv_expiry"))) TS_PaymentConstraints_get_max_cltv_expiry(uint64_t this_ptr) {
77649         LDKPaymentConstraints this_ptr_conv;
77650         this_ptr_conv.inner = untag_ptr(this_ptr);
77651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77653         this_ptr_conv.is_owned = false;
77654         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
77655         return ret_conv;
77656 }
77657
77658 void  __attribute__((export_name("TS_PaymentConstraints_set_max_cltv_expiry"))) TS_PaymentConstraints_set_max_cltv_expiry(uint64_t this_ptr, int32_t val) {
77659         LDKPaymentConstraints this_ptr_conv;
77660         this_ptr_conv.inner = untag_ptr(this_ptr);
77661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77663         this_ptr_conv.is_owned = false;
77664         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
77665 }
77666
77667 int64_t  __attribute__((export_name("TS_PaymentConstraints_get_htlc_minimum_msat"))) TS_PaymentConstraints_get_htlc_minimum_msat(uint64_t this_ptr) {
77668         LDKPaymentConstraints this_ptr_conv;
77669         this_ptr_conv.inner = untag_ptr(this_ptr);
77670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77672         this_ptr_conv.is_owned = false;
77673         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
77674         return ret_conv;
77675 }
77676
77677 void  __attribute__((export_name("TS_PaymentConstraints_set_htlc_minimum_msat"))) TS_PaymentConstraints_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
77678         LDKPaymentConstraints this_ptr_conv;
77679         this_ptr_conv.inner = untag_ptr(this_ptr);
77680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77682         this_ptr_conv.is_owned = false;
77683         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
77684 }
77685
77686 uint64_t  __attribute__((export_name("TS_PaymentConstraints_new"))) TS_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
77687         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
77688         uint64_t ret_ref = 0;
77689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77691         return ret_ref;
77692 }
77693
77694 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
77695         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
77696         uint64_t ret_ref = 0;
77697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77699         return ret_ref;
77700 }
77701 int64_t  __attribute__((export_name("TS_PaymentConstraints_clone_ptr"))) TS_PaymentConstraints_clone_ptr(uint64_t arg) {
77702         LDKPaymentConstraints arg_conv;
77703         arg_conv.inner = untag_ptr(arg);
77704         arg_conv.is_owned = ptr_is_owned(arg);
77705         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77706         arg_conv.is_owned = false;
77707         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
77708         return ret_conv;
77709 }
77710
77711 uint64_t  __attribute__((export_name("TS_PaymentConstraints_clone"))) TS_PaymentConstraints_clone(uint64_t orig) {
77712         LDKPaymentConstraints orig_conv;
77713         orig_conv.inner = untag_ptr(orig);
77714         orig_conv.is_owned = ptr_is_owned(orig);
77715         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77716         orig_conv.is_owned = false;
77717         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
77718         uint64_t ret_ref = 0;
77719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77721         return ret_ref;
77722 }
77723
77724 void  __attribute__((export_name("TS_PaymentContext_free"))) TS_PaymentContext_free(uint64_t this_ptr) {
77725         if (!ptr_is_owned(this_ptr)) return;
77726         void* this_ptr_ptr = untag_ptr(this_ptr);
77727         CHECK_ACCESS(this_ptr_ptr);
77728         LDKPaymentContext this_ptr_conv = *(LDKPaymentContext*)(this_ptr_ptr);
77729         FREE(untag_ptr(this_ptr));
77730         PaymentContext_free(this_ptr_conv);
77731 }
77732
77733 static inline uint64_t PaymentContext_clone_ptr(LDKPaymentContext *NONNULL_PTR arg) {
77734         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
77735         *ret_copy = PaymentContext_clone(arg);
77736         uint64_t ret_ref = tag_ptr(ret_copy, true);
77737         return ret_ref;
77738 }
77739 int64_t  __attribute__((export_name("TS_PaymentContext_clone_ptr"))) TS_PaymentContext_clone_ptr(uint64_t arg) {
77740         LDKPaymentContext* arg_conv = (LDKPaymentContext*)untag_ptr(arg);
77741         int64_t ret_conv = PaymentContext_clone_ptr(arg_conv);
77742         return ret_conv;
77743 }
77744
77745 uint64_t  __attribute__((export_name("TS_PaymentContext_clone"))) TS_PaymentContext_clone(uint64_t orig) {
77746         LDKPaymentContext* orig_conv = (LDKPaymentContext*)untag_ptr(orig);
77747         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
77748         *ret_copy = PaymentContext_clone(orig_conv);
77749         uint64_t ret_ref = tag_ptr(ret_copy, true);
77750         return ret_ref;
77751 }
77752
77753 uint64_t  __attribute__((export_name("TS_PaymentContext_unknown"))) TS_PaymentContext_unknown(uint64_t a) {
77754         LDKUnknownPaymentContext a_conv;
77755         a_conv.inner = untag_ptr(a);
77756         a_conv.is_owned = ptr_is_owned(a);
77757         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77758         a_conv = UnknownPaymentContext_clone(&a_conv);
77759         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
77760         *ret_copy = PaymentContext_unknown(a_conv);
77761         uint64_t ret_ref = tag_ptr(ret_copy, true);
77762         return ret_ref;
77763 }
77764
77765 uint64_t  __attribute__((export_name("TS_PaymentContext_bolt12_offer"))) TS_PaymentContext_bolt12_offer(uint64_t a) {
77766         LDKBolt12OfferContext a_conv;
77767         a_conv.inner = untag_ptr(a);
77768         a_conv.is_owned = ptr_is_owned(a);
77769         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77770         a_conv = Bolt12OfferContext_clone(&a_conv);
77771         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
77772         *ret_copy = PaymentContext_bolt12_offer(a_conv);
77773         uint64_t ret_ref = tag_ptr(ret_copy, true);
77774         return ret_ref;
77775 }
77776
77777 uint64_t  __attribute__((export_name("TS_PaymentContext_bolt12_refund"))) TS_PaymentContext_bolt12_refund(uint64_t a) {
77778         LDKBolt12RefundContext a_conv;
77779         a_conv.inner = untag_ptr(a);
77780         a_conv.is_owned = ptr_is_owned(a);
77781         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77782         a_conv = Bolt12RefundContext_clone(&a_conv);
77783         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
77784         *ret_copy = PaymentContext_bolt12_refund(a_conv);
77785         uint64_t ret_ref = tag_ptr(ret_copy, true);
77786         return ret_ref;
77787 }
77788
77789 jboolean  __attribute__((export_name("TS_PaymentContext_eq"))) TS_PaymentContext_eq(uint64_t a, uint64_t b) {
77790         LDKPaymentContext* a_conv = (LDKPaymentContext*)untag_ptr(a);
77791         LDKPaymentContext* b_conv = (LDKPaymentContext*)untag_ptr(b);
77792         jboolean ret_conv = PaymentContext_eq(a_conv, b_conv);
77793         return ret_conv;
77794 }
77795
77796 void  __attribute__((export_name("TS_UnknownPaymentContext_free"))) TS_UnknownPaymentContext_free(uint64_t this_obj) {
77797         LDKUnknownPaymentContext this_obj_conv;
77798         this_obj_conv.inner = untag_ptr(this_obj);
77799         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77801         UnknownPaymentContext_free(this_obj_conv);
77802 }
77803
77804 static inline uint64_t UnknownPaymentContext_clone_ptr(LDKUnknownPaymentContext *NONNULL_PTR arg) {
77805         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(arg);
77806         uint64_t ret_ref = 0;
77807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77809         return ret_ref;
77810 }
77811 int64_t  __attribute__((export_name("TS_UnknownPaymentContext_clone_ptr"))) TS_UnknownPaymentContext_clone_ptr(uint64_t arg) {
77812         LDKUnknownPaymentContext arg_conv;
77813         arg_conv.inner = untag_ptr(arg);
77814         arg_conv.is_owned = ptr_is_owned(arg);
77815         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77816         arg_conv.is_owned = false;
77817         int64_t ret_conv = UnknownPaymentContext_clone_ptr(&arg_conv);
77818         return ret_conv;
77819 }
77820
77821 uint64_t  __attribute__((export_name("TS_UnknownPaymentContext_clone"))) TS_UnknownPaymentContext_clone(uint64_t orig) {
77822         LDKUnknownPaymentContext orig_conv;
77823         orig_conv.inner = untag_ptr(orig);
77824         orig_conv.is_owned = ptr_is_owned(orig);
77825         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77826         orig_conv.is_owned = false;
77827         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(&orig_conv);
77828         uint64_t ret_ref = 0;
77829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77831         return ret_ref;
77832 }
77833
77834 jboolean  __attribute__((export_name("TS_UnknownPaymentContext_eq"))) TS_UnknownPaymentContext_eq(uint64_t a, uint64_t b) {
77835         LDKUnknownPaymentContext a_conv;
77836         a_conv.inner = untag_ptr(a);
77837         a_conv.is_owned = ptr_is_owned(a);
77838         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77839         a_conv.is_owned = false;
77840         LDKUnknownPaymentContext b_conv;
77841         b_conv.inner = untag_ptr(b);
77842         b_conv.is_owned = ptr_is_owned(b);
77843         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77844         b_conv.is_owned = false;
77845         jboolean ret_conv = UnknownPaymentContext_eq(&a_conv, &b_conv);
77846         return ret_conv;
77847 }
77848
77849 void  __attribute__((export_name("TS_Bolt12OfferContext_free"))) TS_Bolt12OfferContext_free(uint64_t this_obj) {
77850         LDKBolt12OfferContext this_obj_conv;
77851         this_obj_conv.inner = untag_ptr(this_obj);
77852         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77854         Bolt12OfferContext_free(this_obj_conv);
77855 }
77856
77857 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_get_offer_id"))) TS_Bolt12OfferContext_get_offer_id(uint64_t this_ptr) {
77858         LDKBolt12OfferContext this_ptr_conv;
77859         this_ptr_conv.inner = untag_ptr(this_ptr);
77860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77862         this_ptr_conv.is_owned = false;
77863         LDKOfferId ret_var = Bolt12OfferContext_get_offer_id(&this_ptr_conv);
77864         uint64_t ret_ref = 0;
77865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77867         return ret_ref;
77868 }
77869
77870 void  __attribute__((export_name("TS_Bolt12OfferContext_set_offer_id"))) TS_Bolt12OfferContext_set_offer_id(uint64_t this_ptr, uint64_t val) {
77871         LDKBolt12OfferContext this_ptr_conv;
77872         this_ptr_conv.inner = untag_ptr(this_ptr);
77873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77875         this_ptr_conv.is_owned = false;
77876         LDKOfferId val_conv;
77877         val_conv.inner = untag_ptr(val);
77878         val_conv.is_owned = ptr_is_owned(val);
77879         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77880         val_conv = OfferId_clone(&val_conv);
77881         Bolt12OfferContext_set_offer_id(&this_ptr_conv, val_conv);
77882 }
77883
77884 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_get_invoice_request"))) TS_Bolt12OfferContext_get_invoice_request(uint64_t this_ptr) {
77885         LDKBolt12OfferContext this_ptr_conv;
77886         this_ptr_conv.inner = untag_ptr(this_ptr);
77887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77889         this_ptr_conv.is_owned = false;
77890         LDKInvoiceRequestFields ret_var = Bolt12OfferContext_get_invoice_request(&this_ptr_conv);
77891         uint64_t ret_ref = 0;
77892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77894         return ret_ref;
77895 }
77896
77897 void  __attribute__((export_name("TS_Bolt12OfferContext_set_invoice_request"))) TS_Bolt12OfferContext_set_invoice_request(uint64_t this_ptr, uint64_t val) {
77898         LDKBolt12OfferContext this_ptr_conv;
77899         this_ptr_conv.inner = untag_ptr(this_ptr);
77900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77902         this_ptr_conv.is_owned = false;
77903         LDKInvoiceRequestFields val_conv;
77904         val_conv.inner = untag_ptr(val);
77905         val_conv.is_owned = ptr_is_owned(val);
77906         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77907         val_conv = InvoiceRequestFields_clone(&val_conv);
77908         Bolt12OfferContext_set_invoice_request(&this_ptr_conv, val_conv);
77909 }
77910
77911 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_new"))) TS_Bolt12OfferContext_new(uint64_t offer_id_arg, uint64_t invoice_request_arg) {
77912         LDKOfferId offer_id_arg_conv;
77913         offer_id_arg_conv.inner = untag_ptr(offer_id_arg);
77914         offer_id_arg_conv.is_owned = ptr_is_owned(offer_id_arg);
77915         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_id_arg_conv);
77916         offer_id_arg_conv = OfferId_clone(&offer_id_arg_conv);
77917         LDKInvoiceRequestFields invoice_request_arg_conv;
77918         invoice_request_arg_conv.inner = untag_ptr(invoice_request_arg);
77919         invoice_request_arg_conv.is_owned = ptr_is_owned(invoice_request_arg);
77920         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_arg_conv);
77921         invoice_request_arg_conv = InvoiceRequestFields_clone(&invoice_request_arg_conv);
77922         LDKBolt12OfferContext ret_var = Bolt12OfferContext_new(offer_id_arg_conv, invoice_request_arg_conv);
77923         uint64_t ret_ref = 0;
77924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77926         return ret_ref;
77927 }
77928
77929 static inline uint64_t Bolt12OfferContext_clone_ptr(LDKBolt12OfferContext *NONNULL_PTR arg) {
77930         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(arg);
77931         uint64_t ret_ref = 0;
77932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77934         return ret_ref;
77935 }
77936 int64_t  __attribute__((export_name("TS_Bolt12OfferContext_clone_ptr"))) TS_Bolt12OfferContext_clone_ptr(uint64_t arg) {
77937         LDKBolt12OfferContext arg_conv;
77938         arg_conv.inner = untag_ptr(arg);
77939         arg_conv.is_owned = ptr_is_owned(arg);
77940         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77941         arg_conv.is_owned = false;
77942         int64_t ret_conv = Bolt12OfferContext_clone_ptr(&arg_conv);
77943         return ret_conv;
77944 }
77945
77946 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_clone"))) TS_Bolt12OfferContext_clone(uint64_t orig) {
77947         LDKBolt12OfferContext orig_conv;
77948         orig_conv.inner = untag_ptr(orig);
77949         orig_conv.is_owned = ptr_is_owned(orig);
77950         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77951         orig_conv.is_owned = false;
77952         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(&orig_conv);
77953         uint64_t ret_ref = 0;
77954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77956         return ret_ref;
77957 }
77958
77959 jboolean  __attribute__((export_name("TS_Bolt12OfferContext_eq"))) TS_Bolt12OfferContext_eq(uint64_t a, uint64_t b) {
77960         LDKBolt12OfferContext a_conv;
77961         a_conv.inner = untag_ptr(a);
77962         a_conv.is_owned = ptr_is_owned(a);
77963         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77964         a_conv.is_owned = false;
77965         LDKBolt12OfferContext b_conv;
77966         b_conv.inner = untag_ptr(b);
77967         b_conv.is_owned = ptr_is_owned(b);
77968         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77969         b_conv.is_owned = false;
77970         jboolean ret_conv = Bolt12OfferContext_eq(&a_conv, &b_conv);
77971         return ret_conv;
77972 }
77973
77974 void  __attribute__((export_name("TS_Bolt12RefundContext_free"))) TS_Bolt12RefundContext_free(uint64_t this_obj) {
77975         LDKBolt12RefundContext this_obj_conv;
77976         this_obj_conv.inner = untag_ptr(this_obj);
77977         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77979         Bolt12RefundContext_free(this_obj_conv);
77980 }
77981
77982 uint64_t  __attribute__((export_name("TS_Bolt12RefundContext_new"))) TS_Bolt12RefundContext_new() {
77983         LDKBolt12RefundContext ret_var = Bolt12RefundContext_new();
77984         uint64_t ret_ref = 0;
77985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77987         return ret_ref;
77988 }
77989
77990 static inline uint64_t Bolt12RefundContext_clone_ptr(LDKBolt12RefundContext *NONNULL_PTR arg) {
77991         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(arg);
77992         uint64_t ret_ref = 0;
77993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77995         return ret_ref;
77996 }
77997 int64_t  __attribute__((export_name("TS_Bolt12RefundContext_clone_ptr"))) TS_Bolt12RefundContext_clone_ptr(uint64_t arg) {
77998         LDKBolt12RefundContext arg_conv;
77999         arg_conv.inner = untag_ptr(arg);
78000         arg_conv.is_owned = ptr_is_owned(arg);
78001         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78002         arg_conv.is_owned = false;
78003         int64_t ret_conv = Bolt12RefundContext_clone_ptr(&arg_conv);
78004         return ret_conv;
78005 }
78006
78007 uint64_t  __attribute__((export_name("TS_Bolt12RefundContext_clone"))) TS_Bolt12RefundContext_clone(uint64_t orig) {
78008         LDKBolt12RefundContext orig_conv;
78009         orig_conv.inner = untag_ptr(orig);
78010         orig_conv.is_owned = ptr_is_owned(orig);
78011         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78012         orig_conv.is_owned = false;
78013         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(&orig_conv);
78014         uint64_t ret_ref = 0;
78015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78017         return ret_ref;
78018 }
78019
78020 jboolean  __attribute__((export_name("TS_Bolt12RefundContext_eq"))) TS_Bolt12RefundContext_eq(uint64_t a, uint64_t b) {
78021         LDKBolt12RefundContext a_conv;
78022         a_conv.inner = untag_ptr(a);
78023         a_conv.is_owned = ptr_is_owned(a);
78024         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78025         a_conv.is_owned = false;
78026         LDKBolt12RefundContext b_conv;
78027         b_conv.inner = untag_ptr(b);
78028         b_conv.is_owned = ptr_is_owned(b);
78029         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78030         b_conv.is_owned = false;
78031         jboolean ret_conv = Bolt12RefundContext_eq(&a_conv, &b_conv);
78032         return ret_conv;
78033 }
78034
78035 int8_tArray  __attribute__((export_name("TS_ForwardTlvs_write"))) TS_ForwardTlvs_write(uint64_t obj) {
78036         LDKForwardTlvs obj_conv;
78037         obj_conv.inner = untag_ptr(obj);
78038         obj_conv.is_owned = ptr_is_owned(obj);
78039         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78040         obj_conv.is_owned = false;
78041         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
78042         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78043         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78044         CVec_u8Z_free(ret_var);
78045         return ret_arr;
78046 }
78047
78048 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_write"))) TS_ReceiveTlvs_write(uint64_t obj) {
78049         LDKReceiveTlvs obj_conv;
78050         obj_conv.inner = untag_ptr(obj);
78051         obj_conv.is_owned = ptr_is_owned(obj);
78052         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78053         obj_conv.is_owned = false;
78054         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
78055         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78056         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78057         CVec_u8Z_free(ret_var);
78058         return ret_arr;
78059 }
78060
78061 int8_tArray  __attribute__((export_name("TS_PaymentRelay_write"))) TS_PaymentRelay_write(uint64_t obj) {
78062         LDKPaymentRelay obj_conv;
78063         obj_conv.inner = untag_ptr(obj);
78064         obj_conv.is_owned = ptr_is_owned(obj);
78065         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78066         obj_conv.is_owned = false;
78067         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
78068         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78069         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78070         CVec_u8Z_free(ret_var);
78071         return ret_arr;
78072 }
78073
78074 uint64_t  __attribute__((export_name("TS_PaymentRelay_read"))) TS_PaymentRelay_read(int8_tArray ser) {
78075         LDKu8slice ser_ref;
78076         ser_ref.datalen = ser->arr_len;
78077         ser_ref.data = ser->elems;
78078         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
78079         *ret_conv = PaymentRelay_read(ser_ref);
78080         FREE(ser);
78081         return tag_ptr(ret_conv, true);
78082 }
78083
78084 int8_tArray  __attribute__((export_name("TS_PaymentConstraints_write"))) TS_PaymentConstraints_write(uint64_t obj) {
78085         LDKPaymentConstraints obj_conv;
78086         obj_conv.inner = untag_ptr(obj);
78087         obj_conv.is_owned = ptr_is_owned(obj);
78088         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78089         obj_conv.is_owned = false;
78090         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
78091         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78092         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78093         CVec_u8Z_free(ret_var);
78094         return ret_arr;
78095 }
78096
78097 uint64_t  __attribute__((export_name("TS_PaymentConstraints_read"))) TS_PaymentConstraints_read(int8_tArray ser) {
78098         LDKu8slice ser_ref;
78099         ser_ref.datalen = ser->arr_len;
78100         ser_ref.data = ser->elems;
78101         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
78102         *ret_conv = PaymentConstraints_read(ser_ref);
78103         FREE(ser);
78104         return tag_ptr(ret_conv, true);
78105 }
78106
78107 int8_tArray  __attribute__((export_name("TS_PaymentContext_write"))) TS_PaymentContext_write(uint64_t obj) {
78108         LDKPaymentContext* obj_conv = (LDKPaymentContext*)untag_ptr(obj);
78109         LDKCVec_u8Z ret_var = PaymentContext_write(obj_conv);
78110         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78111         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78112         CVec_u8Z_free(ret_var);
78113         return ret_arr;
78114 }
78115
78116 uint64_t  __attribute__((export_name("TS_PaymentContext_read"))) TS_PaymentContext_read(int8_tArray ser) {
78117         LDKu8slice ser_ref;
78118         ser_ref.datalen = ser->arr_len;
78119         ser_ref.data = ser->elems;
78120         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
78121         *ret_conv = PaymentContext_read(ser_ref);
78122         FREE(ser);
78123         return tag_ptr(ret_conv, true);
78124 }
78125
78126 int8_tArray  __attribute__((export_name("TS_UnknownPaymentContext_write"))) TS_UnknownPaymentContext_write(uint64_t obj) {
78127         LDKUnknownPaymentContext obj_conv;
78128         obj_conv.inner = untag_ptr(obj);
78129         obj_conv.is_owned = ptr_is_owned(obj);
78130         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78131         obj_conv.is_owned = false;
78132         LDKCVec_u8Z ret_var = UnknownPaymentContext_write(&obj_conv);
78133         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78134         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78135         CVec_u8Z_free(ret_var);
78136         return ret_arr;
78137 }
78138
78139 uint64_t  __attribute__((export_name("TS_UnknownPaymentContext_read"))) TS_UnknownPaymentContext_read(int8_tArray ser) {
78140         LDKu8slice ser_ref;
78141         ser_ref.datalen = ser->arr_len;
78142         ser_ref.data = ser->elems;
78143         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
78144         *ret_conv = UnknownPaymentContext_read(ser_ref);
78145         FREE(ser);
78146         return tag_ptr(ret_conv, true);
78147 }
78148
78149 int8_tArray  __attribute__((export_name("TS_Bolt12OfferContext_write"))) TS_Bolt12OfferContext_write(uint64_t obj) {
78150         LDKBolt12OfferContext obj_conv;
78151         obj_conv.inner = untag_ptr(obj);
78152         obj_conv.is_owned = ptr_is_owned(obj);
78153         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78154         obj_conv.is_owned = false;
78155         LDKCVec_u8Z ret_var = Bolt12OfferContext_write(&obj_conv);
78156         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78157         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78158         CVec_u8Z_free(ret_var);
78159         return ret_arr;
78160 }
78161
78162 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_read"))) TS_Bolt12OfferContext_read(int8_tArray ser) {
78163         LDKu8slice ser_ref;
78164         ser_ref.datalen = ser->arr_len;
78165         ser_ref.data = ser->elems;
78166         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
78167         *ret_conv = Bolt12OfferContext_read(ser_ref);
78168         FREE(ser);
78169         return tag_ptr(ret_conv, true);
78170 }
78171
78172 int8_tArray  __attribute__((export_name("TS_Bolt12RefundContext_write"))) TS_Bolt12RefundContext_write(uint64_t obj) {
78173         LDKBolt12RefundContext obj_conv;
78174         obj_conv.inner = untag_ptr(obj);
78175         obj_conv.is_owned = ptr_is_owned(obj);
78176         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78177         obj_conv.is_owned = false;
78178         LDKCVec_u8Z ret_var = Bolt12RefundContext_write(&obj_conv);
78179         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78180         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78181         CVec_u8Z_free(ret_var);
78182         return ret_arr;
78183 }
78184
78185 uint64_t  __attribute__((export_name("TS_Bolt12RefundContext_read"))) TS_Bolt12RefundContext_read(int8_tArray ser) {
78186         LDKu8slice ser_ref;
78187         ser_ref.datalen = ser->arr_len;
78188         ser_ref.data = ser->elems;
78189         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
78190         *ret_conv = Bolt12RefundContext_read(ser_ref);
78191         FREE(ser);
78192         return tag_ptr(ret_conv, true);
78193 }
78194
78195 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
78196         if (!ptr_is_owned(this_ptr)) return;
78197         void* this_ptr_ptr = untag_ptr(this_ptr);
78198         CHECK_ACCESS(this_ptr_ptr);
78199         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
78200         FREE(untag_ptr(this_ptr));
78201         PaymentPurpose_free(this_ptr_conv);
78202 }
78203
78204 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
78205         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78206         *ret_copy = PaymentPurpose_clone(arg);
78207         uint64_t ret_ref = tag_ptr(ret_copy, true);
78208         return ret_ref;
78209 }
78210 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
78211         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
78212         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
78213         return ret_conv;
78214 }
78215
78216 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
78217         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
78218         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78219         *ret_copy = PaymentPurpose_clone(orig_conv);
78220         uint64_t ret_ref = tag_ptr(ret_copy, true);
78221         return ret_ref;
78222 }
78223
78224 uint64_t  __attribute__((export_name("TS_PaymentPurpose_bolt11_invoice_payment"))) TS_PaymentPurpose_bolt11_invoice_payment(uint64_t payment_preimage, int8_tArray payment_secret) {
78225         void* payment_preimage_ptr = untag_ptr(payment_preimage);
78226         CHECK_ACCESS(payment_preimage_ptr);
78227         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
78228         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
78229         LDKThirtyTwoBytes payment_secret_ref;
78230         CHECK(payment_secret->arr_len == 32);
78231         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
78232         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78233         *ret_copy = PaymentPurpose_bolt11_invoice_payment(payment_preimage_conv, payment_secret_ref);
78234         uint64_t ret_ref = tag_ptr(ret_copy, true);
78235         return ret_ref;
78236 }
78237
78238 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) {
78239         void* payment_preimage_ptr = untag_ptr(payment_preimage);
78240         CHECK_ACCESS(payment_preimage_ptr);
78241         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
78242         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
78243         LDKThirtyTwoBytes payment_secret_ref;
78244         CHECK(payment_secret->arr_len == 32);
78245         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
78246         LDKBolt12OfferContext payment_context_conv;
78247         payment_context_conv.inner = untag_ptr(payment_context);
78248         payment_context_conv.is_owned = ptr_is_owned(payment_context);
78249         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
78250         payment_context_conv = Bolt12OfferContext_clone(&payment_context_conv);
78251         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78252         *ret_copy = PaymentPurpose_bolt12_offer_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
78253         uint64_t ret_ref = tag_ptr(ret_copy, true);
78254         return ret_ref;
78255 }
78256
78257 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) {
78258         void* payment_preimage_ptr = untag_ptr(payment_preimage);
78259         CHECK_ACCESS(payment_preimage_ptr);
78260         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
78261         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
78262         LDKThirtyTwoBytes payment_secret_ref;
78263         CHECK(payment_secret->arr_len == 32);
78264         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
78265         LDKBolt12RefundContext payment_context_conv;
78266         payment_context_conv.inner = untag_ptr(payment_context);
78267         payment_context_conv.is_owned = ptr_is_owned(payment_context);
78268         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
78269         payment_context_conv = Bolt12RefundContext_clone(&payment_context_conv);
78270         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78271         *ret_copy = PaymentPurpose_bolt12_refund_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
78272         uint64_t ret_ref = tag_ptr(ret_copy, true);
78273         return ret_ref;
78274 }
78275
78276 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
78277         LDKThirtyTwoBytes a_ref;
78278         CHECK(a->arr_len == 32);
78279         memcpy(a_ref.data, a->elems, 32); FREE(a);
78280         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78281         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
78282         uint64_t ret_ref = tag_ptr(ret_copy, true);
78283         return ret_ref;
78284 }
78285
78286 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
78287         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
78288         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
78289         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
78290         return ret_conv;
78291 }
78292
78293 uint64_t  __attribute__((export_name("TS_PaymentPurpose_preimage"))) TS_PaymentPurpose_preimage(uint64_t this_arg) {
78294         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
78295         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
78296         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
78297         uint64_t ret_ref = tag_ptr(ret_copy, true);
78298         return ret_ref;
78299 }
78300
78301 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
78302         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
78303         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
78304         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78305         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78306         CVec_u8Z_free(ret_var);
78307         return ret_arr;
78308 }
78309
78310 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
78311         LDKu8slice ser_ref;
78312         ser_ref.datalen = ser->arr_len;
78313         ser_ref.data = ser->elems;
78314         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
78315         *ret_conv = PaymentPurpose_read(ser_ref);
78316         FREE(ser);
78317         return tag_ptr(ret_conv, true);
78318 }
78319
78320 void  __attribute__((export_name("TS_ClaimedHTLC_free"))) TS_ClaimedHTLC_free(uint64_t this_obj) {
78321         LDKClaimedHTLC this_obj_conv;
78322         this_obj_conv.inner = untag_ptr(this_obj);
78323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78325         ClaimedHTLC_free(this_obj_conv);
78326 }
78327
78328 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_get_channel_id"))) TS_ClaimedHTLC_get_channel_id(uint64_t this_ptr) {
78329         LDKClaimedHTLC this_ptr_conv;
78330         this_ptr_conv.inner = untag_ptr(this_ptr);
78331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78333         this_ptr_conv.is_owned = false;
78334         LDKChannelId ret_var = ClaimedHTLC_get_channel_id(&this_ptr_conv);
78335         uint64_t ret_ref = 0;
78336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78338         return ret_ref;
78339 }
78340
78341 void  __attribute__((export_name("TS_ClaimedHTLC_set_channel_id"))) TS_ClaimedHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
78342         LDKClaimedHTLC this_ptr_conv;
78343         this_ptr_conv.inner = untag_ptr(this_ptr);
78344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78346         this_ptr_conv.is_owned = false;
78347         LDKChannelId val_conv;
78348         val_conv.inner = untag_ptr(val);
78349         val_conv.is_owned = ptr_is_owned(val);
78350         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78351         val_conv = ChannelId_clone(&val_conv);
78352         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_conv);
78353 }
78354
78355 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_user_channel_id"))) TS_ClaimedHTLC_get_user_channel_id(uint64_t this_ptr) {
78356         LDKClaimedHTLC this_ptr_conv;
78357         this_ptr_conv.inner = untag_ptr(this_ptr);
78358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78360         this_ptr_conv.is_owned = false;
78361         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
78362         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
78363         return ret_arr;
78364 }
78365
78366 void  __attribute__((export_name("TS_ClaimedHTLC_set_user_channel_id"))) TS_ClaimedHTLC_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
78367         LDKClaimedHTLC this_ptr_conv;
78368         this_ptr_conv.inner = untag_ptr(this_ptr);
78369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78371         this_ptr_conv.is_owned = false;
78372         LDKU128 val_ref;
78373         CHECK(val->arr_len == 16);
78374         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
78375         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
78376 }
78377
78378 int32_t  __attribute__((export_name("TS_ClaimedHTLC_get_cltv_expiry"))) TS_ClaimedHTLC_get_cltv_expiry(uint64_t this_ptr) {
78379         LDKClaimedHTLC this_ptr_conv;
78380         this_ptr_conv.inner = untag_ptr(this_ptr);
78381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78383         this_ptr_conv.is_owned = false;
78384         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
78385         return ret_conv;
78386 }
78387
78388 void  __attribute__((export_name("TS_ClaimedHTLC_set_cltv_expiry"))) TS_ClaimedHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
78389         LDKClaimedHTLC this_ptr_conv;
78390         this_ptr_conv.inner = untag_ptr(this_ptr);
78391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78393         this_ptr_conv.is_owned = false;
78394         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
78395 }
78396
78397 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_value_msat"))) TS_ClaimedHTLC_get_value_msat(uint64_t this_ptr) {
78398         LDKClaimedHTLC this_ptr_conv;
78399         this_ptr_conv.inner = untag_ptr(this_ptr);
78400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78402         this_ptr_conv.is_owned = false;
78403         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
78404         return ret_conv;
78405 }
78406
78407 void  __attribute__((export_name("TS_ClaimedHTLC_set_value_msat"))) TS_ClaimedHTLC_set_value_msat(uint64_t this_ptr, int64_t val) {
78408         LDKClaimedHTLC this_ptr_conv;
78409         this_ptr_conv.inner = untag_ptr(this_ptr);
78410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78412         this_ptr_conv.is_owned = false;
78413         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
78414 }
78415
78416 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_counterparty_skimmed_fee_msat"))) TS_ClaimedHTLC_get_counterparty_skimmed_fee_msat(uint64_t this_ptr) {
78417         LDKClaimedHTLC this_ptr_conv;
78418         this_ptr_conv.inner = untag_ptr(this_ptr);
78419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78421         this_ptr_conv.is_owned = false;
78422         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
78423         return ret_conv;
78424 }
78425
78426 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) {
78427         LDKClaimedHTLC this_ptr_conv;
78428         this_ptr_conv.inner = untag_ptr(this_ptr);
78429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78431         this_ptr_conv.is_owned = false;
78432         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
78433 }
78434
78435 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) {
78436         LDKChannelId channel_id_arg_conv;
78437         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
78438         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
78439         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
78440         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
78441         LDKU128 user_channel_id_arg_ref;
78442         CHECK(user_channel_id_arg->arr_len == 16);
78443         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
78444         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);
78445         uint64_t ret_ref = 0;
78446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78448         return ret_ref;
78449 }
78450
78451 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
78452         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
78453         uint64_t ret_ref = 0;
78454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78456         return ret_ref;
78457 }
78458 int64_t  __attribute__((export_name("TS_ClaimedHTLC_clone_ptr"))) TS_ClaimedHTLC_clone_ptr(uint64_t arg) {
78459         LDKClaimedHTLC arg_conv;
78460         arg_conv.inner = untag_ptr(arg);
78461         arg_conv.is_owned = ptr_is_owned(arg);
78462         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78463         arg_conv.is_owned = false;
78464         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
78465         return ret_conv;
78466 }
78467
78468 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_clone"))) TS_ClaimedHTLC_clone(uint64_t orig) {
78469         LDKClaimedHTLC orig_conv;
78470         orig_conv.inner = untag_ptr(orig);
78471         orig_conv.is_owned = ptr_is_owned(orig);
78472         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78473         orig_conv.is_owned = false;
78474         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
78475         uint64_t ret_ref = 0;
78476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78478         return ret_ref;
78479 }
78480
78481 jboolean  __attribute__((export_name("TS_ClaimedHTLC_eq"))) TS_ClaimedHTLC_eq(uint64_t a, uint64_t b) {
78482         LDKClaimedHTLC a_conv;
78483         a_conv.inner = untag_ptr(a);
78484         a_conv.is_owned = ptr_is_owned(a);
78485         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78486         a_conv.is_owned = false;
78487         LDKClaimedHTLC b_conv;
78488         b_conv.inner = untag_ptr(b);
78489         b_conv.is_owned = ptr_is_owned(b);
78490         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78491         b_conv.is_owned = false;
78492         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
78493         return ret_conv;
78494 }
78495
78496 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_write"))) TS_ClaimedHTLC_write(uint64_t obj) {
78497         LDKClaimedHTLC obj_conv;
78498         obj_conv.inner = untag_ptr(obj);
78499         obj_conv.is_owned = ptr_is_owned(obj);
78500         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78501         obj_conv.is_owned = false;
78502         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
78503         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78504         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78505         CVec_u8Z_free(ret_var);
78506         return ret_arr;
78507 }
78508
78509 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_read"))) TS_ClaimedHTLC_read(int8_tArray ser) {
78510         LDKu8slice ser_ref;
78511         ser_ref.datalen = ser->arr_len;
78512         ser_ref.data = ser->elems;
78513         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
78514         *ret_conv = ClaimedHTLC_read(ser_ref);
78515         FREE(ser);
78516         return tag_ptr(ret_conv, true);
78517 }
78518
78519 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
78520         if (!ptr_is_owned(this_ptr)) return;
78521         void* this_ptr_ptr = untag_ptr(this_ptr);
78522         CHECK_ACCESS(this_ptr_ptr);
78523         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
78524         FREE(untag_ptr(this_ptr));
78525         PathFailure_free(this_ptr_conv);
78526 }
78527
78528 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
78529         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
78530         *ret_copy = PathFailure_clone(arg);
78531         uint64_t ret_ref = tag_ptr(ret_copy, true);
78532         return ret_ref;
78533 }
78534 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
78535         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
78536         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
78537         return ret_conv;
78538 }
78539
78540 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
78541         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
78542         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
78543         *ret_copy = PathFailure_clone(orig_conv);
78544         uint64_t ret_ref = tag_ptr(ret_copy, true);
78545         return ret_ref;
78546 }
78547
78548 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
78549         void* err_ptr = untag_ptr(err);
78550         CHECK_ACCESS(err_ptr);
78551         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
78552         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
78553         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
78554         *ret_copy = PathFailure_initial_send(err_conv);
78555         uint64_t ret_ref = tag_ptr(ret_copy, true);
78556         return ret_ref;
78557 }
78558
78559 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
78560         void* network_update_ptr = untag_ptr(network_update);
78561         CHECK_ACCESS(network_update_ptr);
78562         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
78563         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
78564         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
78565         *ret_copy = PathFailure_on_path(network_update_conv);
78566         uint64_t ret_ref = tag_ptr(ret_copy, true);
78567         return ret_ref;
78568 }
78569
78570 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
78571         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
78572         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
78573         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
78574         return ret_conv;
78575 }
78576
78577 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
78578         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
78579         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
78580         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78581         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78582         CVec_u8Z_free(ret_var);
78583         return ret_arr;
78584 }
78585
78586 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
78587         LDKu8slice ser_ref;
78588         ser_ref.datalen = ser->arr_len;
78589         ser_ref.data = ser->elems;
78590         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
78591         *ret_conv = PathFailure_read(ser_ref);
78592         FREE(ser);
78593         return tag_ptr(ret_conv, true);
78594 }
78595
78596 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
78597         if (!ptr_is_owned(this_ptr)) return;
78598         void* this_ptr_ptr = untag_ptr(this_ptr);
78599         CHECK_ACCESS(this_ptr_ptr);
78600         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
78601         FREE(untag_ptr(this_ptr));
78602         ClosureReason_free(this_ptr_conv);
78603 }
78604
78605 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
78606         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78607         *ret_copy = ClosureReason_clone(arg);
78608         uint64_t ret_ref = tag_ptr(ret_copy, true);
78609         return ret_ref;
78610 }
78611 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
78612         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
78613         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
78614         return ret_conv;
78615 }
78616
78617 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
78618         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
78619         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78620         *ret_copy = ClosureReason_clone(orig_conv);
78621         uint64_t ret_ref = tag_ptr(ret_copy, true);
78622         return ret_ref;
78623 }
78624
78625 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
78626         LDKUntrustedString peer_msg_conv;
78627         peer_msg_conv.inner = untag_ptr(peer_msg);
78628         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
78629         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
78630         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
78631         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78632         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
78633         uint64_t ret_ref = tag_ptr(ret_copy, true);
78634         return ret_ref;
78635 }
78636
78637 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
78638         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78639         *ret_copy = ClosureReason_holder_force_closed();
78640         uint64_t ret_ref = tag_ptr(ret_copy, true);
78641         return ret_ref;
78642 }
78643
78644 uint64_t  __attribute__((export_name("TS_ClosureReason_legacy_cooperative_closure"))) TS_ClosureReason_legacy_cooperative_closure() {
78645         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78646         *ret_copy = ClosureReason_legacy_cooperative_closure();
78647         uint64_t ret_ref = tag_ptr(ret_copy, true);
78648         return ret_ref;
78649 }
78650
78651 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_initiated_cooperative_closure"))) TS_ClosureReason_counterparty_initiated_cooperative_closure() {
78652         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78653         *ret_copy = ClosureReason_counterparty_initiated_cooperative_closure();
78654         uint64_t ret_ref = tag_ptr(ret_copy, true);
78655         return ret_ref;
78656 }
78657
78658 uint64_t  __attribute__((export_name("TS_ClosureReason_locally_initiated_cooperative_closure"))) TS_ClosureReason_locally_initiated_cooperative_closure() {
78659         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78660         *ret_copy = ClosureReason_locally_initiated_cooperative_closure();
78661         uint64_t ret_ref = tag_ptr(ret_copy, true);
78662         return ret_ref;
78663 }
78664
78665 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
78666         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78667         *ret_copy = ClosureReason_commitment_tx_confirmed();
78668         uint64_t ret_ref = tag_ptr(ret_copy, true);
78669         return ret_ref;
78670 }
78671
78672 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
78673         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78674         *ret_copy = ClosureReason_funding_timed_out();
78675         uint64_t ret_ref = tag_ptr(ret_copy, true);
78676         return ret_ref;
78677 }
78678
78679 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
78680         LDKStr err_conv = str_ref_to_owned_c(err);
78681         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78682         *ret_copy = ClosureReason_processing_error(err_conv);
78683         uint64_t ret_ref = tag_ptr(ret_copy, true);
78684         return ret_ref;
78685 }
78686
78687 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
78688         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78689         *ret_copy = ClosureReason_disconnected_peer();
78690         uint64_t ret_ref = tag_ptr(ret_copy, true);
78691         return ret_ref;
78692 }
78693
78694 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
78695         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78696         *ret_copy = ClosureReason_outdated_channel_manager();
78697         uint64_t ret_ref = tag_ptr(ret_copy, true);
78698         return ret_ref;
78699 }
78700
78701 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_coop_closed_unfunded_channel"))) TS_ClosureReason_counterparty_coop_closed_unfunded_channel() {
78702         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78703         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
78704         uint64_t ret_ref = tag_ptr(ret_copy, true);
78705         return ret_ref;
78706 }
78707
78708 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_batch_closure"))) TS_ClosureReason_funding_batch_closure() {
78709         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78710         *ret_copy = ClosureReason_funding_batch_closure();
78711         uint64_t ret_ref = tag_ptr(ret_copy, true);
78712         return ret_ref;
78713 }
78714
78715 uint64_t  __attribute__((export_name("TS_ClosureReason_htlcs_timed_out"))) TS_ClosureReason_htlcs_timed_out() {
78716         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78717         *ret_copy = ClosureReason_htlcs_timed_out();
78718         uint64_t ret_ref = tag_ptr(ret_copy, true);
78719         return ret_ref;
78720 }
78721
78722 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
78723         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
78724         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
78725         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
78726         return ret_conv;
78727 }
78728
78729 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
78730         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
78731         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
78732         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78733         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78734         CVec_u8Z_free(ret_var);
78735         return ret_arr;
78736 }
78737
78738 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
78739         LDKu8slice ser_ref;
78740         ser_ref.datalen = ser->arr_len;
78741         ser_ref.data = ser->elems;
78742         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
78743         *ret_conv = ClosureReason_read(ser_ref);
78744         FREE(ser);
78745         return tag_ptr(ret_conv, true);
78746 }
78747
78748 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
78749         if (!ptr_is_owned(this_ptr)) return;
78750         void* this_ptr_ptr = untag_ptr(this_ptr);
78751         CHECK_ACCESS(this_ptr_ptr);
78752         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
78753         FREE(untag_ptr(this_ptr));
78754         HTLCDestination_free(this_ptr_conv);
78755 }
78756
78757 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
78758         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78759         *ret_copy = HTLCDestination_clone(arg);
78760         uint64_t ret_ref = tag_ptr(ret_copy, true);
78761         return ret_ref;
78762 }
78763 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
78764         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
78765         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
78766         return ret_conv;
78767 }
78768
78769 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
78770         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
78771         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78772         *ret_copy = HTLCDestination_clone(orig_conv);
78773         uint64_t ret_ref = tag_ptr(ret_copy, true);
78774         return ret_ref;
78775 }
78776
78777 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, uint64_t channel_id) {
78778         LDKPublicKey node_id_ref;
78779         CHECK(node_id->arr_len == 33);
78780         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
78781         LDKChannelId channel_id_conv;
78782         channel_id_conv.inner = untag_ptr(channel_id);
78783         channel_id_conv.is_owned = ptr_is_owned(channel_id);
78784         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
78785         channel_id_conv = ChannelId_clone(&channel_id_conv);
78786         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78787         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_conv);
78788         uint64_t ret_ref = tag_ptr(ret_copy, true);
78789         return ret_ref;
78790 }
78791
78792 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
78793         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78794         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
78795         uint64_t ret_ref = tag_ptr(ret_copy, true);
78796         return ret_ref;
78797 }
78798
78799 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
78800         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78801         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
78802         uint64_t ret_ref = tag_ptr(ret_copy, true);
78803         return ret_ref;
78804 }
78805
78806 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_onion"))) TS_HTLCDestination_invalid_onion() {
78807         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78808         *ret_copy = HTLCDestination_invalid_onion();
78809         uint64_t ret_ref = tag_ptr(ret_copy, true);
78810         return ret_ref;
78811 }
78812
78813 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
78814         LDKThirtyTwoBytes payment_hash_ref;
78815         CHECK(payment_hash->arr_len == 32);
78816         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
78817         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78818         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
78819         uint64_t ret_ref = tag_ptr(ret_copy, true);
78820         return ret_ref;
78821 }
78822
78823 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
78824         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
78825         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
78826         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
78827         return ret_conv;
78828 }
78829
78830 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
78831         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
78832         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
78833         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78834         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78835         CVec_u8Z_free(ret_var);
78836         return ret_arr;
78837 }
78838
78839 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
78840         LDKu8slice ser_ref;
78841         ser_ref.datalen = ser->arr_len;
78842         ser_ref.data = ser->elems;
78843         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
78844         *ret_conv = HTLCDestination_read(ser_ref);
78845         FREE(ser);
78846         return tag_ptr(ret_conv, true);
78847 }
78848
78849 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
78850         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
78851         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
78852         return ret_conv;
78853 }
78854
78855 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
78856         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
78857         return ret_conv;
78858 }
78859
78860 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
78861         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
78862         return ret_conv;
78863 }
78864
78865 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
78866         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
78867         return ret_conv;
78868 }
78869
78870 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
78871         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
78872         return ret_conv;
78873 }
78874
78875 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
78876         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
78877         return ret_conv;
78878 }
78879
78880 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
78881         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
78882         return ret_conv;
78883 }
78884
78885 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
78886         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
78887         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
78888         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
78889         return ret_conv;
78890 }
78891
78892 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
78893         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
78894         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
78895         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78896         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78897         CVec_u8Z_free(ret_var);
78898         return ret_arr;
78899 }
78900
78901 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
78902         LDKu8slice ser_ref;
78903         ser_ref.datalen = ser->arr_len;
78904         ser_ref.data = ser->elems;
78905         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
78906         *ret_conv = PaymentFailureReason_read(ser_ref);
78907         FREE(ser);
78908         return tag_ptr(ret_conv, true);
78909 }
78910
78911 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
78912         if (!ptr_is_owned(this_ptr)) return;
78913         void* this_ptr_ptr = untag_ptr(this_ptr);
78914         CHECK_ACCESS(this_ptr_ptr);
78915         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
78916         FREE(untag_ptr(this_ptr));
78917         Event_free(this_ptr_conv);
78918 }
78919
78920 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
78921         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78922         *ret_copy = Event_clone(arg);
78923         uint64_t ret_ref = tag_ptr(ret_copy, true);
78924         return ret_ref;
78925 }
78926 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
78927         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
78928         int64_t ret_conv = Event_clone_ptr(arg_conv);
78929         return ret_conv;
78930 }
78931
78932 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
78933         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
78934         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78935         *ret_copy = Event_clone(orig_conv);
78936         uint64_t ret_ref = tag_ptr(ret_copy, true);
78937         return ret_ref;
78938 }
78939
78940 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) {
78941         LDKChannelId temporary_channel_id_conv;
78942         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
78943         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
78944         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
78945         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
78946         LDKPublicKey counterparty_node_id_ref;
78947         CHECK(counterparty_node_id->arr_len == 33);
78948         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
78949         LDKCVec_u8Z output_script_ref;
78950         output_script_ref.datalen = output_script->arr_len;
78951         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
78952         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
78953         LDKU128 user_channel_id_ref;
78954         CHECK(user_channel_id->arr_len == 16);
78955         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
78956         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78957         *ret_copy = Event_funding_generation_ready(temporary_channel_id_conv, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
78958         uint64_t ret_ref = tag_ptr(ret_copy, true);
78959         return ret_ref;
78960 }
78961
78962 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) {
78963         LDKPublicKey receiver_node_id_ref;
78964         CHECK(receiver_node_id->arr_len == 33);
78965         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
78966         LDKThirtyTwoBytes payment_hash_ref;
78967         CHECK(payment_hash->arr_len == 32);
78968         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
78969         LDKRecipientOnionFields onion_fields_conv;
78970         onion_fields_conv.inner = untag_ptr(onion_fields);
78971         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
78972         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
78973         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
78974         void* purpose_ptr = untag_ptr(purpose);
78975         CHECK_ACCESS(purpose_ptr);
78976         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
78977         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
78978         LDKChannelId via_channel_id_conv;
78979         via_channel_id_conv.inner = untag_ptr(via_channel_id);
78980         via_channel_id_conv.is_owned = ptr_is_owned(via_channel_id);
78981         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_conv);
78982         via_channel_id_conv = ChannelId_clone(&via_channel_id_conv);
78983         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
78984         CHECK_ACCESS(via_user_channel_id_ptr);
78985         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
78986         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
78987         void* claim_deadline_ptr = untag_ptr(claim_deadline);
78988         CHECK_ACCESS(claim_deadline_ptr);
78989         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
78990         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
78991         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78992         *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);
78993         uint64_t ret_ref = tag_ptr(ret_copy, true);
78994         return ret_ref;
78995 }
78996
78997 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) {
78998         LDKPublicKey receiver_node_id_ref;
78999         CHECK(receiver_node_id->arr_len == 33);
79000         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
79001         LDKThirtyTwoBytes payment_hash_ref;
79002         CHECK(payment_hash->arr_len == 32);
79003         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79004         void* purpose_ptr = untag_ptr(purpose);
79005         CHECK_ACCESS(purpose_ptr);
79006         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
79007         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
79008         LDKCVec_ClaimedHTLCZ htlcs_constr;
79009         htlcs_constr.datalen = htlcs->arr_len;
79010         if (htlcs_constr.datalen > 0)
79011                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
79012         else
79013                 htlcs_constr.data = NULL;
79014         uint64_t* htlcs_vals = htlcs->elems;
79015         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
79016                 uint64_t htlcs_conv_13 = htlcs_vals[n];
79017                 LDKClaimedHTLC htlcs_conv_13_conv;
79018                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
79019                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
79020                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
79021                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
79022                 htlcs_constr.data[n] = htlcs_conv_13_conv;
79023         }
79024         FREE(htlcs);
79025         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
79026         CHECK_ACCESS(sender_intended_total_msat_ptr);
79027         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
79028         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
79029         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79030         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
79031         uint64_t ret_ref = tag_ptr(ret_copy, true);
79032         return ret_ref;
79033 }
79034
79035 uint64_t  __attribute__((export_name("TS_Event_connection_needed"))) TS_Event_connection_needed(int8_tArray node_id, uint64_tArray addresses) {
79036         LDKPublicKey node_id_ref;
79037         CHECK(node_id->arr_len == 33);
79038         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79039         LDKCVec_SocketAddressZ addresses_constr;
79040         addresses_constr.datalen = addresses->arr_len;
79041         if (addresses_constr.datalen > 0)
79042                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
79043         else
79044                 addresses_constr.data = NULL;
79045         uint64_t* addresses_vals = addresses->elems;
79046         for (size_t p = 0; p < addresses_constr.datalen; p++) {
79047                 uint64_t addresses_conv_15 = addresses_vals[p];
79048                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
79049                 CHECK_ACCESS(addresses_conv_15_ptr);
79050                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
79051                 addresses_constr.data[p] = addresses_conv_15_conv;
79052         }
79053         FREE(addresses);
79054         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79055         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
79056         uint64_t ret_ref = tag_ptr(ret_copy, true);
79057         return ret_ref;
79058 }
79059
79060 uint64_t  __attribute__((export_name("TS_Event_invoice_request_failed"))) TS_Event_invoice_request_failed(int8_tArray payment_id) {
79061         LDKThirtyTwoBytes payment_id_ref;
79062         CHECK(payment_id->arr_len == 32);
79063         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79064         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79065         *ret_copy = Event_invoice_request_failed(payment_id_ref);
79066         uint64_t ret_ref = tag_ptr(ret_copy, true);
79067         return ret_ref;
79068 }
79069
79070 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) {
79071         void* payment_id_ptr = untag_ptr(payment_id);
79072         CHECK_ACCESS(payment_id_ptr);
79073         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
79074         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
79075         LDKThirtyTwoBytes payment_preimage_ref;
79076         CHECK(payment_preimage->arr_len == 32);
79077         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
79078         LDKThirtyTwoBytes payment_hash_ref;
79079         CHECK(payment_hash->arr_len == 32);
79080         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79081         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
79082         CHECK_ACCESS(fee_paid_msat_ptr);
79083         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
79084         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
79085         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79086         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
79087         uint64_t ret_ref = tag_ptr(ret_copy, true);
79088         return ret_ref;
79089 }
79090
79091 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
79092         LDKThirtyTwoBytes payment_id_ref;
79093         CHECK(payment_id->arr_len == 32);
79094         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79095         LDKThirtyTwoBytes payment_hash_ref;
79096         CHECK(payment_hash->arr_len == 32);
79097         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79098         void* reason_ptr = untag_ptr(reason);
79099         CHECK_ACCESS(reason_ptr);
79100         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
79101         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
79102         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79103         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
79104         uint64_t ret_ref = tag_ptr(ret_copy, true);
79105         return ret_ref;
79106 }
79107
79108 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) {
79109         LDKThirtyTwoBytes payment_id_ref;
79110         CHECK(payment_id->arr_len == 32);
79111         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79112         void* payment_hash_ptr = untag_ptr(payment_hash);
79113         CHECK_ACCESS(payment_hash_ptr);
79114         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
79115         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
79116         LDKPath path_conv;
79117         path_conv.inner = untag_ptr(path);
79118         path_conv.is_owned = ptr_is_owned(path);
79119         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
79120         path_conv = Path_clone(&path_conv);
79121         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79122         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
79123         uint64_t ret_ref = tag_ptr(ret_copy, true);
79124         return ret_ref;
79125 }
79126
79127 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) {
79128         void* payment_id_ptr = untag_ptr(payment_id);
79129         CHECK_ACCESS(payment_id_ptr);
79130         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
79131         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
79132         LDKThirtyTwoBytes payment_hash_ref;
79133         CHECK(payment_hash->arr_len == 32);
79134         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79135         void* failure_ptr = untag_ptr(failure);
79136         CHECK_ACCESS(failure_ptr);
79137         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
79138         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
79139         LDKPath path_conv;
79140         path_conv.inner = untag_ptr(path);
79141         path_conv.is_owned = ptr_is_owned(path);
79142         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
79143         path_conv = Path_clone(&path_conv);
79144         void* short_channel_id_ptr = untag_ptr(short_channel_id);
79145         CHECK_ACCESS(short_channel_id_ptr);
79146         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
79147         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
79148         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79149         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
79150         uint64_t ret_ref = tag_ptr(ret_copy, true);
79151         return ret_ref;
79152 }
79153
79154 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
79155         LDKThirtyTwoBytes payment_id_ref;
79156         CHECK(payment_id->arr_len == 32);
79157         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79158         LDKThirtyTwoBytes payment_hash_ref;
79159         CHECK(payment_hash->arr_len == 32);
79160         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79161         LDKPath path_conv;
79162         path_conv.inner = untag_ptr(path);
79163         path_conv.is_owned = ptr_is_owned(path);
79164         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
79165         path_conv = Path_clone(&path_conv);
79166         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79167         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
79168         uint64_t ret_ref = tag_ptr(ret_copy, true);
79169         return ret_ref;
79170 }
79171
79172 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) {
79173         LDKThirtyTwoBytes payment_id_ref;
79174         CHECK(payment_id->arr_len == 32);
79175         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79176         LDKThirtyTwoBytes payment_hash_ref;
79177         CHECK(payment_hash->arr_len == 32);
79178         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79179         LDKPath path_conv;
79180         path_conv.inner = untag_ptr(path);
79181         path_conv.is_owned = ptr_is_owned(path);
79182         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
79183         path_conv = Path_clone(&path_conv);
79184         void* short_channel_id_ptr = untag_ptr(short_channel_id);
79185         CHECK_ACCESS(short_channel_id_ptr);
79186         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
79187         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
79188         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79189         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
79190         uint64_t ret_ref = tag_ptr(ret_copy, true);
79191         return ret_ref;
79192 }
79193
79194 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
79195         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79196         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
79197         uint64_t ret_ref = tag_ptr(ret_copy, true);
79198         return ret_ref;
79199 }
79200
79201 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) {
79202         LDKThirtyTwoBytes intercept_id_ref;
79203         CHECK(intercept_id->arr_len == 32);
79204         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
79205         LDKThirtyTwoBytes payment_hash_ref;
79206         CHECK(payment_hash->arr_len == 32);
79207         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79208         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79209         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
79210         uint64_t ret_ref = tag_ptr(ret_copy, true);
79211         return ret_ref;
79212 }
79213
79214 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs, uint64_t channel_id) {
79215         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
79216         outputs_constr.datalen = outputs->arr_len;
79217         if (outputs_constr.datalen > 0)
79218                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
79219         else
79220                 outputs_constr.data = NULL;
79221         uint64_t* outputs_vals = outputs->elems;
79222         for (size_t b = 0; b < outputs_constr.datalen; b++) {
79223                 uint64_t outputs_conv_27 = outputs_vals[b];
79224                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
79225                 CHECK_ACCESS(outputs_conv_27_ptr);
79226                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
79227                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
79228                 outputs_constr.data[b] = outputs_conv_27_conv;
79229         }
79230         FREE(outputs);
79231         LDKChannelId channel_id_conv;
79232         channel_id_conv.inner = untag_ptr(channel_id);
79233         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79234         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79235         channel_id_conv = ChannelId_clone(&channel_id_conv);
79236         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79237         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
79238         uint64_t ret_ref = tag_ptr(ret_copy, true);
79239         return ret_ref;
79240 }
79241
79242 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) {
79243         LDKChannelId prev_channel_id_conv;
79244         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
79245         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
79246         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
79247         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
79248         LDKChannelId next_channel_id_conv;
79249         next_channel_id_conv.inner = untag_ptr(next_channel_id);
79250         next_channel_id_conv.is_owned = ptr_is_owned(next_channel_id);
79251         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_conv);
79252         next_channel_id_conv = ChannelId_clone(&next_channel_id_conv);
79253         void* prev_user_channel_id_ptr = untag_ptr(prev_user_channel_id);
79254         CHECK_ACCESS(prev_user_channel_id_ptr);
79255         LDKCOption_U128Z prev_user_channel_id_conv = *(LDKCOption_U128Z*)(prev_user_channel_id_ptr);
79256         prev_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(prev_user_channel_id));
79257         void* next_user_channel_id_ptr = untag_ptr(next_user_channel_id);
79258         CHECK_ACCESS(next_user_channel_id_ptr);
79259         LDKCOption_U128Z next_user_channel_id_conv = *(LDKCOption_U128Z*)(next_user_channel_id_ptr);
79260         next_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(next_user_channel_id));
79261         void* total_fee_earned_msat_ptr = untag_ptr(total_fee_earned_msat);
79262         CHECK_ACCESS(total_fee_earned_msat_ptr);
79263         LDKCOption_u64Z total_fee_earned_msat_conv = *(LDKCOption_u64Z*)(total_fee_earned_msat_ptr);
79264         total_fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(total_fee_earned_msat));
79265         void* skimmed_fee_msat_ptr = untag_ptr(skimmed_fee_msat);
79266         CHECK_ACCESS(skimmed_fee_msat_ptr);
79267         LDKCOption_u64Z skimmed_fee_msat_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_ptr);
79268         skimmed_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat));
79269         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
79270         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
79271         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
79272         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
79273         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79274         *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);
79275         uint64_t ret_ref = tag_ptr(ret_copy, true);
79276         return ret_ref;
79277 }
79278
79279 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) {
79280         LDKChannelId channel_id_conv;
79281         channel_id_conv.inner = untag_ptr(channel_id);
79282         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79283         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79284         channel_id_conv = ChannelId_clone(&channel_id_conv);
79285         LDKU128 user_channel_id_ref;
79286         CHECK(user_channel_id->arr_len == 16);
79287         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
79288         LDKChannelId former_temporary_channel_id_conv;
79289         former_temporary_channel_id_conv.inner = untag_ptr(former_temporary_channel_id);
79290         former_temporary_channel_id_conv.is_owned = ptr_is_owned(former_temporary_channel_id);
79291         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_conv);
79292         former_temporary_channel_id_conv = ChannelId_clone(&former_temporary_channel_id_conv);
79293         LDKPublicKey counterparty_node_id_ref;
79294         CHECK(counterparty_node_id->arr_len == 33);
79295         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79296         LDKOutPoint funding_txo_conv;
79297         funding_txo_conv.inner = untag_ptr(funding_txo);
79298         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
79299         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
79300         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
79301         LDKChannelTypeFeatures channel_type_conv;
79302         channel_type_conv.inner = untag_ptr(channel_type);
79303         channel_type_conv.is_owned = ptr_is_owned(channel_type);
79304         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
79305         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
79306         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79307         *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);
79308         uint64_t ret_ref = tag_ptr(ret_copy, true);
79309         return ret_ref;
79310 }
79311
79312 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) {
79313         LDKChannelId channel_id_conv;
79314         channel_id_conv.inner = untag_ptr(channel_id);
79315         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79316         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79317         channel_id_conv = ChannelId_clone(&channel_id_conv);
79318         LDKU128 user_channel_id_ref;
79319         CHECK(user_channel_id->arr_len == 16);
79320         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
79321         LDKPublicKey counterparty_node_id_ref;
79322         CHECK(counterparty_node_id->arr_len == 33);
79323         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79324         LDKChannelTypeFeatures channel_type_conv;
79325         channel_type_conv.inner = untag_ptr(channel_type);
79326         channel_type_conv.is_owned = ptr_is_owned(channel_type);
79327         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
79328         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
79329         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79330         *ret_copy = Event_channel_ready(channel_id_conv, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
79331         uint64_t ret_ref = tag_ptr(ret_copy, true);
79332         return ret_ref;
79333 }
79334
79335 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) {
79336         LDKChannelId channel_id_conv;
79337         channel_id_conv.inner = untag_ptr(channel_id);
79338         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79339         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79340         channel_id_conv = ChannelId_clone(&channel_id_conv);
79341         LDKU128 user_channel_id_ref;
79342         CHECK(user_channel_id->arr_len == 16);
79343         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
79344         void* reason_ptr = untag_ptr(reason);
79345         CHECK_ACCESS(reason_ptr);
79346         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
79347         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
79348         LDKPublicKey counterparty_node_id_ref;
79349         CHECK(counterparty_node_id->arr_len == 33);
79350         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79351         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
79352         CHECK_ACCESS(channel_capacity_sats_ptr);
79353         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
79354         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
79355         LDKOutPoint channel_funding_txo_conv;
79356         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
79357         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
79358         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
79359         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
79360         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79361         *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);
79362         uint64_t ret_ref = tag_ptr(ret_copy, true);
79363         return ret_ref;
79364 }
79365
79366 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(uint64_t channel_id, int8_tArray transaction) {
79367         LDKChannelId channel_id_conv;
79368         channel_id_conv.inner = untag_ptr(channel_id);
79369         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79370         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79371         channel_id_conv = ChannelId_clone(&channel_id_conv);
79372         LDKTransaction transaction_ref;
79373         transaction_ref.datalen = transaction->arr_len;
79374         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
79375         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
79376         transaction_ref.data_is_owned = true;
79377         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79378         *ret_copy = Event_discard_funding(channel_id_conv, transaction_ref);
79379         uint64_t ret_ref = tag_ptr(ret_copy, true);
79380         return ret_ref;
79381 }
79382
79383 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) {
79384         LDKChannelId temporary_channel_id_conv;
79385         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
79386         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
79387         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
79388         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
79389         LDKPublicKey counterparty_node_id_ref;
79390         CHECK(counterparty_node_id->arr_len == 33);
79391         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79392         LDKChannelTypeFeatures channel_type_conv;
79393         channel_type_conv.inner = untag_ptr(channel_type);
79394         channel_type_conv.is_owned = ptr_is_owned(channel_type);
79395         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
79396         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
79397         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79398         *ret_copy = Event_open_channel_request(temporary_channel_id_conv, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
79399         uint64_t ret_ref = tag_ptr(ret_copy, true);
79400         return ret_ref;
79401 }
79402
79403 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(uint64_t prev_channel_id, uint64_t failed_next_destination) {
79404         LDKChannelId prev_channel_id_conv;
79405         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
79406         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
79407         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
79408         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
79409         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
79410         CHECK_ACCESS(failed_next_destination_ptr);
79411         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
79412         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
79413         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79414         *ret_copy = Event_htlchandling_failed(prev_channel_id_conv, failed_next_destination_conv);
79415         uint64_t ret_ref = tag_ptr(ret_copy, true);
79416         return ret_ref;
79417 }
79418
79419 uint64_t  __attribute__((export_name("TS_Event_bump_transaction"))) TS_Event_bump_transaction(uint64_t a) {
79420         void* a_ptr = untag_ptr(a);
79421         CHECK_ACCESS(a_ptr);
79422         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
79423         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
79424         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79425         *ret_copy = Event_bump_transaction(a_conv);
79426         uint64_t ret_ref = tag_ptr(ret_copy, true);
79427         return ret_ref;
79428 }
79429
79430 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
79431         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
79432         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
79433         jboolean ret_conv = Event_eq(a_conv, b_conv);
79434         return ret_conv;
79435 }
79436
79437 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
79438         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
79439         LDKCVec_u8Z ret_var = Event_write(obj_conv);
79440         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79441         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79442         CVec_u8Z_free(ret_var);
79443         return ret_arr;
79444 }
79445
79446 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
79447         LDKu8slice ser_ref;
79448         ser_ref.datalen = ser->arr_len;
79449         ser_ref.data = ser->elems;
79450         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
79451         *ret_conv = Event_read(ser_ref);
79452         FREE(ser);
79453         return tag_ptr(ret_conv, true);
79454 }
79455
79456 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
79457         if (!ptr_is_owned(this_ptr)) return;
79458         void* this_ptr_ptr = untag_ptr(this_ptr);
79459         CHECK_ACCESS(this_ptr_ptr);
79460         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
79461         FREE(untag_ptr(this_ptr));
79462         MessageSendEvent_free(this_ptr_conv);
79463 }
79464
79465 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
79466         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79467         *ret_copy = MessageSendEvent_clone(arg);
79468         uint64_t ret_ref = tag_ptr(ret_copy, true);
79469         return ret_ref;
79470 }
79471 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
79472         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
79473         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
79474         return ret_conv;
79475 }
79476
79477 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
79478         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
79479         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79480         *ret_copy = MessageSendEvent_clone(orig_conv);
79481         uint64_t ret_ref = tag_ptr(ret_copy, true);
79482         return ret_ref;
79483 }
79484
79485 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
79486         LDKPublicKey node_id_ref;
79487         CHECK(node_id->arr_len == 33);
79488         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79489         LDKAcceptChannel msg_conv;
79490         msg_conv.inner = untag_ptr(msg);
79491         msg_conv.is_owned = ptr_is_owned(msg);
79492         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79493         msg_conv = AcceptChannel_clone(&msg_conv);
79494         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79495         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
79496         uint64_t ret_ref = tag_ptr(ret_copy, true);
79497         return ret_ref;
79498 }
79499
79500 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel_v2"))) TS_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, uint64_t msg) {
79501         LDKPublicKey node_id_ref;
79502         CHECK(node_id->arr_len == 33);
79503         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79504         LDKAcceptChannelV2 msg_conv;
79505         msg_conv.inner = untag_ptr(msg);
79506         msg_conv.is_owned = ptr_is_owned(msg);
79507         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79508         msg_conv = AcceptChannelV2_clone(&msg_conv);
79509         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79510         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
79511         uint64_t ret_ref = tag_ptr(ret_copy, true);
79512         return ret_ref;
79513 }
79514
79515 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
79516         LDKPublicKey node_id_ref;
79517         CHECK(node_id->arr_len == 33);
79518         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79519         LDKOpenChannel msg_conv;
79520         msg_conv.inner = untag_ptr(msg);
79521         msg_conv.is_owned = ptr_is_owned(msg);
79522         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79523         msg_conv = OpenChannel_clone(&msg_conv);
79524         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79525         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
79526         uint64_t ret_ref = tag_ptr(ret_copy, true);
79527         return ret_ref;
79528 }
79529
79530 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel_v2"))) TS_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, uint64_t msg) {
79531         LDKPublicKey node_id_ref;
79532         CHECK(node_id->arr_len == 33);
79533         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79534         LDKOpenChannelV2 msg_conv;
79535         msg_conv.inner = untag_ptr(msg);
79536         msg_conv.is_owned = ptr_is_owned(msg);
79537         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79538         msg_conv = OpenChannelV2_clone(&msg_conv);
79539         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79540         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
79541         uint64_t ret_ref = tag_ptr(ret_copy, true);
79542         return ret_ref;
79543 }
79544
79545 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
79546         LDKPublicKey node_id_ref;
79547         CHECK(node_id->arr_len == 33);
79548         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79549         LDKFundingCreated msg_conv;
79550         msg_conv.inner = untag_ptr(msg);
79551         msg_conv.is_owned = ptr_is_owned(msg);
79552         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79553         msg_conv = FundingCreated_clone(&msg_conv);
79554         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79555         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
79556         uint64_t ret_ref = tag_ptr(ret_copy, true);
79557         return ret_ref;
79558 }
79559
79560 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
79561         LDKPublicKey node_id_ref;
79562         CHECK(node_id->arr_len == 33);
79563         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79564         LDKFundingSigned msg_conv;
79565         msg_conv.inner = untag_ptr(msg);
79566         msg_conv.is_owned = ptr_is_owned(msg);
79567         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79568         msg_conv = FundingSigned_clone(&msg_conv);
79569         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79570         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
79571         uint64_t ret_ref = tag_ptr(ret_copy, true);
79572         return ret_ref;
79573 }
79574
79575 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_stfu"))) TS_MessageSendEvent_send_stfu(int8_tArray node_id, uint64_t msg) {
79576         LDKPublicKey node_id_ref;
79577         CHECK(node_id->arr_len == 33);
79578         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79579         LDKStfu msg_conv;
79580         msg_conv.inner = untag_ptr(msg);
79581         msg_conv.is_owned = ptr_is_owned(msg);
79582         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79583         msg_conv = Stfu_clone(&msg_conv);
79584         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79585         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
79586         uint64_t ret_ref = tag_ptr(ret_copy, true);
79587         return ret_ref;
79588 }
79589
79590 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice"))) TS_MessageSendEvent_send_splice(int8_tArray node_id, uint64_t msg) {
79591         LDKPublicKey node_id_ref;
79592         CHECK(node_id->arr_len == 33);
79593         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79594         LDKSplice msg_conv;
79595         msg_conv.inner = untag_ptr(msg);
79596         msg_conv.is_owned = ptr_is_owned(msg);
79597         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79598         msg_conv = Splice_clone(&msg_conv);
79599         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79600         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
79601         uint64_t ret_ref = tag_ptr(ret_copy, true);
79602         return ret_ref;
79603 }
79604
79605 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice_ack"))) TS_MessageSendEvent_send_splice_ack(int8_tArray node_id, uint64_t msg) {
79606         LDKPublicKey node_id_ref;
79607         CHECK(node_id->arr_len == 33);
79608         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79609         LDKSpliceAck msg_conv;
79610         msg_conv.inner = untag_ptr(msg);
79611         msg_conv.is_owned = ptr_is_owned(msg);
79612         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79613         msg_conv = SpliceAck_clone(&msg_conv);
79614         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79615         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
79616         uint64_t ret_ref = tag_ptr(ret_copy, true);
79617         return ret_ref;
79618 }
79619
79620 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice_locked"))) TS_MessageSendEvent_send_splice_locked(int8_tArray node_id, uint64_t msg) {
79621         LDKPublicKey node_id_ref;
79622         CHECK(node_id->arr_len == 33);
79623         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79624         LDKSpliceLocked msg_conv;
79625         msg_conv.inner = untag_ptr(msg);
79626         msg_conv.is_owned = ptr_is_owned(msg);
79627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79628         msg_conv = SpliceLocked_clone(&msg_conv);
79629         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79630         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
79631         uint64_t ret_ref = tag_ptr(ret_copy, true);
79632         return ret_ref;
79633 }
79634
79635 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_input"))) TS_MessageSendEvent_send_tx_add_input(int8_tArray node_id, uint64_t msg) {
79636         LDKPublicKey node_id_ref;
79637         CHECK(node_id->arr_len == 33);
79638         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79639         LDKTxAddInput msg_conv;
79640         msg_conv.inner = untag_ptr(msg);
79641         msg_conv.is_owned = ptr_is_owned(msg);
79642         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79643         msg_conv = TxAddInput_clone(&msg_conv);
79644         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79645         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
79646         uint64_t ret_ref = tag_ptr(ret_copy, true);
79647         return ret_ref;
79648 }
79649
79650 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_output"))) TS_MessageSendEvent_send_tx_add_output(int8_tArray node_id, uint64_t msg) {
79651         LDKPublicKey node_id_ref;
79652         CHECK(node_id->arr_len == 33);
79653         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79654         LDKTxAddOutput msg_conv;
79655         msg_conv.inner = untag_ptr(msg);
79656         msg_conv.is_owned = ptr_is_owned(msg);
79657         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79658         msg_conv = TxAddOutput_clone(&msg_conv);
79659         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79660         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
79661         uint64_t ret_ref = tag_ptr(ret_copy, true);
79662         return ret_ref;
79663 }
79664
79665 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_input"))) TS_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, uint64_t msg) {
79666         LDKPublicKey node_id_ref;
79667         CHECK(node_id->arr_len == 33);
79668         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79669         LDKTxRemoveInput msg_conv;
79670         msg_conv.inner = untag_ptr(msg);
79671         msg_conv.is_owned = ptr_is_owned(msg);
79672         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79673         msg_conv = TxRemoveInput_clone(&msg_conv);
79674         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79675         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
79676         uint64_t ret_ref = tag_ptr(ret_copy, true);
79677         return ret_ref;
79678 }
79679
79680 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_output"))) TS_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, uint64_t msg) {
79681         LDKPublicKey node_id_ref;
79682         CHECK(node_id->arr_len == 33);
79683         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79684         LDKTxRemoveOutput msg_conv;
79685         msg_conv.inner = untag_ptr(msg);
79686         msg_conv.is_owned = ptr_is_owned(msg);
79687         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79688         msg_conv = TxRemoveOutput_clone(&msg_conv);
79689         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79690         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
79691         uint64_t ret_ref = tag_ptr(ret_copy, true);
79692         return ret_ref;
79693 }
79694
79695 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_complete"))) TS_MessageSendEvent_send_tx_complete(int8_tArray node_id, uint64_t msg) {
79696         LDKPublicKey node_id_ref;
79697         CHECK(node_id->arr_len == 33);
79698         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79699         LDKTxComplete msg_conv;
79700         msg_conv.inner = untag_ptr(msg);
79701         msg_conv.is_owned = ptr_is_owned(msg);
79702         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79703         msg_conv = TxComplete_clone(&msg_conv);
79704         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79705         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
79706         uint64_t ret_ref = tag_ptr(ret_copy, true);
79707         return ret_ref;
79708 }
79709
79710 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_signatures"))) TS_MessageSendEvent_send_tx_signatures(int8_tArray node_id, uint64_t msg) {
79711         LDKPublicKey node_id_ref;
79712         CHECK(node_id->arr_len == 33);
79713         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79714         LDKTxSignatures msg_conv;
79715         msg_conv.inner = untag_ptr(msg);
79716         msg_conv.is_owned = ptr_is_owned(msg);
79717         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79718         msg_conv = TxSignatures_clone(&msg_conv);
79719         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79720         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
79721         uint64_t ret_ref = tag_ptr(ret_copy, true);
79722         return ret_ref;
79723 }
79724
79725 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_init_rbf"))) TS_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, uint64_t msg) {
79726         LDKPublicKey node_id_ref;
79727         CHECK(node_id->arr_len == 33);
79728         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79729         LDKTxInitRbf msg_conv;
79730         msg_conv.inner = untag_ptr(msg);
79731         msg_conv.is_owned = ptr_is_owned(msg);
79732         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79733         msg_conv = TxInitRbf_clone(&msg_conv);
79734         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79735         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
79736         uint64_t ret_ref = tag_ptr(ret_copy, true);
79737         return ret_ref;
79738 }
79739
79740 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_ack_rbf"))) TS_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, uint64_t msg) {
79741         LDKPublicKey node_id_ref;
79742         CHECK(node_id->arr_len == 33);
79743         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79744         LDKTxAckRbf msg_conv;
79745         msg_conv.inner = untag_ptr(msg);
79746         msg_conv.is_owned = ptr_is_owned(msg);
79747         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79748         msg_conv = TxAckRbf_clone(&msg_conv);
79749         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79750         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
79751         uint64_t ret_ref = tag_ptr(ret_copy, true);
79752         return ret_ref;
79753 }
79754
79755 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_abort"))) TS_MessageSendEvent_send_tx_abort(int8_tArray node_id, uint64_t msg) {
79756         LDKPublicKey node_id_ref;
79757         CHECK(node_id->arr_len == 33);
79758         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79759         LDKTxAbort msg_conv;
79760         msg_conv.inner = untag_ptr(msg);
79761         msg_conv.is_owned = ptr_is_owned(msg);
79762         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79763         msg_conv = TxAbort_clone(&msg_conv);
79764         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79765         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
79766         uint64_t ret_ref = tag_ptr(ret_copy, true);
79767         return ret_ref;
79768 }
79769
79770 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
79771         LDKPublicKey node_id_ref;
79772         CHECK(node_id->arr_len == 33);
79773         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79774         LDKChannelReady msg_conv;
79775         msg_conv.inner = untag_ptr(msg);
79776         msg_conv.is_owned = ptr_is_owned(msg);
79777         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79778         msg_conv = ChannelReady_clone(&msg_conv);
79779         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79780         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
79781         uint64_t ret_ref = tag_ptr(ret_copy, true);
79782         return ret_ref;
79783 }
79784
79785 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
79786         LDKPublicKey node_id_ref;
79787         CHECK(node_id->arr_len == 33);
79788         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79789         LDKAnnouncementSignatures msg_conv;
79790         msg_conv.inner = untag_ptr(msg);
79791         msg_conv.is_owned = ptr_is_owned(msg);
79792         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79793         msg_conv = AnnouncementSignatures_clone(&msg_conv);
79794         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79795         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
79796         uint64_t ret_ref = tag_ptr(ret_copy, true);
79797         return ret_ref;
79798 }
79799
79800 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
79801         LDKPublicKey node_id_ref;
79802         CHECK(node_id->arr_len == 33);
79803         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79804         LDKCommitmentUpdate updates_conv;
79805         updates_conv.inner = untag_ptr(updates);
79806         updates_conv.is_owned = ptr_is_owned(updates);
79807         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
79808         updates_conv = CommitmentUpdate_clone(&updates_conv);
79809         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79810         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
79811         uint64_t ret_ref = tag_ptr(ret_copy, true);
79812         return ret_ref;
79813 }
79814
79815 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
79816         LDKPublicKey node_id_ref;
79817         CHECK(node_id->arr_len == 33);
79818         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79819         LDKRevokeAndACK msg_conv;
79820         msg_conv.inner = untag_ptr(msg);
79821         msg_conv.is_owned = ptr_is_owned(msg);
79822         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79823         msg_conv = RevokeAndACK_clone(&msg_conv);
79824         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79825         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
79826         uint64_t ret_ref = tag_ptr(ret_copy, true);
79827         return ret_ref;
79828 }
79829
79830 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
79831         LDKPublicKey node_id_ref;
79832         CHECK(node_id->arr_len == 33);
79833         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79834         LDKClosingSigned msg_conv;
79835         msg_conv.inner = untag_ptr(msg);
79836         msg_conv.is_owned = ptr_is_owned(msg);
79837         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79838         msg_conv = ClosingSigned_clone(&msg_conv);
79839         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79840         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
79841         uint64_t ret_ref = tag_ptr(ret_copy, true);
79842         return ret_ref;
79843 }
79844
79845 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
79846         LDKPublicKey node_id_ref;
79847         CHECK(node_id->arr_len == 33);
79848         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79849         LDKShutdown msg_conv;
79850         msg_conv.inner = untag_ptr(msg);
79851         msg_conv.is_owned = ptr_is_owned(msg);
79852         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79853         msg_conv = Shutdown_clone(&msg_conv);
79854         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79855         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
79856         uint64_t ret_ref = tag_ptr(ret_copy, true);
79857         return ret_ref;
79858 }
79859
79860 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
79861         LDKPublicKey node_id_ref;
79862         CHECK(node_id->arr_len == 33);
79863         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79864         LDKChannelReestablish msg_conv;
79865         msg_conv.inner = untag_ptr(msg);
79866         msg_conv.is_owned = ptr_is_owned(msg);
79867         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79868         msg_conv = ChannelReestablish_clone(&msg_conv);
79869         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79870         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
79871         uint64_t ret_ref = tag_ptr(ret_copy, true);
79872         return ret_ref;
79873 }
79874
79875 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) {
79876         LDKPublicKey node_id_ref;
79877         CHECK(node_id->arr_len == 33);
79878         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79879         LDKChannelAnnouncement msg_conv;
79880         msg_conv.inner = untag_ptr(msg);
79881         msg_conv.is_owned = ptr_is_owned(msg);
79882         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79883         msg_conv = ChannelAnnouncement_clone(&msg_conv);
79884         LDKChannelUpdate update_msg_conv;
79885         update_msg_conv.inner = untag_ptr(update_msg);
79886         update_msg_conv.is_owned = ptr_is_owned(update_msg);
79887         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
79888         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
79889         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79890         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
79891         uint64_t ret_ref = tag_ptr(ret_copy, true);
79892         return ret_ref;
79893 }
79894
79895 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
79896         LDKChannelAnnouncement msg_conv;
79897         msg_conv.inner = untag_ptr(msg);
79898         msg_conv.is_owned = ptr_is_owned(msg);
79899         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79900         msg_conv = ChannelAnnouncement_clone(&msg_conv);
79901         LDKChannelUpdate update_msg_conv;
79902         update_msg_conv.inner = untag_ptr(update_msg);
79903         update_msg_conv.is_owned = ptr_is_owned(update_msg);
79904         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
79905         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
79906         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79907         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
79908         uint64_t ret_ref = tag_ptr(ret_copy, true);
79909         return ret_ref;
79910 }
79911
79912 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
79913         LDKChannelUpdate msg_conv;
79914         msg_conv.inner = untag_ptr(msg);
79915         msg_conv.is_owned = ptr_is_owned(msg);
79916         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79917         msg_conv = ChannelUpdate_clone(&msg_conv);
79918         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79919         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
79920         uint64_t ret_ref = tag_ptr(ret_copy, true);
79921         return ret_ref;
79922 }
79923
79924 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
79925         LDKNodeAnnouncement msg_conv;
79926         msg_conv.inner = untag_ptr(msg);
79927         msg_conv.is_owned = ptr_is_owned(msg);
79928         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79929         msg_conv = NodeAnnouncement_clone(&msg_conv);
79930         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79931         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
79932         uint64_t ret_ref = tag_ptr(ret_copy, true);
79933         return ret_ref;
79934 }
79935
79936 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
79937         LDKPublicKey node_id_ref;
79938         CHECK(node_id->arr_len == 33);
79939         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79940         LDKChannelUpdate msg_conv;
79941         msg_conv.inner = untag_ptr(msg);
79942         msg_conv.is_owned = ptr_is_owned(msg);
79943         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79944         msg_conv = ChannelUpdate_clone(&msg_conv);
79945         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79946         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
79947         uint64_t ret_ref = tag_ptr(ret_copy, true);
79948         return ret_ref;
79949 }
79950
79951 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
79952         LDKPublicKey node_id_ref;
79953         CHECK(node_id->arr_len == 33);
79954         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79955         void* action_ptr = untag_ptr(action);
79956         CHECK_ACCESS(action_ptr);
79957         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
79958         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
79959         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79960         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
79961         uint64_t ret_ref = tag_ptr(ret_copy, true);
79962         return ret_ref;
79963 }
79964
79965 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
79966         LDKPublicKey node_id_ref;
79967         CHECK(node_id->arr_len == 33);
79968         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79969         LDKQueryChannelRange msg_conv;
79970         msg_conv.inner = untag_ptr(msg);
79971         msg_conv.is_owned = ptr_is_owned(msg);
79972         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79973         msg_conv = QueryChannelRange_clone(&msg_conv);
79974         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79975         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
79976         uint64_t ret_ref = tag_ptr(ret_copy, true);
79977         return ret_ref;
79978 }
79979
79980 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
79981         LDKPublicKey node_id_ref;
79982         CHECK(node_id->arr_len == 33);
79983         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79984         LDKQueryShortChannelIds msg_conv;
79985         msg_conv.inner = untag_ptr(msg);
79986         msg_conv.is_owned = ptr_is_owned(msg);
79987         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79988         msg_conv = QueryShortChannelIds_clone(&msg_conv);
79989         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79990         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
79991         uint64_t ret_ref = tag_ptr(ret_copy, true);
79992         return ret_ref;
79993 }
79994
79995 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
79996         LDKPublicKey node_id_ref;
79997         CHECK(node_id->arr_len == 33);
79998         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79999         LDKReplyChannelRange msg_conv;
80000         msg_conv.inner = untag_ptr(msg);
80001         msg_conv.is_owned = ptr_is_owned(msg);
80002         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80003         msg_conv = ReplyChannelRange_clone(&msg_conv);
80004         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80005         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
80006         uint64_t ret_ref = tag_ptr(ret_copy, true);
80007         return ret_ref;
80008 }
80009
80010 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
80011         LDKPublicKey node_id_ref;
80012         CHECK(node_id->arr_len == 33);
80013         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80014         LDKGossipTimestampFilter msg_conv;
80015         msg_conv.inner = untag_ptr(msg);
80016         msg_conv.is_owned = ptr_is_owned(msg);
80017         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80018         msg_conv = GossipTimestampFilter_clone(&msg_conv);
80019         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80020         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
80021         uint64_t ret_ref = tag_ptr(ret_copy, true);
80022         return ret_ref;
80023 }
80024
80025 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
80026         if (!ptr_is_owned(this_ptr)) return;
80027         void* this_ptr_ptr = untag_ptr(this_ptr);
80028         CHECK_ACCESS(this_ptr_ptr);
80029         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
80030         FREE(untag_ptr(this_ptr));
80031         MessageSendEventsProvider_free(this_ptr_conv);
80032 }
80033
80034 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
80035         if (!ptr_is_owned(this_ptr)) return;
80036         void* this_ptr_ptr = untag_ptr(this_ptr);
80037         CHECK_ACCESS(this_ptr_ptr);
80038         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
80039         FREE(untag_ptr(this_ptr));
80040         EventsProvider_free(this_ptr_conv);
80041 }
80042
80043 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
80044         if (!ptr_is_owned(this_ptr)) return;
80045         void* this_ptr_ptr = untag_ptr(this_ptr);
80046         CHECK_ACCESS(this_ptr_ptr);
80047         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
80048         FREE(untag_ptr(this_ptr));
80049         EventHandler_free(this_ptr_conv);
80050 }
80051
80052 void  __attribute__((export_name("TS_AnchorDescriptor_free"))) TS_AnchorDescriptor_free(uint64_t this_obj) {
80053         LDKAnchorDescriptor this_obj_conv;
80054         this_obj_conv.inner = untag_ptr(this_obj);
80055         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80057         AnchorDescriptor_free(this_obj_conv);
80058 }
80059
80060 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_channel_derivation_parameters"))) TS_AnchorDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
80061         LDKAnchorDescriptor this_ptr_conv;
80062         this_ptr_conv.inner = untag_ptr(this_ptr);
80063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80065         this_ptr_conv.is_owned = false;
80066         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
80067         uint64_t ret_ref = 0;
80068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80070         return ret_ref;
80071 }
80072
80073 void  __attribute__((export_name("TS_AnchorDescriptor_set_channel_derivation_parameters"))) TS_AnchorDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
80074         LDKAnchorDescriptor this_ptr_conv;
80075         this_ptr_conv.inner = untag_ptr(this_ptr);
80076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80078         this_ptr_conv.is_owned = false;
80079         LDKChannelDerivationParameters val_conv;
80080         val_conv.inner = untag_ptr(val);
80081         val_conv.is_owned = ptr_is_owned(val);
80082         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80083         val_conv = ChannelDerivationParameters_clone(&val_conv);
80084         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
80085 }
80086
80087 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_outpoint"))) TS_AnchorDescriptor_get_outpoint(uint64_t this_ptr) {
80088         LDKAnchorDescriptor this_ptr_conv;
80089         this_ptr_conv.inner = untag_ptr(this_ptr);
80090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80092         this_ptr_conv.is_owned = false;
80093         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
80094         uint64_t ret_ref = 0;
80095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80097         return ret_ref;
80098 }
80099
80100 void  __attribute__((export_name("TS_AnchorDescriptor_set_outpoint"))) TS_AnchorDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
80101         LDKAnchorDescriptor this_ptr_conv;
80102         this_ptr_conv.inner = untag_ptr(this_ptr);
80103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80105         this_ptr_conv.is_owned = false;
80106         LDKOutPoint val_conv;
80107         val_conv.inner = untag_ptr(val);
80108         val_conv.is_owned = ptr_is_owned(val);
80109         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80110         val_conv = OutPoint_clone(&val_conv);
80111         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
80112 }
80113
80114 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_new"))) TS_AnchorDescriptor_new(uint64_t channel_derivation_parameters_arg, uint64_t outpoint_arg) {
80115         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
80116         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
80117         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
80118         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
80119         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
80120         LDKOutPoint outpoint_arg_conv;
80121         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
80122         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
80123         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
80124         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
80125         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
80126         uint64_t ret_ref = 0;
80127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80129         return ret_ref;
80130 }
80131
80132 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
80133         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
80134         uint64_t ret_ref = 0;
80135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80137         return ret_ref;
80138 }
80139 int64_t  __attribute__((export_name("TS_AnchorDescriptor_clone_ptr"))) TS_AnchorDescriptor_clone_ptr(uint64_t arg) {
80140         LDKAnchorDescriptor arg_conv;
80141         arg_conv.inner = untag_ptr(arg);
80142         arg_conv.is_owned = ptr_is_owned(arg);
80143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80144         arg_conv.is_owned = false;
80145         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
80146         return ret_conv;
80147 }
80148
80149 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_clone"))) TS_AnchorDescriptor_clone(uint64_t orig) {
80150         LDKAnchorDescriptor orig_conv;
80151         orig_conv.inner = untag_ptr(orig);
80152         orig_conv.is_owned = ptr_is_owned(orig);
80153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80154         orig_conv.is_owned = false;
80155         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
80156         uint64_t ret_ref = 0;
80157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80159         return ret_ref;
80160 }
80161
80162 jboolean  __attribute__((export_name("TS_AnchorDescriptor_eq"))) TS_AnchorDescriptor_eq(uint64_t a, uint64_t b) {
80163         LDKAnchorDescriptor a_conv;
80164         a_conv.inner = untag_ptr(a);
80165         a_conv.is_owned = ptr_is_owned(a);
80166         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80167         a_conv.is_owned = false;
80168         LDKAnchorDescriptor b_conv;
80169         b_conv.inner = untag_ptr(b);
80170         b_conv.is_owned = ptr_is_owned(b);
80171         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80172         b_conv.is_owned = false;
80173         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
80174         return ret_conv;
80175 }
80176
80177 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_previous_utxo"))) TS_AnchorDescriptor_previous_utxo(uint64_t this_arg) {
80178         LDKAnchorDescriptor this_arg_conv;
80179         this_arg_conv.inner = untag_ptr(this_arg);
80180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80182         this_arg_conv.is_owned = false;
80183         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80184         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
80185         return tag_ptr(ret_ref, true);
80186 }
80187
80188 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_unsigned_tx_input"))) TS_AnchorDescriptor_unsigned_tx_input(uint64_t this_arg) {
80189         LDKAnchorDescriptor this_arg_conv;
80190         this_arg_conv.inner = untag_ptr(this_arg);
80191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80193         this_arg_conv.is_owned = false;
80194         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
80195         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
80196         return tag_ptr(ret_ref, true);
80197 }
80198
80199 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_witness_script"))) TS_AnchorDescriptor_witness_script(uint64_t this_arg) {
80200         LDKAnchorDescriptor this_arg_conv;
80201         this_arg_conv.inner = untag_ptr(this_arg);
80202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80204         this_arg_conv.is_owned = false;
80205         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
80206         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80207         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80208         CVec_u8Z_free(ret_var);
80209         return ret_arr;
80210 }
80211
80212 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_tx_input_witness"))) TS_AnchorDescriptor_tx_input_witness(uint64_t this_arg, int8_tArray signature) {
80213         LDKAnchorDescriptor this_arg_conv;
80214         this_arg_conv.inner = untag_ptr(this_arg);
80215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80217         this_arg_conv.is_owned = false;
80218         LDKECDSASignature signature_ref;
80219         CHECK(signature->arr_len == 64);
80220         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
80221         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
80222         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80223         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80224         Witness_free(ret_var);
80225         return ret_arr;
80226 }
80227
80228 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_derive_channel_signer"))) TS_AnchorDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
80229         LDKAnchorDescriptor this_arg_conv;
80230         this_arg_conv.inner = untag_ptr(this_arg);
80231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80233         this_arg_conv.is_owned = false;
80234         void* signer_provider_ptr = untag_ptr(signer_provider);
80235         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
80236         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
80237         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
80238         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
80239         return tag_ptr(ret_ret, true);
80240 }
80241
80242 void  __attribute__((export_name("TS_BumpTransactionEvent_free"))) TS_BumpTransactionEvent_free(uint64_t this_ptr) {
80243         if (!ptr_is_owned(this_ptr)) return;
80244         void* this_ptr_ptr = untag_ptr(this_ptr);
80245         CHECK_ACCESS(this_ptr_ptr);
80246         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
80247         FREE(untag_ptr(this_ptr));
80248         BumpTransactionEvent_free(this_ptr_conv);
80249 }
80250
80251 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
80252         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
80253         *ret_copy = BumpTransactionEvent_clone(arg);
80254         uint64_t ret_ref = tag_ptr(ret_copy, true);
80255         return ret_ref;
80256 }
80257 int64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone_ptr"))) TS_BumpTransactionEvent_clone_ptr(uint64_t arg) {
80258         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
80259         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
80260         return ret_conv;
80261 }
80262
80263 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone"))) TS_BumpTransactionEvent_clone(uint64_t orig) {
80264         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
80265         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
80266         *ret_copy = BumpTransactionEvent_clone(orig_conv);
80267         uint64_t ret_ref = tag_ptr(ret_copy, true);
80268         return ret_ref;
80269 }
80270
80271 uint64_t  __attribute__((export_name("TS_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) {
80272         LDKChannelId channel_id_conv;
80273         channel_id_conv.inner = untag_ptr(channel_id);
80274         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80275         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80276         channel_id_conv = ChannelId_clone(&channel_id_conv);
80277         LDKPublicKey counterparty_node_id_ref;
80278         CHECK(counterparty_node_id->arr_len == 33);
80279         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
80280         LDKThirtyTwoBytes claim_id_ref;
80281         CHECK(claim_id->arr_len == 32);
80282         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
80283         LDKTransaction commitment_tx_ref;
80284         commitment_tx_ref.datalen = commitment_tx->arr_len;
80285         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
80286         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
80287         commitment_tx_ref.data_is_owned = true;
80288         LDKAnchorDescriptor anchor_descriptor_conv;
80289         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
80290         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
80291         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
80292         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
80293         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
80294         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
80295         if (pending_htlcs_constr.datalen > 0)
80296                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
80297         else
80298                 pending_htlcs_constr.data = NULL;
80299         uint64_t* pending_htlcs_vals = pending_htlcs->elems;
80300         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
80301                 uint64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
80302                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
80303                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
80304                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
80305                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
80306                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
80307                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
80308         }
80309         FREE(pending_htlcs);
80310         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
80311         *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);
80312         uint64_t ret_ref = tag_ptr(ret_copy, true);
80313         return ret_ref;
80314 }
80315
80316 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) {
80317         LDKChannelId channel_id_conv;
80318         channel_id_conv.inner = untag_ptr(channel_id);
80319         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80320         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80321         channel_id_conv = ChannelId_clone(&channel_id_conv);
80322         LDKPublicKey counterparty_node_id_ref;
80323         CHECK(counterparty_node_id->arr_len == 33);
80324         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
80325         LDKThirtyTwoBytes claim_id_ref;
80326         CHECK(claim_id->arr_len == 32);
80327         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
80328         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
80329         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
80330         if (htlc_descriptors_constr.datalen > 0)
80331                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
80332         else
80333                 htlc_descriptors_constr.data = NULL;
80334         uint64_t* htlc_descriptors_vals = htlc_descriptors->elems;
80335         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
80336                 uint64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
80337                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
80338                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
80339                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
80340                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
80341                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
80342                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
80343         }
80344         FREE(htlc_descriptors);
80345         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
80346         *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);
80347         uint64_t ret_ref = tag_ptr(ret_copy, true);
80348         return ret_ref;
80349 }
80350
80351 jboolean  __attribute__((export_name("TS_BumpTransactionEvent_eq"))) TS_BumpTransactionEvent_eq(uint64_t a, uint64_t b) {
80352         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
80353         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
80354         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
80355         return ret_conv;
80356 }
80357
80358 void  __attribute__((export_name("TS_Input_free"))) TS_Input_free(uint64_t this_obj) {
80359         LDKInput this_obj_conv;
80360         this_obj_conv.inner = untag_ptr(this_obj);
80361         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80363         Input_free(this_obj_conv);
80364 }
80365
80366 uint64_t  __attribute__((export_name("TS_Input_get_outpoint"))) TS_Input_get_outpoint(uint64_t this_ptr) {
80367         LDKInput this_ptr_conv;
80368         this_ptr_conv.inner = untag_ptr(this_ptr);
80369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80371         this_ptr_conv.is_owned = false;
80372         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
80373         uint64_t ret_ref = 0;
80374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80376         return ret_ref;
80377 }
80378
80379 void  __attribute__((export_name("TS_Input_set_outpoint"))) TS_Input_set_outpoint(uint64_t this_ptr, uint64_t val) {
80380         LDKInput this_ptr_conv;
80381         this_ptr_conv.inner = untag_ptr(this_ptr);
80382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80384         this_ptr_conv.is_owned = false;
80385         LDKOutPoint val_conv;
80386         val_conv.inner = untag_ptr(val);
80387         val_conv.is_owned = ptr_is_owned(val);
80388         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80389         val_conv = OutPoint_clone(&val_conv);
80390         Input_set_outpoint(&this_ptr_conv, val_conv);
80391 }
80392
80393 uint64_t  __attribute__((export_name("TS_Input_get_previous_utxo"))) TS_Input_get_previous_utxo(uint64_t this_ptr) {
80394         LDKInput this_ptr_conv;
80395         this_ptr_conv.inner = untag_ptr(this_ptr);
80396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80398         this_ptr_conv.is_owned = false;
80399         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80400         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
80401         return tag_ptr(ret_ref, true);
80402 }
80403
80404 void  __attribute__((export_name("TS_Input_set_previous_utxo"))) TS_Input_set_previous_utxo(uint64_t this_ptr, uint64_t val) {
80405         LDKInput this_ptr_conv;
80406         this_ptr_conv.inner = untag_ptr(this_ptr);
80407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80409         this_ptr_conv.is_owned = false;
80410         void* val_ptr = untag_ptr(val);
80411         CHECK_ACCESS(val_ptr);
80412         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
80413         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
80414         Input_set_previous_utxo(&this_ptr_conv, val_conv);
80415 }
80416
80417 int64_t  __attribute__((export_name("TS_Input_get_satisfaction_weight"))) TS_Input_get_satisfaction_weight(uint64_t this_ptr) {
80418         LDKInput this_ptr_conv;
80419         this_ptr_conv.inner = untag_ptr(this_ptr);
80420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80422         this_ptr_conv.is_owned = false;
80423         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
80424         return ret_conv;
80425 }
80426
80427 void  __attribute__((export_name("TS_Input_set_satisfaction_weight"))) TS_Input_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
80428         LDKInput this_ptr_conv;
80429         this_ptr_conv.inner = untag_ptr(this_ptr);
80430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80432         this_ptr_conv.is_owned = false;
80433         Input_set_satisfaction_weight(&this_ptr_conv, val);
80434 }
80435
80436 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) {
80437         LDKOutPoint outpoint_arg_conv;
80438         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
80439         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
80440         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
80441         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
80442         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
80443         CHECK_ACCESS(previous_utxo_arg_ptr);
80444         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
80445         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
80446         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
80447         uint64_t ret_ref = 0;
80448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80450         return ret_ref;
80451 }
80452
80453 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
80454         LDKInput ret_var = Input_clone(arg);
80455         uint64_t ret_ref = 0;
80456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80458         return ret_ref;
80459 }
80460 int64_t  __attribute__((export_name("TS_Input_clone_ptr"))) TS_Input_clone_ptr(uint64_t arg) {
80461         LDKInput arg_conv;
80462         arg_conv.inner = untag_ptr(arg);
80463         arg_conv.is_owned = ptr_is_owned(arg);
80464         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80465         arg_conv.is_owned = false;
80466         int64_t ret_conv = Input_clone_ptr(&arg_conv);
80467         return ret_conv;
80468 }
80469
80470 uint64_t  __attribute__((export_name("TS_Input_clone"))) TS_Input_clone(uint64_t orig) {
80471         LDKInput orig_conv;
80472         orig_conv.inner = untag_ptr(orig);
80473         orig_conv.is_owned = ptr_is_owned(orig);
80474         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80475         orig_conv.is_owned = false;
80476         LDKInput ret_var = Input_clone(&orig_conv);
80477         uint64_t ret_ref = 0;
80478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80480         return ret_ref;
80481 }
80482
80483 int64_t  __attribute__((export_name("TS_Input_hash"))) TS_Input_hash(uint64_t o) {
80484         LDKInput o_conv;
80485         o_conv.inner = untag_ptr(o);
80486         o_conv.is_owned = ptr_is_owned(o);
80487         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80488         o_conv.is_owned = false;
80489         int64_t ret_conv = Input_hash(&o_conv);
80490         return ret_conv;
80491 }
80492
80493 jboolean  __attribute__((export_name("TS_Input_eq"))) TS_Input_eq(uint64_t a, uint64_t b) {
80494         LDKInput a_conv;
80495         a_conv.inner = untag_ptr(a);
80496         a_conv.is_owned = ptr_is_owned(a);
80497         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80498         a_conv.is_owned = false;
80499         LDKInput b_conv;
80500         b_conv.inner = untag_ptr(b);
80501         b_conv.is_owned = ptr_is_owned(b);
80502         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80503         b_conv.is_owned = false;
80504         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
80505         return ret_conv;
80506 }
80507
80508 void  __attribute__((export_name("TS_Utxo_free"))) TS_Utxo_free(uint64_t this_obj) {
80509         LDKUtxo this_obj_conv;
80510         this_obj_conv.inner = untag_ptr(this_obj);
80511         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80513         Utxo_free(this_obj_conv);
80514 }
80515
80516 uint64_t  __attribute__((export_name("TS_Utxo_get_outpoint"))) TS_Utxo_get_outpoint(uint64_t this_ptr) {
80517         LDKUtxo this_ptr_conv;
80518         this_ptr_conv.inner = untag_ptr(this_ptr);
80519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80521         this_ptr_conv.is_owned = false;
80522         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
80523         uint64_t ret_ref = 0;
80524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80526         return ret_ref;
80527 }
80528
80529 void  __attribute__((export_name("TS_Utxo_set_outpoint"))) TS_Utxo_set_outpoint(uint64_t this_ptr, uint64_t val) {
80530         LDKUtxo this_ptr_conv;
80531         this_ptr_conv.inner = untag_ptr(this_ptr);
80532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80534         this_ptr_conv.is_owned = false;
80535         LDKOutPoint val_conv;
80536         val_conv.inner = untag_ptr(val);
80537         val_conv.is_owned = ptr_is_owned(val);
80538         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80539         val_conv = OutPoint_clone(&val_conv);
80540         Utxo_set_outpoint(&this_ptr_conv, val_conv);
80541 }
80542
80543 uint64_t  __attribute__((export_name("TS_Utxo_get_output"))) TS_Utxo_get_output(uint64_t this_ptr) {
80544         LDKUtxo this_ptr_conv;
80545         this_ptr_conv.inner = untag_ptr(this_ptr);
80546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80548         this_ptr_conv.is_owned = false;
80549         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80550         *ret_ref = Utxo_get_output(&this_ptr_conv);
80551         return tag_ptr(ret_ref, true);
80552 }
80553
80554 void  __attribute__((export_name("TS_Utxo_set_output"))) TS_Utxo_set_output(uint64_t this_ptr, uint64_t val) {
80555         LDKUtxo this_ptr_conv;
80556         this_ptr_conv.inner = untag_ptr(this_ptr);
80557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80559         this_ptr_conv.is_owned = false;
80560         void* val_ptr = untag_ptr(val);
80561         CHECK_ACCESS(val_ptr);
80562         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
80563         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
80564         Utxo_set_output(&this_ptr_conv, val_conv);
80565 }
80566
80567 int64_t  __attribute__((export_name("TS_Utxo_get_satisfaction_weight"))) TS_Utxo_get_satisfaction_weight(uint64_t this_ptr) {
80568         LDKUtxo this_ptr_conv;
80569         this_ptr_conv.inner = untag_ptr(this_ptr);
80570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80572         this_ptr_conv.is_owned = false;
80573         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
80574         return ret_conv;
80575 }
80576
80577 void  __attribute__((export_name("TS_Utxo_set_satisfaction_weight"))) TS_Utxo_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
80578         LDKUtxo this_ptr_conv;
80579         this_ptr_conv.inner = untag_ptr(this_ptr);
80580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80582         this_ptr_conv.is_owned = false;
80583         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
80584 }
80585
80586 uint64_t  __attribute__((export_name("TS_Utxo_new"))) TS_Utxo_new(uint64_t outpoint_arg, uint64_t output_arg, int64_t satisfaction_weight_arg) {
80587         LDKOutPoint outpoint_arg_conv;
80588         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
80589         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
80590         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
80591         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
80592         void* output_arg_ptr = untag_ptr(output_arg);
80593         CHECK_ACCESS(output_arg_ptr);
80594         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
80595         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
80596         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
80597         uint64_t ret_ref = 0;
80598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80600         return ret_ref;
80601 }
80602
80603 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
80604         LDKUtxo ret_var = Utxo_clone(arg);
80605         uint64_t ret_ref = 0;
80606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80608         return ret_ref;
80609 }
80610 int64_t  __attribute__((export_name("TS_Utxo_clone_ptr"))) TS_Utxo_clone_ptr(uint64_t arg) {
80611         LDKUtxo arg_conv;
80612         arg_conv.inner = untag_ptr(arg);
80613         arg_conv.is_owned = ptr_is_owned(arg);
80614         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80615         arg_conv.is_owned = false;
80616         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
80617         return ret_conv;
80618 }
80619
80620 uint64_t  __attribute__((export_name("TS_Utxo_clone"))) TS_Utxo_clone(uint64_t orig) {
80621         LDKUtxo orig_conv;
80622         orig_conv.inner = untag_ptr(orig);
80623         orig_conv.is_owned = ptr_is_owned(orig);
80624         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80625         orig_conv.is_owned = false;
80626         LDKUtxo ret_var = Utxo_clone(&orig_conv);
80627         uint64_t ret_ref = 0;
80628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80630         return ret_ref;
80631 }
80632
80633 int64_t  __attribute__((export_name("TS_Utxo_hash"))) TS_Utxo_hash(uint64_t o) {
80634         LDKUtxo o_conv;
80635         o_conv.inner = untag_ptr(o);
80636         o_conv.is_owned = ptr_is_owned(o);
80637         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80638         o_conv.is_owned = false;
80639         int64_t ret_conv = Utxo_hash(&o_conv);
80640         return ret_conv;
80641 }
80642
80643 jboolean  __attribute__((export_name("TS_Utxo_eq"))) TS_Utxo_eq(uint64_t a, uint64_t b) {
80644         LDKUtxo a_conv;
80645         a_conv.inner = untag_ptr(a);
80646         a_conv.is_owned = ptr_is_owned(a);
80647         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80648         a_conv.is_owned = false;
80649         LDKUtxo b_conv;
80650         b_conv.inner = untag_ptr(b);
80651         b_conv.is_owned = ptr_is_owned(b);
80652         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80653         b_conv.is_owned = false;
80654         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
80655         return ret_conv;
80656 }
80657
80658 uint64_t  __attribute__((export_name("TS_Utxo_new_p2pkh"))) TS_Utxo_new_p2pkh(uint64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
80659         LDKOutPoint outpoint_conv;
80660         outpoint_conv.inner = untag_ptr(outpoint);
80661         outpoint_conv.is_owned = ptr_is_owned(outpoint);
80662         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
80663         outpoint_conv = OutPoint_clone(&outpoint_conv);
80664         uint8_t pubkey_hash_arr[20];
80665         CHECK(pubkey_hash->arr_len == 20);
80666         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
80667         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
80668         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
80669         uint64_t ret_ref = 0;
80670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80672         return ret_ref;
80673 }
80674
80675 void  __attribute__((export_name("TS_CoinSelection_free"))) TS_CoinSelection_free(uint64_t this_obj) {
80676         LDKCoinSelection this_obj_conv;
80677         this_obj_conv.inner = untag_ptr(this_obj);
80678         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80680         CoinSelection_free(this_obj_conv);
80681 }
80682
80683 uint64_tArray  __attribute__((export_name("TS_CoinSelection_get_confirmed_utxos"))) TS_CoinSelection_get_confirmed_utxos(uint64_t this_ptr) {
80684         LDKCoinSelection this_ptr_conv;
80685         this_ptr_conv.inner = untag_ptr(this_ptr);
80686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80688         this_ptr_conv.is_owned = false;
80689         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
80690         uint64_tArray ret_arr = NULL;
80691         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
80692         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
80693         for (size_t g = 0; g < ret_var.datalen; g++) {
80694                 LDKUtxo ret_conv_6_var = ret_var.data[g];
80695                 uint64_t ret_conv_6_ref = 0;
80696                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
80697                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
80698                 ret_arr_ptr[g] = ret_conv_6_ref;
80699         }
80700         
80701         FREE(ret_var.data);
80702         return ret_arr;
80703 }
80704
80705 void  __attribute__((export_name("TS_CoinSelection_set_confirmed_utxos"))) TS_CoinSelection_set_confirmed_utxos(uint64_t this_ptr, uint64_tArray val) {
80706         LDKCoinSelection this_ptr_conv;
80707         this_ptr_conv.inner = untag_ptr(this_ptr);
80708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80710         this_ptr_conv.is_owned = false;
80711         LDKCVec_UtxoZ val_constr;
80712         val_constr.datalen = val->arr_len;
80713         if (val_constr.datalen > 0)
80714                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
80715         else
80716                 val_constr.data = NULL;
80717         uint64_t* val_vals = val->elems;
80718         for (size_t g = 0; g < val_constr.datalen; g++) {
80719                 uint64_t val_conv_6 = val_vals[g];
80720                 LDKUtxo val_conv_6_conv;
80721                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
80722                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
80723                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
80724                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
80725                 val_constr.data[g] = val_conv_6_conv;
80726         }
80727         FREE(val);
80728         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
80729 }
80730
80731 uint64_t  __attribute__((export_name("TS_CoinSelection_get_change_output"))) TS_CoinSelection_get_change_output(uint64_t this_ptr) {
80732         LDKCoinSelection this_ptr_conv;
80733         this_ptr_conv.inner = untag_ptr(this_ptr);
80734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80736         this_ptr_conv.is_owned = false;
80737         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
80738         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
80739         uint64_t ret_ref = tag_ptr(ret_copy, true);
80740         return ret_ref;
80741 }
80742
80743 void  __attribute__((export_name("TS_CoinSelection_set_change_output"))) TS_CoinSelection_set_change_output(uint64_t this_ptr, uint64_t val) {
80744         LDKCoinSelection this_ptr_conv;
80745         this_ptr_conv.inner = untag_ptr(this_ptr);
80746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80748         this_ptr_conv.is_owned = false;
80749         void* val_ptr = untag_ptr(val);
80750         CHECK_ACCESS(val_ptr);
80751         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
80752         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
80753         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
80754 }
80755
80756 uint64_t  __attribute__((export_name("TS_CoinSelection_new"))) TS_CoinSelection_new(uint64_tArray confirmed_utxos_arg, uint64_t change_output_arg) {
80757         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
80758         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
80759         if (confirmed_utxos_arg_constr.datalen > 0)
80760                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
80761         else
80762                 confirmed_utxos_arg_constr.data = NULL;
80763         uint64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
80764         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
80765                 uint64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
80766                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
80767                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
80768                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
80769                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
80770                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
80771                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
80772         }
80773         FREE(confirmed_utxos_arg);
80774         void* change_output_arg_ptr = untag_ptr(change_output_arg);
80775         CHECK_ACCESS(change_output_arg_ptr);
80776         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
80777         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
80778         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
80779         uint64_t ret_ref = 0;
80780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80782         return ret_ref;
80783 }
80784
80785 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
80786         LDKCoinSelection ret_var = CoinSelection_clone(arg);
80787         uint64_t ret_ref = 0;
80788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80790         return ret_ref;
80791 }
80792 int64_t  __attribute__((export_name("TS_CoinSelection_clone_ptr"))) TS_CoinSelection_clone_ptr(uint64_t arg) {
80793         LDKCoinSelection arg_conv;
80794         arg_conv.inner = untag_ptr(arg);
80795         arg_conv.is_owned = ptr_is_owned(arg);
80796         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80797         arg_conv.is_owned = false;
80798         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
80799         return ret_conv;
80800 }
80801
80802 uint64_t  __attribute__((export_name("TS_CoinSelection_clone"))) TS_CoinSelection_clone(uint64_t orig) {
80803         LDKCoinSelection orig_conv;
80804         orig_conv.inner = untag_ptr(orig);
80805         orig_conv.is_owned = ptr_is_owned(orig);
80806         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80807         orig_conv.is_owned = false;
80808         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
80809         uint64_t ret_ref = 0;
80810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80812         return ret_ref;
80813 }
80814
80815 void  __attribute__((export_name("TS_CoinSelectionSource_free"))) TS_CoinSelectionSource_free(uint64_t this_ptr) {
80816         if (!ptr_is_owned(this_ptr)) return;
80817         void* this_ptr_ptr = untag_ptr(this_ptr);
80818         CHECK_ACCESS(this_ptr_ptr);
80819         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
80820         FREE(untag_ptr(this_ptr));
80821         CoinSelectionSource_free(this_ptr_conv);
80822 }
80823
80824 void  __attribute__((export_name("TS_WalletSource_free"))) TS_WalletSource_free(uint64_t this_ptr) {
80825         if (!ptr_is_owned(this_ptr)) return;
80826         void* this_ptr_ptr = untag_ptr(this_ptr);
80827         CHECK_ACCESS(this_ptr_ptr);
80828         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
80829         FREE(untag_ptr(this_ptr));
80830         WalletSource_free(this_ptr_conv);
80831 }
80832
80833 void  __attribute__((export_name("TS_Wallet_free"))) TS_Wallet_free(uint64_t this_obj) {
80834         LDKWallet this_obj_conv;
80835         this_obj_conv.inner = untag_ptr(this_obj);
80836         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80838         Wallet_free(this_obj_conv);
80839 }
80840
80841 uint64_t  __attribute__((export_name("TS_Wallet_new"))) TS_Wallet_new(uint64_t source, uint64_t logger) {
80842         void* source_ptr = untag_ptr(source);
80843         CHECK_ACCESS(source_ptr);
80844         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
80845         if (source_conv.free == LDKWalletSource_JCalls_free) {
80846                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80847                 LDKWalletSource_JCalls_cloned(&source_conv);
80848         }
80849         void* logger_ptr = untag_ptr(logger);
80850         CHECK_ACCESS(logger_ptr);
80851         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
80852         if (logger_conv.free == LDKLogger_JCalls_free) {
80853                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80854                 LDKLogger_JCalls_cloned(&logger_conv);
80855         }
80856         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
80857         uint64_t ret_ref = 0;
80858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80860         return ret_ref;
80861 }
80862
80863 uint64_t  __attribute__((export_name("TS_Wallet_as_CoinSelectionSource"))) TS_Wallet_as_CoinSelectionSource(uint64_t this_arg) {
80864         LDKWallet this_arg_conv;
80865         this_arg_conv.inner = untag_ptr(this_arg);
80866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80868         this_arg_conv.is_owned = false;
80869         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
80870         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
80871         return tag_ptr(ret_ret, true);
80872 }
80873
80874 void  __attribute__((export_name("TS_BumpTransactionEventHandler_free"))) TS_BumpTransactionEventHandler_free(uint64_t this_obj) {
80875         LDKBumpTransactionEventHandler this_obj_conv;
80876         this_obj_conv.inner = untag_ptr(this_obj);
80877         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80879         BumpTransactionEventHandler_free(this_obj_conv);
80880 }
80881
80882 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) {
80883         void* broadcaster_ptr = untag_ptr(broadcaster);
80884         CHECK_ACCESS(broadcaster_ptr);
80885         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
80886         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
80887                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80888                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
80889         }
80890         void* utxo_source_ptr = untag_ptr(utxo_source);
80891         CHECK_ACCESS(utxo_source_ptr);
80892         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
80893         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
80894                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80895                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
80896         }
80897         void* signer_provider_ptr = untag_ptr(signer_provider);
80898         CHECK_ACCESS(signer_provider_ptr);
80899         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
80900         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
80901                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80902                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
80903         }
80904         void* logger_ptr = untag_ptr(logger);
80905         CHECK_ACCESS(logger_ptr);
80906         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
80907         if (logger_conv.free == LDKLogger_JCalls_free) {
80908                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80909                 LDKLogger_JCalls_cloned(&logger_conv);
80910         }
80911         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
80912         uint64_t ret_ref = 0;
80913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80915         return ret_ref;
80916 }
80917
80918 void  __attribute__((export_name("TS_BumpTransactionEventHandler_handle_event"))) TS_BumpTransactionEventHandler_handle_event(uint64_t this_arg, uint64_t event) {
80919         LDKBumpTransactionEventHandler this_arg_conv;
80920         this_arg_conv.inner = untag_ptr(this_arg);
80921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80923         this_arg_conv.is_owned = false;
80924         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
80925         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
80926 }
80927
80928 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
80929         if (!ptr_is_owned(this_ptr)) return;
80930         void* this_ptr_ptr = untag_ptr(this_ptr);
80931         CHECK_ACCESS(this_ptr_ptr);
80932         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
80933         FREE(untag_ptr(this_ptr));
80934         GossipSync_free(this_ptr_conv);
80935 }
80936
80937 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
80938         LDKP2PGossipSync a_conv;
80939         a_conv.inner = untag_ptr(a);
80940         a_conv.is_owned = ptr_is_owned(a);
80941         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80942         a_conv.is_owned = false;
80943         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
80944         *ret_copy = GossipSync_p2_p(&a_conv);
80945         uint64_t ret_ref = tag_ptr(ret_copy, true);
80946         return ret_ref;
80947 }
80948
80949 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
80950         LDKRapidGossipSync a_conv;
80951         a_conv.inner = untag_ptr(a);
80952         a_conv.is_owned = ptr_is_owned(a);
80953         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80954         a_conv.is_owned = false;
80955         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
80956         *ret_copy = GossipSync_rapid(&a_conv);
80957         uint64_t ret_ref = tag_ptr(ret_copy, true);
80958         return ret_ref;
80959 }
80960
80961 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
80962         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
80963         *ret_copy = GossipSync_none();
80964         uint64_t ret_ref = tag_ptr(ret_copy, true);
80965         return ret_ref;
80966 }
80967
80968 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
80969         if (!ptr_is_owned(this_ptr)) return;
80970         void* this_ptr_ptr = untag_ptr(this_ptr);
80971         CHECK_ACCESS(this_ptr_ptr);
80972         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
80973         FREE(untag_ptr(this_ptr));
80974         GraphSyncError_free(this_ptr_conv);
80975 }
80976
80977 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
80978         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
80979         *ret_copy = GraphSyncError_clone(arg);
80980         uint64_t ret_ref = tag_ptr(ret_copy, true);
80981         return ret_ref;
80982 }
80983 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
80984         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
80985         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
80986         return ret_conv;
80987 }
80988
80989 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
80990         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
80991         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
80992         *ret_copy = GraphSyncError_clone(orig_conv);
80993         uint64_t ret_ref = tag_ptr(ret_copy, true);
80994         return ret_ref;
80995 }
80996
80997 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
80998         void* a_ptr = untag_ptr(a);
80999         CHECK_ACCESS(a_ptr);
81000         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
81001         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
81002         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
81003         *ret_copy = GraphSyncError_decode_error(a_conv);
81004         uint64_t ret_ref = tag_ptr(ret_copy, true);
81005         return ret_ref;
81006 }
81007
81008 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
81009         LDKLightningError a_conv;
81010         a_conv.inner = untag_ptr(a);
81011         a_conv.is_owned = ptr_is_owned(a);
81012         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81013         a_conv = LightningError_clone(&a_conv);
81014         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
81015         *ret_copy = GraphSyncError_lightning_error(a_conv);
81016         uint64_t ret_ref = tag_ptr(ret_copy, true);
81017         return ret_ref;
81018 }
81019
81020 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
81021         LDKRapidGossipSync this_obj_conv;
81022         this_obj_conv.inner = untag_ptr(this_obj);
81023         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81025         RapidGossipSync_free(this_obj_conv);
81026 }
81027
81028 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
81029         LDKNetworkGraph network_graph_conv;
81030         network_graph_conv.inner = untag_ptr(network_graph);
81031         network_graph_conv.is_owned = ptr_is_owned(network_graph);
81032         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
81033         network_graph_conv.is_owned = false;
81034         void* logger_ptr = untag_ptr(logger);
81035         CHECK_ACCESS(logger_ptr);
81036         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
81037         if (logger_conv.free == LDKLogger_JCalls_free) {
81038                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81039                 LDKLogger_JCalls_cloned(&logger_conv);
81040         }
81041         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
81042         uint64_t ret_ref = 0;
81043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81045         return ret_ref;
81046 }
81047
81048 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) {
81049         LDKRapidGossipSync this_arg_conv;
81050         this_arg_conv.inner = untag_ptr(this_arg);
81051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81053         this_arg_conv.is_owned = false;
81054         LDKu8slice update_data_ref;
81055         update_data_ref.datalen = update_data->arr_len;
81056         update_data_ref.data = update_data->elems;
81057         void* current_time_unix_ptr = untag_ptr(current_time_unix);
81058         CHECK_ACCESS(current_time_unix_ptr);
81059         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
81060         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
81061         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
81062         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
81063         FREE(update_data);
81064         return tag_ptr(ret_conv, true);
81065 }
81066
81067 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
81068         LDKRapidGossipSync this_arg_conv;
81069         this_arg_conv.inner = untag_ptr(this_arg);
81070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81072         this_arg_conv.is_owned = false;
81073         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
81074         return ret_conv;
81075 }
81076
81077 void  __attribute__((export_name("TS_Bolt11ParseError_free"))) TS_Bolt11ParseError_free(uint64_t this_ptr) {
81078         if (!ptr_is_owned(this_ptr)) return;
81079         void* this_ptr_ptr = untag_ptr(this_ptr);
81080         CHECK_ACCESS(this_ptr_ptr);
81081         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
81082         FREE(untag_ptr(this_ptr));
81083         Bolt11ParseError_free(this_ptr_conv);
81084 }
81085
81086 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
81087         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81088         *ret_copy = Bolt11ParseError_clone(arg);
81089         uint64_t ret_ref = tag_ptr(ret_copy, true);
81090         return ret_ref;
81091 }
81092 int64_t  __attribute__((export_name("TS_Bolt11ParseError_clone_ptr"))) TS_Bolt11ParseError_clone_ptr(uint64_t arg) {
81093         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
81094         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
81095         return ret_conv;
81096 }
81097
81098 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_clone"))) TS_Bolt11ParseError_clone(uint64_t orig) {
81099         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
81100         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81101         *ret_copy = Bolt11ParseError_clone(orig_conv);
81102         uint64_t ret_ref = tag_ptr(ret_copy, true);
81103         return ret_ref;
81104 }
81105
81106 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bech32_error"))) TS_Bolt11ParseError_bech32_error(uint64_t a) {
81107         void* a_ptr = untag_ptr(a);
81108         CHECK_ACCESS(a_ptr);
81109         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
81110         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
81111         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81112         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
81113         uint64_t ret_ref = tag_ptr(ret_copy, true);
81114         return ret_ref;
81115 }
81116
81117 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_parse_amount_error"))) TS_Bolt11ParseError_parse_amount_error(int32_t a) {
81118         
81119         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81120         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
81121         uint64_t ret_ref = tag_ptr(ret_copy, true);
81122         return ret_ref;
81123 }
81124
81125 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_signature"))) TS_Bolt11ParseError_malformed_signature(uint32_t a) {
81126         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
81127         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81128         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
81129         uint64_t ret_ref = tag_ptr(ret_copy, true);
81130         return ret_ref;
81131 }
81132
81133 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bad_prefix"))) TS_Bolt11ParseError_bad_prefix() {
81134         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81135         *ret_copy = Bolt11ParseError_bad_prefix();
81136         uint64_t ret_ref = tag_ptr(ret_copy, true);
81137         return ret_ref;
81138 }
81139
81140 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_currency"))) TS_Bolt11ParseError_unknown_currency() {
81141         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81142         *ret_copy = Bolt11ParseError_unknown_currency();
81143         uint64_t ret_ref = tag_ptr(ret_copy, true);
81144         return ret_ref;
81145 }
81146
81147 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_si_prefix"))) TS_Bolt11ParseError_unknown_si_prefix() {
81148         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81149         *ret_copy = Bolt11ParseError_unknown_si_prefix();
81150         uint64_t ret_ref = tag_ptr(ret_copy, true);
81151         return ret_ref;
81152 }
81153
81154 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_hrp"))) TS_Bolt11ParseError_malformed_hrp() {
81155         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81156         *ret_copy = Bolt11ParseError_malformed_hrp();
81157         uint64_t ret_ref = tag_ptr(ret_copy, true);
81158         return ret_ref;
81159 }
81160
81161 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_too_short_data_part"))) TS_Bolt11ParseError_too_short_data_part() {
81162         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81163         *ret_copy = Bolt11ParseError_too_short_data_part();
81164         uint64_t ret_ref = tag_ptr(ret_copy, true);
81165         return ret_ref;
81166 }
81167
81168 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unexpected_end_of_tagged_fields"))) TS_Bolt11ParseError_unexpected_end_of_tagged_fields() {
81169         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81170         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
81171         uint64_t ret_ref = tag_ptr(ret_copy, true);
81172         return ret_ref;
81173 }
81174
81175 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_description_decode_error"))) TS_Bolt11ParseError_description_decode_error(int32_t a) {
81176         
81177         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81178         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
81179         uint64_t ret_ref = tag_ptr(ret_copy, true);
81180         return ret_ref;
81181 }
81182
81183 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_padding_error"))) TS_Bolt11ParseError_padding_error() {
81184         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81185         *ret_copy = Bolt11ParseError_padding_error();
81186         uint64_t ret_ref = tag_ptr(ret_copy, true);
81187         return ret_ref;
81188 }
81189
81190 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_integer_overflow_error"))) TS_Bolt11ParseError_integer_overflow_error() {
81191         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81192         *ret_copy = Bolt11ParseError_integer_overflow_error();
81193         uint64_t ret_ref = tag_ptr(ret_copy, true);
81194         return ret_ref;
81195 }
81196
81197 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_seg_wit_program_length"))) TS_Bolt11ParseError_invalid_seg_wit_program_length() {
81198         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81199         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
81200         uint64_t ret_ref = tag_ptr(ret_copy, true);
81201         return ret_ref;
81202 }
81203
81204 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_pub_key_hash_length"))) TS_Bolt11ParseError_invalid_pub_key_hash_length() {
81205         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81206         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
81207         uint64_t ret_ref = tag_ptr(ret_copy, true);
81208         return ret_ref;
81209 }
81210
81211 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_script_hash_length"))) TS_Bolt11ParseError_invalid_script_hash_length() {
81212         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81213         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
81214         uint64_t ret_ref = tag_ptr(ret_copy, true);
81215         return ret_ref;
81216 }
81217
81218 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_recovery_id"))) TS_Bolt11ParseError_invalid_recovery_id() {
81219         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81220         *ret_copy = Bolt11ParseError_invalid_recovery_id();
81221         uint64_t ret_ref = tag_ptr(ret_copy, true);
81222         return ret_ref;
81223 }
81224
81225 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_slice_length"))) TS_Bolt11ParseError_invalid_slice_length(jstring a) {
81226         LDKStr a_conv = str_ref_to_owned_c(a);
81227         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81228         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
81229         uint64_t ret_ref = tag_ptr(ret_copy, true);
81230         return ret_ref;
81231 }
81232
81233 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_skip"))) TS_Bolt11ParseError_skip() {
81234         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81235         *ret_copy = Bolt11ParseError_skip();
81236         uint64_t ret_ref = tag_ptr(ret_copy, true);
81237         return ret_ref;
81238 }
81239
81240 jboolean  __attribute__((export_name("TS_Bolt11ParseError_eq"))) TS_Bolt11ParseError_eq(uint64_t a, uint64_t b) {
81241         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
81242         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
81243         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
81244         return ret_conv;
81245 }
81246
81247 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
81248         if (!ptr_is_owned(this_ptr)) return;
81249         void* this_ptr_ptr = untag_ptr(this_ptr);
81250         CHECK_ACCESS(this_ptr_ptr);
81251         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
81252         FREE(untag_ptr(this_ptr));
81253         ParseOrSemanticError_free(this_ptr_conv);
81254 }
81255
81256 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
81257         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
81258         *ret_copy = ParseOrSemanticError_clone(arg);
81259         uint64_t ret_ref = tag_ptr(ret_copy, true);
81260         return ret_ref;
81261 }
81262 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
81263         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
81264         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
81265         return ret_conv;
81266 }
81267
81268 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
81269         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
81270         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
81271         *ret_copy = ParseOrSemanticError_clone(orig_conv);
81272         uint64_t ret_ref = tag_ptr(ret_copy, true);
81273         return ret_ref;
81274 }
81275
81276 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
81277         void* a_ptr = untag_ptr(a);
81278         CHECK_ACCESS(a_ptr);
81279         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
81280         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
81281         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
81282         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
81283         uint64_t ret_ref = tag_ptr(ret_copy, true);
81284         return ret_ref;
81285 }
81286
81287 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
81288         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_js(a);
81289         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
81290         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
81291         uint64_t ret_ref = tag_ptr(ret_copy, true);
81292         return ret_ref;
81293 }
81294
81295 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
81296         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
81297         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
81298         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
81299         return ret_conv;
81300 }
81301
81302 void  __attribute__((export_name("TS_Bolt11Invoice_free"))) TS_Bolt11Invoice_free(uint64_t this_obj) {
81303         LDKBolt11Invoice this_obj_conv;
81304         this_obj_conv.inner = untag_ptr(this_obj);
81305         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81307         Bolt11Invoice_free(this_obj_conv);
81308 }
81309
81310 jboolean  __attribute__((export_name("TS_Bolt11Invoice_eq"))) TS_Bolt11Invoice_eq(uint64_t a, uint64_t b) {
81311         LDKBolt11Invoice a_conv;
81312         a_conv.inner = untag_ptr(a);
81313         a_conv.is_owned = ptr_is_owned(a);
81314         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81315         a_conv.is_owned = false;
81316         LDKBolt11Invoice b_conv;
81317         b_conv.inner = untag_ptr(b);
81318         b_conv.is_owned = ptr_is_owned(b);
81319         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81320         b_conv.is_owned = false;
81321         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
81322         return ret_conv;
81323 }
81324
81325 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
81326         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
81327         uint64_t ret_ref = 0;
81328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81330         return ret_ref;
81331 }
81332 int64_t  __attribute__((export_name("TS_Bolt11Invoice_clone_ptr"))) TS_Bolt11Invoice_clone_ptr(uint64_t arg) {
81333         LDKBolt11Invoice arg_conv;
81334         arg_conv.inner = untag_ptr(arg);
81335         arg_conv.is_owned = ptr_is_owned(arg);
81336         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81337         arg_conv.is_owned = false;
81338         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
81339         return ret_conv;
81340 }
81341
81342 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_clone"))) TS_Bolt11Invoice_clone(uint64_t orig) {
81343         LDKBolt11Invoice orig_conv;
81344         orig_conv.inner = untag_ptr(orig);
81345         orig_conv.is_owned = ptr_is_owned(orig);
81346         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81347         orig_conv.is_owned = false;
81348         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
81349         uint64_t ret_ref = 0;
81350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81352         return ret_ref;
81353 }
81354
81355 int64_t  __attribute__((export_name("TS_Bolt11Invoice_hash"))) TS_Bolt11Invoice_hash(uint64_t o) {
81356         LDKBolt11Invoice o_conv;
81357         o_conv.inner = untag_ptr(o);
81358         o_conv.is_owned = ptr_is_owned(o);
81359         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81360         o_conv.is_owned = false;
81361         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
81362         return ret_conv;
81363 }
81364
81365 void  __attribute__((export_name("TS_SignedRawBolt11Invoice_free"))) TS_SignedRawBolt11Invoice_free(uint64_t this_obj) {
81366         LDKSignedRawBolt11Invoice this_obj_conv;
81367         this_obj_conv.inner = untag_ptr(this_obj);
81368         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81370         SignedRawBolt11Invoice_free(this_obj_conv);
81371 }
81372
81373 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_eq"))) TS_SignedRawBolt11Invoice_eq(uint64_t a, uint64_t b) {
81374         LDKSignedRawBolt11Invoice a_conv;
81375         a_conv.inner = untag_ptr(a);
81376         a_conv.is_owned = ptr_is_owned(a);
81377         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81378         a_conv.is_owned = false;
81379         LDKSignedRawBolt11Invoice b_conv;
81380         b_conv.inner = untag_ptr(b);
81381         b_conv.is_owned = ptr_is_owned(b);
81382         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81383         b_conv.is_owned = false;
81384         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
81385         return ret_conv;
81386 }
81387
81388 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
81389         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
81390         uint64_t ret_ref = 0;
81391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81393         return ret_ref;
81394 }
81395 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone_ptr"))) TS_SignedRawBolt11Invoice_clone_ptr(uint64_t arg) {
81396         LDKSignedRawBolt11Invoice arg_conv;
81397         arg_conv.inner = untag_ptr(arg);
81398         arg_conv.is_owned = ptr_is_owned(arg);
81399         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81400         arg_conv.is_owned = false;
81401         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
81402         return ret_conv;
81403 }
81404
81405 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone"))) TS_SignedRawBolt11Invoice_clone(uint64_t orig) {
81406         LDKSignedRawBolt11Invoice orig_conv;
81407         orig_conv.inner = untag_ptr(orig);
81408         orig_conv.is_owned = ptr_is_owned(orig);
81409         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81410         orig_conv.is_owned = false;
81411         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
81412         uint64_t ret_ref = 0;
81413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81415         return ret_ref;
81416 }
81417
81418 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_hash"))) TS_SignedRawBolt11Invoice_hash(uint64_t o) {
81419         LDKSignedRawBolt11Invoice o_conv;
81420         o_conv.inner = untag_ptr(o);
81421         o_conv.is_owned = ptr_is_owned(o);
81422         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81423         o_conv.is_owned = false;
81424         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
81425         return ret_conv;
81426 }
81427
81428 void  __attribute__((export_name("TS_RawBolt11Invoice_free"))) TS_RawBolt11Invoice_free(uint64_t this_obj) {
81429         LDKRawBolt11Invoice this_obj_conv;
81430         this_obj_conv.inner = untag_ptr(this_obj);
81431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81433         RawBolt11Invoice_free(this_obj_conv);
81434 }
81435
81436 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_get_data"))) TS_RawBolt11Invoice_get_data(uint64_t this_ptr) {
81437         LDKRawBolt11Invoice this_ptr_conv;
81438         this_ptr_conv.inner = untag_ptr(this_ptr);
81439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81441         this_ptr_conv.is_owned = false;
81442         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
81443         uint64_t ret_ref = 0;
81444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81446         return ret_ref;
81447 }
81448
81449 void  __attribute__((export_name("TS_RawBolt11Invoice_set_data"))) TS_RawBolt11Invoice_set_data(uint64_t this_ptr, uint64_t val) {
81450         LDKRawBolt11Invoice this_ptr_conv;
81451         this_ptr_conv.inner = untag_ptr(this_ptr);
81452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81454         this_ptr_conv.is_owned = false;
81455         LDKRawDataPart val_conv;
81456         val_conv.inner = untag_ptr(val);
81457         val_conv.is_owned = ptr_is_owned(val);
81458         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81459         val_conv = RawDataPart_clone(&val_conv);
81460         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
81461 }
81462
81463 jboolean  __attribute__((export_name("TS_RawBolt11Invoice_eq"))) TS_RawBolt11Invoice_eq(uint64_t a, uint64_t b) {
81464         LDKRawBolt11Invoice a_conv;
81465         a_conv.inner = untag_ptr(a);
81466         a_conv.is_owned = ptr_is_owned(a);
81467         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81468         a_conv.is_owned = false;
81469         LDKRawBolt11Invoice b_conv;
81470         b_conv.inner = untag_ptr(b);
81471         b_conv.is_owned = ptr_is_owned(b);
81472         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81473         b_conv.is_owned = false;
81474         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
81475         return ret_conv;
81476 }
81477
81478 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
81479         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
81480         uint64_t ret_ref = 0;
81481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81483         return ret_ref;
81484 }
81485 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone_ptr"))) TS_RawBolt11Invoice_clone_ptr(uint64_t arg) {
81486         LDKRawBolt11Invoice arg_conv;
81487         arg_conv.inner = untag_ptr(arg);
81488         arg_conv.is_owned = ptr_is_owned(arg);
81489         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81490         arg_conv.is_owned = false;
81491         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
81492         return ret_conv;
81493 }
81494
81495 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone"))) TS_RawBolt11Invoice_clone(uint64_t orig) {
81496         LDKRawBolt11Invoice orig_conv;
81497         orig_conv.inner = untag_ptr(orig);
81498         orig_conv.is_owned = ptr_is_owned(orig);
81499         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81500         orig_conv.is_owned = false;
81501         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
81502         uint64_t ret_ref = 0;
81503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81505         return ret_ref;
81506 }
81507
81508 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_hash"))) TS_RawBolt11Invoice_hash(uint64_t o) {
81509         LDKRawBolt11Invoice o_conv;
81510         o_conv.inner = untag_ptr(o);
81511         o_conv.is_owned = ptr_is_owned(o);
81512         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81513         o_conv.is_owned = false;
81514         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
81515         return ret_conv;
81516 }
81517
81518 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
81519         LDKRawDataPart this_obj_conv;
81520         this_obj_conv.inner = untag_ptr(this_obj);
81521         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81523         RawDataPart_free(this_obj_conv);
81524 }
81525
81526 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
81527         LDKRawDataPart this_ptr_conv;
81528         this_ptr_conv.inner = untag_ptr(this_ptr);
81529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81531         this_ptr_conv.is_owned = false;
81532         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
81533         uint64_t ret_ref = 0;
81534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81536         return ret_ref;
81537 }
81538
81539 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
81540         LDKRawDataPart this_ptr_conv;
81541         this_ptr_conv.inner = untag_ptr(this_ptr);
81542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81544         this_ptr_conv.is_owned = false;
81545         LDKPositiveTimestamp val_conv;
81546         val_conv.inner = untag_ptr(val);
81547         val_conv.is_owned = ptr_is_owned(val);
81548         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81549         val_conv = PositiveTimestamp_clone(&val_conv);
81550         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
81551 }
81552
81553 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
81554         LDKRawDataPart a_conv;
81555         a_conv.inner = untag_ptr(a);
81556         a_conv.is_owned = ptr_is_owned(a);
81557         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81558         a_conv.is_owned = false;
81559         LDKRawDataPart b_conv;
81560         b_conv.inner = untag_ptr(b);
81561         b_conv.is_owned = ptr_is_owned(b);
81562         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81563         b_conv.is_owned = false;
81564         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
81565         return ret_conv;
81566 }
81567
81568 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
81569         LDKRawDataPart ret_var = RawDataPart_clone(arg);
81570         uint64_t ret_ref = 0;
81571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81573         return ret_ref;
81574 }
81575 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
81576         LDKRawDataPart arg_conv;
81577         arg_conv.inner = untag_ptr(arg);
81578         arg_conv.is_owned = ptr_is_owned(arg);
81579         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81580         arg_conv.is_owned = false;
81581         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
81582         return ret_conv;
81583 }
81584
81585 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
81586         LDKRawDataPart orig_conv;
81587         orig_conv.inner = untag_ptr(orig);
81588         orig_conv.is_owned = ptr_is_owned(orig);
81589         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81590         orig_conv.is_owned = false;
81591         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
81592         uint64_t ret_ref = 0;
81593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81595         return ret_ref;
81596 }
81597
81598 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
81599         LDKRawDataPart o_conv;
81600         o_conv.inner = untag_ptr(o);
81601         o_conv.is_owned = ptr_is_owned(o);
81602         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81603         o_conv.is_owned = false;
81604         int64_t ret_conv = RawDataPart_hash(&o_conv);
81605         return ret_conv;
81606 }
81607
81608 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
81609         LDKPositiveTimestamp this_obj_conv;
81610         this_obj_conv.inner = untag_ptr(this_obj);
81611         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81613         PositiveTimestamp_free(this_obj_conv);
81614 }
81615
81616 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
81617         LDKPositiveTimestamp a_conv;
81618         a_conv.inner = untag_ptr(a);
81619         a_conv.is_owned = ptr_is_owned(a);
81620         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81621         a_conv.is_owned = false;
81622         LDKPositiveTimestamp b_conv;
81623         b_conv.inner = untag_ptr(b);
81624         b_conv.is_owned = ptr_is_owned(b);
81625         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81626         b_conv.is_owned = false;
81627         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
81628         return ret_conv;
81629 }
81630
81631 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
81632         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
81633         uint64_t ret_ref = 0;
81634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81636         return ret_ref;
81637 }
81638 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
81639         LDKPositiveTimestamp arg_conv;
81640         arg_conv.inner = untag_ptr(arg);
81641         arg_conv.is_owned = ptr_is_owned(arg);
81642         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81643         arg_conv.is_owned = false;
81644         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
81645         return ret_conv;
81646 }
81647
81648 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
81649         LDKPositiveTimestamp orig_conv;
81650         orig_conv.inner = untag_ptr(orig);
81651         orig_conv.is_owned = ptr_is_owned(orig);
81652         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81653         orig_conv.is_owned = false;
81654         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
81655         uint64_t ret_ref = 0;
81656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81658         return ret_ref;
81659 }
81660
81661 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
81662         LDKPositiveTimestamp o_conv;
81663         o_conv.inner = untag_ptr(o);
81664         o_conv.is_owned = ptr_is_owned(o);
81665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81666         o_conv.is_owned = false;
81667         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
81668         return ret_conv;
81669 }
81670
81671 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
81672         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
81673         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
81674         return ret_conv;
81675 }
81676
81677 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
81678         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
81679         return ret_conv;
81680 }
81681
81682 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
81683         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
81684         return ret_conv;
81685 }
81686
81687 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
81688         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
81689         return ret_conv;
81690 }
81691
81692 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
81693         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
81694         return ret_conv;
81695 }
81696
81697 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
81698         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
81699         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
81700         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
81701         return ret_conv;
81702 }
81703
81704 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
81705         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
81706         int64_t ret_conv = SiPrefix_hash(o_conv);
81707         return ret_conv;
81708 }
81709
81710 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
81711         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
81712         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
81713         return ret_conv;
81714 }
81715
81716 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
81717         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
81718         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
81719         return ret_conv;
81720 }
81721
81722 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
81723         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
81724         return ret_conv;
81725 }
81726
81727 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
81728         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
81729         return ret_conv;
81730 }
81731
81732 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
81733         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
81734         return ret_conv;
81735 }
81736
81737 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
81738         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
81739         return ret_conv;
81740 }
81741
81742 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
81743         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
81744         return ret_conv;
81745 }
81746
81747 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
81748         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
81749         int64_t ret_conv = Currency_hash(o_conv);
81750         return ret_conv;
81751 }
81752
81753 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
81754         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
81755         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
81756         jboolean ret_conv = Currency_eq(a_conv, b_conv);
81757         return ret_conv;
81758 }
81759
81760 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
81761         LDKSha256 this_obj_conv;
81762         this_obj_conv.inner = untag_ptr(this_obj);
81763         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81765         Sha256_free(this_obj_conv);
81766 }
81767
81768 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
81769         LDKSha256 ret_var = Sha256_clone(arg);
81770         uint64_t ret_ref = 0;
81771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81773         return ret_ref;
81774 }
81775 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
81776         LDKSha256 arg_conv;
81777         arg_conv.inner = untag_ptr(arg);
81778         arg_conv.is_owned = ptr_is_owned(arg);
81779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81780         arg_conv.is_owned = false;
81781         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
81782         return ret_conv;
81783 }
81784
81785 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
81786         LDKSha256 orig_conv;
81787         orig_conv.inner = untag_ptr(orig);
81788         orig_conv.is_owned = ptr_is_owned(orig);
81789         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81790         orig_conv.is_owned = false;
81791         LDKSha256 ret_var = Sha256_clone(&orig_conv);
81792         uint64_t ret_ref = 0;
81793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81795         return ret_ref;
81796 }
81797
81798 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
81799         LDKSha256 o_conv;
81800         o_conv.inner = untag_ptr(o);
81801         o_conv.is_owned = ptr_is_owned(o);
81802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81803         o_conv.is_owned = false;
81804         int64_t ret_conv = Sha256_hash(&o_conv);
81805         return ret_conv;
81806 }
81807
81808 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
81809         LDKSha256 a_conv;
81810         a_conv.inner = untag_ptr(a);
81811         a_conv.is_owned = ptr_is_owned(a);
81812         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81813         a_conv.is_owned = false;
81814         LDKSha256 b_conv;
81815         b_conv.inner = untag_ptr(b);
81816         b_conv.is_owned = ptr_is_owned(b);
81817         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81818         b_conv.is_owned = false;
81819         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
81820         return ret_conv;
81821 }
81822
81823 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
81824         uint8_t bytes_arr[32];
81825         CHECK(bytes->arr_len == 32);
81826         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
81827         uint8_t (*bytes_ref)[32] = &bytes_arr;
81828         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
81829         uint64_t ret_ref = 0;
81830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81832         return ret_ref;
81833 }
81834
81835 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
81836         LDKDescription this_obj_conv;
81837         this_obj_conv.inner = untag_ptr(this_obj);
81838         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81840         Description_free(this_obj_conv);
81841 }
81842
81843 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
81844         LDKDescription ret_var = Description_clone(arg);
81845         uint64_t ret_ref = 0;
81846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81848         return ret_ref;
81849 }
81850 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
81851         LDKDescription arg_conv;
81852         arg_conv.inner = untag_ptr(arg);
81853         arg_conv.is_owned = ptr_is_owned(arg);
81854         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81855         arg_conv.is_owned = false;
81856         int64_t ret_conv = Description_clone_ptr(&arg_conv);
81857         return ret_conv;
81858 }
81859
81860 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
81861         LDKDescription orig_conv;
81862         orig_conv.inner = untag_ptr(orig);
81863         orig_conv.is_owned = ptr_is_owned(orig);
81864         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81865         orig_conv.is_owned = false;
81866         LDKDescription ret_var = Description_clone(&orig_conv);
81867         uint64_t ret_ref = 0;
81868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81870         return ret_ref;
81871 }
81872
81873 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
81874         LDKDescription o_conv;
81875         o_conv.inner = untag_ptr(o);
81876         o_conv.is_owned = ptr_is_owned(o);
81877         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81878         o_conv.is_owned = false;
81879         int64_t ret_conv = Description_hash(&o_conv);
81880         return ret_conv;
81881 }
81882
81883 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
81884         LDKDescription a_conv;
81885         a_conv.inner = untag_ptr(a);
81886         a_conv.is_owned = ptr_is_owned(a);
81887         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81888         a_conv.is_owned = false;
81889         LDKDescription b_conv;
81890         b_conv.inner = untag_ptr(b);
81891         b_conv.is_owned = ptr_is_owned(b);
81892         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81893         b_conv.is_owned = false;
81894         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
81895         return ret_conv;
81896 }
81897
81898 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
81899         LDKPayeePubKey this_obj_conv;
81900         this_obj_conv.inner = untag_ptr(this_obj);
81901         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81903         PayeePubKey_free(this_obj_conv);
81904 }
81905
81906 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
81907         LDKPayeePubKey this_ptr_conv;
81908         this_ptr_conv.inner = untag_ptr(this_ptr);
81909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81911         this_ptr_conv.is_owned = false;
81912         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
81913         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
81914         return ret_arr;
81915 }
81916
81917 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
81918         LDKPayeePubKey this_ptr_conv;
81919         this_ptr_conv.inner = untag_ptr(this_ptr);
81920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81922         this_ptr_conv.is_owned = false;
81923         LDKPublicKey val_ref;
81924         CHECK(val->arr_len == 33);
81925         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
81926         PayeePubKey_set_a(&this_ptr_conv, val_ref);
81927 }
81928
81929 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
81930         LDKPublicKey a_arg_ref;
81931         CHECK(a_arg->arr_len == 33);
81932         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
81933         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
81934         uint64_t ret_ref = 0;
81935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81937         return ret_ref;
81938 }
81939
81940 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
81941         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
81942         uint64_t ret_ref = 0;
81943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81945         return ret_ref;
81946 }
81947 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
81948         LDKPayeePubKey arg_conv;
81949         arg_conv.inner = untag_ptr(arg);
81950         arg_conv.is_owned = ptr_is_owned(arg);
81951         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81952         arg_conv.is_owned = false;
81953         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
81954         return ret_conv;
81955 }
81956
81957 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
81958         LDKPayeePubKey orig_conv;
81959         orig_conv.inner = untag_ptr(orig);
81960         orig_conv.is_owned = ptr_is_owned(orig);
81961         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81962         orig_conv.is_owned = false;
81963         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
81964         uint64_t ret_ref = 0;
81965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81967         return ret_ref;
81968 }
81969
81970 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
81971         LDKPayeePubKey o_conv;
81972         o_conv.inner = untag_ptr(o);
81973         o_conv.is_owned = ptr_is_owned(o);
81974         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81975         o_conv.is_owned = false;
81976         int64_t ret_conv = PayeePubKey_hash(&o_conv);
81977         return ret_conv;
81978 }
81979
81980 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
81981         LDKPayeePubKey a_conv;
81982         a_conv.inner = untag_ptr(a);
81983         a_conv.is_owned = ptr_is_owned(a);
81984         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81985         a_conv.is_owned = false;
81986         LDKPayeePubKey b_conv;
81987         b_conv.inner = untag_ptr(b);
81988         b_conv.is_owned = ptr_is_owned(b);
81989         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81990         b_conv.is_owned = false;
81991         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
81992         return ret_conv;
81993 }
81994
81995 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
81996         LDKExpiryTime this_obj_conv;
81997         this_obj_conv.inner = untag_ptr(this_obj);
81998         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82000         ExpiryTime_free(this_obj_conv);
82001 }
82002
82003 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
82004         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
82005         uint64_t ret_ref = 0;
82006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82008         return ret_ref;
82009 }
82010 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
82011         LDKExpiryTime arg_conv;
82012         arg_conv.inner = untag_ptr(arg);
82013         arg_conv.is_owned = ptr_is_owned(arg);
82014         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82015         arg_conv.is_owned = false;
82016         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
82017         return ret_conv;
82018 }
82019
82020 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
82021         LDKExpiryTime orig_conv;
82022         orig_conv.inner = untag_ptr(orig);
82023         orig_conv.is_owned = ptr_is_owned(orig);
82024         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82025         orig_conv.is_owned = false;
82026         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
82027         uint64_t ret_ref = 0;
82028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82030         return ret_ref;
82031 }
82032
82033 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
82034         LDKExpiryTime o_conv;
82035         o_conv.inner = untag_ptr(o);
82036         o_conv.is_owned = ptr_is_owned(o);
82037         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82038         o_conv.is_owned = false;
82039         int64_t ret_conv = ExpiryTime_hash(&o_conv);
82040         return ret_conv;
82041 }
82042
82043 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
82044         LDKExpiryTime a_conv;
82045         a_conv.inner = untag_ptr(a);
82046         a_conv.is_owned = ptr_is_owned(a);
82047         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82048         a_conv.is_owned = false;
82049         LDKExpiryTime b_conv;
82050         b_conv.inner = untag_ptr(b);
82051         b_conv.is_owned = ptr_is_owned(b);
82052         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82053         b_conv.is_owned = false;
82054         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
82055         return ret_conv;
82056 }
82057
82058 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
82059         LDKMinFinalCltvExpiryDelta this_obj_conv;
82060         this_obj_conv.inner = untag_ptr(this_obj);
82061         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82063         MinFinalCltvExpiryDelta_free(this_obj_conv);
82064 }
82065
82066 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
82067         LDKMinFinalCltvExpiryDelta this_ptr_conv;
82068         this_ptr_conv.inner = untag_ptr(this_ptr);
82069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82071         this_ptr_conv.is_owned = false;
82072         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
82073         return ret_conv;
82074 }
82075
82076 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
82077         LDKMinFinalCltvExpiryDelta this_ptr_conv;
82078         this_ptr_conv.inner = untag_ptr(this_ptr);
82079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82081         this_ptr_conv.is_owned = false;
82082         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
82083 }
82084
82085 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
82086         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
82087         uint64_t ret_ref = 0;
82088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82090         return ret_ref;
82091 }
82092
82093 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
82094         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
82095         uint64_t ret_ref = 0;
82096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82098         return ret_ref;
82099 }
82100 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
82101         LDKMinFinalCltvExpiryDelta arg_conv;
82102         arg_conv.inner = untag_ptr(arg);
82103         arg_conv.is_owned = ptr_is_owned(arg);
82104         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82105         arg_conv.is_owned = false;
82106         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
82107         return ret_conv;
82108 }
82109
82110 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
82111         LDKMinFinalCltvExpiryDelta orig_conv;
82112         orig_conv.inner = untag_ptr(orig);
82113         orig_conv.is_owned = ptr_is_owned(orig);
82114         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82115         orig_conv.is_owned = false;
82116         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
82117         uint64_t ret_ref = 0;
82118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82120         return ret_ref;
82121 }
82122
82123 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
82124         LDKMinFinalCltvExpiryDelta o_conv;
82125         o_conv.inner = untag_ptr(o);
82126         o_conv.is_owned = ptr_is_owned(o);
82127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82128         o_conv.is_owned = false;
82129         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
82130         return ret_conv;
82131 }
82132
82133 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
82134         LDKMinFinalCltvExpiryDelta a_conv;
82135         a_conv.inner = untag_ptr(a);
82136         a_conv.is_owned = ptr_is_owned(a);
82137         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82138         a_conv.is_owned = false;
82139         LDKMinFinalCltvExpiryDelta b_conv;
82140         b_conv.inner = untag_ptr(b);
82141         b_conv.is_owned = ptr_is_owned(b);
82142         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82143         b_conv.is_owned = false;
82144         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
82145         return ret_conv;
82146 }
82147
82148 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
82149         if (!ptr_is_owned(this_ptr)) return;
82150         void* this_ptr_ptr = untag_ptr(this_ptr);
82151         CHECK_ACCESS(this_ptr_ptr);
82152         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
82153         FREE(untag_ptr(this_ptr));
82154         Fallback_free(this_ptr_conv);
82155 }
82156
82157 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
82158         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82159         *ret_copy = Fallback_clone(arg);
82160         uint64_t ret_ref = tag_ptr(ret_copy, true);
82161         return ret_ref;
82162 }
82163 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
82164         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
82165         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
82166         return ret_conv;
82167 }
82168
82169 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
82170         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
82171         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82172         *ret_copy = Fallback_clone(orig_conv);
82173         uint64_t ret_ref = tag_ptr(ret_copy, true);
82174         return ret_ref;
82175 }
82176
82177 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
82178         
82179         LDKCVec_u8Z program_ref;
82180         program_ref.datalen = program->arr_len;
82181         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
82182         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
82183         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82184         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
82185         uint64_t ret_ref = tag_ptr(ret_copy, true);
82186         return ret_ref;
82187 }
82188
82189 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
82190         LDKTwentyBytes a_ref;
82191         CHECK(a->arr_len == 20);
82192         memcpy(a_ref.data, a->elems, 20); FREE(a);
82193         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82194         *ret_copy = Fallback_pub_key_hash(a_ref);
82195         uint64_t ret_ref = tag_ptr(ret_copy, true);
82196         return ret_ref;
82197 }
82198
82199 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
82200         LDKTwentyBytes a_ref;
82201         CHECK(a->arr_len == 20);
82202         memcpy(a_ref.data, a->elems, 20); FREE(a);
82203         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82204         *ret_copy = Fallback_script_hash(a_ref);
82205         uint64_t ret_ref = tag_ptr(ret_copy, true);
82206         return ret_ref;
82207 }
82208
82209 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
82210         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
82211         int64_t ret_conv = Fallback_hash(o_conv);
82212         return ret_conv;
82213 }
82214
82215 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
82216         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
82217         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
82218         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
82219         return ret_conv;
82220 }
82221
82222 void  __attribute__((export_name("TS_Bolt11InvoiceSignature_free"))) TS_Bolt11InvoiceSignature_free(uint64_t this_obj) {
82223         LDKBolt11InvoiceSignature this_obj_conv;
82224         this_obj_conv.inner = untag_ptr(this_obj);
82225         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82227         Bolt11InvoiceSignature_free(this_obj_conv);
82228 }
82229
82230 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
82231         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
82232         uint64_t ret_ref = 0;
82233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82235         return ret_ref;
82236 }
82237 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone_ptr"))) TS_Bolt11InvoiceSignature_clone_ptr(uint64_t arg) {
82238         LDKBolt11InvoiceSignature arg_conv;
82239         arg_conv.inner = untag_ptr(arg);
82240         arg_conv.is_owned = ptr_is_owned(arg);
82241         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82242         arg_conv.is_owned = false;
82243         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
82244         return ret_conv;
82245 }
82246
82247 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone"))) TS_Bolt11InvoiceSignature_clone(uint64_t orig) {
82248         LDKBolt11InvoiceSignature orig_conv;
82249         orig_conv.inner = untag_ptr(orig);
82250         orig_conv.is_owned = ptr_is_owned(orig);
82251         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82252         orig_conv.is_owned = false;
82253         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
82254         uint64_t ret_ref = 0;
82255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82257         return ret_ref;
82258 }
82259
82260 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_hash"))) TS_Bolt11InvoiceSignature_hash(uint64_t o) {
82261         LDKBolt11InvoiceSignature o_conv;
82262         o_conv.inner = untag_ptr(o);
82263         o_conv.is_owned = ptr_is_owned(o);
82264         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82265         o_conv.is_owned = false;
82266         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
82267         return ret_conv;
82268 }
82269
82270 jboolean  __attribute__((export_name("TS_Bolt11InvoiceSignature_eq"))) TS_Bolt11InvoiceSignature_eq(uint64_t a, uint64_t b) {
82271         LDKBolt11InvoiceSignature a_conv;
82272         a_conv.inner = untag_ptr(a);
82273         a_conv.is_owned = ptr_is_owned(a);
82274         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82275         a_conv.is_owned = false;
82276         LDKBolt11InvoiceSignature b_conv;
82277         b_conv.inner = untag_ptr(b);
82278         b_conv.is_owned = ptr_is_owned(b);
82279         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82280         b_conv.is_owned = false;
82281         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
82282         return ret_conv;
82283 }
82284
82285 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
82286         LDKPrivateRoute this_obj_conv;
82287         this_obj_conv.inner = untag_ptr(this_obj);
82288         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82290         PrivateRoute_free(this_obj_conv);
82291 }
82292
82293 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
82294         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
82295         uint64_t ret_ref = 0;
82296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82298         return ret_ref;
82299 }
82300 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
82301         LDKPrivateRoute arg_conv;
82302         arg_conv.inner = untag_ptr(arg);
82303         arg_conv.is_owned = ptr_is_owned(arg);
82304         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82305         arg_conv.is_owned = false;
82306         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
82307         return ret_conv;
82308 }
82309
82310 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
82311         LDKPrivateRoute orig_conv;
82312         orig_conv.inner = untag_ptr(orig);
82313         orig_conv.is_owned = ptr_is_owned(orig);
82314         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82315         orig_conv.is_owned = false;
82316         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
82317         uint64_t ret_ref = 0;
82318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82320         return ret_ref;
82321 }
82322
82323 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
82324         LDKPrivateRoute o_conv;
82325         o_conv.inner = untag_ptr(o);
82326         o_conv.is_owned = ptr_is_owned(o);
82327         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82328         o_conv.is_owned = false;
82329         int64_t ret_conv = PrivateRoute_hash(&o_conv);
82330         return ret_conv;
82331 }
82332
82333 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
82334         LDKPrivateRoute a_conv;
82335         a_conv.inner = untag_ptr(a);
82336         a_conv.is_owned = ptr_is_owned(a);
82337         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82338         a_conv.is_owned = false;
82339         LDKPrivateRoute b_conv;
82340         b_conv.inner = untag_ptr(b);
82341         b_conv.is_owned = ptr_is_owned(b);
82342         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82343         b_conv.is_owned = false;
82344         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
82345         return ret_conv;
82346 }
82347
82348 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_into_parts"))) TS_SignedRawBolt11Invoice_into_parts(uint64_t this_arg) {
82349         LDKSignedRawBolt11Invoice this_arg_conv;
82350         this_arg_conv.inner = untag_ptr(this_arg);
82351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82353         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
82354         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
82355         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
82356         return tag_ptr(ret_conv, true);
82357 }
82358
82359 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_raw_invoice"))) TS_SignedRawBolt11Invoice_raw_invoice(uint64_t this_arg) {
82360         LDKSignedRawBolt11Invoice this_arg_conv;
82361         this_arg_conv.inner = untag_ptr(this_arg);
82362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82364         this_arg_conv.is_owned = false;
82365         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
82366         uint64_t ret_ref = 0;
82367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82369         return ret_ref;
82370 }
82371
82372 int8_tArray  __attribute__((export_name("TS_SignedRawBolt11Invoice_signable_hash"))) TS_SignedRawBolt11Invoice_signable_hash(uint64_t this_arg) {
82373         LDKSignedRawBolt11Invoice this_arg_conv;
82374         this_arg_conv.inner = untag_ptr(this_arg);
82375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82377         this_arg_conv.is_owned = false;
82378         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
82379         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
82380         return ret_arr;
82381 }
82382
82383 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_signature"))) TS_SignedRawBolt11Invoice_signature(uint64_t this_arg) {
82384         LDKSignedRawBolt11Invoice this_arg_conv;
82385         this_arg_conv.inner = untag_ptr(this_arg);
82386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82388         this_arg_conv.is_owned = false;
82389         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
82390         uint64_t ret_ref = 0;
82391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82393         return ret_ref;
82394 }
82395
82396 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_recover_payee_pub_key"))) TS_SignedRawBolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
82397         LDKSignedRawBolt11Invoice this_arg_conv;
82398         this_arg_conv.inner = untag_ptr(this_arg);
82399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82401         this_arg_conv.is_owned = false;
82402         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
82403         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
82404         return tag_ptr(ret_conv, true);
82405 }
82406
82407 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_check_signature"))) TS_SignedRawBolt11Invoice_check_signature(uint64_t this_arg) {
82408         LDKSignedRawBolt11Invoice this_arg_conv;
82409         this_arg_conv.inner = untag_ptr(this_arg);
82410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82412         this_arg_conv.is_owned = false;
82413         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
82414         return ret_conv;
82415 }
82416
82417 int8_tArray  __attribute__((export_name("TS_RawBolt11Invoice_signable_hash"))) TS_RawBolt11Invoice_signable_hash(uint64_t this_arg) {
82418         LDKRawBolt11Invoice this_arg_conv;
82419         this_arg_conv.inner = untag_ptr(this_arg);
82420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82422         this_arg_conv.is_owned = false;
82423         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
82424         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
82425         return ret_arr;
82426 }
82427
82428 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_hash"))) TS_RawBolt11Invoice_payment_hash(uint64_t this_arg) {
82429         LDKRawBolt11Invoice this_arg_conv;
82430         this_arg_conv.inner = untag_ptr(this_arg);
82431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82433         this_arg_conv.is_owned = false;
82434         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
82435         uint64_t ret_ref = 0;
82436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82438         return ret_ref;
82439 }
82440
82441 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description"))) TS_RawBolt11Invoice_description(uint64_t this_arg) {
82442         LDKRawBolt11Invoice this_arg_conv;
82443         this_arg_conv.inner = untag_ptr(this_arg);
82444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82446         this_arg_conv.is_owned = false;
82447         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
82448         uint64_t ret_ref = 0;
82449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82451         return ret_ref;
82452 }
82453
82454 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payee_pub_key"))) TS_RawBolt11Invoice_payee_pub_key(uint64_t this_arg) {
82455         LDKRawBolt11Invoice this_arg_conv;
82456         this_arg_conv.inner = untag_ptr(this_arg);
82457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82459         this_arg_conv.is_owned = false;
82460         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
82461         uint64_t ret_ref = 0;
82462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82464         return ret_ref;
82465 }
82466
82467 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description_hash"))) TS_RawBolt11Invoice_description_hash(uint64_t this_arg) {
82468         LDKRawBolt11Invoice this_arg_conv;
82469         this_arg_conv.inner = untag_ptr(this_arg);
82470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82472         this_arg_conv.is_owned = false;
82473         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
82474         uint64_t ret_ref = 0;
82475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82477         return ret_ref;
82478 }
82479
82480 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_expiry_time"))) TS_RawBolt11Invoice_expiry_time(uint64_t this_arg) {
82481         LDKRawBolt11Invoice this_arg_conv;
82482         this_arg_conv.inner = untag_ptr(this_arg);
82483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82485         this_arg_conv.is_owned = false;
82486         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
82487         uint64_t ret_ref = 0;
82488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82490         return ret_ref;
82491 }
82492
82493 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_min_final_cltv_expiry_delta"))) TS_RawBolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
82494         LDKRawBolt11Invoice this_arg_conv;
82495         this_arg_conv.inner = untag_ptr(this_arg);
82496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82498         this_arg_conv.is_owned = false;
82499         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
82500         uint64_t ret_ref = 0;
82501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82503         return ret_ref;
82504 }
82505
82506 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_secret"))) TS_RawBolt11Invoice_payment_secret(uint64_t this_arg) {
82507         LDKRawBolt11Invoice this_arg_conv;
82508         this_arg_conv.inner = untag_ptr(this_arg);
82509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82511         this_arg_conv.is_owned = false;
82512         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
82513         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
82514         uint64_t ret_ref = tag_ptr(ret_copy, true);
82515         return ret_ref;
82516 }
82517
82518 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_metadata"))) TS_RawBolt11Invoice_payment_metadata(uint64_t this_arg) {
82519         LDKRawBolt11Invoice this_arg_conv;
82520         this_arg_conv.inner = untag_ptr(this_arg);
82521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82523         this_arg_conv.is_owned = false;
82524         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
82525         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
82526         uint64_t ret_ref = tag_ptr(ret_copy, true);
82527         return ret_ref;
82528 }
82529
82530 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_features"))) TS_RawBolt11Invoice_features(uint64_t this_arg) {
82531         LDKRawBolt11Invoice this_arg_conv;
82532         this_arg_conv.inner = untag_ptr(this_arg);
82533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82535         this_arg_conv.is_owned = false;
82536         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
82537         uint64_t ret_ref = 0;
82538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82540         return ret_ref;
82541 }
82542
82543 uint64_tArray  __attribute__((export_name("TS_RawBolt11Invoice_private_routes"))) TS_RawBolt11Invoice_private_routes(uint64_t this_arg) {
82544         LDKRawBolt11Invoice this_arg_conv;
82545         this_arg_conv.inner = untag_ptr(this_arg);
82546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82548         this_arg_conv.is_owned = false;
82549         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
82550         uint64_tArray ret_arr = NULL;
82551         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
82552         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
82553         for (size_t o = 0; o < ret_var.datalen; o++) {
82554                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
82555                 uint64_t ret_conv_14_ref = 0;
82556                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
82557                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
82558                 ret_arr_ptr[o] = ret_conv_14_ref;
82559         }
82560         
82561         FREE(ret_var.data);
82562         return ret_arr;
82563 }
82564
82565 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_amount_pico_btc"))) TS_RawBolt11Invoice_amount_pico_btc(uint64_t this_arg) {
82566         LDKRawBolt11Invoice this_arg_conv;
82567         this_arg_conv.inner = untag_ptr(this_arg);
82568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82570         this_arg_conv.is_owned = false;
82571         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
82572         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
82573         uint64_t ret_ref = tag_ptr(ret_copy, true);
82574         return ret_ref;
82575 }
82576
82577 uint32_t  __attribute__((export_name("TS_RawBolt11Invoice_currency"))) TS_RawBolt11Invoice_currency(uint64_t this_arg) {
82578         LDKRawBolt11Invoice this_arg_conv;
82579         this_arg_conv.inner = untag_ptr(this_arg);
82580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82582         this_arg_conv.is_owned = false;
82583         uint32_t ret_conv = LDKCurrency_to_js(RawBolt11Invoice_currency(&this_arg_conv));
82584         return ret_conv;
82585 }
82586
82587 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
82588         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
82589         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
82590         return tag_ptr(ret_conv, true);
82591 }
82592
82593 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
82594         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
82595         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
82596         return tag_ptr(ret_conv, true);
82597 }
82598
82599 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
82600         LDKPositiveTimestamp this_arg_conv;
82601         this_arg_conv.inner = untag_ptr(this_arg);
82602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82604         this_arg_conv.is_owned = false;
82605         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
82606         return ret_conv;
82607 }
82608
82609 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
82610         LDKPositiveTimestamp this_arg_conv;
82611         this_arg_conv.inner = untag_ptr(this_arg);
82612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82614         this_arg_conv.is_owned = false;
82615         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
82616         return ret_conv;
82617 }
82618
82619 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_signable_hash"))) TS_Bolt11Invoice_signable_hash(uint64_t this_arg) {
82620         LDKBolt11Invoice this_arg_conv;
82621         this_arg_conv.inner = untag_ptr(this_arg);
82622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82624         this_arg_conv.is_owned = false;
82625         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
82626         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
82627         return ret_arr;
82628 }
82629
82630 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_into_signed_raw"))) TS_Bolt11Invoice_into_signed_raw(uint64_t this_arg) {
82631         LDKBolt11Invoice this_arg_conv;
82632         this_arg_conv.inner = untag_ptr(this_arg);
82633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82635         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
82636         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
82637         uint64_t ret_ref = 0;
82638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82640         return ret_ref;
82641 }
82642
82643 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_check_signature"))) TS_Bolt11Invoice_check_signature(uint64_t this_arg) {
82644         LDKBolt11Invoice this_arg_conv;
82645         this_arg_conv.inner = untag_ptr(this_arg);
82646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82648         this_arg_conv.is_owned = false;
82649         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
82650         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
82651         return tag_ptr(ret_conv, true);
82652 }
82653
82654 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_signed"))) TS_Bolt11Invoice_from_signed(uint64_t signed_invoice) {
82655         LDKSignedRawBolt11Invoice signed_invoice_conv;
82656         signed_invoice_conv.inner = untag_ptr(signed_invoice);
82657         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
82658         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
82659         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
82660         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
82661         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
82662         return tag_ptr(ret_conv, true);
82663 }
82664
82665 int64_t  __attribute__((export_name("TS_Bolt11Invoice_duration_since_epoch"))) TS_Bolt11Invoice_duration_since_epoch(uint64_t this_arg) {
82666         LDKBolt11Invoice this_arg_conv;
82667         this_arg_conv.inner = untag_ptr(this_arg);
82668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82670         this_arg_conv.is_owned = false;
82671         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
82672         return ret_conv;
82673 }
82674
82675 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_hash"))) TS_Bolt11Invoice_payment_hash(uint64_t this_arg) {
82676         LDKBolt11Invoice this_arg_conv;
82677         this_arg_conv.inner = untag_ptr(this_arg);
82678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82680         this_arg_conv.is_owned = false;
82681         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
82682         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
82683         return ret_arr;
82684 }
82685
82686 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payee_pub_key"))) TS_Bolt11Invoice_payee_pub_key(uint64_t this_arg) {
82687         LDKBolt11Invoice this_arg_conv;
82688         this_arg_conv.inner = untag_ptr(this_arg);
82689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82691         this_arg_conv.is_owned = false;
82692         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
82693         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
82694         return ret_arr;
82695 }
82696
82697 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_secret"))) TS_Bolt11Invoice_payment_secret(uint64_t this_arg) {
82698         LDKBolt11Invoice this_arg_conv;
82699         this_arg_conv.inner = untag_ptr(this_arg);
82700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82702         this_arg_conv.is_owned = false;
82703         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
82704         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
82705         return ret_arr;
82706 }
82707
82708 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_payment_metadata"))) TS_Bolt11Invoice_payment_metadata(uint64_t this_arg) {
82709         LDKBolt11Invoice this_arg_conv;
82710         this_arg_conv.inner = untag_ptr(this_arg);
82711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82713         this_arg_conv.is_owned = false;
82714         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
82715         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
82716         uint64_t ret_ref = tag_ptr(ret_copy, true);
82717         return ret_ref;
82718 }
82719
82720 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_features"))) TS_Bolt11Invoice_features(uint64_t this_arg) {
82721         LDKBolt11Invoice this_arg_conv;
82722         this_arg_conv.inner = untag_ptr(this_arg);
82723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82725         this_arg_conv.is_owned = false;
82726         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
82727         uint64_t ret_ref = 0;
82728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82730         return ret_ref;
82731 }
82732
82733 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_recover_payee_pub_key"))) TS_Bolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
82734         LDKBolt11Invoice this_arg_conv;
82735         this_arg_conv.inner = untag_ptr(this_arg);
82736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82738         this_arg_conv.is_owned = false;
82739         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
82740         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
82741         return ret_arr;
82742 }
82743
82744 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_get_payee_pub_key"))) TS_Bolt11Invoice_get_payee_pub_key(uint64_t this_arg) {
82745         LDKBolt11Invoice this_arg_conv;
82746         this_arg_conv.inner = untag_ptr(this_arg);
82747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82749         this_arg_conv.is_owned = false;
82750         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
82751         memcpy(ret_arr->elems, Bolt11Invoice_get_payee_pub_key(&this_arg_conv).compressed_form, 33);
82752         return ret_arr;
82753 }
82754
82755 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_expires_at"))) TS_Bolt11Invoice_expires_at(uint64_t this_arg) {
82756         LDKBolt11Invoice this_arg_conv;
82757         this_arg_conv.inner = untag_ptr(this_arg);
82758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82760         this_arg_conv.is_owned = false;
82761         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
82762         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
82763         uint64_t ret_ref = tag_ptr(ret_copy, true);
82764         return ret_ref;
82765 }
82766
82767 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiry_time"))) TS_Bolt11Invoice_expiry_time(uint64_t this_arg) {
82768         LDKBolt11Invoice this_arg_conv;
82769         this_arg_conv.inner = untag_ptr(this_arg);
82770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82772         this_arg_conv.is_owned = false;
82773         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
82774         return ret_conv;
82775 }
82776
82777 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiration_remaining_from_epoch"))) TS_Bolt11Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
82778         LDKBolt11Invoice this_arg_conv;
82779         this_arg_conv.inner = untag_ptr(this_arg);
82780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82782         this_arg_conv.is_owned = false;
82783         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
82784         return ret_conv;
82785 }
82786
82787 jboolean  __attribute__((export_name("TS_Bolt11Invoice_would_expire"))) TS_Bolt11Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
82788         LDKBolt11Invoice this_arg_conv;
82789         this_arg_conv.inner = untag_ptr(this_arg);
82790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82792         this_arg_conv.is_owned = false;
82793         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
82794         return ret_conv;
82795 }
82796
82797 int64_t  __attribute__((export_name("TS_Bolt11Invoice_min_final_cltv_expiry_delta"))) TS_Bolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
82798         LDKBolt11Invoice this_arg_conv;
82799         this_arg_conv.inner = untag_ptr(this_arg);
82800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82802         this_arg_conv.is_owned = false;
82803         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
82804         return ret_conv;
82805 }
82806
82807 ptrArray  __attribute__((export_name("TS_Bolt11Invoice_fallback_addresses"))) TS_Bolt11Invoice_fallback_addresses(uint64_t this_arg) {
82808         LDKBolt11Invoice this_arg_conv;
82809         this_arg_conv.inner = untag_ptr(this_arg);
82810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82812         this_arg_conv.is_owned = false;
82813         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
82814         ptrArray ret_arr = NULL;
82815         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
82816         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
82817         for (size_t i = 0; i < ret_var.datalen; i++) {
82818                 LDKStr ret_conv_8_str = ret_var.data[i];
82819                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
82820                 Str_free(ret_conv_8_str);
82821                 ret_arr_ptr[i] = ret_conv_8_conv;
82822         }
82823         
82824         FREE(ret_var.data);
82825         return ret_arr;
82826 }
82827
82828 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_private_routes"))) TS_Bolt11Invoice_private_routes(uint64_t this_arg) {
82829         LDKBolt11Invoice this_arg_conv;
82830         this_arg_conv.inner = untag_ptr(this_arg);
82831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82833         this_arg_conv.is_owned = false;
82834         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
82835         uint64_tArray ret_arr = NULL;
82836         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
82837         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
82838         for (size_t o = 0; o < ret_var.datalen; o++) {
82839                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
82840                 uint64_t ret_conv_14_ref = 0;
82841                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
82842                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
82843                 ret_arr_ptr[o] = ret_conv_14_ref;
82844         }
82845         
82846         FREE(ret_var.data);
82847         return ret_arr;
82848 }
82849
82850 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_route_hints"))) TS_Bolt11Invoice_route_hints(uint64_t this_arg) {
82851         LDKBolt11Invoice this_arg_conv;
82852         this_arg_conv.inner = untag_ptr(this_arg);
82853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82855         this_arg_conv.is_owned = false;
82856         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
82857         uint64_tArray ret_arr = NULL;
82858         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
82859         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
82860         for (size_t l = 0; l < ret_var.datalen; l++) {
82861                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
82862                 uint64_t ret_conv_11_ref = 0;
82863                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
82864                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
82865                 ret_arr_ptr[l] = ret_conv_11_ref;
82866         }
82867         
82868         FREE(ret_var.data);
82869         return ret_arr;
82870 }
82871
82872 uint32_t  __attribute__((export_name("TS_Bolt11Invoice_currency"))) TS_Bolt11Invoice_currency(uint64_t this_arg) {
82873         LDKBolt11Invoice this_arg_conv;
82874         this_arg_conv.inner = untag_ptr(this_arg);
82875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82877         this_arg_conv.is_owned = false;
82878         uint32_t ret_conv = LDKCurrency_to_js(Bolt11Invoice_currency(&this_arg_conv));
82879         return ret_conv;
82880 }
82881
82882 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_amount_milli_satoshis"))) TS_Bolt11Invoice_amount_milli_satoshis(uint64_t this_arg) {
82883         LDKBolt11Invoice this_arg_conv;
82884         this_arg_conv.inner = untag_ptr(this_arg);
82885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82887         this_arg_conv.is_owned = false;
82888         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
82889         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
82890         uint64_t ret_ref = tag_ptr(ret_copy, true);
82891         return ret_ref;
82892 }
82893
82894 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
82895         LDKStr description_conv = str_ref_to_owned_c(description);
82896         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
82897         *ret_conv = Description_new(description_conv);
82898         return tag_ptr(ret_conv, true);
82899 }
82900
82901 uint64_t  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
82902         LDKDescription this_arg_conv;
82903         this_arg_conv.inner = untag_ptr(this_arg);
82904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82906         this_arg_conv = Description_clone(&this_arg_conv);
82907         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
82908         uint64_t ret_ref = 0;
82909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82911         return ret_ref;
82912 }
82913
82914 jstring  __attribute__((export_name("TS_Description_to_str"))) TS_Description_to_str(uint64_t o) {
82915         LDKDescription o_conv;
82916         o_conv.inner = untag_ptr(o);
82917         o_conv.is_owned = ptr_is_owned(o);
82918         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82919         o_conv.is_owned = false;
82920         LDKStr ret_str = Description_to_str(&o_conv);
82921         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
82922         Str_free(ret_str);
82923         return ret_conv;
82924 }
82925
82926 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
82927         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
82928         uint64_t ret_ref = 0;
82929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82931         return ret_ref;
82932 }
82933
82934 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
82935         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
82936         uint64_t ret_ref = 0;
82937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82939         return ret_ref;
82940 }
82941
82942 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
82943         LDKExpiryTime this_arg_conv;
82944         this_arg_conv.inner = untag_ptr(this_arg);
82945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82947         this_arg_conv.is_owned = false;
82948         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
82949         return ret_conv;
82950 }
82951
82952 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
82953         LDKExpiryTime this_arg_conv;
82954         this_arg_conv.inner = untag_ptr(this_arg);
82955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82957         this_arg_conv.is_owned = false;
82958         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
82959         return ret_conv;
82960 }
82961
82962 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
82963         LDKRouteHint hops_conv;
82964         hops_conv.inner = untag_ptr(hops);
82965         hops_conv.is_owned = ptr_is_owned(hops);
82966         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
82967         hops_conv = RouteHint_clone(&hops_conv);
82968         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
82969         *ret_conv = PrivateRoute_new(hops_conv);
82970         return tag_ptr(ret_conv, true);
82971 }
82972
82973 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
82974         LDKPrivateRoute this_arg_conv;
82975         this_arg_conv.inner = untag_ptr(this_arg);
82976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82978         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
82979         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
82980         uint64_t ret_ref = 0;
82981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82983         return ret_ref;
82984 }
82985
82986 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
82987         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
82988         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
82989         return ret_conv;
82990 }
82991
82992 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
82993         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
82994         return ret_conv;
82995 }
82996
82997 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
82998         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
82999         return ret_conv;
83000 }
83001
83002 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
83003         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
83004         return ret_conv;
83005 }
83006
83007 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
83008         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
83009         return ret_conv;
83010 }
83011
83012 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
83013         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
83014         return ret_conv;
83015 }
83016
83017 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
83018         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
83019         return ret_conv;
83020 }
83021
83022 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
83023         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
83024         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
83025         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
83026         return ret_conv;
83027 }
83028
83029 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
83030         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
83031         LDKStr ret_str = CreationError_to_str(o_conv);
83032         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83033         Str_free(ret_str);
83034         return ret_conv;
83035 }
83036
83037 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_clone"))) TS_Bolt11SemanticError_clone(uint64_t orig) {
83038         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
83039         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_clone(orig_conv));
83040         return ret_conv;
83041 }
83042
83043 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_hash"))) TS_Bolt11SemanticError_no_payment_hash() {
83044         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_hash());
83045         return ret_conv;
83046 }
83047
83048 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_hashes"))) TS_Bolt11SemanticError_multiple_payment_hashes() {
83049         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_hashes());
83050         return ret_conv;
83051 }
83052
83053 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_description"))) TS_Bolt11SemanticError_no_description() {
83054         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_description());
83055         return ret_conv;
83056 }
83057
83058 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_descriptions"))) TS_Bolt11SemanticError_multiple_descriptions() {
83059         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_descriptions());
83060         return ret_conv;
83061 }
83062
83063 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_secret"))) TS_Bolt11SemanticError_no_payment_secret() {
83064         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_secret());
83065         return ret_conv;
83066 }
83067
83068 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_secrets"))) TS_Bolt11SemanticError_multiple_payment_secrets() {
83069         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_secrets());
83070         return ret_conv;
83071 }
83072
83073 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_features"))) TS_Bolt11SemanticError_invalid_features() {
83074         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_features());
83075         return ret_conv;
83076 }
83077
83078 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_recovery_id"))) TS_Bolt11SemanticError_invalid_recovery_id() {
83079         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_recovery_id());
83080         return ret_conv;
83081 }
83082
83083 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_signature"))) TS_Bolt11SemanticError_invalid_signature() {
83084         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_signature());
83085         return ret_conv;
83086 }
83087
83088 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_imprecise_amount"))) TS_Bolt11SemanticError_imprecise_amount() {
83089         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_imprecise_amount());
83090         return ret_conv;
83091 }
83092
83093 jboolean  __attribute__((export_name("TS_Bolt11SemanticError_eq"))) TS_Bolt11SemanticError_eq(uint64_t a, uint64_t b) {
83094         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
83095         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
83096         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
83097         return ret_conv;
83098 }
83099
83100 jstring  __attribute__((export_name("TS_Bolt11SemanticError_to_str"))) TS_Bolt11SemanticError_to_str(uint64_t o) {
83101         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
83102         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
83103         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83104         Str_free(ret_str);
83105         return ret_conv;
83106 }
83107
83108 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
83109         if (!ptr_is_owned(this_ptr)) return;
83110         void* this_ptr_ptr = untag_ptr(this_ptr);
83111         CHECK_ACCESS(this_ptr_ptr);
83112         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
83113         FREE(untag_ptr(this_ptr));
83114         SignOrCreationError_free(this_ptr_conv);
83115 }
83116
83117 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
83118         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
83119         *ret_copy = SignOrCreationError_clone(arg);
83120         uint64_t ret_ref = tag_ptr(ret_copy, true);
83121         return ret_ref;
83122 }
83123 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
83124         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
83125         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
83126         return ret_conv;
83127 }
83128
83129 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
83130         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
83131         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
83132         *ret_copy = SignOrCreationError_clone(orig_conv);
83133         uint64_t ret_ref = tag_ptr(ret_copy, true);
83134         return ret_ref;
83135 }
83136
83137 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
83138         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
83139         *ret_copy = SignOrCreationError_sign_error();
83140         uint64_t ret_ref = tag_ptr(ret_copy, true);
83141         return ret_ref;
83142 }
83143
83144 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
83145         LDKCreationError a_conv = LDKCreationError_from_js(a);
83146         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
83147         *ret_copy = SignOrCreationError_creation_error(a_conv);
83148         uint64_t ret_ref = tag_ptr(ret_copy, true);
83149         return ret_ref;
83150 }
83151
83152 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
83153         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
83154         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
83155         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
83156         return ret_conv;
83157 }
83158
83159 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
83160         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
83161         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
83162         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83163         Str_free(ret_str);
83164         return ret_conv;
83165 }
83166
83167 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) {
83168         LDKBolt11Invoice invoice_conv;
83169         invoice_conv.inner = untag_ptr(invoice);
83170         invoice_conv.is_owned = ptr_is_owned(invoice);
83171         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
83172         invoice_conv.is_owned = false;
83173         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
83174         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
83175         return tag_ptr(ret_conv, true);
83176 }
83177
83178 uint64_t  __attribute__((export_name("TS_payment_parameters_from_invoice"))) TS_payment_parameters_from_invoice(uint64_t invoice) {
83179         LDKBolt11Invoice invoice_conv;
83180         invoice_conv.inner = untag_ptr(invoice);
83181         invoice_conv.is_owned = ptr_is_owned(invoice);
83182         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
83183         invoice_conv.is_owned = false;
83184         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
83185         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
83186         return tag_ptr(ret_conv, true);
83187 }
83188
83189 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) {
83190         void* amt_msat_ptr = untag_ptr(amt_msat);
83191         CHECK_ACCESS(amt_msat_ptr);
83192         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83193         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83194         void* payment_hash_ptr = untag_ptr(payment_hash);
83195         CHECK_ACCESS(payment_hash_ptr);
83196         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
83197         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
83198         LDKStr description_conv = str_ref_to_owned_c(description);
83199         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
83200         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
83201         if (phantom_route_hints_constr.datalen > 0)
83202                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
83203         else
83204                 phantom_route_hints_constr.data = NULL;
83205         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
83206         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
83207                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
83208                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
83209                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
83210                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
83211                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
83212                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
83213                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
83214         }
83215         FREE(phantom_route_hints);
83216         void* entropy_source_ptr = untag_ptr(entropy_source);
83217         CHECK_ACCESS(entropy_source_ptr);
83218         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83219         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83220                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83221                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83222         }
83223         void* node_signer_ptr = untag_ptr(node_signer);
83224         CHECK_ACCESS(node_signer_ptr);
83225         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83226         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83227                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83228                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83229         }
83230         void* logger_ptr = untag_ptr(logger);
83231         CHECK_ACCESS(logger_ptr);
83232         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83233         if (logger_conv.free == LDKLogger_JCalls_free) {
83234                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83235                 LDKLogger_JCalls_cloned(&logger_conv);
83236         }
83237         LDKCurrency network_conv = LDKCurrency_from_js(network);
83238         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83239         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83240         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83241         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83242         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83243         *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);
83244         return tag_ptr(ret_conv, true);
83245 }
83246
83247 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) {
83248         void* amt_msat_ptr = untag_ptr(amt_msat);
83249         CHECK_ACCESS(amt_msat_ptr);
83250         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83251         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83252         void* payment_hash_ptr = untag_ptr(payment_hash);
83253         CHECK_ACCESS(payment_hash_ptr);
83254         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
83255         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
83256         LDKSha256 description_hash_conv;
83257         description_hash_conv.inner = untag_ptr(description_hash);
83258         description_hash_conv.is_owned = ptr_is_owned(description_hash);
83259         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
83260         description_hash_conv = Sha256_clone(&description_hash_conv);
83261         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
83262         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
83263         if (phantom_route_hints_constr.datalen > 0)
83264                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
83265         else
83266                 phantom_route_hints_constr.data = NULL;
83267         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
83268         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
83269                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
83270                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
83271                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
83272                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
83273                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
83274                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
83275                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
83276         }
83277         FREE(phantom_route_hints);
83278         void* entropy_source_ptr = untag_ptr(entropy_source);
83279         CHECK_ACCESS(entropy_source_ptr);
83280         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83281         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83282                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83283                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83284         }
83285         void* node_signer_ptr = untag_ptr(node_signer);
83286         CHECK_ACCESS(node_signer_ptr);
83287         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83288         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83289                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83290                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83291         }
83292         void* logger_ptr = untag_ptr(logger);
83293         CHECK_ACCESS(logger_ptr);
83294         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83295         if (logger_conv.free == LDKLogger_JCalls_free) {
83296                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83297                 LDKLogger_JCalls_cloned(&logger_conv);
83298         }
83299         LDKCurrency network_conv = LDKCurrency_from_js(network);
83300         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83301         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83302         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83303         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83304         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83305         *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);
83306         return tag_ptr(ret_conv, true);
83307 }
83308
83309 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) {
83310         LDKChannelManager channelmanager_conv;
83311         channelmanager_conv.inner = untag_ptr(channelmanager);
83312         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
83313         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
83314         channelmanager_conv.is_owned = false;
83315         void* node_signer_ptr = untag_ptr(node_signer);
83316         CHECK_ACCESS(node_signer_ptr);
83317         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83318         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83319                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83320                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83321         }
83322         void* logger_ptr = untag_ptr(logger);
83323         CHECK_ACCESS(logger_ptr);
83324         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83325         if (logger_conv.free == LDKLogger_JCalls_free) {
83326                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83327                 LDKLogger_JCalls_cloned(&logger_conv);
83328         }
83329         LDKCurrency network_conv = LDKCurrency_from_js(network);
83330         void* amt_msat_ptr = untag_ptr(amt_msat);
83331         CHECK_ACCESS(amt_msat_ptr);
83332         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83333         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83334         LDKSha256 description_hash_conv;
83335         description_hash_conv.inner = untag_ptr(description_hash);
83336         description_hash_conv.is_owned = ptr_is_owned(description_hash);
83337         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
83338         description_hash_conv = Sha256_clone(&description_hash_conv);
83339         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83340         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83341         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83342         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83343         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83344         *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);
83345         return tag_ptr(ret_conv, true);
83346 }
83347
83348 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) {
83349         LDKChannelManager channelmanager_conv;
83350         channelmanager_conv.inner = untag_ptr(channelmanager);
83351         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
83352         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
83353         channelmanager_conv.is_owned = false;
83354         void* node_signer_ptr = untag_ptr(node_signer);
83355         CHECK_ACCESS(node_signer_ptr);
83356         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83357         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83358                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83359                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83360         }
83361         void* logger_ptr = untag_ptr(logger);
83362         CHECK_ACCESS(logger_ptr);
83363         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83364         if (logger_conv.free == LDKLogger_JCalls_free) {
83365                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83366                 LDKLogger_JCalls_cloned(&logger_conv);
83367         }
83368         LDKCurrency network_conv = LDKCurrency_from_js(network);
83369         void* amt_msat_ptr = untag_ptr(amt_msat);
83370         CHECK_ACCESS(amt_msat_ptr);
83371         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83372         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83373         LDKStr description_conv = str_ref_to_owned_c(description);
83374         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83375         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83376         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83377         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83378         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83379         *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);
83380         return tag_ptr(ret_conv, true);
83381 }
83382
83383 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) {
83384         LDKChannelManager channelmanager_conv;
83385         channelmanager_conv.inner = untag_ptr(channelmanager);
83386         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
83387         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
83388         channelmanager_conv.is_owned = false;
83389         void* node_signer_ptr = untag_ptr(node_signer);
83390         CHECK_ACCESS(node_signer_ptr);
83391         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83392         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83393                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83394                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83395         }
83396         void* logger_ptr = untag_ptr(logger);
83397         CHECK_ACCESS(logger_ptr);
83398         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83399         if (logger_conv.free == LDKLogger_JCalls_free) {
83400                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83401                 LDKLogger_JCalls_cloned(&logger_conv);
83402         }
83403         LDKCurrency network_conv = LDKCurrency_from_js(network);
83404         void* amt_msat_ptr = untag_ptr(amt_msat);
83405         CHECK_ACCESS(amt_msat_ptr);
83406         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83407         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83408         LDKStr description_conv = str_ref_to_owned_c(description);
83409         LDKThirtyTwoBytes payment_hash_ref;
83410         CHECK(payment_hash->arr_len == 32);
83411         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
83412         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83413         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83414         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83415         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83416         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83417         *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);
83418         return tag_ptr(ret_conv, true);
83419 }
83420
83421 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
83422         LDKStr s_conv = str_ref_to_owned_c(s);
83423         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
83424         *ret_conv = SiPrefix_from_str(s_conv);
83425         return tag_ptr(ret_conv, true);
83426 }
83427
83428 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_str"))) TS_Bolt11Invoice_from_str(jstring s) {
83429         LDKStr s_conv = str_ref_to_owned_c(s);
83430         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
83431         *ret_conv = Bolt11Invoice_from_str(s_conv);
83432         return tag_ptr(ret_conv, true);
83433 }
83434
83435 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_from_str"))) TS_SignedRawBolt11Invoice_from_str(jstring s) {
83436         LDKStr s_conv = str_ref_to_owned_c(s);
83437         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
83438         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
83439         return tag_ptr(ret_conv, true);
83440 }
83441
83442 jstring  __attribute__((export_name("TS_Bolt11ParseError_to_str"))) TS_Bolt11ParseError_to_str(uint64_t o) {
83443         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
83444         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
83445         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83446         Str_free(ret_str);
83447         return ret_conv;
83448 }
83449
83450 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
83451         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
83452         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
83453         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83454         Str_free(ret_str);
83455         return ret_conv;
83456 }
83457
83458 jstring  __attribute__((export_name("TS_Bolt11Invoice_to_str"))) TS_Bolt11Invoice_to_str(uint64_t o) {
83459         LDKBolt11Invoice o_conv;
83460         o_conv.inner = untag_ptr(o);
83461         o_conv.is_owned = ptr_is_owned(o);
83462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83463         o_conv.is_owned = false;
83464         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
83465         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83466         Str_free(ret_str);
83467         return ret_conv;
83468 }
83469
83470 jstring  __attribute__((export_name("TS_SignedRawBolt11Invoice_to_str"))) TS_SignedRawBolt11Invoice_to_str(uint64_t o) {
83471         LDKSignedRawBolt11Invoice o_conv;
83472         o_conv.inner = untag_ptr(o);
83473         o_conv.is_owned = ptr_is_owned(o);
83474         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83475         o_conv.is_owned = false;
83476         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
83477         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83478         Str_free(ret_str);
83479         return ret_conv;
83480 }
83481
83482 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
83483         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
83484         LDKStr ret_str = Currency_to_str(o_conv);
83485         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83486         Str_free(ret_str);
83487         return ret_conv;
83488 }
83489
83490 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
83491         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
83492         LDKStr ret_str = SiPrefix_to_str(o_conv);
83493         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83494         Str_free(ret_str);
83495         return ret_conv;
83496 }
83497