5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
10 extern void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12 if (!expression) { abort(); }
15 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
16 return val == 0xdeadbeef0badf00dULL;
20 void *malloc(size_t size);
23 #define MALLOC(a, _) malloc(a)
24 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
25 #define DO_ASSERT(a) (void)(a)
27 #define CHECK_ACCESS(p)
28 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
30 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
31 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
32 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
33 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
35 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
37 #define DECL_ARR_TYPE(ty, name) \
38 struct name##array { \
42 typedef struct name##array * name##Array; \
43 static inline name##Array init_##name##Array(size_t arr_len) { \
44 name##Array arr = (name##Array)MALLOC(arr_len * sizeof(ty) + sizeof(uint32_t), "##name array init"); \
45 arr->arr_len = arr_len; \
49 DECL_ARR_TYPE(int64_t, int64_t);
50 DECL_ARR_TYPE(int8_t, int8_t);
51 DECL_ARR_TYPE(uint32_t, uint32_t);
52 DECL_ARR_TYPE(void*, ptr);
53 DECL_ARR_TYPE(char, char);
54 typedef charArray jstring;
56 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
57 charArray arr = init_charArray(len);
58 memcpy(arr->elems, chars, len);
61 static inline LDKStr str_ref_to_owned_c(const jstring str) {
62 char* newchars = MALLOC(str->arr_len + 1, "String chars");
63 memcpy(newchars, str->elems, str->arr_len);
64 newchars[str->arr_len] = 0;
68 .chars_is_owned = true
73 typedef bool jboolean;
75 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
76 return (uint32_t)MALLOC(size, "JS-Called malloc");
78 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
81 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
82 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
84 case 0: return LDKAccessError_UnknownChain;
85 case 1: return LDKAccessError_UnknownTx;
89 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
91 case LDKAccessError_UnknownChain: return 0;
92 case LDKAccessError_UnknownTx: return 1;
96 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
98 case 0: return LDKCOption_NoneZ_Some;
99 case 1: return LDKCOption_NoneZ_None;
103 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
105 case LDKCOption_NoneZ_Some: return 0;
106 case LDKCOption_NoneZ_None: return 1;
110 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
112 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
113 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
117 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
119 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
120 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
124 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
126 case 0: return LDKConfirmationTarget_Background;
127 case 1: return LDKConfirmationTarget_Normal;
128 case 2: return LDKConfirmationTarget_HighPriority;
132 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
134 case LDKConfirmationTarget_Background: return 0;
135 case LDKConfirmationTarget_Normal: return 1;
136 case LDKConfirmationTarget_HighPriority: return 2;
140 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
142 case 0: return LDKLevel_Gossip;
143 case 1: return LDKLevel_Trace;
144 case 2: return LDKLevel_Debug;
145 case 3: return LDKLevel_Info;
146 case 4: return LDKLevel_Warn;
147 case 5: return LDKLevel_Error;
151 static inline int32_t LDKLevel_to_js(LDKLevel val) {
153 case LDKLevel_Gossip: return 0;
154 case LDKLevel_Trace: return 1;
155 case LDKLevel_Debug: return 2;
156 case LDKLevel_Info: return 3;
157 case LDKLevel_Warn: return 4;
158 case LDKLevel_Error: return 5;
162 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
164 case 0: return LDKNetwork_Bitcoin;
165 case 1: return LDKNetwork_Testnet;
166 case 2: return LDKNetwork_Regtest;
167 case 3: return LDKNetwork_Signet;
171 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
173 case LDKNetwork_Bitcoin: return 0;
174 case LDKNetwork_Testnet: return 1;
175 case LDKNetwork_Regtest: return 2;
176 case LDKNetwork_Signet: return 3;
180 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
182 case 0: return LDKSecp256k1Error_IncorrectSignature;
183 case 1: return LDKSecp256k1Error_InvalidMessage;
184 case 2: return LDKSecp256k1Error_InvalidPublicKey;
185 case 3: return LDKSecp256k1Error_InvalidSignature;
186 case 4: return LDKSecp256k1Error_InvalidSecretKey;
187 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
188 case 6: return LDKSecp256k1Error_InvalidTweak;
189 case 7: return LDKSecp256k1Error_TweakCheckFailed;
190 case 8: return LDKSecp256k1Error_NotEnoughMemory;
194 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
196 case LDKSecp256k1Error_IncorrectSignature: return 0;
197 case LDKSecp256k1Error_InvalidMessage: return 1;
198 case LDKSecp256k1Error_InvalidPublicKey: return 2;
199 case LDKSecp256k1Error_InvalidSignature: return 3;
200 case LDKSecp256k1Error_InvalidSecretKey: return 4;
201 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
202 case LDKSecp256k1Error_InvalidTweak: return 6;
203 case LDKSecp256k1Error_TweakCheckFailed: return 7;
204 case LDKSecp256k1Error_NotEnoughMemory: return 8;
208 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
209 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
210 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
213 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) { return CVec_u8Z_clone(&thing->script_pubkey);}int8_tArray __attribute__((export_name("TS_TxOut_get_script_pubkey"))) TS_TxOut_get_script_pubkey(uint32_t thing) {
214 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
215 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
216 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
217 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
218 CVec_u8Z_free(ret_var);
222 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((export_name("TS_TxOut_get_value"))) TS_TxOut_get_value(uint32_t thing) {
223 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
224 int64_t ret_val = TxOut_get_value(thing_conv);
228 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
229 CHECK(owner->result_ok);
230 return ChannelConfig_clone(&*owner->contents.result);
232 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t owner) {
233 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
234 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
235 uint64_t ret_ref = 0;
236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
239 ret_ref = (uint64_t)ret_var.inner;
240 if (ret_var.is_owned) {
246 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
247 CHECK(!owner->result_ok);
248 return DecodeError_clone(&*owner->contents.err);
250 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint32_t owner) {
251 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
252 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
253 uint64_t ret_ref = 0;
254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
257 ret_ref = (uint64_t)ret_var.inner;
258 if (ret_var.is_owned) {
264 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
265 CHECK(owner->result_ok);
266 return OutPoint_clone(&*owner->contents.result);
268 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint32_t owner) {
269 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
270 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
271 uint64_t ret_ref = 0;
272 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
273 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
274 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
275 ret_ref = (uint64_t)ret_var.inner;
276 if (ret_var.is_owned) {
282 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
283 CHECK(!owner->result_ok);
284 return DecodeError_clone(&*owner->contents.err);
286 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint32_t owner) {
287 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
288 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
289 uint64_t ret_ref = 0;
290 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
291 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
293 ret_ref = (uint64_t)ret_var.inner;
294 if (ret_var.is_owned) {
300 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
301 CHECK(owner->result_ok);
302 return *owner->contents.result;
304 int8_tArray __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint32_t owner) {
305 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
306 int8_tArray ret_arr = init_int8_tArray(32);
307 memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
311 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
312 CHECK(!owner->result_ok);
313 return *owner->contents.err;
315 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint32_t owner) {
316 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
317 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
321 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
322 CHECK(owner->result_ok);
323 return *owner->contents.result;
325 int8_tArray __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint32_t owner) {
326 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
327 int8_tArray ret_arr = init_int8_tArray(33);
328 memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
332 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
333 CHECK(!owner->result_ok);
334 return *owner->contents.err;
336 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint32_t owner) {
337 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
338 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
342 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
343 CHECK(owner->result_ok);
344 return TxCreationKeys_clone(&*owner->contents.result);
346 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t owner) {
347 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
348 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
349 uint64_t ret_ref = 0;
350 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
351 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
353 ret_ref = (uint64_t)ret_var.inner;
354 if (ret_var.is_owned) {
360 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
361 CHECK(!owner->result_ok);
362 return DecodeError_clone(&*owner->contents.err);
364 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t owner) {
365 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
366 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
367 uint64_t ret_ref = 0;
368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
371 ret_ref = (uint64_t)ret_var.inner;
372 if (ret_var.is_owned) {
378 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
379 CHECK(owner->result_ok);
380 return ChannelPublicKeys_clone(&*owner->contents.result);
382 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t owner) {
383 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
384 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
385 uint64_t ret_ref = 0;
386 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
387 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
389 ret_ref = (uint64_t)ret_var.inner;
390 if (ret_var.is_owned) {
396 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
397 CHECK(!owner->result_ok);
398 return DecodeError_clone(&*owner->contents.err);
400 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t owner) {
401 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
402 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
403 uint64_t ret_ref = 0;
404 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
405 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
407 ret_ref = (uint64_t)ret_var.inner;
408 if (ret_var.is_owned) {
414 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
415 CHECK(owner->result_ok);
416 return TxCreationKeys_clone(&*owner->contents.result);
418 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint32_t owner) {
419 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
420 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
421 uint64_t ret_ref = 0;
422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
425 ret_ref = (uint64_t)ret_var.inner;
426 if (ret_var.is_owned) {
432 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
433 CHECK(!owner->result_ok);
434 return *owner->contents.err;
436 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint32_t owner) {
437 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
438 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
442 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint32_t ptr) {
443 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
445 case LDKCOption_u32Z_Some: return 0;
446 case LDKCOption_u32Z_None: return 1;
450 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint32_t ptr) {
451 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
452 assert(obj->tag == LDKCOption_u32Z_Some);
455 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
456 CHECK(owner->result_ok);
457 return HTLCOutputInCommitment_clone(&*owner->contents.result);
459 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t owner) {
460 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
461 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
462 uint64_t ret_ref = 0;
463 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
464 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
466 ret_ref = (uint64_t)ret_var.inner;
467 if (ret_var.is_owned) {
473 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
474 CHECK(!owner->result_ok);
475 return DecodeError_clone(&*owner->contents.err);
477 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t owner) {
478 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
479 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
480 uint64_t ret_ref = 0;
481 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
482 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
484 ret_ref = (uint64_t)ret_var.inner;
485 if (ret_var.is_owned) {
491 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
492 CHECK(owner->result_ok);
493 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
495 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
496 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
497 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
498 uint64_t ret_ref = 0;
499 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
500 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
502 ret_ref = (uint64_t)ret_var.inner;
503 if (ret_var.is_owned) {
509 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
510 CHECK(!owner->result_ok);
511 return DecodeError_clone(&*owner->contents.err);
513 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
514 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
515 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
516 uint64_t ret_ref = 0;
517 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
518 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
520 ret_ref = (uint64_t)ret_var.inner;
521 if (ret_var.is_owned) {
527 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
528 CHECK(owner->result_ok);
529 return ChannelTransactionParameters_clone(&*owner->contents.result);
531 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
532 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
533 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
534 uint64_t ret_ref = 0;
535 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
536 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
538 ret_ref = (uint64_t)ret_var.inner;
539 if (ret_var.is_owned) {
545 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
546 CHECK(!owner->result_ok);
547 return DecodeError_clone(&*owner->contents.err);
549 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
550 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
551 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
552 uint64_t ret_ref = 0;
553 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
554 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
556 ret_ref = (uint64_t)ret_var.inner;
557 if (ret_var.is_owned) {
563 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
564 CHECK(owner->result_ok);
565 return HolderCommitmentTransaction_clone(&*owner->contents.result);
567 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
568 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
569 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
570 uint64_t ret_ref = 0;
571 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
572 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
573 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
574 ret_ref = (uint64_t)ret_var.inner;
575 if (ret_var.is_owned) {
581 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
582 CHECK(!owner->result_ok);
583 return DecodeError_clone(&*owner->contents.err);
585 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
586 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
587 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
588 uint64_t ret_ref = 0;
589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
592 ret_ref = (uint64_t)ret_var.inner;
593 if (ret_var.is_owned) {
599 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
600 CHECK(owner->result_ok);
601 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
603 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
604 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
605 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
606 uint64_t ret_ref = 0;
607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
610 ret_ref = (uint64_t)ret_var.inner;
611 if (ret_var.is_owned) {
617 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
618 CHECK(!owner->result_ok);
619 return DecodeError_clone(&*owner->contents.err);
621 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
622 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
623 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
624 uint64_t ret_ref = 0;
625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
627 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
628 ret_ref = (uint64_t)ret_var.inner;
629 if (ret_var.is_owned) {
635 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
636 CHECK(owner->result_ok);
637 return &*owner->contents.result;
639 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t owner) {
640 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
641 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
642 uint64_t ret_ref = 0;
643 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
644 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
645 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
646 ret_ref = (uint64_t)ret_var.inner & ~1;
650 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
651 CHECK(!owner->result_ok);
652 return *owner->contents.err;
654 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint32_t owner) {
655 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
656 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
659 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
660 CHECK(owner->result_ok);
661 return CommitmentTransaction_clone(&*owner->contents.result);
663 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
664 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
665 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
666 uint64_t ret_ref = 0;
667 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
668 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
670 ret_ref = (uint64_t)ret_var.inner;
671 if (ret_var.is_owned) {
677 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
678 CHECK(!owner->result_ok);
679 return DecodeError_clone(&*owner->contents.err);
681 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
682 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
683 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
684 uint64_t ret_ref = 0;
685 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
686 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
687 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
688 ret_ref = (uint64_t)ret_var.inner;
689 if (ret_var.is_owned) {
695 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
696 CHECK(owner->result_ok);
697 return &*owner->contents.result;
699 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t owner) {
700 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
701 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
702 uint64_t ret_ref = 0;
703 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
704 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
706 ret_ref = (uint64_t)ret_var.inner & ~1;
710 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
711 CHECK(!owner->result_ok);
712 return *owner->contents.err;
714 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t owner) {
715 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
716 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
719 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
720 CHECK(owner->result_ok);
721 return *owner->contents.result;
723 ptrArray __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint32_t owner) {
724 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
725 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
726 ptrArray ret_arr = NULL;
727 ret_arr = init_ptrArray(ret_var.datalen);
728 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
729 for (size_t m = 0; m < ret_var.datalen; m++) {
730 int8_tArray ret_conv_12_arr = init_int8_tArray(64);
731 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
732 ret_arr_ptr[m] = ret_conv_12_arr;
738 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
739 CHECK(!owner->result_ok);
740 return *owner->contents.err;
742 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint32_t owner) {
743 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
744 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
747 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
748 CHECK(owner->result_ok);
749 return ShutdownScript_clone(&*owner->contents.result);
751 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t owner) {
752 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
753 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
754 uint64_t ret_ref = 0;
755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
758 ret_ref = (uint64_t)ret_var.inner;
759 if (ret_var.is_owned) {
765 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
766 CHECK(!owner->result_ok);
767 return DecodeError_clone(&*owner->contents.err);
769 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t owner) {
770 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
771 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
772 uint64_t ret_ref = 0;
773 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
774 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
776 ret_ref = (uint64_t)ret_var.inner;
777 if (ret_var.is_owned) {
783 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
784 CHECK(owner->result_ok);
785 return ShutdownScript_clone(&*owner->contents.result);
787 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t owner) {
788 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
789 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
790 uint64_t ret_ref = 0;
791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
794 ret_ref = (uint64_t)ret_var.inner;
795 if (ret_var.is_owned) {
801 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
802 CHECK(!owner->result_ok);
803 return InvalidShutdownScript_clone(&*owner->contents.err);
805 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t owner) {
806 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
807 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
808 uint64_t ret_ref = 0;
809 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
810 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
811 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
812 ret_ref = (uint64_t)ret_var.inner;
813 if (ret_var.is_owned) {
819 typedef struct LDKType_JCalls {
820 atomic_size_t refcnt;
821 uint32_t instance_ptr;
823 static void LDKType_JCalls_free(void* this_arg) {
824 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
825 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
829 uint16_t type_id_LDKType_jcall(const void* this_arg) {
830 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
831 return js_invoke_function_0(j_calls->instance_ptr, 0);
833 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
834 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
835 jstring ret = (jstring)js_invoke_function_0(j_calls->instance_ptr, 1);
836 LDKStr ret_conv = str_ref_to_owned_c(ret);
839 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
840 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
841 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 2);
843 ret_ref.datalen = ret->arr_len;
844 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
845 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
848 static void LDKType_JCalls_cloned(LDKType* new_obj) {
849 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
850 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
852 static inline LDKType LDKType_init (JSValue o) {
853 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
854 atomic_init(&calls->refcnt, 1);
855 calls->instance_ptr = o;
858 .this_arg = (void*) calls,
859 .type_id = type_id_LDKType_jcall,
860 .debug_str = debug_str_LDKType_jcall,
861 .write = write_LDKType_jcall,
862 .cloned = LDKType_JCalls_cloned,
863 .free = LDKType_JCalls_free,
867 long __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
868 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
869 *res_ptr = LDKType_init(o);
870 return (long)res_ptr;
872 int16_t __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint32_t this_arg) {
873 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
874 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
875 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
876 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
880 jstring __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint32_t this_arg) {
881 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
882 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
883 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
884 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
885 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
890 int8_tArray __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint32_t this_arg) {
891 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
892 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
893 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
894 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
895 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
896 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
897 CVec_u8Z_free(ret_var);
901 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint32_t ptr) {
902 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
904 case LDKCOption_TypeZ_Some: return 0;
905 case LDKCOption_TypeZ_None: return 1;
909 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint32_t ptr) {
910 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
911 assert(obj->tag == LDKCOption_TypeZ_Some);
912 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
913 *some_ret = Type_clone(&obj->some);
914 return (uint64_t)some_ret;
916 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
917 CHECK(owner->result_ok);
918 return COption_TypeZ_clone(&*owner->contents.result);
920 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t owner) {
921 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
922 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
923 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
924 uint64_t ret_ref = (uint64_t)ret_copy;
928 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
929 CHECK(!owner->result_ok);
930 return DecodeError_clone(&*owner->contents.err);
932 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint32_t owner) {
933 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
934 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
935 uint64_t ret_ref = 0;
936 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
937 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
939 ret_ref = (uint64_t)ret_var.inner;
940 if (ret_var.is_owned) {
946 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
947 CHECK(owner->result_ok);
948 return *owner->contents.result;
950 jstring __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint32_t owner) {
951 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
952 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
953 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
957 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
958 CHECK(!owner->result_ok);
959 return *owner->contents.err;
961 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint32_t owner) {
962 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
963 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
967 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
968 CHECK(owner->result_ok);
969 return ChannelMonitorUpdate_clone(&*owner->contents.result);
971 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t owner) {
972 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
973 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
974 uint64_t ret_ref = 0;
975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
978 ret_ref = (uint64_t)ret_var.inner;
979 if (ret_var.is_owned) {
985 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
986 CHECK(!owner->result_ok);
987 return DecodeError_clone(&*owner->contents.err);
989 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t owner) {
990 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
991 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
992 uint64_t ret_ref = 0;
993 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
994 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
995 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
996 ret_ref = (uint64_t)ret_var.inner;
997 if (ret_var.is_owned) {
1003 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint32_t ptr) {
1004 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1006 case LDKMonitorEvent_HTLCEvent: return 0;
1007 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
1008 case LDKMonitorEvent_UpdateCompleted: return 2;
1009 case LDKMonitorEvent_UpdateFailed: return 3;
1013 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint32_t ptr) {
1014 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1015 assert(obj->tag == LDKMonitorEvent_HTLCEvent);
1016 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1017 uint64_t htlc_event_ref = 0;
1018 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1019 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1020 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
1021 htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1022 return htlc_event_ref;
1024 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint32_t ptr) {
1025 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1026 assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
1027 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1028 uint64_t commitment_tx_confirmed_ref = 0;
1029 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1030 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1031 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
1032 commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
1033 return commitment_tx_confirmed_ref;
1035 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo"))) TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo(uint32_t ptr) {
1036 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1037 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
1038 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
1039 uint64_t funding_txo_ref = 0;
1040 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1041 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1042 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
1043 funding_txo_ref = (uint64_t)funding_txo_var.inner & ~1;
1044 return funding_txo_ref;
1046 int64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id"))) TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id(uint32_t ptr) {
1047 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1048 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
1049 return obj->update_completed.monitor_update_id;
1051 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint32_t ptr) {
1052 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1053 assert(obj->tag == LDKMonitorEvent_UpdateFailed);
1054 LDKOutPoint update_failed_var = obj->update_failed;
1055 uint64_t update_failed_ref = 0;
1056 CHECK((((uint64_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1057 CHECK((((uint64_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1058 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
1059 update_failed_ref = (uint64_t)update_failed_var.inner & ~1;
1060 return update_failed_ref;
1062 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint32_t ptr) {
1063 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
1065 case LDKCOption_MonitorEventZ_Some: return 0;
1066 case LDKCOption_MonitorEventZ_None: return 1;
1070 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint32_t ptr) {
1071 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
1072 assert(obj->tag == LDKCOption_MonitorEventZ_Some);
1073 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1076 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
1077 CHECK(owner->result_ok);
1078 return COption_MonitorEventZ_clone(&*owner->contents.result);
1080 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t owner) {
1081 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
1082 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
1083 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
1084 uint64_t ret_ref = (uint64_t)ret_copy;
1088 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
1089 CHECK(!owner->result_ok);
1090 return DecodeError_clone(&*owner->contents.err);
1092 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t owner) {
1093 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
1094 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
1095 uint64_t ret_ref = 0;
1096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1099 ret_ref = (uint64_t)ret_var.inner;
1100 if (ret_var.is_owned) {
1106 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
1107 CHECK(owner->result_ok);
1108 return HTLCUpdate_clone(&*owner->contents.result);
1110 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t owner) {
1111 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
1112 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
1113 uint64_t ret_ref = 0;
1114 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1115 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1117 ret_ref = (uint64_t)ret_var.inner;
1118 if (ret_var.is_owned) {
1124 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
1125 CHECK(!owner->result_ok);
1126 return DecodeError_clone(&*owner->contents.err);
1128 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t owner) {
1129 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
1130 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
1131 uint64_t ret_ref = 0;
1132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1135 ret_ref = (uint64_t)ret_var.inner;
1136 if (ret_var.is_owned) {
1142 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1143 CHECK(owner->result_ok);
1144 return *owner->contents.result;
1146 void __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint32_t owner) {
1147 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
1148 CResult_NoneNoneZ_get_ok(owner_conv);
1151 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1152 CHECK(!owner->result_ok);
1153 return *owner->contents.err;
1155 void __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint32_t owner) {
1156 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
1157 CResult_NoneNoneZ_get_err(owner_conv);
1160 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
1161 return OutPoint_clone(&owner->a);
1163 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t owner) {
1164 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
1165 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
1166 uint64_t ret_ref = 0;
1167 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1168 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1169 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1170 ret_ref = (uint64_t)ret_var.inner;
1171 if (ret_var.is_owned) {
1177 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
1178 return CVec_u8Z_clone(&owner->b);
1180 int8_tArray __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t owner) {
1181 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
1182 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
1183 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
1184 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1185 CVec_u8Z_free(ret_var);
1189 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
1192 int32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t owner) {
1193 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
1194 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(owner_conv);
1198 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
1199 return CVec_u8Z_clone(&owner->b);
1201 int8_tArray __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t owner) {
1202 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
1203 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
1204 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
1205 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1206 CVec_u8Z_free(ret_var);
1210 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
1211 return ThirtyTwoBytes_clone(&owner->a);
1213 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t owner) {
1214 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
1215 int8_tArray ret_arr = init_int8_tArray(32);
1216 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
1220 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
1223 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t owner) {
1224 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
1225 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
1226 uint32_tArray ret_arr = NULL;
1227 ret_arr = init_uint32_tArray(ret_var.datalen);
1228 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
1229 for (size_t v = 0; v < ret_var.datalen; v++) {
1230 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = &ret_var.data[v];
1231 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_u32ScriptZ
1232 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv) | 1;
1238 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1239 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1240 for (size_t i = 0; i < ret.datalen; i++) {
1241 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1245 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint32_t ptr) {
1246 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1248 case LDKPaymentPurpose_InvoicePayment: return 0;
1249 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1253 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint32_t ptr) {
1254 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1255 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1256 int8_tArray payment_preimage_arr = init_int8_tArray(32);
1257 memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1258 return payment_preimage_arr;
1260 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint32_t ptr) {
1261 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1262 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1263 int8_tArray payment_secret_arr = init_int8_tArray(32);
1264 memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1265 return payment_secret_arr;
1267 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint32_t ptr) {
1268 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1269 assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1270 int8_tArray spontaneous_payment_arr = init_int8_tArray(32);
1271 memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1272 return spontaneous_payment_arr;
1274 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint32_t ptr) {
1275 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1277 case LDKCOption_u64Z_Some: return 0;
1278 case LDKCOption_u64Z_None: return 1;
1282 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint32_t ptr) {
1283 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1284 assert(obj->tag == LDKCOption_u64Z_Some);
1287 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint32_t ptr) {
1288 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1290 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1291 case LDKNetworkUpdate_ChannelClosed: return 1;
1292 case LDKNetworkUpdate_NodeFailure: return 2;
1296 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint32_t ptr) {
1297 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1298 assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1299 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1300 uint64_t msg_ref = 0;
1301 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1302 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1303 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1304 msg_ref = (uint64_t)msg_var.inner & ~1;
1307 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelClosed_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelClosed_get_short_channel_id(uint32_t ptr) {
1308 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1309 assert(obj->tag == LDKNetworkUpdate_ChannelClosed);
1310 return obj->channel_closed.short_channel_id;
1312 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelClosed_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelClosed_get_is_permanent(uint32_t ptr) {
1313 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1314 assert(obj->tag == LDKNetworkUpdate_ChannelClosed);
1315 return obj->channel_closed.is_permanent;
1317 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint32_t ptr) {
1318 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1319 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1320 int8_tArray node_id_arr = init_int8_tArray(33);
1321 memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1324 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint32_t ptr) {
1325 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1326 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1327 return obj->node_failure.is_permanent;
1329 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint32_t ptr) {
1330 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1332 case LDKCOption_NetworkUpdateZ_Some: return 0;
1333 case LDKCOption_NetworkUpdateZ_None: return 1;
1337 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint32_t ptr) {
1338 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1339 assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1340 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1343 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1344 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1345 for (size_t i = 0; i < ret.datalen; i++) {
1346 ret.data[i] = RouteHop_clone(&orig->data[i]);
1350 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint32_t ptr) {
1351 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1353 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1354 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1355 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1359 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint32_t ptr) {
1360 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1361 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1362 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1363 uint64_t outpoint_ref = 0;
1364 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1365 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1366 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1367 outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1368 return outpoint_ref;
1370 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint32_t ptr) {
1371 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1372 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1373 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1374 return (uint64_t)output_ref;
1376 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint32_t ptr) {
1377 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1378 assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1379 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1380 uint64_t delayed_payment_output_ref = 0;
1381 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1382 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1383 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1384 delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1385 return delayed_payment_output_ref;
1387 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint32_t ptr) {
1388 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1389 assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1390 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1391 uint64_t static_payment_output_ref = 0;
1392 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1393 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1394 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1395 static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1396 return static_payment_output_ref;
1398 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1399 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1400 for (size_t i = 0; i < ret.datalen; i++) {
1401 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1405 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint32_t ptr) {
1406 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1408 case LDKClosureReason_CounterpartyForceClosed: return 0;
1409 case LDKClosureReason_HolderForceClosed: return 1;
1410 case LDKClosureReason_CooperativeClosure: return 2;
1411 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1412 case LDKClosureReason_FundingTimedOut: return 4;
1413 case LDKClosureReason_ProcessingError: return 5;
1414 case LDKClosureReason_DisconnectedPeer: return 6;
1415 case LDKClosureReason_OutdatedChannelManager: return 7;
1419 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint32_t ptr) {
1420 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1421 assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1422 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1423 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1424 return peer_msg_conv;
1426 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint32_t ptr) {
1427 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1428 assert(obj->tag == LDKClosureReason_ProcessingError);
1429 LDKStr err_str = obj->processing_error.err;
1430 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1433 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint32_t ptr) {
1434 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1436 case LDKEvent_FundingGenerationReady: return 0;
1437 case LDKEvent_PaymentReceived: return 1;
1438 case LDKEvent_PaymentSent: return 2;
1439 case LDKEvent_PaymentPathFailed: return 3;
1440 case LDKEvent_PaymentFailed: return 4;
1441 case LDKEvent_PendingHTLCsForwardable: return 5;
1442 case LDKEvent_SpendableOutputs: return 6;
1443 case LDKEvent_PaymentForwarded: return 7;
1444 case LDKEvent_ChannelClosed: return 8;
1445 case LDKEvent_DiscardFunding: return 9;
1446 case LDKEvent_PaymentPathSuccessful: return 10;
1450 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint32_t ptr) {
1451 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1452 assert(obj->tag == LDKEvent_FundingGenerationReady);
1453 int8_tArray temporary_channel_id_arr = init_int8_tArray(32);
1454 memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1455 return temporary_channel_id_arr;
1457 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint32_t ptr) {
1458 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1459 assert(obj->tag == LDKEvent_FundingGenerationReady);
1460 return obj->funding_generation_ready.channel_value_satoshis;
1462 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint32_t ptr) {
1463 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1464 assert(obj->tag == LDKEvent_FundingGenerationReady);
1465 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1466 int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen);
1467 memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1468 return output_script_arr;
1470 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint32_t ptr) {
1471 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1472 assert(obj->tag == LDKEvent_FundingGenerationReady);
1473 return obj->funding_generation_ready.user_channel_id;
1475 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint32_t ptr) {
1476 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1477 assert(obj->tag == LDKEvent_PaymentReceived);
1478 int8_tArray payment_hash_arr = init_int8_tArray(32);
1479 memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1480 return payment_hash_arr;
1482 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amt"))) TS_LDKEvent_PaymentReceived_get_amt(uint32_t ptr) {
1483 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1484 assert(obj->tag == LDKEvent_PaymentReceived);
1485 return obj->payment_received.amt;
1487 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint32_t ptr) {
1488 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1489 assert(obj->tag == LDKEvent_PaymentReceived);
1490 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
1493 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint32_t ptr) {
1494 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1495 assert(obj->tag == LDKEvent_PaymentSent);
1496 int8_tArray payment_id_arr = init_int8_tArray(32);
1497 memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1498 return payment_id_arr;
1500 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint32_t ptr) {
1501 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1502 assert(obj->tag == LDKEvent_PaymentSent);
1503 int8_tArray payment_preimage_arr = init_int8_tArray(32);
1504 memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1505 return payment_preimage_arr;
1507 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint32_t ptr) {
1508 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1509 assert(obj->tag == LDKEvent_PaymentSent);
1510 int8_tArray payment_hash_arr = init_int8_tArray(32);
1511 memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1512 return payment_hash_arr;
1514 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint32_t ptr) {
1515 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1516 assert(obj->tag == LDKEvent_PaymentSent);
1517 uint64_t fee_paid_msat_ref = ((uint64_t)&obj->payment_sent.fee_paid_msat) | 1;
1518 return fee_paid_msat_ref;
1520 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint32_t ptr) {
1521 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1522 assert(obj->tag == LDKEvent_PaymentPathFailed);
1523 int8_tArray payment_id_arr = init_int8_tArray(32);
1524 memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1525 return payment_id_arr;
1527 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint32_t ptr) {
1528 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1529 assert(obj->tag == LDKEvent_PaymentPathFailed);
1530 int8_tArray payment_hash_arr = init_int8_tArray(32);
1531 memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1532 return payment_hash_arr;
1534 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest"))) TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest(uint32_t ptr) {
1535 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1536 assert(obj->tag == LDKEvent_PaymentPathFailed);
1537 return obj->payment_path_failed.rejected_by_dest;
1539 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint32_t ptr) {
1540 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1541 assert(obj->tag == LDKEvent_PaymentPathFailed);
1542 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
1543 return network_update_ref;
1545 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint32_t ptr) {
1546 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1547 assert(obj->tag == LDKEvent_PaymentPathFailed);
1548 return obj->payment_path_failed.all_paths_failed;
1550 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint32_t ptr) {
1551 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1552 assert(obj->tag == LDKEvent_PaymentPathFailed);
1553 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1554 uint32_tArray path_arr = NULL;
1555 path_arr = init_uint32_tArray(path_var.datalen);
1556 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1557 for (size_t k = 0; k < path_var.datalen; k++) {
1558 LDKRouteHop path_conv_10_var = path_var.data[k];
1559 uint64_t path_conv_10_ref = 0;
1560 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1561 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1562 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1563 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
1564 path_arr_ptr[k] = path_conv_10_ref;
1569 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint32_t ptr) {
1570 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1571 assert(obj->tag == LDKEvent_PaymentPathFailed);
1572 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
1573 return short_channel_id_ref;
1575 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint32_t ptr) {
1576 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1577 assert(obj->tag == LDKEvent_PaymentPathFailed);
1578 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1579 uint64_t retry_ref = 0;
1580 if ((uint64_t)retry_var.inner > 4096) {
1581 CHECK((((uint64_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1582 CHECK((((uint64_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1583 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1584 retry_ref = (uint64_t)retry_var.inner & ~1;
1588 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint32_t ptr) {
1589 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1590 assert(obj->tag == LDKEvent_PaymentFailed);
1591 int8_tArray payment_id_arr = init_int8_tArray(32);
1592 memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1593 return payment_id_arr;
1595 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint32_t ptr) {
1596 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1597 assert(obj->tag == LDKEvent_PaymentFailed);
1598 int8_tArray payment_hash_arr = init_int8_tArray(32);
1599 memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1600 return payment_hash_arr;
1602 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint32_t ptr) {
1603 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1604 assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1605 return obj->pending_htl_cs_forwardable.time_forwardable;
1607 uint32_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint32_t ptr) {
1608 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1609 assert(obj->tag == LDKEvent_SpendableOutputs);
1610 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1611 uint32_tArray outputs_arr = NULL;
1612 outputs_arr = init_uint32_tArray(outputs_var.datalen);
1613 uint32_t *outputs_arr_ptr = (uint32_t*)(((uint8_t*)outputs_arr) + 4);
1614 for (size_t b = 0; b < outputs_var.datalen; b++) {
1615 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
1616 outputs_arr_ptr[b] = outputs_conv_27_ref;
1621 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint32_t ptr) {
1622 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1623 assert(obj->tag == LDKEvent_PaymentForwarded);
1624 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
1625 return fee_earned_msat_ref;
1627 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint32_t ptr) {
1628 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1629 assert(obj->tag == LDKEvent_PaymentForwarded);
1630 return obj->payment_forwarded.claim_from_onchain_tx;
1632 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint32_t ptr) {
1633 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1634 assert(obj->tag == LDKEvent_ChannelClosed);
1635 int8_tArray channel_id_arr = init_int8_tArray(32);
1636 memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1637 return channel_id_arr;
1639 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint32_t ptr) {
1640 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1641 assert(obj->tag == LDKEvent_ChannelClosed);
1642 return obj->channel_closed.user_channel_id;
1644 uint32_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint32_t ptr) {
1645 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1646 assert(obj->tag == LDKEvent_ChannelClosed);
1647 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
1650 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint32_t ptr) {
1651 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1652 assert(obj->tag == LDKEvent_DiscardFunding);
1653 int8_tArray channel_id_arr = init_int8_tArray(32);
1654 memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1655 return channel_id_arr;
1657 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint32_t ptr) {
1658 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1659 assert(obj->tag == LDKEvent_DiscardFunding);
1660 LDKTransaction transaction_var = obj->discard_funding.transaction;
1661 int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen);
1662 memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1663 return transaction_arr;
1665 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint32_t ptr) {
1666 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1667 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1668 int8_tArray payment_id_arr = init_int8_tArray(32);
1669 memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1670 return payment_id_arr;
1672 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint32_t ptr) {
1673 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1674 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1675 int8_tArray payment_hash_arr = init_int8_tArray(32);
1676 memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1677 return payment_hash_arr;
1679 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint32_t ptr) {
1680 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1681 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1682 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1683 uint32_tArray path_arr = NULL;
1684 path_arr = init_uint32_tArray(path_var.datalen);
1685 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1686 for (size_t k = 0; k < path_var.datalen; k++) {
1687 LDKRouteHop path_conv_10_var = path_var.data[k];
1688 uint64_t path_conv_10_ref = 0;
1689 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1690 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1691 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1692 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
1693 path_arr_ptr[k] = path_conv_10_ref;
1698 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1699 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1700 for (size_t i = 0; i < ret.datalen; i++) {
1701 ret.data[i] = Event_clone(&orig->data[i]);
1705 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1708 int64_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t owner) {
1709 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1710 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(owner_conv);
1714 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1717 int8_tArray __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t owner) {
1718 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1719 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
1720 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
1721 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1725 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1726 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1727 for (size_t i = 0; i < ret.datalen; i++) {
1728 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1732 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
1735 int32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t owner) {
1736 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
1737 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(owner_conv);
1741 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
1742 return TxOut_clone(&owner->b);
1744 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t owner) {
1745 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
1746 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
1747 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
1748 return (uint64_t)ret_ref;
1751 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1752 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1753 for (size_t i = 0; i < ret.datalen; i++) {
1754 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
1758 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
1759 return ThirtyTwoBytes_clone(&owner->a);
1761 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t owner) {
1762 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
1763 int8_tArray ret_arr = init_int8_tArray(32);
1764 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
1768 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
1769 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
1771 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t owner) {
1772 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
1773 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
1774 uint32_tArray ret_arr = NULL;
1775 ret_arr = init_uint32_tArray(ret_var.datalen);
1776 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
1777 for (size_t u = 0; u < ret_var.datalen; u++) {
1778 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1779 *ret_conv_20_conv = ret_var.data[u];
1780 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
1787 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
1788 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
1789 for (size_t i = 0; i < ret.datalen; i++) {
1790 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
1794 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1795 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1796 for (size_t i = 0; i < ret.datalen; i++) {
1797 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1801 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint32_t ptr) {
1802 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1804 case LDKBalance_ClaimableOnChannelClose: return 0;
1805 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
1806 case LDKBalance_ContentiousClaimable: return 2;
1807 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: return 3;
1811 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint32_t ptr) {
1812 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1813 assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
1814 return obj->claimable_on_channel_close.claimable_amount_satoshis;
1816 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint32_t ptr) {
1817 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1818 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
1819 return obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
1821 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint32_t ptr) {
1822 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1823 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
1824 return obj->claimable_awaiting_confirmations.confirmation_height;
1826 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint32_t ptr) {
1827 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1828 assert(obj->tag == LDKBalance_ContentiousClaimable);
1829 return obj->contentious_claimable.claimable_amount_satoshis;
1831 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint32_t ptr) {
1832 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1833 assert(obj->tag == LDKBalance_ContentiousClaimable);
1834 return obj->contentious_claimable.timeout_height;
1836 int64_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis(uint32_t ptr) {
1837 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1838 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
1839 return obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
1841 int32_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height(uint32_t ptr) {
1842 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1843 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
1844 return obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
1846 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
1847 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
1848 for (size_t i = 0; i < ret.datalen; i++) {
1849 ret.data[i] = Balance_clone(&orig->data[i]);
1853 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
1856 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t owner) {
1857 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
1858 int8_tArray ret_arr = init_int8_tArray(64);
1859 memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
1863 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
1866 ptrArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t owner) {
1867 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
1868 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
1869 ptrArray ret_arr = NULL;
1870 ret_arr = init_ptrArray(ret_var.datalen);
1871 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
1872 for (size_t m = 0; m < ret_var.datalen; m++) {
1873 int8_tArray ret_conv_12_arr = init_int8_tArray(64);
1874 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1875 ret_arr_ptr[m] = ret_conv_12_arr;
1881 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
1882 CHECK(owner->result_ok);
1883 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
1885 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t owner) {
1886 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
1887 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1888 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
1889 return ((uint64_t)ret_conv);
1892 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
1893 CHECK(!owner->result_ok);
1894 return *owner->contents.err;
1896 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t owner) {
1897 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
1898 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
1901 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
1902 CHECK(owner->result_ok);
1903 return *owner->contents.result;
1905 int8_tArray __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint32_t owner) {
1906 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
1907 int8_tArray ret_arr = init_int8_tArray(64);
1908 memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1912 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
1913 CHECK(!owner->result_ok);
1914 return *owner->contents.err;
1916 void __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint32_t owner) {
1917 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
1918 CResult_SignatureNoneZ_get_err(owner_conv);
1921 typedef struct LDKBaseSign_JCalls {
1922 atomic_size_t refcnt;
1923 uint32_t instance_ptr;
1924 } LDKBaseSign_JCalls;
1925 static void LDKBaseSign_JCalls_free(void* this_arg) {
1926 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1927 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1931 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1932 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1933 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->instance_ptr, 3, (uint32_t)idx);
1934 LDKPublicKey ret_ref;
1935 CHECK(ret->arr_len == 33);
1936 memcpy(ret_ref.compressed_form, ret->elems, 33);
1939 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1940 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1941 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->instance_ptr, 4, (uint32_t)idx);
1942 LDKThirtyTwoBytes ret_ref;
1943 CHECK(ret->arr_len == 32);
1944 memcpy(ret_ref.data, ret->elems, 32);
1947 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1948 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1949 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1950 uint64_t holder_tx_ref = 0;
1951 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1952 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1953 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1954 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1955 holder_tx_ref = (uint64_t)holder_tx_var.inner;
1956 if (holder_tx_var.is_owned) {
1959 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 5, (uint32_t)holder_tx_ref);
1960 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1961 CHECK_ACCESS(ret_ptr);
1962 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1966 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1967 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1968 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 6);
1969 LDKThirtyTwoBytes ret_ref;
1970 CHECK(ret->arr_len == 32);
1971 memcpy(ret_ref.data, ret->elems, 32);
1974 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1975 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1976 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1977 uint64_t commitment_tx_ref = 0;
1978 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1979 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1980 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1981 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1982 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1983 if (commitment_tx_var.is_owned) {
1984 commitment_tx_ref |= 1;
1986 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 7, (uint32_t)commitment_tx_ref);
1987 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1988 CHECK_ACCESS(ret_ptr);
1989 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1993 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1994 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1995 int8_tArray secret_arr = init_int8_tArray(32);
1996 memcpy(secret_arr->elems, *secret, 32);
1997 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 8, (uint32_t)idx, (uint32_t)secret_arr);
1998 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1999 CHECK_ACCESS(ret_ptr);
2000 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2004 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2005 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2006 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2007 uint64_t commitment_tx_ref = 0;
2008 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2009 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2010 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2011 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2012 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2013 if (commitment_tx_var.is_owned) {
2014 commitment_tx_ref |= 1;
2016 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 9, (uint32_t)commitment_tx_ref);
2017 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2018 CHECK_ACCESS(ret_ptr);
2019 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2023 LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
2024 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2025 LDKTransaction justice_tx_var = justice_tx;
2026 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen);
2027 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2028 Transaction_free(justice_tx_var);
2029 int8_tArray per_commitment_key_arr = init_int8_tArray(32);
2030 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2031 uint32_t ret = js_invoke_function_4(j_calls->instance_ptr, 10, (uint32_t)justice_tx_arr, (uint32_t)input, (uint32_t)amount, (uint32_t)per_commitment_key_arr);
2032 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2033 CHECK_ACCESS(ret_ptr);
2034 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2038 LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
2039 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2040 LDKTransaction justice_tx_var = justice_tx;
2041 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen);
2042 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2043 Transaction_free(justice_tx_var);
2044 int8_tArray per_commitment_key_arr = init_int8_tArray(32);
2045 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2046 LDKHTLCOutputInCommitment htlc_var = *htlc;
2047 uint64_t htlc_ref = 0;
2048 htlc_var = HTLCOutputInCommitment_clone(htlc);
2049 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2050 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2051 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2052 htlc_ref = (uint64_t)htlc_var.inner;
2053 if (htlc_var.is_owned) {
2056 uint32_t ret = js_invoke_function_5(j_calls->instance_ptr, 11, (uint32_t)justice_tx_arr, (uint32_t)input, (uint32_t)amount, (uint32_t)per_commitment_key_arr, (uint32_t)htlc_ref);
2057 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2058 CHECK_ACCESS(ret_ptr);
2059 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2063 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
2064 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2065 LDKTransaction htlc_tx_var = htlc_tx;
2066 int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen);
2067 memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2068 Transaction_free(htlc_tx_var);
2069 int8_tArray per_commitment_point_arr = init_int8_tArray(33);
2070 memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
2071 LDKHTLCOutputInCommitment htlc_var = *htlc;
2072 uint64_t htlc_ref = 0;
2073 htlc_var = HTLCOutputInCommitment_clone(htlc);
2074 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2075 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2076 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2077 htlc_ref = (uint64_t)htlc_var.inner;
2078 if (htlc_var.is_owned) {
2081 uint32_t ret = js_invoke_function_5(j_calls->instance_ptr, 12, (uint32_t)htlc_tx_arr, (uint32_t)input, (uint32_t)amount, (uint32_t)per_commitment_point_arr, (uint32_t)htlc_ref);
2082 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2083 CHECK_ACCESS(ret_ptr);
2084 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2088 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2089 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2090 LDKClosingTransaction closing_tx_var = *closing_tx;
2091 uint64_t closing_tx_ref = 0;
2092 closing_tx_var = ClosingTransaction_clone(closing_tx);
2093 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2094 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2095 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2096 closing_tx_ref = (uint64_t)closing_tx_var.inner;
2097 if (closing_tx_var.is_owned) {
2098 closing_tx_ref |= 1;
2100 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 13, (uint32_t)closing_tx_ref);
2101 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2102 CHECK_ACCESS(ret_ptr);
2103 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2107 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2108 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2109 LDKUnsignedChannelAnnouncement msg_var = *msg;
2110 uint64_t msg_ref = 0;
2111 msg_var = UnsignedChannelAnnouncement_clone(msg);
2112 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2113 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2114 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2115 msg_ref = (uint64_t)msg_var.inner;
2116 if (msg_var.is_owned) {
2119 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 14, (uint32_t)msg_ref);
2120 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2121 CHECK_ACCESS(ret_ptr);
2122 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2126 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2127 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2128 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2129 uint64_t channel_parameters_ref = 0;
2130 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2131 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2132 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2133 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2134 channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2135 if (channel_parameters_var.is_owned) {
2136 channel_parameters_ref |= 1;
2138 js_invoke_function_1(j_calls->instance_ptr, 15, (uint32_t)channel_parameters_ref);
2140 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
2141 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
2142 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2144 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint32_t pubkeys) {
2145 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2146 atomic_init(&calls->refcnt, 1);
2147 calls->instance_ptr = o;
2149 LDKChannelPublicKeys pubkeys_conv;
2150 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2151 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2152 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2155 .this_arg = (void*) calls,
2156 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2157 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2158 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
2159 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2160 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2161 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
2162 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2163 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2164 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2165 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2166 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2167 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2168 .ready_channel = ready_channel_LDKBaseSign_jcall,
2169 .free = LDKBaseSign_JCalls_free,
2170 .pubkeys = pubkeys_conv,
2171 .set_pubkeys = NULL,
2175 long __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint32_t pubkeys) {
2176 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2177 *res_ptr = LDKBaseSign_init(o, pubkeys);
2178 return (long)res_ptr;
2180 int8_tArray __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
2181 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2182 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2183 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2184 int8_tArray ret_arr = init_int8_tArray(33);
2185 memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
2189 int8_tArray __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
2190 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2191 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2192 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2193 int8_tArray ret_arr = init_int8_tArray(32);
2194 memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
2198 uint32_t __attribute__((export_name("TS_BaseSign_validate_holder_commitment"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
2199 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2200 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2201 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2202 LDKHolderCommitmentTransaction holder_tx_conv;
2203 holder_tx_conv.inner = (void*)(holder_tx & (~1));
2204 holder_tx_conv.is_owned = false;
2205 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2206 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2207 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
2208 return (uint64_t)ret_conv;
2211 int8_tArray __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
2212 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2213 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2214 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2215 int8_tArray ret_arr = init_int8_tArray(32);
2216 memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
2220 uint32_t __attribute__((export_name("TS_BaseSign_sign_counterparty_commitment"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
2221 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2222 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2223 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2224 LDKCommitmentTransaction commitment_tx_conv;
2225 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2226 commitment_tx_conv.is_owned = false;
2227 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2228 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2229 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2230 return (uint64_t)ret_conv;
2233 uint32_t __attribute__((export_name("TS_BaseSign_validate_counterparty_revocation"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
2234 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2235 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2236 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2237 unsigned char secret_arr[32];
2238 CHECK(secret->arr_len == 32);
2239 memcpy(secret_arr, secret->elems, 32);
2240 unsigned char (*secret_ref)[32] = &secret_arr;
2241 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2242 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2243 return (uint64_t)ret_conv;
2246 uint32_t __attribute__((export_name("TS_BaseSign_sign_holder_commitment_and_htlcs"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
2247 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2248 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2249 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2250 LDKHolderCommitmentTransaction commitment_tx_conv;
2251 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2252 commitment_tx_conv.is_owned = false;
2253 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2254 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2255 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2256 return (uint64_t)ret_conv;
2259 uint32_t __attribute__((export_name("TS_BaseSign_sign_justice_revoked_output"))) TS_BaseSign_sign_justice_revoked_output(uint32_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) {
2260 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2261 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2262 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2263 LDKTransaction justice_tx_ref;
2264 justice_tx_ref.datalen = justice_tx->arr_len;
2265 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2266 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen);
2267 justice_tx_ref.data_is_owned = true;
2268 unsigned char per_commitment_key_arr[32];
2269 CHECK(per_commitment_key->arr_len == 32);
2270 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32);
2271 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2272 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2273 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2274 return (uint64_t)ret_conv;
2277 uint32_t __attribute__((export_name("TS_BaseSign_sign_justice_revoked_htlc"))) TS_BaseSign_sign_justice_revoked_htlc(uint32_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, uint32_t htlc) {
2278 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2279 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2280 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2281 LDKTransaction justice_tx_ref;
2282 justice_tx_ref.datalen = justice_tx->arr_len;
2283 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2284 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen);
2285 justice_tx_ref.data_is_owned = true;
2286 unsigned char per_commitment_key_arr[32];
2287 CHECK(per_commitment_key->arr_len == 32);
2288 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32);
2289 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2290 LDKHTLCOutputInCommitment htlc_conv;
2291 htlc_conv.inner = (void*)(htlc & (~1));
2292 htlc_conv.is_owned = false;
2293 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2294 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2295 *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);
2296 return (uint64_t)ret_conv;
2299 uint32_t __attribute__((export_name("TS_BaseSign_sign_counterparty_htlc_transaction"))) TS_BaseSign_sign_counterparty_htlc_transaction(uint32_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, uint32_t htlc) {
2300 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2301 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2302 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2303 LDKTransaction htlc_tx_ref;
2304 htlc_tx_ref.datalen = htlc_tx->arr_len;
2305 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2306 memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen);
2307 htlc_tx_ref.data_is_owned = true;
2308 LDKPublicKey per_commitment_point_ref;
2309 CHECK(per_commitment_point->arr_len == 33);
2310 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
2311 LDKHTLCOutputInCommitment htlc_conv;
2312 htlc_conv.inner = (void*)(htlc & (~1));
2313 htlc_conv.is_owned = false;
2314 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2315 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2316 *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);
2317 return (uint64_t)ret_conv;
2320 uint32_t __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
2321 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2322 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2323 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2324 LDKClosingTransaction closing_tx_conv;
2325 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2326 closing_tx_conv.is_owned = false;
2327 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2328 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2329 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2330 return (uint64_t)ret_conv;
2333 uint32_t __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
2334 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2335 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2336 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2337 LDKUnsignedChannelAnnouncement msg_conv;
2338 msg_conv.inner = (void*)(msg & (~1));
2339 msg_conv.is_owned = false;
2340 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2341 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2342 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2343 return (uint64_t)ret_conv;
2346 void __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
2347 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2348 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2349 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2350 LDKChannelTransactionParameters channel_parameters_conv;
2351 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2352 channel_parameters_conv.is_owned = false;
2353 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2354 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2357 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2358 if (this_arg->set_pubkeys != NULL)
2359 this_arg->set_pubkeys(this_arg);
2360 return this_arg->pubkeys;
2362 uint32_t __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
2363 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2364 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2365 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2366 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2367 uint64_t ret_ref = 0;
2368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2371 ret_ref = (uint64_t)ret_var.inner;
2372 if (ret_var.is_owned) {
2378 typedef struct LDKSign_JCalls {
2379 atomic_size_t refcnt;
2380 uint32_t instance_ptr;
2381 LDKBaseSign_JCalls* BaseSign;
2383 static void LDKSign_JCalls_free(void* this_arg) {
2384 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2385 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2389 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2390 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2391 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 16);
2392 LDKCVec_u8Z ret_ref;
2393 ret_ref.datalen = ret->arr_len;
2394 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2395 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
2398 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2399 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2400 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2401 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2403 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint32_t pubkeys) {
2404 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2405 atomic_init(&calls->refcnt, 1);
2406 calls->instance_ptr = o;
2408 LDKChannelPublicKeys pubkeys_conv;
2409 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2410 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2411 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2414 .this_arg = (void*) calls,
2415 .write = write_LDKSign_jcall,
2416 .cloned = LDKSign_JCalls_cloned,
2417 .free = LDKSign_JCalls_free,
2418 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
2420 calls->BaseSign = ret.BaseSign.this_arg;
2423 long __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint32_t pubkeys) {
2424 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2425 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
2426 return (long)res_ptr;
2428 int8_tArray __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint32_t this_arg) {
2429 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2430 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2431 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
2432 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2433 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
2434 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2435 CVec_u8Z_free(ret_var);
2439 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
2440 return ThirtyTwoBytes_clone(&owner->a);
2442 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t owner) {
2443 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
2444 int8_tArray ret_arr = init_int8_tArray(32);
2445 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
2449 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
2450 return ChannelMonitor_clone(&owner->b);
2452 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t owner) {
2453 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
2454 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
2455 uint64_t ret_ref = 0;
2456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2459 ret_ref = (uint64_t)ret_var.inner;
2460 if (ret_var.is_owned) {
2466 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
2467 CHECK(owner->result_ok);
2468 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
2470 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t owner) {
2471 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
2472 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2473 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
2474 return ((uint64_t)ret_conv);
2477 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
2478 CHECK(!owner->result_ok);
2479 return DecodeError_clone(&*owner->contents.err);
2481 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t owner) {
2482 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
2483 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
2484 uint64_t ret_ref = 0;
2485 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2486 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2488 ret_ref = (uint64_t)ret_var.inner;
2489 if (ret_var.is_owned) {
2495 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2496 CHECK(owner->result_ok);
2497 return RouteHop_clone(&*owner->contents.result);
2499 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint32_t owner) {
2500 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
2501 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2502 uint64_t ret_ref = 0;
2503 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2504 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2506 ret_ref = (uint64_t)ret_var.inner;
2507 if (ret_var.is_owned) {
2513 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2514 CHECK(!owner->result_ok);
2515 return DecodeError_clone(&*owner->contents.err);
2517 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint32_t owner) {
2518 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
2519 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2520 uint64_t ret_ref = 0;
2521 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2522 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2524 ret_ref = (uint64_t)ret_var.inner;
2525 if (ret_var.is_owned) {
2531 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2532 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2533 for (size_t i = 0; i < ret.datalen; i++) {
2534 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2538 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2539 CHECK(owner->result_ok);
2540 return Route_clone(&*owner->contents.result);
2542 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint32_t owner) {
2543 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
2544 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2545 uint64_t ret_ref = 0;
2546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2549 ret_ref = (uint64_t)ret_var.inner;
2550 if (ret_var.is_owned) {
2556 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2557 CHECK(!owner->result_ok);
2558 return DecodeError_clone(&*owner->contents.err);
2560 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint32_t owner) {
2561 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
2562 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2563 uint64_t ret_ref = 0;
2564 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2565 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2566 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2567 ret_ref = (uint64_t)ret_var.inner;
2568 if (ret_var.is_owned) {
2574 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2575 CHECK(owner->result_ok);
2576 return RouteParameters_clone(&*owner->contents.result);
2578 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint32_t owner) {
2579 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
2580 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2581 uint64_t ret_ref = 0;
2582 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2583 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2584 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2585 ret_ref = (uint64_t)ret_var.inner;
2586 if (ret_var.is_owned) {
2592 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2593 CHECK(!owner->result_ok);
2594 return DecodeError_clone(&*owner->contents.err);
2596 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint32_t owner) {
2597 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
2598 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2599 uint64_t ret_ref = 0;
2600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2602 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2603 ret_ref = (uint64_t)ret_var.inner;
2604 if (ret_var.is_owned) {
2610 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2611 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2612 for (size_t i = 0; i < ret.datalen; i++) {
2613 ret.data[i] = RouteHint_clone(&orig->data[i]);
2617 static inline struct LDKPayee CResult_PayeeDecodeErrorZ_get_ok(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){
2618 CHECK(owner->result_ok);
2619 return Payee_clone(&*owner->contents.result);
2621 uint32_t __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_get_ok"))) TS_CResult_PayeeDecodeErrorZ_get_ok(uint32_t owner) {
2622 LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1);
2623 LDKPayee ret_var = CResult_PayeeDecodeErrorZ_get_ok(owner_conv);
2624 uint64_t ret_ref = 0;
2625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2627 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2628 ret_ref = (uint64_t)ret_var.inner;
2629 if (ret_var.is_owned) {
2635 static inline struct LDKDecodeError CResult_PayeeDecodeErrorZ_get_err(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){
2636 CHECK(!owner->result_ok);
2637 return DecodeError_clone(&*owner->contents.err);
2639 uint32_t __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_get_err"))) TS_CResult_PayeeDecodeErrorZ_get_err(uint32_t owner) {
2640 LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1);
2641 LDKDecodeError ret_var = CResult_PayeeDecodeErrorZ_get_err(owner_conv);
2642 uint64_t ret_ref = 0;
2643 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2644 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2645 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2646 ret_ref = (uint64_t)ret_var.inner;
2647 if (ret_var.is_owned) {
2653 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2654 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2655 for (size_t i = 0; i < ret.datalen; i++) {
2656 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2660 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2661 CHECK(owner->result_ok);
2662 return RouteHint_clone(&*owner->contents.result);
2664 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint32_t owner) {
2665 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
2666 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2667 uint64_t ret_ref = 0;
2668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2671 ret_ref = (uint64_t)ret_var.inner;
2672 if (ret_var.is_owned) {
2678 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2679 CHECK(!owner->result_ok);
2680 return DecodeError_clone(&*owner->contents.err);
2682 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint32_t owner) {
2683 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
2684 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2685 uint64_t ret_ref = 0;
2686 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2687 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2688 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2689 ret_ref = (uint64_t)ret_var.inner;
2690 if (ret_var.is_owned) {
2696 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2697 CHECK(owner->result_ok);
2698 return RouteHintHop_clone(&*owner->contents.result);
2700 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t owner) {
2701 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
2702 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2703 uint64_t ret_ref = 0;
2704 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2705 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2706 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2707 ret_ref = (uint64_t)ret_var.inner;
2708 if (ret_var.is_owned) {
2714 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2715 CHECK(!owner->result_ok);
2716 return DecodeError_clone(&*owner->contents.err);
2718 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint32_t owner) {
2719 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
2720 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2721 uint64_t ret_ref = 0;
2722 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2723 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2725 ret_ref = (uint64_t)ret_var.inner;
2726 if (ret_var.is_owned) {
2732 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2733 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2734 for (size_t i = 0; i < ret.datalen; i++) {
2735 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2739 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2740 CHECK(owner->result_ok);
2741 return Route_clone(&*owner->contents.result);
2743 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint32_t owner) {
2744 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
2745 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2746 uint64_t ret_ref = 0;
2747 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2748 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2749 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2750 ret_ref = (uint64_t)ret_var.inner;
2751 if (ret_var.is_owned) {
2757 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2758 CHECK(!owner->result_ok);
2759 return LightningError_clone(&*owner->contents.err);
2761 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint32_t owner) {
2762 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
2763 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2764 uint64_t ret_ref = 0;
2765 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2766 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2767 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2768 ret_ref = (uint64_t)ret_var.inner;
2769 if (ret_var.is_owned) {
2775 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
2776 CHECK(owner->result_ok);
2777 return *owner->contents.result;
2779 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint32_t owner) {
2780 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
2781 CResult_NoneLightningErrorZ_get_ok(owner_conv);
2784 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
2785 CHECK(!owner->result_ok);
2786 return LightningError_clone(&*owner->contents.err);
2788 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint32_t owner) {
2789 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
2790 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
2791 uint64_t ret_ref = 0;
2792 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2793 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2794 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2795 ret_ref = (uint64_t)ret_var.inner;
2796 if (ret_var.is_owned) {
2802 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
2805 int8_tArray __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t owner) {
2806 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
2807 int8_tArray ret_arr = init_int8_tArray(33);
2808 memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
2812 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
2813 return Type_clone(&owner->b);
2815 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t owner) {
2816 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
2817 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
2818 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
2819 return (uint64_t)ret_ret;
2822 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
2823 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
2824 for (size_t i = 0; i < ret.datalen; i++) {
2825 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
2829 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint32_t ptr) {
2830 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2832 case LDKErrorAction_DisconnectPeer: return 0;
2833 case LDKErrorAction_IgnoreError: return 1;
2834 case LDKErrorAction_IgnoreAndLog: return 2;
2835 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
2836 case LDKErrorAction_SendErrorMessage: return 4;
2840 uint32_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint32_t ptr) {
2841 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2842 assert(obj->tag == LDKErrorAction_DisconnectPeer);
2843 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2844 uint64_t msg_ref = 0;
2845 if ((uint64_t)msg_var.inner > 4096) {
2846 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2847 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2848 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2849 msg_ref = (uint64_t)msg_var.inner & ~1;
2853 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint32_t ptr) {
2854 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2855 assert(obj->tag == LDKErrorAction_IgnoreAndLog);
2856 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2857 return ignore_and_log_conv;
2859 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint32_t ptr) {
2860 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2861 assert(obj->tag == LDKErrorAction_SendErrorMessage);
2862 LDKErrorMessage msg_var = obj->send_error_message.msg;
2863 uint64_t msg_ref = 0;
2864 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2865 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2866 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2867 msg_ref = (uint64_t)msg_var.inner & ~1;
2870 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint32_t ptr) {
2871 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2873 case LDKMessageSendEvent_SendAcceptChannel: return 0;
2874 case LDKMessageSendEvent_SendOpenChannel: return 1;
2875 case LDKMessageSendEvent_SendFundingCreated: return 2;
2876 case LDKMessageSendEvent_SendFundingSigned: return 3;
2877 case LDKMessageSendEvent_SendFundingLocked: return 4;
2878 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2879 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2880 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2881 case LDKMessageSendEvent_SendClosingSigned: return 8;
2882 case LDKMessageSendEvent_SendShutdown: return 9;
2883 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2884 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 11;
2885 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 12;
2886 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2887 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2888 case LDKMessageSendEvent_HandleError: return 15;
2889 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2890 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2891 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2895 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint32_t ptr) {
2896 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2897 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2898 int8_tArray node_id_arr = init_int8_tArray(33);
2899 memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2902 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint32_t ptr) {
2903 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2904 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2905 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2906 uint64_t msg_ref = 0;
2907 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2908 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2909 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2910 msg_ref = (uint64_t)msg_var.inner & ~1;
2913 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint32_t ptr) {
2914 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2915 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2916 int8_tArray node_id_arr = init_int8_tArray(33);
2917 memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2920 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint32_t ptr) {
2921 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2922 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2923 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2924 uint64_t msg_ref = 0;
2925 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2926 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2927 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2928 msg_ref = (uint64_t)msg_var.inner & ~1;
2931 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint32_t ptr) {
2932 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2933 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2934 int8_tArray node_id_arr = init_int8_tArray(33);
2935 memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2938 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint32_t ptr) {
2939 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2940 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2941 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2942 uint64_t msg_ref = 0;
2943 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2944 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2945 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2946 msg_ref = (uint64_t)msg_var.inner & ~1;
2949 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint32_t ptr) {
2950 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2951 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2952 int8_tArray node_id_arr = init_int8_tArray(33);
2953 memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2956 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint32_t ptr) {
2957 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2958 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2959 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2960 uint64_t msg_ref = 0;
2961 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2962 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2963 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2964 msg_ref = (uint64_t)msg_var.inner & ~1;
2967 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingLocked_get_node_id"))) TS_LDKMessageSendEvent_SendFundingLocked_get_node_id(uint32_t ptr) {
2968 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2969 assert(obj->tag == LDKMessageSendEvent_SendFundingLocked);
2970 int8_tArray node_id_arr = init_int8_tArray(33);
2971 memcpy(node_id_arr->elems, obj->send_funding_locked.node_id.compressed_form, 33);
2974 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingLocked_get_msg"))) TS_LDKMessageSendEvent_SendFundingLocked_get_msg(uint32_t ptr) {
2975 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2976 assert(obj->tag == LDKMessageSendEvent_SendFundingLocked);
2977 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
2978 uint64_t msg_ref = 0;
2979 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2980 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2981 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2982 msg_ref = (uint64_t)msg_var.inner & ~1;
2985 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint32_t ptr) {
2986 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2987 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2988 int8_tArray node_id_arr = init_int8_tArray(33);
2989 memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2992 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint32_t ptr) {
2993 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2994 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2995 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2996 uint64_t msg_ref = 0;
2997 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2998 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2999 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3000 msg_ref = (uint64_t)msg_var.inner & ~1;
3003 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint32_t ptr) {
3004 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3005 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3006 int8_tArray node_id_arr = init_int8_tArray(33);
3007 memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
3010 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint32_t ptr) {
3011 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3012 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3013 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
3014 uint64_t updates_ref = 0;
3015 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3016 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3017 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
3018 updates_ref = (uint64_t)updates_var.inner & ~1;
3021 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint32_t ptr) {
3022 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3023 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3024 int8_tArray node_id_arr = init_int8_tArray(33);
3025 memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
3028 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint32_t ptr) {
3029 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3030 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3031 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
3032 uint64_t msg_ref = 0;
3033 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3034 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3035 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3036 msg_ref = (uint64_t)msg_var.inner & ~1;
3039 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint32_t ptr) {
3040 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3041 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3042 int8_tArray node_id_arr = init_int8_tArray(33);
3043 memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
3046 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint32_t ptr) {
3047 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3048 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3049 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3050 uint64_t msg_ref = 0;
3051 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3052 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3053 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3054 msg_ref = (uint64_t)msg_var.inner & ~1;
3057 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint32_t ptr) {
3058 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3059 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3060 int8_tArray node_id_arr = init_int8_tArray(33);
3061 memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
3064 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint32_t ptr) {
3065 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3066 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3067 LDKShutdown msg_var = obj->send_shutdown.msg;
3068 uint64_t msg_ref = 0;
3069 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3070 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3071 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3072 msg_ref = (uint64_t)msg_var.inner & ~1;
3075 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint32_t ptr) {
3076 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3077 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
3078 int8_tArray node_id_arr = init_int8_tArray(33);
3079 memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
3082 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint32_t ptr) {
3083 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3084 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
3085 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
3086 uint64_t msg_ref = 0;
3087 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3088 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3089 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3090 msg_ref = (uint64_t)msg_var.inner & ~1;
3093 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint32_t ptr) {
3094 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3095 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
3096 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
3097 uint64_t msg_ref = 0;
3098 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3099 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3100 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3101 msg_ref = (uint64_t)msg_var.inner & ~1;
3104 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint32_t ptr) {
3105 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3106 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
3107 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
3108 uint64_t update_msg_ref = 0;
3109 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3110 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3111 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3112 update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
3113 return update_msg_ref;
3115 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint32_t ptr) {
3116 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3117 assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
3118 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
3119 uint64_t msg_ref = 0;
3120 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3121 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3122 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3123 msg_ref = (uint64_t)msg_var.inner & ~1;
3126 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint32_t ptr) {
3127 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3128 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
3129 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
3130 uint64_t msg_ref = 0;
3131 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3132 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3133 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3134 msg_ref = (uint64_t)msg_var.inner & ~1;
3137 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint32_t ptr) {
3138 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3139 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
3140 int8_tArray node_id_arr = init_int8_tArray(33);
3141 memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
3144 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint32_t ptr) {
3145 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3146 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
3147 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
3148 uint64_t msg_ref = 0;
3149 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3150 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3151 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3152 msg_ref = (uint64_t)msg_var.inner & ~1;
3155 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint32_t ptr) {
3156 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3157 assert(obj->tag == LDKMessageSendEvent_HandleError);
3158 int8_tArray node_id_arr = init_int8_tArray(33);
3159 memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
3162 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint32_t ptr) {
3163 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3164 assert(obj->tag == LDKMessageSendEvent_HandleError);
3165 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
3168 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint32_t ptr) {
3169 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3170 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
3171 int8_tArray node_id_arr = init_int8_tArray(33);
3172 memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
3175 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint32_t ptr) {
3176 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3177 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
3178 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
3179 uint64_t msg_ref = 0;
3180 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3181 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3182 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3183 msg_ref = (uint64_t)msg_var.inner & ~1;
3186 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint32_t ptr) {
3187 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3188 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
3189 int8_tArray node_id_arr = init_int8_tArray(33);
3190 memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
3193 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint32_t ptr) {
3194 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3195 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
3196 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3197 uint64_t msg_ref = 0;
3198 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3199 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3200 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3201 msg_ref = (uint64_t)msg_var.inner & ~1;
3204 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint32_t ptr) {
3205 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3206 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
3207 int8_tArray node_id_arr = init_int8_tArray(33);
3208 memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
3211 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint32_t ptr) {
3212 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3213 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
3214 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3215 uint64_t msg_ref = 0;
3216 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3217 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3218 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3219 msg_ref = (uint64_t)msg_var.inner & ~1;
3222 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3223 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3224 for (size_t i = 0; i < ret.datalen; i++) {
3225 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3229 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3230 CHECK(owner->result_ok);
3231 return *owner->contents.result;
3233 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint32_t owner) {
3234 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3235 jboolean ret_val = CResult_boolLightningErrorZ_get_ok(owner_conv);
3239 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3240 CHECK(!owner->result_ok);
3241 return LightningError_clone(&*owner->contents.err);
3243 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint32_t owner) {
3244 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3245 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3246 uint64_t ret_ref = 0;
3247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3249 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3250 ret_ref = (uint64_t)ret_var.inner;
3251 if (ret_var.is_owned) {
3257 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3258 return ChannelAnnouncement_clone(&owner->a);
3260 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t owner) {
3261 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3262 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3263 uint64_t ret_ref = 0;
3264 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3265 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3266 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3267 ret_ref = (uint64_t)ret_var.inner;
3268 if (ret_var.is_owned) {
3274 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3275 return ChannelUpdate_clone(&owner->b);
3277 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t owner) {
3278 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3279 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3280 uint64_t ret_ref = 0;
3281 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3282 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3284 ret_ref = (uint64_t)ret_var.inner;
3285 if (ret_var.is_owned) {
3291 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3292 return ChannelUpdate_clone(&owner->c);
3294 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t owner) {
3295 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3296 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3297 uint64_t ret_ref = 0;
3298 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3299 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3300 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3301 ret_ref = (uint64_t)ret_var.inner;
3302 if (ret_var.is_owned) {
3308 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3309 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3310 for (size_t i = 0; i < ret.datalen; i++) {
3311 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3315 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3316 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3317 for (size_t i = 0; i < ret.datalen; i++) {
3318 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3322 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
3323 CHECK(owner->result_ok);
3324 return CVec_u8Z_clone(&*owner->contents.result);
3326 int8_tArray __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t owner) {
3327 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
3328 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
3329 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
3330 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3331 CVec_u8Z_free(ret_var);
3335 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
3336 CHECK(!owner->result_ok);
3337 return PeerHandleError_clone(&*owner->contents.err);
3339 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t owner) {
3340 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
3341 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
3342 uint64_t ret_ref = 0;
3343 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3344 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3345 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3346 ret_ref = (uint64_t)ret_var.inner;
3347 if (ret_var.is_owned) {
3353 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
3354 CHECK(owner->result_ok);
3355 return *owner->contents.result;
3357 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint32_t owner) {
3358 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
3359 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
3362 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
3363 CHECK(!owner->result_ok);
3364 return PeerHandleError_clone(&*owner->contents.err);
3366 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint32_t owner) {
3367 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
3368 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
3369 uint64_t ret_ref = 0;
3370 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3371 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3373 ret_ref = (uint64_t)ret_var.inner;
3374 if (ret_var.is_owned) {
3380 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
3381 CHECK(owner->result_ok);
3382 return *owner->contents.result;
3384 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint32_t owner) {
3385 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
3386 jboolean ret_val = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
3390 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
3391 CHECK(!owner->result_ok);
3392 return PeerHandleError_clone(&*owner->contents.err);
3394 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint32_t owner) {
3395 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
3396 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
3397 uint64_t ret_ref = 0;
3398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3401 ret_ref = (uint64_t)ret_var.inner;
3402 if (ret_var.is_owned) {
3408 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3409 CHECK(owner->result_ok);
3410 return TxOut_clone(&*owner->contents.result);
3412 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint32_t owner) {
3413 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3414 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3415 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
3416 return (uint64_t)ret_ref;
3419 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3420 CHECK(!owner->result_ok);
3421 return AccessError_clone(&*owner->contents.err);
3423 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint32_t owner) {
3424 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3425 uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
3429 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3430 CHECK(owner->result_ok);
3431 return *owner->contents.result;
3433 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t owner) {
3434 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3435 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
3438 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3439 CHECK(!owner->result_ok);
3440 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
3442 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t owner) {
3443 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3444 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
3448 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr(uint32_t ptr) {
3449 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
3451 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: return 0;
3452 case LDKCOption_C2Tuple_usizeTransactionZZ_None: return 1;
3456 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some(uint32_t ptr) {
3457 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
3458 assert(obj->tag == LDKCOption_C2Tuple_usizeTransactionZZ_Some);
3459 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
3460 *some_conv = obj->some;
3461 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
3462 return ((uint64_t)some_conv);
3464 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint32_t ptr) {
3465 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
3467 case LDKCOption_ClosureReasonZ_Some: return 0;
3468 case LDKCOption_ClosureReasonZ_None: return 1;
3472 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint32_t ptr) {
3473 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
3474 assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
3475 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
3478 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3479 CHECK(owner->result_ok);
3480 return COption_ClosureReasonZ_clone(&*owner->contents.result);
3482 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint32_t owner) {
3483 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
3484 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
3485 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
3486 uint64_t ret_ref = (uint64_t)ret_copy;
3490 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3491 CHECK(!owner->result_ok);
3492 return DecodeError_clone(&*owner->contents.err);
3494 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint32_t owner) {
3495 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
3496 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
3497 uint64_t ret_ref = 0;
3498 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3499 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3501 ret_ref = (uint64_t)ret_var.inner;
3502 if (ret_var.is_owned) {
3508 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint32_t ptr) {
3509 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
3511 case LDKCOption_EventZ_Some: return 0;
3512 case LDKCOption_EventZ_None: return 1;
3516 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint32_t ptr) {
3517 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
3518 assert(obj->tag == LDKCOption_EventZ_Some);
3519 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
3522 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3523 CHECK(owner->result_ok);
3524 return COption_EventZ_clone(&*owner->contents.result);
3526 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint32_t owner) {
3527 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
3528 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
3529 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
3530 uint64_t ret_ref = (uint64_t)ret_copy;
3534 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3535 CHECK(!owner->result_ok);
3536 return DecodeError_clone(&*owner->contents.err);
3538 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint32_t owner) {
3539 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
3540 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
3541 uint64_t ret_ref = 0;
3542 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3543 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3545 ret_ref = (uint64_t)ret_var.inner;
3546 if (ret_var.is_owned) {
3552 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3553 CHECK(owner->result_ok);
3554 return NodeId_clone(&*owner->contents.result);
3556 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint32_t owner) {
3557 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3558 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3559 uint64_t ret_ref = 0;
3560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3563 ret_ref = (uint64_t)ret_var.inner;
3564 if (ret_var.is_owned) {
3570 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3571 CHECK(!owner->result_ok);
3572 return DecodeError_clone(&*owner->contents.err);
3574 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint32_t owner) {
3575 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3576 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3577 uint64_t ret_ref = 0;
3578 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3579 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3580 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3581 ret_ref = (uint64_t)ret_var.inner;
3582 if (ret_var.is_owned) {
3588 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3589 CHECK(owner->result_ok);
3590 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3592 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t owner) {
3593 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3594 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3595 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3596 uint64_t ret_ref = (uint64_t)ret_copy;
3600 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3601 CHECK(!owner->result_ok);
3602 return DecodeError_clone(&*owner->contents.err);
3604 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t owner) {
3605 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3606 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3607 uint64_t ret_ref = 0;
3608 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3609 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3611 ret_ref = (uint64_t)ret_var.inner;
3612 if (ret_var.is_owned) {
3618 typedef struct LDKAccess_JCalls {
3619 atomic_size_t refcnt;
3620 uint32_t instance_ptr;
3622 static void LDKAccess_JCalls_free(void* this_arg) {
3623 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3624 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3628 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3629 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3630 int8_tArray genesis_hash_arr = init_int8_tArray(32);
3631 memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3632 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 17, (uint32_t)genesis_hash_arr, (uint32_t)short_channel_id);
3633 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3634 CHECK_ACCESS(ret_ptr);
3635 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3639 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3640 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3641 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3643 static inline LDKAccess LDKAccess_init (JSValue o) {
3644 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3645 atomic_init(&calls->refcnt, 1);
3646 calls->instance_ptr = o;
3649 .this_arg = (void*) calls,
3650 .get_utxo = get_utxo_LDKAccess_jcall,
3651 .free = LDKAccess_JCalls_free,
3655 long __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
3656 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3657 *res_ptr = LDKAccess_init(o);
3658 return (long)res_ptr;
3660 uint32_t __attribute__((export_name("TS_Access_get_utxo"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
3661 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3662 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3663 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3664 unsigned char genesis_hash_arr[32];
3665 CHECK(genesis_hash->arr_len == 32);
3666 memcpy(genesis_hash_arr, genesis_hash->elems, 32);
3667 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3668 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3669 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3670 return (uint64_t)ret_conv;
3673 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint32_t ptr) {
3674 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
3676 case LDKCOption_AccessZ_Some: return 0;
3677 case LDKCOption_AccessZ_None: return 1;
3681 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint32_t ptr) {
3682 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
3683 assert(obj->tag == LDKCOption_AccessZ_Some);
3684 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3685 *some_ret = obj->some;
3686 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
3687 return (uint64_t)some_ret;
3689 static inline struct LDKDirectionalChannelInfo CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3690 CHECK(owner->result_ok);
3691 return DirectionalChannelInfo_clone(&*owner->contents.result);
3693 uint32_t __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
3694 LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1);
3695 LDKDirectionalChannelInfo ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(owner_conv);
3696 uint64_t ret_ref = 0;
3697 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3698 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3700 ret_ref = (uint64_t)ret_var.inner;
3701 if (ret_var.is_owned) {
3707 static inline struct LDKDecodeError CResult_DirectionalChannelInfoDecodeErrorZ_get_err(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3708 CHECK(!owner->result_ok);
3709 return DecodeError_clone(&*owner->contents.err);
3711 uint32_t __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_get_err"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
3712 LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1);
3713 LDKDecodeError ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_err(owner_conv);
3714 uint64_t ret_ref = 0;
3715 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3716 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3718 ret_ref = (uint64_t)ret_var.inner;
3719 if (ret_var.is_owned) {
3725 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3726 CHECK(owner->result_ok);
3727 return ChannelInfo_clone(&*owner->contents.result);
3729 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
3730 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3731 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3732 uint64_t ret_ref = 0;
3733 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3734 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3735 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3736 ret_ref = (uint64_t)ret_var.inner;
3737 if (ret_var.is_owned) {
3743 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3744 CHECK(!owner->result_ok);
3745 return DecodeError_clone(&*owner->contents.err);
3747 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
3748 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3749 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3750 uint64_t ret_ref = 0;
3751 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3752 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3754 ret_ref = (uint64_t)ret_var.inner;
3755 if (ret_var.is_owned) {
3761 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3762 CHECK(owner->result_ok);
3763 return RoutingFees_clone(&*owner->contents.result);
3765 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t owner) {
3766 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3767 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3768 uint64_t ret_ref = 0;
3769 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3770 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3772 ret_ref = (uint64_t)ret_var.inner;
3773 if (ret_var.is_owned) {
3779 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3780 CHECK(!owner->result_ok);
3781 return DecodeError_clone(&*owner->contents.err);
3783 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint32_t owner) {
3784 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3785 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3786 uint64_t ret_ref = 0;
3787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3789 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3790 ret_ref = (uint64_t)ret_var.inner;
3791 if (ret_var.is_owned) {
3797 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint32_t ptr) {
3798 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3800 case LDKNetAddress_IPv4: return 0;
3801 case LDKNetAddress_IPv6: return 1;
3802 case LDKNetAddress_OnionV2: return 2;
3803 case LDKNetAddress_OnionV3: return 3;
3807 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint32_t ptr) {
3808 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3809 assert(obj->tag == LDKNetAddress_IPv4);
3810 int8_tArray addr_arr = init_int8_tArray(4);
3811 memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3814 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint32_t ptr) {
3815 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3816 assert(obj->tag == LDKNetAddress_IPv4);
3817 return obj->i_pv4.port;
3819 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint32_t ptr) {
3820 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3821 assert(obj->tag == LDKNetAddress_IPv6);
3822 int8_tArray addr_arr = init_int8_tArray(16);
3823 memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3826 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint32_t ptr) {
3827 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3828 assert(obj->tag == LDKNetAddress_IPv6);
3829 return obj->i_pv6.port;
3831 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint32_t ptr) {
3832 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3833 assert(obj->tag == LDKNetAddress_OnionV2);
3834 int8_tArray onion_v2_arr = init_int8_tArray(12);
3835 memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3836 return onion_v2_arr;
3838 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint32_t ptr) {
3839 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3840 assert(obj->tag == LDKNetAddress_OnionV3);
3841 int8_tArray ed25519_pubkey_arr = init_int8_tArray(32);
3842 memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3843 return ed25519_pubkey_arr;
3845 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint32_t ptr) {
3846 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3847 assert(obj->tag == LDKNetAddress_OnionV3);
3848 return obj->onion_v3.checksum;
3850 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint32_t ptr) {
3851 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3852 assert(obj->tag == LDKNetAddress_OnionV3);
3853 return obj->onion_v3.version;
3855 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint32_t ptr) {
3856 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3857 assert(obj->tag == LDKNetAddress_OnionV3);
3858 return obj->onion_v3.port;
3860 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3861 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3862 for (size_t i = 0; i < ret.datalen; i++) {
3863 ret.data[i] = NetAddress_clone(&orig->data[i]);
3867 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3868 CHECK(owner->result_ok);
3869 return NodeAnnouncementInfo_clone(&*owner->contents.result);
3871 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t owner) {
3872 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3873 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3874 uint64_t ret_ref = 0;
3875 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3876 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3877 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3878 ret_ref = (uint64_t)ret_var.inner;
3879 if (ret_var.is_owned) {
3885 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3886 CHECK(!owner->result_ok);
3887 return DecodeError_clone(&*owner->contents.err);
3889 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t owner) {
3890 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3891 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3892 uint64_t ret_ref = 0;
3893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3895 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3896 ret_ref = (uint64_t)ret_var.inner;
3897 if (ret_var.is_owned) {
3903 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3904 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3905 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3908 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3909 CHECK(owner->result_ok);
3910 return NodeInfo_clone(&*owner->contents.result);
3912 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint32_t owner) {
3913 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3914 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3915 uint64_t ret_ref = 0;
3916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3919 ret_ref = (uint64_t)ret_var.inner;
3920 if (ret_var.is_owned) {
3926 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3927 CHECK(!owner->result_ok);
3928 return DecodeError_clone(&*owner->contents.err);
3930 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint32_t owner) {
3931 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3932 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3933 uint64_t ret_ref = 0;
3934 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3935 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3937 ret_ref = (uint64_t)ret_var.inner;
3938 if (ret_var.is_owned) {
3944 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3945 CHECK(owner->result_ok);
3946 return NetworkGraph_clone(&*owner->contents.result);
3948 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t owner) {
3949 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3950 LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3951 uint64_t ret_ref = 0;
3952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3955 ret_ref = (uint64_t)ret_var.inner;
3956 if (ret_var.is_owned) {
3962 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3963 CHECK(!owner->result_ok);
3964 return DecodeError_clone(&*owner->contents.err);
3966 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint32_t owner) {
3967 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3968 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3969 uint64_t ret_ref = 0;
3970 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3971 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3972 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3973 ret_ref = (uint64_t)ret_var.inner;
3974 if (ret_var.is_owned) {
3980 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint32_t ptr) {
3981 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3983 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3984 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3988 uint32_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint32_t ptr) {
3989 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3990 assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3991 LDKCVec_NetAddressZ some_var = obj->some;
3992 uint32_tArray some_arr = NULL;
3993 some_arr = init_uint32_tArray(some_var.datalen);
3994 uint32_t *some_arr_ptr = (uint32_t*)(((uint8_t*)some_arr) + 4);
3995 for (size_t m = 0; m < some_var.datalen; m++) {
3996 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
3997 some_arr_ptr[m] = some_conv_12_ref;
4002 static inline struct LDKScoringParameters *CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
4003 CHECK(owner->result_ok);
4004 return &*owner->contents.result;
4006 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_get_ok"))) TS_CResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t owner) {
4007 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
4008 LDKScoringParameters ret_var = *CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv);
4009 uint64_t ret_ref = 0;
4010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4013 ret_ref = (uint64_t)ret_var.inner & ~1;
4017 static inline struct LDKDecodeError CResult_ScoringParametersDecodeErrorZ_get_err(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
4018 CHECK(!owner->result_ok);
4019 return DecodeError_clone(&*owner->contents.err);
4021 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_get_err"))) TS_CResult_ScoringParametersDecodeErrorZ_get_err(uint32_t owner) {
4022 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
4023 LDKDecodeError ret_var = CResult_ScoringParametersDecodeErrorZ_get_err(owner_conv);
4024 uint64_t ret_ref = 0;
4025 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4026 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4027 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4028 ret_ref = (uint64_t)ret_var.inner;
4029 if (ret_var.is_owned) {
4035 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4036 CHECK(owner->result_ok);
4037 return InitFeatures_clone(&*owner->contents.result);
4039 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
4040 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
4041 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
4042 uint64_t ret_ref = 0;
4043 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4044 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4045 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4046 ret_ref = (uint64_t)ret_var.inner;
4047 if (ret_var.is_owned) {
4053 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4054 CHECK(!owner->result_ok);
4055 return DecodeError_clone(&*owner->contents.err);
4057 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint32_t owner) {
4058 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
4059 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
4060 uint64_t ret_ref = 0;
4061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4063 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4064 ret_ref = (uint64_t)ret_var.inner;
4065 if (ret_var.is_owned) {
4071 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4072 CHECK(owner->result_ok);
4073 return ChannelFeatures_clone(&*owner->contents.result);
4075 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
4076 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
4077 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
4078 uint64_t ret_ref = 0;
4079 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4080 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4081 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4082 ret_ref = (uint64_t)ret_var.inner;
4083 if (ret_var.is_owned) {
4089 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4090 CHECK(!owner->result_ok);
4091 return DecodeError_clone(&*owner->contents.err);
4093 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t owner) {
4094 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
4095 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
4096 uint64_t ret_ref = 0;
4097 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4098 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4099 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4100 ret_ref = (uint64_t)ret_var.inner;
4101 if (ret_var.is_owned) {
4107 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4108 CHECK(owner->result_ok);
4109 return NodeFeatures_clone(&*owner->contents.result);
4111 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
4112 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
4113 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
4114 uint64_t ret_ref = 0;
4115 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4116 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4118 ret_ref = (uint64_t)ret_var.inner;
4119 if (ret_var.is_owned) {
4125 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4126 CHECK(!owner->result_ok);
4127 return DecodeError_clone(&*owner->contents.err);
4129 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
4130 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
4131 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
4132 uint64_t ret_ref = 0;
4133 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4134 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4136 ret_ref = (uint64_t)ret_var.inner;
4137 if (ret_var.is_owned) {
4143 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4144 CHECK(owner->result_ok);
4145 return InvoiceFeatures_clone(&*owner->contents.result);
4147 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
4148 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
4149 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
4150 uint64_t ret_ref = 0;
4151 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4152 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4154 ret_ref = (uint64_t)ret_var.inner;
4155 if (ret_var.is_owned) {
4161 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4162 CHECK(!owner->result_ok);
4163 return DecodeError_clone(&*owner->contents.err);
4165 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t owner) {
4166 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
4167 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
4168 uint64_t ret_ref = 0;
4169 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4170 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4171 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4172 ret_ref = (uint64_t)ret_var.inner;
4173 if (ret_var.is_owned) {
4179 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4180 CHECK(owner->result_ok);
4181 return ChannelTypeFeatures_clone(&*owner->contents.result);
4183 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
4184 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
4185 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
4186 uint64_t ret_ref = 0;
4187 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4188 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4190 ret_ref = (uint64_t)ret_var.inner;
4191 if (ret_var.is_owned) {
4197 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4198 CHECK(!owner->result_ok);
4199 return DecodeError_clone(&*owner->contents.err);
4201 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
4202 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
4203 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
4204 uint64_t ret_ref = 0;
4205 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4206 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4207 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4208 ret_ref = (uint64_t)ret_var.inner;
4209 if (ret_var.is_owned) {
4215 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
4216 CHECK(owner->result_ok);
4217 return NetAddress_clone(&*owner->contents.result);
4219 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint32_t owner) {
4220 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
4221 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
4222 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
4223 uint64_t ret_ref = (uint64_t)ret_copy;
4227 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
4228 CHECK(!owner->result_ok);
4229 return DecodeError_clone(&*owner->contents.err);
4231 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint32_t owner) {
4232 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
4233 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
4234 uint64_t ret_ref = 0;
4235 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4236 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4237 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4238 ret_ref = (uint64_t)ret_var.inner;
4239 if (ret_var.is_owned) {
4245 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
4246 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
4247 for (size_t i = 0; i < ret.datalen; i++) {
4248 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
4252 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4253 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4254 for (size_t i = 0; i < ret.datalen; i++) {
4255 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4259 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4260 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4261 for (size_t i = 0; i < ret.datalen; i++) {
4262 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4266 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4267 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4268 for (size_t i = 0; i < ret.datalen; i++) {
4269 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4273 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
4274 CHECK(owner->result_ok);
4275 return AcceptChannel_clone(&*owner->contents.result);
4277 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t owner) {
4278 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
4279 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
4280 uint64_t ret_ref = 0;
4281 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4282 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4284 ret_ref = (uint64_t)ret_var.inner;
4285 if (ret_var.is_owned) {
4291 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
4292 CHECK(!owner->result_ok);
4293 return DecodeError_clone(&*owner->contents.err);
4295 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint32_t owner) {
4296 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
4297 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
4298 uint64_t ret_ref = 0;
4299 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4300 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4302 ret_ref = (uint64_t)ret_var.inner;
4303 if (ret_var.is_owned) {
4309 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
4310 CHECK(owner->result_ok);
4311 return AnnouncementSignatures_clone(&*owner->contents.result);
4313 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t owner) {
4314 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
4315 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
4316 uint64_t ret_ref = 0;
4317 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4318 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4319 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4320 ret_ref = (uint64_t)ret_var.inner;
4321 if (ret_var.is_owned) {
4327 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
4328 CHECK(!owner->result_ok);
4329 return DecodeError_clone(&*owner->contents.err);
4331 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t owner) {
4332 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
4333 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
4334 uint64_t ret_ref = 0;
4335 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4336 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4337 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4338 ret_ref = (uint64_t)ret_var.inner;
4339 if (ret_var.is_owned) {
4345 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
4346 CHECK(owner->result_ok);
4347 return ChannelReestablish_clone(&*owner->contents.result);
4349 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t owner) {
4350 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
4351 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
4352 uint64_t ret_ref = 0;
4353 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4354 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4355 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4356 ret_ref = (uint64_t)ret_var.inner;
4357 if (ret_var.is_owned) {
4363 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
4364 CHECK(!owner->result_ok);
4365 return DecodeError_clone(&*owner->contents.err);
4367 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t owner) {
4368 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
4369 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
4370 uint64_t ret_ref = 0;
4371 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4372 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4374 ret_ref = (uint64_t)ret_var.inner;
4375 if (ret_var.is_owned) {
4381 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
4382 CHECK(owner->result_ok);
4383 return ClosingSigned_clone(&*owner->contents.result);
4385 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t owner) {
4386 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
4387 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
4388 uint64_t ret_ref = 0;
4389 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4390 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4391 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4392 ret_ref = (uint64_t)ret_var.inner;
4393 if (ret_var.is_owned) {
4399 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
4400 CHECK(!owner->result_ok);
4401 return DecodeError_clone(&*owner->contents.err);
4403 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint32_t owner) {
4404 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
4405 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
4406 uint64_t ret_ref = 0;
4407 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4408 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4409 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4410 ret_ref = (uint64_t)ret_var.inner;
4411 if (ret_var.is_owned) {
4417 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
4418 CHECK(owner->result_ok);
4419 return ClosingSignedFeeRange_clone(&*owner->contents.result);
4421 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t owner) {
4422 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
4423 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
4424 uint64_t ret_ref = 0;
4425 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4426 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4428 ret_ref = (uint64_t)ret_var.inner;
4429 if (ret_var.is_owned) {
4435 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
4436 CHECK(!owner->result_ok);
4437 return DecodeError_clone(&*owner->contents.err);
4439 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t owner) {
4440 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
4441 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
4442 uint64_t ret_ref = 0;
4443 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4444 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4446 ret_ref = (uint64_t)ret_var.inner;
4447 if (ret_var.is_owned) {
4453 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
4454 CHECK(owner->result_ok);
4455 return CommitmentSigned_clone(&*owner->contents.result);
4457 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t owner) {
4458 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
4459 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
4460 uint64_t ret_ref = 0;
4461 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4462 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4464 ret_ref = (uint64_t)ret_var.inner;
4465 if (ret_var.is_owned) {
4471 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
4472 CHECK(!owner->result_ok);
4473 return DecodeError_clone(&*owner->contents.err);
4475 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t owner) {
4476 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
4477 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
4478 uint64_t ret_ref = 0;
4479 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4480 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4481 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4482 ret_ref = (uint64_t)ret_var.inner;
4483 if (ret_var.is_owned) {
4489 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
4490 CHECK(owner->result_ok);
4491 return FundingCreated_clone(&*owner->contents.result);
4493 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t owner) {
4494 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
4495 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
4496 uint64_t ret_ref = 0;
4497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4500 ret_ref = (uint64_t)ret_var.inner;
4501 if (ret_var.is_owned) {
4507 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
4508 CHECK(!owner->result_ok);
4509 return DecodeError_clone(&*owner->contents.err);
4511 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint32_t owner) {
4512 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
4513 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
4514 uint64_t ret_ref = 0;
4515 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4516 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4517 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4518 ret_ref = (uint64_t)ret_var.inner;
4519 if (ret_var.is_owned) {
4525 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
4526 CHECK(owner->result_ok);
4527 return FundingSigned_clone(&*owner->contents.result);
4529 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint32_t owner) {
4530 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
4531 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
4532 uint64_t ret_ref = 0;
4533 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4534 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4535 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4536 ret_ref = (uint64_t)ret_var.inner;
4537 if (ret_var.is_owned) {
4543 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
4544 CHECK(!owner->result_ok);
4545 return DecodeError_clone(&*owner->contents.err);
4547 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint32_t owner) {
4548 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
4549 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
4550 uint64_t ret_ref = 0;
4551 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4552 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4553 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4554 ret_ref = (uint64_t)ret_var.inner;
4555 if (ret_var.is_owned) {
4561 static inline struct LDKFundingLocked CResult_FundingLockedDecodeErrorZ_get_ok(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
4562 CHECK(owner->result_ok);
4563 return FundingLocked_clone(&*owner->contents.result);
4565 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_get_ok"))) TS_CResult_FundingLockedDecodeErrorZ_get_ok(uint32_t owner) {
4566 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
4567 LDKFundingLocked ret_var = CResult_FundingLockedDecodeErrorZ_get_ok(owner_conv);
4568 uint64_t ret_ref = 0;
4569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4572 ret_ref = (uint64_t)ret_var.inner;
4573 if (ret_var.is_owned) {
4579 static inline struct LDKDecodeError CResult_FundingLockedDecodeErrorZ_get_err(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
4580 CHECK(!owner->result_ok);
4581 return DecodeError_clone(&*owner->contents.err);
4583 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_get_err"))) TS_CResult_FundingLockedDecodeErrorZ_get_err(uint32_t owner) {
4584 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
4585 LDKDecodeError ret_var = CResult_FundingLockedDecodeErrorZ_get_err(owner_conv);
4586 uint64_t ret_ref = 0;
4587 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4588 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4590 ret_ref = (uint64_t)ret_var.inner;
4591 if (ret_var.is_owned) {
4597 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
4598 CHECK(owner->result_ok);
4599 return Init_clone(&*owner->contents.result);
4601 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint32_t owner) {
4602 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
4603 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
4604 uint64_t ret_ref = 0;
4605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4608 ret_ref = (uint64_t)ret_var.inner;
4609 if (ret_var.is_owned) {
4615 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
4616 CHECK(!owner->result_ok);
4617 return DecodeError_clone(&*owner->contents.err);
4619 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint32_t owner) {
4620 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
4621 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
4622 uint64_t ret_ref = 0;
4623 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4624 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4626 ret_ref = (uint64_t)ret_var.inner;
4627 if (ret_var.is_owned) {
4633 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
4634 CHECK(owner->result_ok);
4635 return OpenChannel_clone(&*owner->contents.result);
4637 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint32_t owner) {
4638 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
4639 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
4640 uint64_t ret_ref = 0;
4641 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4642 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4643 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4644 ret_ref = (uint64_t)ret_var.inner;
4645 if (ret_var.is_owned) {
4651 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
4652 CHECK(!owner->result_ok);
4653 return DecodeError_clone(&*owner->contents.err);
4655 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint32_t owner) {
4656 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
4657 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
4658 uint64_t ret_ref = 0;
4659 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4660 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4661 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4662 ret_ref = (uint64_t)ret_var.inner;
4663 if (ret_var.is_owned) {
4669 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
4670 CHECK(owner->result_ok);
4671 return RevokeAndACK_clone(&*owner->contents.result);
4673 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t owner) {
4674 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
4675 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
4676 uint64_t ret_ref = 0;
4677 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4678 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4679 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4680 ret_ref = (uint64_t)ret_var.inner;
4681 if (ret_var.is_owned) {
4687 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
4688 CHECK(!owner->result_ok);
4689 return DecodeError_clone(&*owner->contents.err);
4691 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t owner) {
4692 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
4693 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
4694 uint64_t ret_ref = 0;
4695 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4696 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4698 ret_ref = (uint64_t)ret_var.inner;
4699 if (ret_var.is_owned) {
4705 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
4706 CHECK(owner->result_ok);
4707 return Shutdown_clone(&*owner->contents.result);
4709 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint32_t owner) {
4710 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
4711 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
4712 uint64_t ret_ref = 0;
4713 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4714 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4715 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4716 ret_ref = (uint64_t)ret_var.inner;
4717 if (ret_var.is_owned) {
4723 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
4724 CHECK(!owner->result_ok);
4725 return DecodeError_clone(&*owner->contents.err);
4727 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint32_t owner) {
4728 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
4729 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
4730 uint64_t ret_ref = 0;
4731 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4732 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4734 ret_ref = (uint64_t)ret_var.inner;
4735 if (ret_var.is_owned) {
4741 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
4742 CHECK(owner->result_ok);
4743 return UpdateFailHTLC_clone(&*owner->contents.result);
4745 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4746 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
4747 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
4748 uint64_t ret_ref = 0;
4749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4751 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4752 ret_ref = (uint64_t)ret_var.inner;
4753 if (ret_var.is_owned) {
4759 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
4760 CHECK(!owner->result_ok);
4761 return DecodeError_clone(&*owner->contents.err);
4763 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t owner) {
4764 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
4765 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
4766 uint64_t ret_ref = 0;
4767 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4768 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4769 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4770 ret_ref = (uint64_t)ret_var.inner;
4771 if (ret_var.is_owned) {
4777 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
4778 CHECK(owner->result_ok);
4779 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
4781 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4782 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
4783 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
4784 uint64_t ret_ref = 0;
4785 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4786 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4787 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4788 ret_ref = (uint64_t)ret_var.inner;
4789 if (ret_var.is_owned) {
4795 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
4796 CHECK(!owner->result_ok);
4797 return DecodeError_clone(&*owner->contents.err);
4799 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t owner) {
4800 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
4801 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
4802 uint64_t ret_ref = 0;
4803 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4804 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4805 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4806 ret_ref = (uint64_t)ret_var.inner;
4807 if (ret_var.is_owned) {
4813 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
4814 CHECK(owner->result_ok);
4815 return UpdateFee_clone(&*owner->contents.result);
4817 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t owner) {
4818 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
4819 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
4820 uint64_t ret_ref = 0;
4821 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4822 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4824 ret_ref = (uint64_t)ret_var.inner;
4825 if (ret_var.is_owned) {
4831 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
4832 CHECK(!owner->result_ok);
4833 return DecodeError_clone(&*owner->contents.err);
4835 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint32_t owner) {
4836 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
4837 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
4838 uint64_t ret_ref = 0;
4839 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4840 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4841 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4842 ret_ref = (uint64_t)ret_var.inner;
4843 if (ret_var.is_owned) {
4849 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
4850 CHECK(owner->result_ok);
4851 return UpdateFulfillHTLC_clone(&*owner->contents.result);
4853 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4854 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
4855 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
4856 uint64_t ret_ref = 0;
4857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4860 ret_ref = (uint64_t)ret_var.inner;
4861 if (ret_var.is_owned) {
4867 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
4868 CHECK(!owner->result_ok);
4869 return DecodeError_clone(&*owner->contents.err);
4871 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t owner) {
4872 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
4873 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
4874 uint64_t ret_ref = 0;
4875 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4876 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4877 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4878 ret_ref = (uint64_t)ret_var.inner;
4879 if (ret_var.is_owned) {
4885 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
4886 CHECK(owner->result_ok);
4887 return UpdateAddHTLC_clone(&*owner->contents.result);
4889 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4890 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
4891 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
4892 uint64_t ret_ref = 0;
4893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4895 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4896 ret_ref = (uint64_t)ret_var.inner;
4897 if (ret_var.is_owned) {
4903 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
4904 CHECK(!owner->result_ok);
4905 return DecodeError_clone(&*owner->contents.err);
4907 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t owner) {
4908 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
4909 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
4910 uint64_t ret_ref = 0;
4911 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4912 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4913 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4914 ret_ref = (uint64_t)ret_var.inner;
4915 if (ret_var.is_owned) {
4921 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
4922 CHECK(owner->result_ok);
4923 return Ping_clone(&*owner->contents.result);
4925 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint32_t owner) {
4926 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
4927 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
4928 uint64_t ret_ref = 0;
4929 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4930 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4932 ret_ref = (uint64_t)ret_var.inner;
4933 if (ret_var.is_owned) {
4939 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
4940 CHECK(!owner->result_ok);
4941 return DecodeError_clone(&*owner->contents.err);
4943 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint32_t owner) {
4944 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
4945 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
4946 uint64_t ret_ref = 0;
4947 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4948 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4949 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4950 ret_ref = (uint64_t)ret_var.inner;
4951 if (ret_var.is_owned) {
4957 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
4958 CHECK(owner->result_ok);
4959 return Pong_clone(&*owner->contents.result);
4961 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint32_t owner) {
4962 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
4963 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
4964 uint64_t ret_ref = 0;
4965 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4966 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4967 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4968 ret_ref = (uint64_t)ret_var.inner;
4969 if (ret_var.is_owned) {
4975 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
4976 CHECK(!owner->result_ok);
4977 return DecodeError_clone(&*owner->contents.err);
4979 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint32_t owner) {
4980 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
4981 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
4982 uint64_t ret_ref = 0;
4983 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4984 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4985 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4986 ret_ref = (uint64_t)ret_var.inner;
4987 if (ret_var.is_owned) {
4993 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4994 CHECK(owner->result_ok);
4995 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
4997 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
4998 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
4999 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
5000 uint64_t ret_ref = 0;
5001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5003 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5004 ret_ref = (uint64_t)ret_var.inner;
5005 if (ret_var.is_owned) {
5011 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5012 CHECK(!owner->result_ok);
5013 return DecodeError_clone(&*owner->contents.err);
5015 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
5016 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
5017 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
5018 uint64_t ret_ref = 0;
5019 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5020 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5021 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5022 ret_ref = (uint64_t)ret_var.inner;
5023 if (ret_var.is_owned) {
5029 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5030 CHECK(owner->result_ok);
5031 return ChannelAnnouncement_clone(&*owner->contents.result);
5033 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
5034 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
5035 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
5036 uint64_t ret_ref = 0;
5037 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5038 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5040 ret_ref = (uint64_t)ret_var.inner;
5041 if (ret_var.is_owned) {
5047 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5048 CHECK(!owner->result_ok);
5049 return DecodeError_clone(&*owner->contents.err);
5051 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
5052 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
5053 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
5054 uint64_t ret_ref = 0;
5055 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5056 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5058 ret_ref = (uint64_t)ret_var.inner;
5059 if (ret_var.is_owned) {
5065 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
5066 CHECK(owner->result_ok);
5067 return UnsignedChannelUpdate_clone(&*owner->contents.result);
5069 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
5070 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
5071 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
5072 uint64_t ret_ref = 0;
5073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5075 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5076 ret_ref = (uint64_t)ret_var.inner;
5077 if (ret_var.is_owned) {
5083 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
5084 CHECK(!owner->result_ok);
5085 return DecodeError_clone(&*owner->contents.err);
5087 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
5088 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
5089 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
5090 uint64_t ret_ref = 0;
5091 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5092 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5093 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5094 ret_ref = (uint64_t)ret_var.inner;
5095 if (ret_var.is_owned) {
5101 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
5102 CHECK(owner->result_ok);
5103 return ChannelUpdate_clone(&*owner->contents.result);
5105 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
5106 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
5107 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
5108 uint64_t ret_ref = 0;
5109 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5110 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5112 ret_ref = (uint64_t)ret_var.inner;
5113 if (ret_var.is_owned) {
5119 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
5120 CHECK(!owner->result_ok);
5121 return DecodeError_clone(&*owner->contents.err);
5123 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
5124 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
5125 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
5126 uint64_t ret_ref = 0;
5127 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5128 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5129 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5130 ret_ref = (uint64_t)ret_var.inner;
5131 if (ret_var.is_owned) {
5137 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
5138 CHECK(owner->result_ok);
5139 return ErrorMessage_clone(&*owner->contents.result);
5141 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t owner) {
5142 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
5143 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
5144 uint64_t ret_ref = 0;
5145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5148 ret_ref = (uint64_t)ret_var.inner;
5149 if (ret_var.is_owned) {
5155 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
5156 CHECK(!owner->result_ok);
5157 return DecodeError_clone(&*owner->contents.err);
5159 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint32_t owner) {
5160 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
5161 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
5162 uint64_t ret_ref = 0;
5163 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5164 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5166 ret_ref = (uint64_t)ret_var.inner;
5167 if (ret_var.is_owned) {
5173 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5174 CHECK(owner->result_ok);
5175 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
5177 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
5178 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
5179 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
5180 uint64_t ret_ref = 0;
5181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5183 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5184 ret_ref = (uint64_t)ret_var.inner;
5185 if (ret_var.is_owned) {
5191 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5192 CHECK(!owner->result_ok);
5193 return DecodeError_clone(&*owner->contents.err);
5195 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
5196 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
5197 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
5198 uint64_t ret_ref = 0;
5199 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5200 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5201 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5202 ret_ref = (uint64_t)ret_var.inner;
5203 if (ret_var.is_owned) {
5209 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5210 CHECK(owner->result_ok);
5211 return NodeAnnouncement_clone(&*owner->contents.result);
5213 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
5214 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
5215 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
5216 uint64_t ret_ref = 0;
5217 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5218 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5220 ret_ref = (uint64_t)ret_var.inner;
5221 if (ret_var.is_owned) {
5227 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5228 CHECK(!owner->result_ok);
5229 return DecodeError_clone(&*owner->contents.err);
5231 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
5232 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
5233 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
5234 uint64_t ret_ref = 0;
5235 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5236 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5237 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5238 ret_ref = (uint64_t)ret_var.inner;
5239 if (ret_var.is_owned) {
5245 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
5246 CHECK(owner->result_ok);
5247 return QueryShortChannelIds_clone(&*owner->contents.result);
5249 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t owner) {
5250 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
5251 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
5252 uint64_t ret_ref = 0;
5253 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5254 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5256 ret_ref = (uint64_t)ret_var.inner;
5257 if (ret_var.is_owned) {
5263 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
5264 CHECK(!owner->result_ok);
5265 return DecodeError_clone(&*owner->contents.err);
5267 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t owner) {
5268 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
5269 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
5270 uint64_t ret_ref = 0;
5271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5273 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5274 ret_ref = (uint64_t)ret_var.inner;
5275 if (ret_var.is_owned) {
5281 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
5282 CHECK(owner->result_ok);
5283 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
5285 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t owner) {
5286 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
5287 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
5288 uint64_t ret_ref = 0;
5289 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5290 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5291 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5292 ret_ref = (uint64_t)ret_var.inner;
5293 if (ret_var.is_owned) {
5299 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
5300 CHECK(!owner->result_ok);
5301 return DecodeError_clone(&*owner->contents.err);
5303 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t owner) {
5304 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
5305 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
5306 uint64_t ret_ref = 0;
5307 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5308 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5310 ret_ref = (uint64_t)ret_var.inner;
5311 if (ret_var.is_owned) {
5317 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
5318 CHECK(owner->result_ok);
5319 return QueryChannelRange_clone(&*owner->contents.result);
5321 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
5322 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
5323 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
5324 uint64_t ret_ref = 0;
5325 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5326 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5327 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5328 ret_ref = (uint64_t)ret_var.inner;
5329 if (ret_var.is_owned) {
5335 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
5336 CHECK(!owner->result_ok);
5337 return DecodeError_clone(&*owner->contents.err);
5339 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
5340 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
5341 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
5342 uint64_t ret_ref = 0;
5343 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5344 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5345 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5346 ret_ref = (uint64_t)ret_var.inner;
5347 if (ret_var.is_owned) {
5353 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
5354 CHECK(owner->result_ok);
5355 return ReplyChannelRange_clone(&*owner->contents.result);
5357 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
5358 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
5359 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
5360 uint64_t ret_ref = 0;
5361 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5362 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5363 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5364 ret_ref = (uint64_t)ret_var.inner;
5365 if (ret_var.is_owned) {
5371 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
5372 CHECK(!owner->result_ok);
5373 return DecodeError_clone(&*owner->contents.err);
5375 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
5376 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
5377 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
5378 uint64_t ret_ref = 0;
5379 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5380 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5381 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5382 ret_ref = (uint64_t)ret_var.inner;
5383 if (ret_var.is_owned) {
5389 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
5390 CHECK(owner->result_ok);
5391 return GossipTimestampFilter_clone(&*owner->contents.result);
5393 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t owner) {
5394 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
5395 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
5396 uint64_t ret_ref = 0;
5397 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5398 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5400 ret_ref = (uint64_t)ret_var.inner;
5401 if (ret_var.is_owned) {
5407 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
5408 CHECK(!owner->result_ok);
5409 return DecodeError_clone(&*owner->contents.err);
5411 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t owner) {
5412 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
5413 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
5414 uint64_t ret_ref = 0;
5415 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5416 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5417 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5418 ret_ref = (uint64_t)ret_var.inner;
5419 if (ret_var.is_owned) {
5425 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5426 CHECK(owner->result_ok);
5427 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
5429 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
5430 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5431 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5432 uint64_t ret_ref = 0;
5433 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5434 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5435 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5436 ret_ref = (uint64_t)ret_var.inner;
5437 if (ret_var.is_owned) {
5443 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5444 CHECK(!owner->result_ok);
5445 return DecodeError_clone(&*owner->contents.err);
5447 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
5448 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5449 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5450 uint64_t ret_ref = 0;
5451 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5452 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5454 ret_ref = (uint64_t)ret_var.inner;
5455 if (ret_var.is_owned) {
5461 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5462 CHECK(owner->result_ok);
5463 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
5465 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
5466 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5467 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5468 uint64_t ret_ref = 0;
5469 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5470 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5471 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5472 ret_ref = (uint64_t)ret_var.inner;
5473 if (ret_var.is_owned) {
5479 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5480 CHECK(!owner->result_ok);
5481 return DecodeError_clone(&*owner->contents.err);
5483 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
5484 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5485 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5486 uint64_t ret_ref = 0;
5487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5490 ret_ref = (uint64_t)ret_var.inner;
5491 if (ret_var.is_owned) {
5497 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5498 CHECK(owner->result_ok);
5499 return SpendableOutputDescriptor_clone(&*owner->contents.result);
5501 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
5502 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
5503 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
5504 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5505 uint64_t ret_ref = (uint64_t)ret_copy;
5509 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5510 CHECK(!owner->result_ok);
5511 return DecodeError_clone(&*owner->contents.err);
5513 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
5514 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
5515 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5516 uint64_t ret_ref = 0;
5517 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5518 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5520 ret_ref = (uint64_t)ret_var.inner;
5521 if (ret_var.is_owned) {
5527 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5528 CHECK(owner->result_ok);
5529 return Sign_clone(&*owner->contents.result);
5531 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint32_t owner) {
5532 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5533 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5534 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
5535 return (uint64_t)ret_ret;
5538 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5539 CHECK(!owner->result_ok);
5540 return DecodeError_clone(&*owner->contents.err);
5542 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint32_t owner) {
5543 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5544 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
5545 uint64_t ret_ref = 0;
5546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5549 ret_ref = (uint64_t)ret_var.inner;
5550 if (ret_var.is_owned) {
5556 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5557 CHECK(owner->result_ok);
5558 return *owner->contents.result;
5560 int8_tArray __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint32_t owner) {
5561 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5562 int8_tArray ret_arr = init_int8_tArray(68);
5563 memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
5567 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5568 CHECK(!owner->result_ok);
5569 return *owner->contents.err;
5571 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint32_t owner) {
5572 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5573 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
5576 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
5577 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
5578 for (size_t i = 0; i < ret.datalen; i++) {
5579 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
5583 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5584 CHECK(owner->result_ok);
5585 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
5587 ptrArray __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t owner) {
5588 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5589 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
5590 ptrArray ret_arr = NULL;
5591 ret_arr = init_ptrArray(ret_var.datalen);
5592 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
5593 for (size_t m = 0; m < ret_var.datalen; m++) {
5594 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
5595 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen);
5596 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
5597 CVec_u8Z_free(ret_conv_12_var);
5598 ret_arr_ptr[m] = ret_conv_12_arr;
5605 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5606 CHECK(!owner->result_ok);
5607 return *owner->contents.err;
5609 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t owner) {
5610 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5611 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
5614 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5615 CHECK(owner->result_ok);
5616 return InMemorySigner_clone(&*owner->contents.result);
5618 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t owner) {
5619 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5620 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
5621 uint64_t ret_ref = 0;
5622 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5623 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5625 ret_ref = (uint64_t)ret_var.inner;
5626 if (ret_var.is_owned) {
5632 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5633 CHECK(!owner->result_ok);
5634 return DecodeError_clone(&*owner->contents.err);
5636 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint32_t owner) {
5637 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5638 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
5639 uint64_t ret_ref = 0;
5640 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5641 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5643 ret_ref = (uint64_t)ret_var.inner;
5644 if (ret_var.is_owned) {
5650 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
5651 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
5652 for (size_t i = 0; i < ret.datalen; i++) {
5653 ret.data[i] = TxOut_clone(&orig->data[i]);
5657 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5658 CHECK(owner->result_ok);
5659 return *owner->contents.result;
5661 int8_tArray __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint32_t owner) {
5662 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5663 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
5664 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
5665 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5669 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5670 CHECK(!owner->result_ok);
5671 return *owner->contents.err;
5673 void __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint32_t owner) {
5674 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5675 CResult_TransactionNoneZ_get_err(owner_conv);
5678 typedef struct LDKFilter_JCalls {
5679 atomic_size_t refcnt;
5680 uint32_t instance_ptr;
5682 static void LDKFilter_JCalls_free(void* this_arg) {
5683 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5684 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5688 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5689 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5690 int8_tArray txid_arr = init_int8_tArray(32);
5691 memcpy(txid_arr->elems, *txid, 32);
5692 LDKu8slice script_pubkey_var = script_pubkey;
5693 int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen);
5694 memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
5695 js_invoke_function_2(j_calls->instance_ptr, 18, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr);
5697 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5698 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5699 LDKWatchedOutput output_var = output;
5700 uint64_t output_ref = 0;
5701 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5702 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5703 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
5704 output_ref = (uint64_t)output_var.inner;
5705 if (output_var.is_owned) {
5708 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 19, (uint32_t)output_ref);
5709 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5710 CHECK_ACCESS(ret_ptr);
5711 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
5715 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5716 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5717 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5719 static inline LDKFilter LDKFilter_init (JSValue o) {
5720 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5721 atomic_init(&calls->refcnt, 1);
5722 calls->instance_ptr = o;
5725 .this_arg = (void*) calls,
5726 .register_tx = register_tx_LDKFilter_jcall,
5727 .register_output = register_output_LDKFilter_jcall,
5728 .free = LDKFilter_JCalls_free,
5732 long __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
5733 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5734 *res_ptr = LDKFilter_init(o);
5735 return (long)res_ptr;
5737 void __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5738 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5739 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5740 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5741 unsigned char txid_arr[32];
5742 CHECK(txid->arr_len == 32);
5743 memcpy(txid_arr, txid->elems, 32);
5744 unsigned char (*txid_ref)[32] = &txid_arr;
5745 LDKu8slice script_pubkey_ref;
5746 script_pubkey_ref.datalen = script_pubkey->arr_len;
5747 script_pubkey_ref.data = script_pubkey->elems;
5748 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5751 uint32_t __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5752 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5753 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5754 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5755 LDKWatchedOutput output_conv;
5756 output_conv.inner = (void*)(output & (~1));
5757 output_conv.is_owned = (output & 1) || (output == 0);
5758 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
5759 output_conv = WatchedOutput_clone(&output_conv);
5760 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5761 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5762 uint64_t ret_ref = (uint64_t)ret_copy;
5766 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint32_t ptr) {
5767 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5769 case LDKCOption_FilterZ_Some: return 0;
5770 case LDKCOption_FilterZ_None: return 1;
5774 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint32_t ptr) {
5775 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5776 assert(obj->tag == LDKCOption_FilterZ_Some);
5777 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
5778 *some_ret = obj->some;
5779 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5780 return (uint64_t)some_ret;
5782 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
5783 CHECK(owner->result_ok);
5784 return &*owner->contents.result;
5786 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint32_t owner) {
5787 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
5788 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
5789 uint64_t ret_ref = 0;
5790 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5791 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5792 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5793 ret_ref = (uint64_t)ret_var.inner & ~1;
5797 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
5798 CHECK(!owner->result_ok);
5799 return *owner->contents.err;
5801 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint32_t owner) {
5802 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
5803 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
5806 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
5807 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
5808 for (size_t i = 0; i < ret.datalen; i++) {
5809 ret.data[i] = OutPoint_clone(&orig->data[i]);
5813 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint32_t ptr) {
5814 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5816 case LDKAPIError_APIMisuseError: return 0;
5817 case LDKAPIError_FeeRateTooHigh: return 1;
5818 case LDKAPIError_RouteError: return 2;
5819 case LDKAPIError_ChannelUnavailable: return 3;
5820 case LDKAPIError_MonitorUpdateFailed: return 4;
5821 case LDKAPIError_IncompatibleShutdownScript: return 5;
5825 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint32_t ptr) {
5826 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5827 assert(obj->tag == LDKAPIError_APIMisuseError);
5828 LDKStr err_str = obj->api_misuse_error.err;
5829 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5832 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint32_t ptr) {
5833 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5834 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
5835 LDKStr err_str = obj->fee_rate_too_high.err;
5836 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5839 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint32_t ptr) {
5840 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5841 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
5842 return obj->fee_rate_too_high.feerate;
5844 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint32_t ptr) {
5845 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5846 assert(obj->tag == LDKAPIError_RouteError);
5847 LDKStr err_str = obj->route_error.err;
5848 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5851 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint32_t ptr) {
5852 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5853 assert(obj->tag == LDKAPIError_ChannelUnavailable);
5854 LDKStr err_str = obj->channel_unavailable.err;
5855 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5858 uint32_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint32_t ptr) {
5859 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5860 assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
5861 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
5862 uint64_t script_ref = 0;
5863 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5864 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5865 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
5866 script_ref = (uint64_t)script_var.inner & ~1;
5869 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5870 CHECK(owner->result_ok);
5871 return *owner->contents.result;
5873 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint32_t owner) {
5874 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5875 CResult_NoneAPIErrorZ_get_ok(owner_conv);
5878 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5879 CHECK(!owner->result_ok);
5880 return APIError_clone(&*owner->contents.err);
5882 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint32_t owner) {
5883 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5884 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5885 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
5886 uint64_t ret_ref = (uint64_t)ret_copy;
5890 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint32_t ptr) {
5891 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
5893 case LDKCOption_u16Z_Some: return 0;
5894 case LDKCOption_u16Z_None: return 1;
5898 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint32_t ptr) {
5899 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
5900 assert(obj->tag == LDKCOption_u16Z_Some);
5903 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
5904 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
5905 for (size_t i = 0; i < ret.datalen; i++) {
5906 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
5910 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
5911 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
5912 for (size_t i = 0; i < ret.datalen; i++) {
5913 ret.data[i] = APIError_clone(&orig->data[i]);
5917 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5918 CHECK(owner->result_ok);
5919 return ThirtyTwoBytes_clone(&*owner->contents.result);
5921 int8_tArray __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint32_t owner) {
5922 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5923 int8_tArray ret_arr = init_int8_tArray(32);
5924 memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
5928 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5929 CHECK(!owner->result_ok);
5930 return APIError_clone(&*owner->contents.err);
5932 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint32_t owner) {
5933 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5934 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5935 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5936 uint64_t ret_ref = (uint64_t)ret_copy;
5940 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint32_t ptr) {
5941 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5943 case LDKPaymentSendFailure_ParameterError: return 0;
5944 case LDKPaymentSendFailure_PathParameterError: return 1;
5945 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
5946 case LDKPaymentSendFailure_PartialFailure: return 3;
5950 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint32_t ptr) {
5951 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5952 assert(obj->tag == LDKPaymentSendFailure_ParameterError);
5953 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
5954 return parameter_error_ref;
5956 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint32_t ptr) {
5957 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5958 assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
5959 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5960 uint32_tArray path_parameter_error_arr = NULL;
5961 path_parameter_error_arr = init_uint32_tArray(path_parameter_error_var.datalen);
5962 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(((uint8_t*)path_parameter_error_arr) + 4);
5963 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5964 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5965 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5966 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5967 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
5970 return path_parameter_error_arr;
5972 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint32_t ptr) {
5973 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5974 assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
5975 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
5976 uint32_tArray all_failed_retry_safe_arr = NULL;
5977 all_failed_retry_safe_arr = init_uint32_tArray(all_failed_retry_safe_var.datalen);
5978 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(((uint8_t*)all_failed_retry_safe_arr) + 4);
5979 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
5980 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
5981 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
5984 return all_failed_retry_safe_arr;
5986 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint32_t ptr) {
5987 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5988 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5989 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5990 uint32_tArray results_arr = NULL;
5991 results_arr = init_uint32_tArray(results_var.datalen);
5992 uint32_t *results_arr_ptr = (uint32_t*)(((uint8_t*)results_arr) + 4);
5993 for (size_t w = 0; w < results_var.datalen; w++) {
5994 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5995 *results_conv_22_conv = results_var.data[w];
5996 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5997 results_arr_ptr[w] = (uint64_t)results_conv_22_conv;
6002 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint32_t ptr) {
6003 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
6004 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
6005 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
6006 uint64_t failed_paths_retry_ref = 0;
6007 if ((uint64_t)failed_paths_retry_var.inner > 4096) {
6008 CHECK((((uint64_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6009 CHECK((((uint64_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6010 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
6011 failed_paths_retry_ref = (uint64_t)failed_paths_retry_var.inner & ~1;
6013 return failed_paths_retry_ref;
6015 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint32_t ptr) {
6016 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
6017 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
6018 int8_tArray payment_id_arr = init_int8_tArray(32);
6019 memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
6020 return payment_id_arr;
6022 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
6023 CHECK(owner->result_ok);
6024 return ThirtyTwoBytes_clone(&*owner->contents.result);
6026 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t owner) {
6027 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
6028 int8_tArray ret_arr = init_int8_tArray(32);
6029 memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
6033 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
6034 CHECK(!owner->result_ok);
6035 return PaymentSendFailure_clone(&*owner->contents.err);
6037 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t owner) {
6038 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
6039 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6040 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
6041 uint64_t ret_ref = (uint64_t)ret_copy;
6045 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6046 CHECK(owner->result_ok);
6047 return *owner->contents.result;
6049 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint32_t owner) {
6050 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
6051 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
6054 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6055 CHECK(!owner->result_ok);
6056 return PaymentSendFailure_clone(&*owner->contents.err);
6058 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint32_t owner) {
6059 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
6060 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6061 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
6062 uint64_t ret_ref = (uint64_t)ret_copy;
6066 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6067 return ThirtyTwoBytes_clone(&owner->a);
6069 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t owner) {
6070 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
6071 int8_tArray ret_arr = init_int8_tArray(32);
6072 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
6076 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6077 return ThirtyTwoBytes_clone(&owner->b);
6079 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t owner) {
6080 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
6081 int8_tArray ret_arr = init_int8_tArray(32);
6082 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
6086 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6087 CHECK(owner->result_ok);
6088 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
6090 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t owner) {
6091 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
6092 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
6093 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
6094 return ((uint64_t)ret_conv);
6097 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6098 CHECK(!owner->result_ok);
6099 return PaymentSendFailure_clone(&*owner->contents.err);
6101 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t owner) {
6102 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
6103 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6104 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
6105 uint64_t ret_ref = (uint64_t)ret_copy;
6109 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6110 return ThirtyTwoBytes_clone(&owner->a);
6112 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t owner) {
6113 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
6114 int8_tArray ret_arr = init_int8_tArray(32);
6115 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
6119 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6120 return ThirtyTwoBytes_clone(&owner->b);
6122 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t owner) {
6123 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
6124 int8_tArray ret_arr = init_int8_tArray(32);
6125 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
6129 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6130 CHECK(owner->result_ok);
6131 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6133 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint32_t owner) {
6134 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
6135 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6136 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
6137 return ((uint64_t)ret_conv);
6140 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6141 CHECK(!owner->result_ok);
6142 return *owner->contents.err;
6144 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint32_t owner) {
6145 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
6146 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
6149 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
6150 CHECK(owner->result_ok);
6151 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6153 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint32_t owner) {
6154 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
6155 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6156 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
6157 return ((uint64_t)ret_conv);
6160 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
6161 CHECK(!owner->result_ok);
6162 return APIError_clone(&*owner->contents.err);
6164 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint32_t owner) {
6165 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
6166 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6167 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
6168 uint64_t ret_ref = (uint64_t)ret_copy;
6172 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6173 CHECK(owner->result_ok);
6174 return ThirtyTwoBytes_clone(&*owner->contents.result);
6176 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint32_t owner) {
6177 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
6178 int8_tArray ret_arr = init_int8_tArray(32);
6179 memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
6183 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6184 CHECK(!owner->result_ok);
6185 return *owner->contents.err;
6187 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint32_t owner) {
6188 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
6189 CResult_PaymentSecretNoneZ_get_err(owner_conv);
6192 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
6193 CHECK(owner->result_ok);
6194 return ThirtyTwoBytes_clone(&*owner->contents.result);
6196 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint32_t owner) {
6197 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
6198 int8_tArray ret_arr = init_int8_tArray(32);
6199 memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
6203 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
6204 CHECK(!owner->result_ok);
6205 return APIError_clone(&*owner->contents.err);
6207 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint32_t owner) {
6208 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
6209 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6210 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
6211 uint64_t ret_ref = (uint64_t)ret_copy;
6215 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6216 CHECK(owner->result_ok);
6217 return ThirtyTwoBytes_clone(&*owner->contents.result);
6219 int8_tArray __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint32_t owner) {
6220 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
6221 int8_tArray ret_arr = init_int8_tArray(32);
6222 memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
6226 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6227 CHECK(!owner->result_ok);
6228 return APIError_clone(&*owner->contents.err);
6230 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint32_t owner) {
6231 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
6232 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6233 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
6234 uint64_t ret_ref = (uint64_t)ret_copy;
6238 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6239 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6240 for (size_t i = 0; i < ret.datalen; i++) {
6241 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6245 typedef struct LDKWatch_JCalls {
6246 atomic_size_t refcnt;
6247 uint32_t instance_ptr;
6249 static void LDKWatch_JCalls_free(void* this_arg) {
6250 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6251 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6255 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6256 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6257 LDKOutPoint funding_txo_var = funding_txo;
6258 uint64_t funding_txo_ref = 0;
6259 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6260 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6261 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6262 funding_txo_ref = (uint64_t)funding_txo_var.inner;
6263 if (funding_txo_var.is_owned) {
6264 funding_txo_ref |= 1;
6266 LDKChannelMonitor monitor_var = monitor;
6267 uint64_t monitor_ref = 0;
6268 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6269 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6270 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6271 monitor_ref = (uint64_t)monitor_var.inner;
6272 if (monitor_var.is_owned) {
6275 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 20, (uint32_t)funding_txo_ref, (uint32_t)monitor_ref);
6276 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6277 CHECK_ACCESS(ret_ptr);
6278 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6282 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
6283 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6284 LDKOutPoint funding_txo_var = funding_txo;
6285 uint64_t funding_txo_ref = 0;
6286 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6287 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6288 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6289 funding_txo_ref = (uint64_t)funding_txo_var.inner;
6290 if (funding_txo_var.is_owned) {
6291 funding_txo_ref |= 1;
6293 LDKChannelMonitorUpdate update_var = update;
6294 uint64_t update_ref = 0;
6295 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6296 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6297 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6298 update_ref = (uint64_t)update_var.inner;
6299 if (update_var.is_owned) {
6302 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 21, (uint32_t)funding_txo_ref, (uint32_t)update_ref);
6303 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6304 CHECK_ACCESS(ret_ptr);
6305 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6309 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6310 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6311 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 22);
6312 LDKCVec_MonitorEventZ ret_constr;
6313 ret_constr.datalen = ret->arr_len;
6314 if (ret_constr.datalen > 0)
6315 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
6317 ret_constr.data = NULL;
6318 uint32_t* ret_vals = ret->elems;
6319 for (size_t o = 0; o < ret_constr.datalen; o++) {
6320 uint32_t ret_conv_14 = ret_vals[o];
6321 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
6322 CHECK_ACCESS(ret_conv_14_ptr);
6323 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
6324 FREE((void*)ret_conv_14);
6325 ret_constr.data[o] = ret_conv_14_conv;
6329 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6330 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6331 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6333 static inline LDKWatch LDKWatch_init (JSValue o) {
6334 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6335 atomic_init(&calls->refcnt, 1);
6336 calls->instance_ptr = o;
6339 .this_arg = (void*) calls,
6340 .watch_channel = watch_channel_LDKWatch_jcall,
6341 .update_channel = update_channel_LDKWatch_jcall,
6342 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6343 .free = LDKWatch_JCalls_free,
6347 long __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
6348 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6349 *res_ptr = LDKWatch_init(o);
6350 return (long)res_ptr;
6352 uint32_t __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
6353 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6354 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6355 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6356 LDKOutPoint funding_txo_conv;
6357 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6358 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6359 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6360 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6361 LDKChannelMonitor monitor_conv;
6362 monitor_conv.inner = (void*)(monitor & (~1));
6363 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
6364 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6365 monitor_conv = ChannelMonitor_clone(&monitor_conv);
6366 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6367 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6368 return (uint64_t)ret_conv;
6371 uint32_t __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
6372 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6373 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6374 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6375 LDKOutPoint funding_txo_conv;
6376 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6377 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6378 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6379 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6380 LDKChannelMonitorUpdate update_conv;
6381 update_conv.inner = (void*)(update & (~1));
6382 update_conv.is_owned = (update & 1) || (update == 0);
6383 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6384 update_conv = ChannelMonitorUpdate_clone(&update_conv);
6385 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6386 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
6387 return (uint64_t)ret_conv;
6390 uint32_tArray __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
6391 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6392 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6393 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6394 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6395 uint32_tArray ret_arr = NULL;
6396 ret_arr = init_uint32_tArray(ret_var.datalen);
6397 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
6398 for (size_t o = 0; o < ret_var.datalen; o++) {
6399 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
6400 *ret_conv_14_copy = ret_var.data[o];
6401 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
6402 ret_arr_ptr[o] = ret_conv_14_ref;
6409 typedef struct LDKBroadcasterInterface_JCalls {
6410 atomic_size_t refcnt;
6411 uint32_t instance_ptr;
6412 } LDKBroadcasterInterface_JCalls;
6413 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6414 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6415 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6419 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
6420 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6421 LDKTransaction tx_var = tx;
6422 int8_tArray tx_arr = init_int8_tArray(tx_var.datalen);
6423 memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
6424 Transaction_free(tx_var);
6425 js_invoke_function_1(j_calls->instance_ptr, 23, (uint32_t)tx_arr);
6427 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6428 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6429 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6431 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
6432 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6433 atomic_init(&calls->refcnt, 1);
6434 calls->instance_ptr = o;
6436 LDKBroadcasterInterface ret = {
6437 .this_arg = (void*) calls,
6438 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
6439 .free = LDKBroadcasterInterface_JCalls_free,
6443 long __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
6444 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6445 *res_ptr = LDKBroadcasterInterface_init(o);
6446 return (long)res_ptr;
6448 void __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
6449 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6450 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6451 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6452 LDKTransaction tx_ref;
6453 tx_ref.datalen = tx->arr_len;
6454 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
6455 memcpy(tx_ref.data, tx->elems, tx_ref.datalen);
6456 tx_ref.data_is_owned = true;
6457 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
6460 typedef struct LDKKeysInterface_JCalls {
6461 atomic_size_t refcnt;
6462 uint32_t instance_ptr;
6463 } LDKKeysInterface_JCalls;
6464 static void LDKKeysInterface_JCalls_free(void* this_arg) {
6465 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6466 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6470 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
6471 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6472 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 24);
6473 LDKSecretKey ret_ref;
6474 CHECK(ret->arr_len == 32);
6475 memcpy(ret_ref.bytes, ret->elems, 32);
6478 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
6479 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6480 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 25);
6481 LDKCVec_u8Z ret_ref;
6482 ret_ref.datalen = ret->arr_len;
6483 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6484 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
6487 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
6488 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6489 uint32_t ret = js_invoke_function_0(j_calls->instance_ptr, 26);
6490 LDKShutdownScript ret_conv;
6491 ret_conv.inner = (void*)(ret & (~1));
6492 ret_conv.is_owned = (ret & 1) || (ret == 0);
6493 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6496 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
6497 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6498 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 27, (uint32_t)inbound, (uint32_t)channel_value_satoshis);
6499 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6500 CHECK_ACCESS(ret_ptr);
6501 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
6505 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
6506 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6507 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 28);
6508 LDKThirtyTwoBytes ret_ref;
6509 CHECK(ret->arr_len == 32);
6510 memcpy(ret_ref.data, ret->elems, 32);
6513 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
6514 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6515 LDKu8slice reader_var = reader;
6516 int8_tArray reader_arr = init_int8_tArray(reader_var.datalen);
6517 memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6518 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 29, (uint32_t)reader_arr);
6519 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6520 CHECK_ACCESS(ret_ptr);
6521 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
6525 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
6526 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6527 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
6528 int8_tArray invoice_preimage_arr = init_int8_tArray(invoice_preimage_var.datalen);
6529 memcpy(invoice_preimage_arr->elems, invoice_preimage_var.data, invoice_preimage_var.datalen);
6530 CVec_u8Z_free(invoice_preimage_var);
6531 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 30, (uint32_t)invoice_preimage_arr);
6532 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6533 CHECK_ACCESS(ret_ptr);
6534 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6538 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
6539 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6540 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 31);
6541 LDKThirtyTwoBytes ret_ref;
6542 CHECK(ret->arr_len == 32);
6543 memcpy(ret_ref.data, ret->elems, 32);
6546 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
6547 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
6548 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6550 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
6551 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
6552 atomic_init(&calls->refcnt, 1);
6553 calls->instance_ptr = o;
6555 LDKKeysInterface ret = {
6556 .this_arg = (void*) calls,
6557 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
6558 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
6559 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
6560 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
6561 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
6562 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
6563 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
6564 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
6565 .free = LDKKeysInterface_JCalls_free,
6569 long __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
6570 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6571 *res_ptr = LDKKeysInterface_init(o);
6572 return (long)res_ptr;
6574 int8_tArray __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
6575 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6576 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6577 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6578 int8_tArray ret_arr = init_int8_tArray(32);
6579 memcpy(ret_arr->elems, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
6583 int8_tArray __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
6584 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6585 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6586 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6587 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6588 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
6589 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6590 CVec_u8Z_free(ret_var);
6594 uint32_t __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
6595 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6596 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6597 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6598 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6599 uint64_t ret_ref = 0;
6600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6602 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6603 ret_ref = (uint64_t)ret_var.inner;
6604 if (ret_var.is_owned) {
6610 uint32_t __attribute__((export_name("TS_KeysInterface_get_channel_signer"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
6611 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6612 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6613 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6614 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6615 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6616 return (uint64_t)ret_ret;
6619 int8_tArray __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
6620 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6621 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6622 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6623 int8_tArray ret_arr = init_int8_tArray(32);
6624 memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
6628 uint32_t __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
6629 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6630 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6631 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6632 LDKu8slice reader_ref;
6633 reader_ref.datalen = reader->arr_len;
6634 reader_ref.data = reader->elems;
6635 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6636 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6637 return (uint64_t)ret_conv;
6640 uint32_t __attribute__((export_name("TS_KeysInterface_sign_invoice"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
6641 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6642 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6643 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6644 LDKCVec_u8Z invoice_preimage_ref;
6645 invoice_preimage_ref.datalen = invoice_preimage->arr_len;
6646 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
6647 memcpy(invoice_preimage_ref.data, invoice_preimage->elems, invoice_preimage_ref.datalen);
6648 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6649 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
6650 return (uint64_t)ret_conv;
6653 int8_tArray __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) {
6654 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6655 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6656 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6657 int8_tArray ret_arr = init_int8_tArray(32);
6658 memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6662 typedef struct LDKFeeEstimator_JCalls {
6663 atomic_size_t refcnt;
6664 uint32_t instance_ptr;
6665 } LDKFeeEstimator_JCalls;
6666 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6667 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6668 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6672 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6673 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6674 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6675 return js_invoke_function_1(j_calls->instance_ptr, 32, (uint32_t)confirmation_target_conv);
6677 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6678 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6679 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6681 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
6682 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6683 atomic_init(&calls->refcnt, 1);
6684 calls->instance_ptr = o;
6686 LDKFeeEstimator ret = {
6687 .this_arg = (void*) calls,
6688 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6689 .free = LDKFeeEstimator_JCalls_free,
6693 long __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
6694 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6695 *res_ptr = LDKFeeEstimator_init(o);
6696 return (long)res_ptr;
6698 int32_t __attribute__((export_name("TS_FeeEstimator_get_est_sat_per_1000_weight"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
6699 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6700 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6701 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6702 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6703 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6707 typedef struct LDKLogger_JCalls {
6708 atomic_size_t refcnt;
6709 uint32_t instance_ptr;
6711 static void LDKLogger_JCalls_free(void* this_arg) {
6712 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6713 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6717 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
6718 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6719 LDKRecord record_var = *record;
6720 uint64_t record_ref = 0;
6721 record_var = Record_clone(record);
6722 CHECK((((uint64_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6723 CHECK((((uint64_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6724 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
6725 record_ref = (uint64_t)record_var.inner;
6726 if (record_var.is_owned) {
6729 js_invoke_function_1(j_calls->instance_ptr, 33, (uint32_t)record_ref);
6731 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
6732 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
6733 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6735 static inline LDKLogger LDKLogger_init (JSValue o) {
6736 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
6737 atomic_init(&calls->refcnt, 1);
6738 calls->instance_ptr = o;
6741 .this_arg = (void*) calls,
6742 .log = log_LDKLogger_jcall,
6743 .free = LDKLogger_JCalls_free,
6747 long __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
6748 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
6749 *res_ptr = LDKLogger_init(o);
6750 return (long)res_ptr;
6752 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6753 return ThirtyTwoBytes_clone(&owner->a);
6755 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t owner) {
6756 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6757 int8_tArray ret_arr = init_int8_tArray(32);
6758 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
6762 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6765 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t owner) {
6766 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6767 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6768 uint64_t ret_ref = 0;
6769 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6770 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6772 ret_ref = (uint64_t)ret_var.inner & ~1;
6776 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6777 CHECK(owner->result_ok);
6778 return &*owner->contents.result;
6780 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t owner) {
6781 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6782 uint64_t ret_ret = (uint64_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
6786 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6787 CHECK(!owner->result_ok);
6788 return DecodeError_clone(&*owner->contents.err);
6790 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t owner) {
6791 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6792 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6793 uint64_t ret_ref = 0;
6794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6797 ret_ref = (uint64_t)ret_var.inner;
6798 if (ret_var.is_owned) {
6804 typedef struct LDKMessageSendEventsProvider_JCalls {
6805 atomic_size_t refcnt;
6806 uint32_t instance_ptr;
6807 } LDKMessageSendEventsProvider_JCalls;
6808 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
6809 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6810 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6814 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
6815 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6816 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 34);
6817 LDKCVec_MessageSendEventZ ret_constr;
6818 ret_constr.datalen = ret->arr_len;
6819 if (ret_constr.datalen > 0)
6820 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6822 ret_constr.data = NULL;
6823 uint32_t* ret_vals = ret->elems;
6824 for (size_t s = 0; s < ret_constr.datalen; s++) {
6825 uint32_t ret_conv_18 = ret_vals[s];
6826 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
6827 CHECK_ACCESS(ret_conv_18_ptr);
6828 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
6829 FREE((void*)ret_conv_18);
6830 ret_constr.data[s] = ret_conv_18_conv;
6834 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
6835 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
6836 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6838 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
6839 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
6840 atomic_init(&calls->refcnt, 1);
6841 calls->instance_ptr = o;
6843 LDKMessageSendEventsProvider ret = {
6844 .this_arg = (void*) calls,
6845 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6846 .free = LDKMessageSendEventsProvider_JCalls_free,
6850 long __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
6851 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6852 *res_ptr = LDKMessageSendEventsProvider_init(o);
6853 return (long)res_ptr;
6855 uint32_tArray __attribute__((export_name("TS_MessageSendEventsProvider_get_and_clear_pending_msg_events"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
6856 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6857 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6858 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
6859 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6860 uint32_tArray ret_arr = NULL;
6861 ret_arr = init_uint32_tArray(ret_var.datalen);
6862 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
6863 for (size_t s = 0; s < ret_var.datalen; s++) {
6864 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6865 *ret_conv_18_copy = ret_var.data[s];
6866 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6867 ret_arr_ptr[s] = ret_conv_18_ref;
6874 typedef struct LDKEventHandler_JCalls {
6875 atomic_size_t refcnt;
6876 uint32_t instance_ptr;
6877 } LDKEventHandler_JCalls;
6878 static void LDKEventHandler_JCalls_free(void* this_arg) {
6879 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6880 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6884 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
6885 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6886 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
6887 *ret_event = Event_clone(event);
6888 js_invoke_function_1(j_calls->instance_ptr, 35, (uint32_t)(uint64_t)ret_event);
6890 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
6891 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
6892 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6894 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
6895 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6896 atomic_init(&calls->refcnt, 1);
6897 calls->instance_ptr = o;
6899 LDKEventHandler ret = {
6900 .this_arg = (void*) calls,
6901 .handle_event = handle_event_LDKEventHandler_jcall,
6902 .free = LDKEventHandler_JCalls_free,
6906 long __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
6907 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6908 *res_ptr = LDKEventHandler_init(o);
6909 return (long)res_ptr;
6911 void __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
6912 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6913 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6914 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
6915 LDKEvent* event_conv = (LDKEvent*)event;
6916 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6919 typedef struct LDKEventsProvider_JCalls {
6920 atomic_size_t refcnt;
6921 uint32_t instance_ptr;
6922 } LDKEventsProvider_JCalls;
6923 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6924 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6925 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6929 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6930 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6931 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6932 *handler_ret = handler;
6933 js_invoke_function_1(j_calls->instance_ptr, 36, (uint32_t)(uint64_t)handler_ret);
6935 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
6936 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
6937 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6939 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
6940 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6941 atomic_init(&calls->refcnt, 1);
6942 calls->instance_ptr = o;
6944 LDKEventsProvider ret = {
6945 .this_arg = (void*) calls,
6946 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6947 .free = LDKEventsProvider_JCalls_free,
6951 long __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
6952 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6953 *res_ptr = LDKEventsProvider_init(o);
6954 return (long)res_ptr;
6956 void __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
6957 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6958 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6959 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
6960 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
6961 CHECK_ACCESS(handler_ptr);
6962 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
6963 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6966 typedef struct LDKListen_JCalls {
6967 atomic_size_t refcnt;
6968 uint32_t instance_ptr;
6970 static void LDKListen_JCalls_free(void* this_arg) {
6971 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6972 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6976 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6977 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6978 LDKu8slice block_var = block;
6979 int8_tArray block_arr = init_int8_tArray(block_var.datalen);
6980 memcpy(block_arr->elems, block_var.data, block_var.datalen);
6981 js_invoke_function_2(j_calls->instance_ptr, 37, (uint32_t)block_arr, (uint32_t)height);
6983 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6984 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6985 int8_tArray header_arr = init_int8_tArray(80);
6986 memcpy(header_arr->elems, *header, 80);
6987 js_invoke_function_2(j_calls->instance_ptr, 38, (uint32_t)header_arr, (uint32_t)height);
6989 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
6990 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
6991 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6993 static inline LDKListen LDKListen_init (JSValue o) {
6994 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6995 atomic_init(&calls->refcnt, 1);
6996 calls->instance_ptr = o;
6999 .this_arg = (void*) calls,
7000 .block_connected = block_connected_LDKListen_jcall,
7001 .block_disconnected = block_disconnected_LDKListen_jcall,
7002 .free = LDKListen_JCalls_free,
7006 long __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
7007 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
7008 *res_ptr = LDKListen_init(o);
7009 return (long)res_ptr;
7011 void __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
7012 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7013 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7014 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
7015 LDKu8slice block_ref;
7016 block_ref.datalen = block->arr_len;
7017 block_ref.data = block->elems;
7018 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
7021 void __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
7022 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7023 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7024 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
7025 unsigned char header_arr[80];
7026 CHECK(header->arr_len == 80);
7027 memcpy(header_arr, header->elems, 80);
7028 unsigned char (*header_ref)[80] = &header_arr;
7029 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
7032 typedef struct LDKConfirm_JCalls {
7033 atomic_size_t refcnt;
7034 uint32_t instance_ptr;
7035 } LDKConfirm_JCalls;
7036 static void LDKConfirm_JCalls_free(void* this_arg) {
7037 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7038 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7042 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
7043 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7044 int8_tArray header_arr = init_int8_tArray(80);
7045 memcpy(header_arr->elems, *header, 80);
7046 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
7047 uint32_tArray txdata_arr = NULL;
7048 txdata_arr = init_uint32_tArray(txdata_var.datalen);
7049 uint32_t *txdata_arr_ptr = (uint32_t*)(((uint8_t*)txdata_arr) + 4);
7050 for (size_t c = 0; c < txdata_var.datalen; c++) {
7051 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7052 *txdata_conv_28_conv = txdata_var.data[c];
7053 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
7056 FREE(txdata_var.data);
7057 js_invoke_function_3(j_calls->instance_ptr, 39, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height);
7059 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
7060 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7061 int8_tArray txid_arr = init_int8_tArray(32);
7062 memcpy(txid_arr->elems, *txid, 32);
7063 js_invoke_function_1(j_calls->instance_ptr, 40, (uint32_t)txid_arr);
7065 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7066 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7067 int8_tArray header_arr = init_int8_tArray(80);
7068 memcpy(header_arr->elems, *header, 80);
7069 js_invoke_function_2(j_calls->instance_ptr, 41, (uint32_t)header_arr, (uint32_t)height);
7071 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
7072 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7073 ptrArray ret = (ptrArray)js_invoke_function_0(j_calls->instance_ptr, 42);
7074 LDKCVec_TxidZ ret_constr;
7075 ret_constr.datalen = ret->arr_len;
7076 if (ret_constr.datalen > 0)
7077 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
7079 ret_constr.data = NULL;
7080 int8_tArray* ret_vals = (void*) ret->elems;
7081 for (size_t m = 0; m < ret_constr.datalen; m++) {
7082 int8_tArray ret_conv_12 = ret_vals[m];
7083 LDKThirtyTwoBytes ret_conv_12_ref;
7084 CHECK(ret_conv_12->arr_len == 32);
7085 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32);
7086 ret_constr.data[m] = ret_conv_12_ref;
7090 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
7091 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
7092 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7094 static inline LDKConfirm LDKConfirm_init (JSValue o) {
7095 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
7096 atomic_init(&calls->refcnt, 1);
7097 calls->instance_ptr = o;
7100 .this_arg = (void*) calls,
7101 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
7102 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
7103 .best_block_updated = best_block_updated_LDKConfirm_jcall,
7104 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
7105 .free = LDKConfirm_JCalls_free,
7109 long __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
7110 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
7111 *res_ptr = LDKConfirm_init(o);
7112 return (long)res_ptr;
7114 void __attribute__((export_name("TS_Confirm_transactions_confirmed"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
7115 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7116 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7117 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
7118 unsigned char header_arr[80];
7119 CHECK(header->arr_len == 80);
7120 memcpy(header_arr, header->elems, 80);
7121 unsigned char (*header_ref)[80] = &header_arr;
7122 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7123 txdata_constr.datalen = txdata->arr_len;
7124 if (txdata_constr.datalen > 0)
7125 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7127 txdata_constr.data = NULL;
7128 uint32_t* txdata_vals = txdata->elems;
7129 for (size_t c = 0; c < txdata_constr.datalen; c++) {
7130 uint32_t txdata_conv_28 = txdata_vals[c];
7131 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
7132 CHECK_ACCESS(txdata_conv_28_ptr);
7133 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
7134 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
7135 txdata_constr.data[c] = txdata_conv_28_conv;
7137 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
7140 void __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
7141 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7142 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7143 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
7144 unsigned char txid_arr[32];
7145 CHECK(txid->arr_len == 32);
7146 memcpy(txid_arr, txid->elems, 32);
7147 unsigned char (*txid_ref)[32] = &txid_arr;
7148 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
7151 void __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
7152 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7153 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7154 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
7155 unsigned char header_arr[80];
7156 CHECK(header->arr_len == 80);
7157 memcpy(header_arr, header->elems, 80);
7158 unsigned char (*header_ref)[80] = &header_arr;
7159 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
7162 ptrArray __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
7163 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7164 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7165 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
7166 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
7167 ptrArray ret_arr = NULL;
7168 ret_arr = init_ptrArray(ret_var.datalen);
7169 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
7170 for (size_t m = 0; m < ret_var.datalen; m++) {
7171 int8_tArray ret_conv_12_arr = init_int8_tArray(32);
7172 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
7173 ret_arr_ptr[m] = ret_conv_12_arr;
7180 typedef struct LDKPersist_JCalls {
7181 atomic_size_t refcnt;
7182 uint32_t instance_ptr;
7183 } LDKPersist_JCalls;
7184 static void LDKPersist_JCalls_free(void* this_arg) {
7185 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7186 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7190 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
7191 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7192 LDKOutPoint channel_id_var = channel_id;
7193 uint64_t channel_id_ref = 0;
7194 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7195 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7196 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
7197 channel_id_ref = (uint64_t)channel_id_var.inner;
7198 if (channel_id_var.is_owned) {
7199 channel_id_ref |= 1;
7201 LDKChannelMonitor data_var = *data;
7202 uint64_t data_ref = 0;
7203 data_var = ChannelMonitor_clone(data);
7204 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7205 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7206 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
7207 data_ref = (uint64_t)data_var.inner;
7208 if (data_var.is_owned) {
7211 LDKMonitorUpdateId update_id_var = update_id;
7212 uint64_t update_id_ref = 0;
7213 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7214 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7215 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
7216 update_id_ref = (uint64_t)update_id_var.inner;
7217 if (update_id_var.is_owned) {
7220 uint32_t ret = js_invoke_function_3(j_calls->instance_ptr, 43, (uint32_t)channel_id_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
7221 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7222 CHECK_ACCESS(ret_ptr);
7223 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
7227 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
7228 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7229 LDKOutPoint channel_id_var = channel_id;
7230 uint64_t channel_id_ref = 0;
7231 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7232 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7233 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
7234 channel_id_ref = (uint64_t)channel_id_var.inner;
7235 if (channel_id_var.is_owned) {
7236 channel_id_ref |= 1;
7238 LDKChannelMonitorUpdate update_var = *update;
7239 uint64_t update_ref = 0;
7240 if ((uint64_t)update_var.inner > 4096) {
7241 update_var = ChannelMonitorUpdate_clone(update);
7242 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7243 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7244 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
7245 update_ref = (uint64_t)update_var.inner;
7246 if (update_var.is_owned) {
7250 LDKChannelMonitor data_var = *data;
7251 uint64_t data_ref = 0;
7252 data_var = ChannelMonitor_clone(data);
7253 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7254 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7255 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
7256 data_ref = (uint64_t)data_var.inner;
7257 if (data_var.is_owned) {
7260 LDKMonitorUpdateId update_id_var = update_id;
7261 uint64_t update_id_ref = 0;
7262 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7263 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7264 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
7265 update_id_ref = (uint64_t)update_id_var.inner;
7266 if (update_id_var.is_owned) {
7269 uint32_t ret = js_invoke_function_4(j_calls->instance_ptr, 44, (uint32_t)channel_id_ref, (uint32_t)update_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
7270 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7271 CHECK_ACCESS(ret_ptr);
7272 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
7276 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
7277 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
7278 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7280 static inline LDKPersist LDKPersist_init (JSValue o) {
7281 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
7282 atomic_init(&calls->refcnt, 1);
7283 calls->instance_ptr = o;
7286 .this_arg = (void*) calls,
7287 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
7288 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
7289 .free = LDKPersist_JCalls_free,
7293 long __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
7294 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
7295 *res_ptr = LDKPersist_init(o);
7296 return (long)res_ptr;
7298 uint32_t __attribute__((export_name("TS_Persist_persist_new_channel"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t channel_id, uint32_t data, uint32_t update_id) {
7299 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7300 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7301 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
7302 LDKOutPoint channel_id_conv;
7303 channel_id_conv.inner = (void*)(channel_id & (~1));
7304 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
7305 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
7306 channel_id_conv = OutPoint_clone(&channel_id_conv);
7307 LDKChannelMonitor data_conv;
7308 data_conv.inner = (void*)(data & (~1));
7309 data_conv.is_owned = false;
7310 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
7311 LDKMonitorUpdateId update_id_conv;
7312 update_id_conv.inner = (void*)(update_id & (~1));
7313 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
7314 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
7315 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
7316 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7317 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
7318 return (uint64_t)ret_conv;
7321 uint32_t __attribute__((export_name("TS_Persist_update_persisted_channel"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t channel_id, uint32_t update, uint32_t data, uint32_t update_id) {
7322 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7323 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7324 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
7325 LDKOutPoint channel_id_conv;
7326 channel_id_conv.inner = (void*)(channel_id & (~1));
7327 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
7328 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
7329 channel_id_conv = OutPoint_clone(&channel_id_conv);
7330 LDKChannelMonitorUpdate update_conv;
7331 update_conv.inner = (void*)(update & (~1));
7332 update_conv.is_owned = false;
7333 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
7334 LDKChannelMonitor data_conv;
7335 data_conv.inner = (void*)(data & (~1));
7336 data_conv.is_owned = false;
7337 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
7338 LDKMonitorUpdateId update_id_conv;
7339 update_id_conv.inner = (void*)(update_id & (~1));
7340 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
7341 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
7342 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
7343 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7344 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
7345 return (uint64_t)ret_conv;
7348 typedef struct LDKChannelMessageHandler_JCalls {
7349 atomic_size_t refcnt;
7350 uint32_t instance_ptr;
7351 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7352 } LDKChannelMessageHandler_JCalls;
7353 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
7354 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7355 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7359 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
7360 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7361 int8_tArray their_node_id_arr = init_int8_tArray(33);
7362 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7363 LDKInitFeatures their_features_var = their_features;
7364 uint64_t their_features_ref = 0;
7365 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7366 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7367 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
7368 their_features_ref = (uint64_t)their_features_var.inner;
7369 if (their_features_var.is_owned) {
7370 their_features_ref |= 1;
7372 LDKOpenChannel msg_var = *msg;
7373 uint64_t msg_ref = 0;
7374 msg_var = OpenChannel_clone(msg);
7375 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7376 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7377 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7378 msg_ref = (uint64_t)msg_var.inner;
7379 if (msg_var.is_owned) {
7382 js_invoke_function_3(j_calls->instance_ptr, 45, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
7384 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
7385 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7386 int8_tArray their_node_id_arr = init_int8_tArray(33);
7387 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7388 LDKInitFeatures their_features_var = their_features;
7389 uint64_t their_features_ref = 0;
7390 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7391 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7392 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
7393 their_features_ref = (uint64_t)their_features_var.inner;
7394 if (their_features_var.is_owned) {
7395 their_features_ref |= 1;
7397 LDKAcceptChannel msg_var = *msg;
7398 uint64_t msg_ref = 0;
7399 msg_var = AcceptChannel_clone(msg);
7400 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7401 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7402 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7403 msg_ref = (uint64_t)msg_var.inner;
7404 if (msg_var.is_owned) {
7407 js_invoke_function_3(j_calls->instance_ptr, 46, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
7409 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
7410 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7411 int8_tArray their_node_id_arr = init_int8_tArray(33);
7412 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7413 LDKFundingCreated msg_var = *msg;
7414 uint64_t msg_ref = 0;
7415 msg_var = FundingCreated_clone(msg);
7416 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7417 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7418 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7419 msg_ref = (uint64_t)msg_var.inner;
7420 if (msg_var.is_owned) {
7423 js_invoke_function_2(j_calls->instance_ptr, 47, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7425 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7426 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7427 int8_tArray their_node_id_arr = init_int8_tArray(33);
7428 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7429 LDKFundingSigned msg_var = *msg;
7430 uint64_t msg_ref = 0;
7431 msg_var = FundingSigned_clone(msg);
7432 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7433 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7434 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7435 msg_ref = (uint64_t)msg_var.inner;
7436 if (msg_var.is_owned) {
7439 js_invoke_function_2(j_calls->instance_ptr, 48, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7441 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7442 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7443 int8_tArray their_node_id_arr = init_int8_tArray(33);
7444 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7445 LDKFundingLocked msg_var = *msg;
7446 uint64_t msg_ref = 0;
7447 msg_var = FundingLocked_clone(msg);
7448 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7449 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7450 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7451 msg_ref = (uint64_t)msg_var.inner;
7452 if (msg_var.is_owned) {
7455 js_invoke_function_2(j_calls->instance_ptr, 49, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7457 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7458 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7459 int8_tArray their_node_id_arr = init_int8_tArray(33);
7460 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7461 LDKInitFeatures their_features_var = *their_features;
7462 uint64_t their_features_ref = 0;
7463 their_features_var = InitFeatures_clone(their_features);
7464 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7465 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7466 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
7467 their_features_ref = (uint64_t)their_features_var.inner;
7468 if (their_features_var.is_owned) {
7469 their_features_ref |= 1;
7471 LDKShutdown msg_var = *msg;
7472 uint64_t msg_ref = 0;
7473 msg_var = Shutdown_clone(msg);
7474 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7475 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7476 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7477 msg_ref = (uint64_t)msg_var.inner;
7478 if (msg_var.is_owned) {
7481 js_invoke_function_3(j_calls->instance_ptr, 50, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
7483 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7484 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7485 int8_tArray their_node_id_arr = init_int8_tArray(33);
7486 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7487 LDKClosingSigned msg_var = *msg;
7488 uint64_t msg_ref = 0;
7489 msg_var = ClosingSigned_clone(msg);
7490 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7491 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7492 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7493 msg_ref = (uint64_t)msg_var.inner;
7494 if (msg_var.is_owned) {
7497 js_invoke_function_2(j_calls->instance_ptr, 51, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7499 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7500 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7501 int8_tArray their_node_id_arr = init_int8_tArray(33);
7502 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7503 LDKUpdateAddHTLC msg_var = *msg;
7504 uint64_t msg_ref = 0;
7505 msg_var = UpdateAddHTLC_clone(msg);
7506 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7507 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7508 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7509 msg_ref = (uint64_t)msg_var.inner;
7510 if (msg_var.is_owned) {
7513 js_invoke_function_2(j_calls->instance_ptr, 52, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7515 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7516 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7517 int8_tArray their_node_id_arr = init_int8_tArray(33);
7518 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7519 LDKUpdateFulfillHTLC msg_var = *msg;
7520 uint64_t msg_ref = 0;
7521 msg_var = UpdateFulfillHTLC_clone(msg);
7522 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7523 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7524 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7525 msg_ref = (uint64_t)msg_var.inner;
7526 if (msg_var.is_owned) {
7529 js_invoke_function_2(j_calls->instance_ptr, 53, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7531 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7532 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7533 int8_tArray their_node_id_arr = init_int8_tArray(33);
7534 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7535 LDKUpdateFailHTLC msg_var = *msg;
7536 uint64_t msg_ref = 0;
7537 msg_var = UpdateFailHTLC_clone(msg);
7538 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7539 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7540 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7541 msg_ref = (uint64_t)msg_var.inner;
7542 if (msg_var.is_owned) {
7545 js_invoke_function_2(j_calls->instance_ptr, 54, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7547 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7548 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7549 int8_tArray their_node_id_arr = init_int8_tArray(33);
7550 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7551 LDKUpdateFailMalformedHTLC msg_var = *msg;
7552 uint64_t msg_ref = 0;
7553 msg_var = UpdateFailMalformedHTLC_clone(msg);
7554 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7555 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7556 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7557 msg_ref = (uint64_t)msg_var.inner;
7558 if (msg_var.is_owned) {
7561 js_invoke_function_2(j_calls->instance_ptr, 55, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7563 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7564 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7565 int8_tArray their_node_id_arr = init_int8_tArray(33);
7566 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7567 LDKCommitmentSigned msg_var = *msg;
7568 uint64_t msg_ref = 0;
7569 msg_var = CommitmentSigned_clone(msg);
7570 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7571 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7572 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7573 msg_ref = (uint64_t)msg_var.inner;
7574 if (msg_var.is_owned) {
7577 js_invoke_function_2(j_calls->instance_ptr, 56, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7579 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7580 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7581 int8_tArray their_node_id_arr = init_int8_tArray(33);
7582 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7583 LDKRevokeAndACK msg_var = *msg;
7584 uint64_t msg_ref = 0;
7585 msg_var = RevokeAndACK_clone(msg);
7586 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7587 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7588 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7589 msg_ref = (uint64_t)msg_var.inner;
7590 if (msg_var.is_owned) {
7593 js_invoke_function_2(j_calls->instance_ptr, 57, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7595 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7596 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7597 int8_tArray their_node_id_arr = init_int8_tArray(33);
7598 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7599 LDKUpdateFee msg_var = *msg;
7600 uint64_t msg_ref = 0;
7601 msg_var = UpdateFee_clone(msg);
7602 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7603 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7604 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7605 msg_ref = (uint64_t)msg_var.inner;
7606 if (msg_var.is_owned) {
7609 js_invoke_function_2(j_calls->instance_ptr, 58, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7611 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7612 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7613 int8_tArray their_node_id_arr = init_int8_tArray(33);
7614 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7615 LDKAnnouncementSignatures msg_var = *msg;
7616 uint64_t msg_ref = 0;
7617 msg_var = AnnouncementSignatures_clone(msg);
7618 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7619 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7620 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7621 msg_ref = (uint64_t)msg_var.inner;
7622 if (msg_var.is_owned) {
7625 js_invoke_function_2(j_calls->instance_ptr, 59, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7627 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7628 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7629 int8_tArray their_node_id_arr = init_int8_tArray(33);
7630 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7631 js_invoke_function_2(j_calls->instance_ptr, 60, (uint32_t)their_node_id_arr, (uint32_t)no_connection_possible);
7633 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7634 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7635 int8_tArray their_node_id_arr = init_int8_tArray(33);
7636 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7637 LDKInit msg_var = *msg;
7638 uint64_t msg_ref = 0;
7639 msg_var = Init_clone(msg);
7640 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7641 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7642 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7643 msg_ref = (uint64_t)msg_var.inner;
7644 if (msg_var.is_owned) {
7647 js_invoke_function_2(j_calls->instance_ptr, 61, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7649 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7650 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7651 int8_tArray their_node_id_arr = init_int8_tArray(33);
7652 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7653 LDKChannelReestablish msg_var = *msg;
7654 uint64_t msg_ref = 0;
7655 msg_var = ChannelReestablish_clone(msg);
7656 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7657 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7658 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7659 msg_ref = (uint64_t)msg_var.inner;
7660 if (msg_var.is_owned) {
7663 js_invoke_function_2(j_calls->instance_ptr, 62, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7665 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
7666 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7667 int8_tArray their_node_id_arr = init_int8_tArray(33);
7668 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7669 LDKChannelUpdate msg_var = *msg;
7670 uint64_t msg_ref = 0;
7671 msg_var = ChannelUpdate_clone(msg);
7672 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7673 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7674 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7675 msg_ref = (uint64_t)msg_var.inner;
7676 if (msg_var.is_owned) {
7679 js_invoke_function_2(j_calls->instance_ptr, 63, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7681 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7682 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7683 int8_tArray their_node_id_arr = init_int8_tArray(33);
7684 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7685 LDKErrorMessage msg_var = *msg;
7686 uint64_t msg_ref = 0;
7687 msg_var = ErrorMessage_clone(msg);
7688 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7689 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7690 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7691 msg_ref = (uint64_t)msg_var.inner;
7692 if (msg_var.is_owned) {
7695 js_invoke_function_2(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7697 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
7698 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
7699 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7700 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7702 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
7703 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7704 atomic_init(&calls->refcnt, 1);
7705 calls->instance_ptr = o;
7707 LDKChannelMessageHandler ret = {
7708 .this_arg = (void*) calls,
7709 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7710 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7711 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7712 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7713 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7714 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7715 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7716 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7717 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7718 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7719 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7720 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7721 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7722 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7723 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7724 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7725 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7726 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7727 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7728 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7729 .free = LDKChannelMessageHandler_JCalls_free,
7730 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
7732 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7735 long __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
7736 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7737 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
7738 return (long)res_ptr;
7740 void __attribute__((export_name("TS_ChannelMessageHandler_handle_open_channel"))) TS_ChannelMessageHandler_handle_open_channel(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
7741 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7742 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7743 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7744 LDKPublicKey their_node_id_ref;
7745 CHECK(their_node_id->arr_len == 33);
7746 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7747 LDKInitFeatures their_features_conv;
7748 their_features_conv.inner = (void*)(their_features & (~1));
7749 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7750 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
7751 their_features_conv = InitFeatures_clone(&their_features_conv);
7752 LDKOpenChannel msg_conv;
7753 msg_conv.inner = (void*)(msg & (~1));
7754 msg_conv.is_owned = false;
7755 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7756 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7759 void __attribute__((export_name("TS_ChannelMessageHandler_handle_accept_channel"))) TS_ChannelMessageHandler_handle_accept_channel(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
7760 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7761 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7762 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7763 LDKPublicKey their_node_id_ref;
7764 CHECK(their_node_id->arr_len == 33);
7765 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7766 LDKInitFeatures their_features_conv;
7767 their_features_conv.inner = (void*)(their_features & (~1));
7768 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7769 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
7770 their_features_conv = InitFeatures_clone(&their_features_conv);
7771 LDKAcceptChannel msg_conv;
7772 msg_conv.inner = (void*)(msg & (~1));
7773 msg_conv.is_owned = false;
7774 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7775 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7778 void __attribute__((export_name("TS_ChannelMessageHandler_handle_funding_created"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7779 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7780 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7781 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7782 LDKPublicKey their_node_id_ref;
7783 CHECK(their_node_id->arr_len == 33);
7784 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7785 LDKFundingCreated msg_conv;
7786 msg_conv.inner = (void*)(msg & (~1));
7787 msg_conv.is_owned = false;
7788 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7789 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7792 void __attribute__((export_name("TS_ChannelMessageHandler_handle_funding_signed"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7793 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7794 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7795 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7796 LDKPublicKey their_node_id_ref;
7797 CHECK(their_node_id->arr_len == 33);
7798 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7799 LDKFundingSigned msg_conv;
7800 msg_conv.inner = (void*)(msg & (~1));
7801 msg_conv.is_owned = false;
7802 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7803 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7806 void __attribute__((export_name("TS_ChannelMessageHandler_handle_funding_locked"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7807 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7808 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7809 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7810 LDKPublicKey their_node_id_ref;
7811 CHECK(their_node_id->arr_len == 33);
7812 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7813 LDKFundingLocked msg_conv;
7814 msg_conv.inner = (void*)(msg & (~1));
7815 msg_conv.is_owned = false;
7816 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7817 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7820 void __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
7821 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7822 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7823 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7824 LDKPublicKey their_node_id_ref;
7825 CHECK(their_node_id->arr_len == 33);
7826 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7827 LDKInitFeatures their_features_conv;
7828 their_features_conv.inner = (void*)(their_features & (~1));
7829 their_features_conv.is_owned = false;
7830 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
7831 LDKShutdown msg_conv;
7832 msg_conv.inner = (void*)(msg & (~1));
7833 msg_conv.is_owned = false;
7834 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7835 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
7838 void __attribute__((export_name("TS_ChannelMessageHandler_handle_closing_signed"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7839 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7840 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7841 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7842 LDKPublicKey their_node_id_ref;
7843 CHECK(their_node_id->arr_len == 33);
7844 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7845 LDKClosingSigned msg_conv;
7846 msg_conv.inner = (void*)(msg & (~1));
7847 msg_conv.is_owned = false;
7848 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7849 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7852 void __attribute__((export_name("TS_ChannelMessageHandler_handle_update_add_htlc"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7853 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7854 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7855 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7856 LDKPublicKey their_node_id_ref;
7857 CHECK(their_node_id->arr_len == 33);
7858 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7859 LDKUpdateAddHTLC msg_conv;
7860 msg_conv.inner = (void*)(msg & (~1));
7861 msg_conv.is_owned = false;
7862 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7863 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7866 void __attribute__((export_name("TS_ChannelMessageHandler_handle_update_fulfill_htlc"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7867 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7868 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7869 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7870 LDKPublicKey their_node_id_ref;
7871 CHECK(their_node_id->arr_len == 33);
7872 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7873 LDKUpdateFulfillHTLC msg_conv;
7874 msg_conv.inner = (void*)(msg & (~1));
7875 msg_conv.is_owned = false;
7876 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7877 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7880 void __attribute__((export_name("TS_ChannelMessageHandler_handle_update_fail_htlc"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7881 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7882 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7883 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7884 LDKPublicKey their_node_id_ref;
7885 CHECK(their_node_id->arr_len == 33);
7886 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7887 LDKUpdateFailHTLC msg_conv;
7888 msg_conv.inner = (void*)(msg & (~1));
7889 msg_conv.is_owned = false;
7890 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7891 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7894 void __attribute__((export_name("TS_ChannelMessageHandler_handle_update_fail_malformed_htlc"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7895 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7896 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7897 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7898 LDKPublicKey their_node_id_ref;
7899 CHECK(their_node_id->arr_len == 33);
7900 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7901 LDKUpdateFailMalformedHTLC msg_conv;
7902 msg_conv.inner = (void*)(msg & (~1));
7903 msg_conv.is_owned = false;
7904 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7905 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7908 void __attribute__((export_name("TS_ChannelMessageHandler_handle_commitment_signed"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7909 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7910 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7911 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7912 LDKPublicKey their_node_id_ref;
7913 CHECK(their_node_id->arr_len == 33);
7914 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7915 LDKCommitmentSigned msg_conv;
7916 msg_conv.inner = (void*)(msg & (~1));
7917 msg_conv.is_owned = false;
7918 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7919 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7922 void __attribute__((export_name("TS_ChannelMessageHandler_handle_revoke_and_ack"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7923 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7924 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7925 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7926 LDKPublicKey their_node_id_ref;
7927 CHECK(their_node_id->arr_len == 33);
7928 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7929 LDKRevokeAndACK msg_conv;
7930 msg_conv.inner = (void*)(msg & (~1));
7931 msg_conv.is_owned = false;
7932 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7933 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7936 void __attribute__((export_name("TS_ChannelMessageHandler_handle_update_fee"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7937 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7938 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7939 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7940 LDKPublicKey their_node_id_ref;
7941 CHECK(their_node_id->arr_len == 33);
7942 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7943 LDKUpdateFee msg_conv;
7944 msg_conv.inner = (void*)(msg & (~1));
7945 msg_conv.is_owned = false;
7946 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7947 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7950 void __attribute__((export_name("TS_ChannelMessageHandler_handle_announcement_signatures"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7951 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7952 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7953 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7954 LDKPublicKey their_node_id_ref;
7955 CHECK(their_node_id->arr_len == 33);
7956 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7957 LDKAnnouncementSignatures msg_conv;
7958 msg_conv.inner = (void*)(msg & (~1));
7959 msg_conv.is_owned = false;
7960 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7961 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7964 void __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
7965 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7966 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7967 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7968 LDKPublicKey their_node_id_ref;
7969 CHECK(their_node_id->arr_len == 33);
7970 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7971 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
7974 void __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7975 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7976 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7977 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7978 LDKPublicKey their_node_id_ref;
7979 CHECK(their_node_id->arr_len == 33);
7980 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7982 msg_conv.inner = (void*)(msg & (~1));
7983 msg_conv.is_owned = false;
7984 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7985 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7988 void __attribute__((export_name("TS_ChannelMessageHandler_handle_channel_reestablish"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7989 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7990 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7991 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7992 LDKPublicKey their_node_id_ref;
7993 CHECK(their_node_id->arr_len == 33);
7994 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7995 LDKChannelReestablish msg_conv;
7996 msg_conv.inner = (void*)(msg & (~1));
7997 msg_conv.is_owned = false;
7998 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7999 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8002 void __attribute__((export_name("TS_ChannelMessageHandler_handle_channel_update"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8003 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8004 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8005 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8006 LDKPublicKey their_node_id_ref;
8007 CHECK(their_node_id->arr_len == 33);
8008 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8009 LDKChannelUpdate msg_conv;
8010 msg_conv.inner = (void*)(msg & (~1));
8011 msg_conv.is_owned = false;
8012 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8013 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8016 void __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8017 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8018 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8019 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8020 LDKPublicKey their_node_id_ref;
8021 CHECK(their_node_id->arr_len == 33);
8022 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8023 LDKErrorMessage msg_conv;
8024 msg_conv.inner = (void*)(msg & (~1));
8025 msg_conv.is_owned = false;
8026 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8027 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8030 typedef struct LDKRoutingMessageHandler_JCalls {
8031 atomic_size_t refcnt;
8032 uint32_t instance_ptr;
8033 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8034 } LDKRoutingMessageHandler_JCalls;
8035 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
8036 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8037 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8041 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
8042 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8043 LDKNodeAnnouncement msg_var = *msg;
8044 uint64_t msg_ref = 0;
8045 msg_var = NodeAnnouncement_clone(msg);
8046 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8047 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8048 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8049 msg_ref = (uint64_t)msg_var.inner;
8050 if (msg_var.is_owned) {
8053 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 65, (uint32_t)msg_ref);
8054 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8055 CHECK_ACCESS(ret_ptr);
8056 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
8060 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
8061 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8062 LDKChannelAnnouncement msg_var = *msg;
8063 uint64_t msg_ref = 0;
8064 msg_var = ChannelAnnouncement_clone(msg);
8065 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8066 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8067 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8068 msg_ref = (uint64_t)msg_var.inner;
8069 if (msg_var.is_owned) {
8072 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 66, (uint32_t)msg_ref);
8073 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8074 CHECK_ACCESS(ret_ptr);
8075 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
8079 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
8080 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8081 LDKChannelUpdate msg_var = *msg;
8082 uint64_t msg_ref = 0;
8083 msg_var = ChannelUpdate_clone(msg);
8084 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8085 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8086 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8087 msg_ref = (uint64_t)msg_var.inner;
8088 if (msg_var.is_owned) {
8091 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 67, (uint32_t)msg_ref);
8092 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8093 CHECK_ACCESS(ret_ptr);
8094 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
8098 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
8099 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8100 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->instance_ptr, 68, (uint32_t)starting_point, (uint32_t)batch_amount);
8101 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
8102 ret_constr.datalen = ret->arr_len;
8103 if (ret_constr.datalen > 0)
8104 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
8106 ret_constr.data = NULL;
8107 uint32_t* ret_vals = ret->elems;
8108 for (size_t h = 0; h < ret_constr.datalen; h++) {
8109 uint32_t ret_conv_59 = ret_vals[h];
8110 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
8111 CHECK_ACCESS(ret_conv_59_ptr);
8112 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
8113 FREE((void*)ret_conv_59);
8114 ret_constr.data[h] = ret_conv_59_conv;
8118 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
8119 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8120 int8_tArray starting_point_arr = init_int8_tArray(33);
8121 memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
8122 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->instance_ptr, 69, (uint32_t)starting_point_arr, (uint32_t)batch_amount);
8123 LDKCVec_NodeAnnouncementZ ret_constr;
8124 ret_constr.datalen = ret->arr_len;
8125 if (ret_constr.datalen > 0)
8126 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
8128 ret_constr.data = NULL;
8129 uint32_t* ret_vals = ret->elems;
8130 for (size_t s = 0; s < ret_constr.datalen; s++) {
8131 uint32_t ret_conv_18 = ret_vals[s];
8132 LDKNodeAnnouncement ret_conv_18_conv;
8133 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
8134 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
8135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
8136 ret_constr.data[s] = ret_conv_18_conv;
8140 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
8141 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8142 int8_tArray their_node_id_arr = init_int8_tArray(33);
8143 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8144 LDKInit init_var = *init;
8145 uint64_t init_ref = 0;
8146 init_var = Init_clone(init);
8147 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8148 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8149 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
8150 init_ref = (uint64_t)init_var.inner;
8151 if (init_var.is_owned) {
8154 js_invoke_function_2(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, (uint32_t)init_ref);
8156 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
8157 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8158 int8_tArray their_node_id_arr = init_int8_tArray(33);
8159 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8160 LDKReplyChannelRange msg_var = msg;
8161 uint64_t msg_ref = 0;
8162 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8163 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8164 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8165 msg_ref = (uint64_t)msg_var.inner;
8166 if (msg_var.is_owned) {
8169 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8170 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8171 CHECK_ACCESS(ret_ptr);
8172 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
8176 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
8177 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8178 int8_tArray their_node_id_arr = init_int8_tArray(33);
8179 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8180 LDKReplyShortChannelIdsEnd msg_var = msg;
8181 uint64_t msg_ref = 0;
8182 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8183 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8184 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8185 msg_ref = (uint64_t)msg_var.inner;
8186 if (msg_var.is_owned) {
8189 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8190 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8191 CHECK_ACCESS(ret_ptr);
8192 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
8196 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
8197 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8198 int8_tArray their_node_id_arr = init_int8_tArray(33);
8199 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8200 LDKQueryChannelRange msg_var = msg;
8201 uint64_t msg_ref = 0;
8202 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8203 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8204 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8205 msg_ref = (uint64_t)msg_var.inner;
8206 if (msg_var.is_owned) {
8209 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8210 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8211 CHECK_ACCESS(ret_ptr);
8212 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
8216 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
8217 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8218 int8_tArray their_node_id_arr = init_int8_tArray(33);
8219 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8220 LDKQueryShortChannelIds msg_var = msg;
8221 uint64_t msg_ref = 0;
8222 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8223 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8224 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8225 msg_ref = (uint64_t)msg_var.inner;
8226 if (msg_var.is_owned) {
8229 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8230 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8231 CHECK_ACCESS(ret_ptr);
8232 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
8236 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
8237 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
8238 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8239 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8241 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
8242 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
8243 atomic_init(&calls->refcnt, 1);
8244 calls->instance_ptr = o;
8246 LDKRoutingMessageHandler ret = {
8247 .this_arg = (void*) calls,
8248 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
8249 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
8250 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
8251 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
8252 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
8253 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
8254 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
8255 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
8256 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
8257 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
8258 .free = LDKRoutingMessageHandler_JCalls_free,
8259 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
8261 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8264 long __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
8265 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
8266 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
8267 return (long)res_ptr;
8269 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
8270 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8271 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8272 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8273 LDKNodeAnnouncement msg_conv;
8274 msg_conv.inner = (void*)(msg & (~1));
8275 msg_conv.is_owned = false;
8276 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8277 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8278 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
8279 return (uint64_t)ret_conv;
8282 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
8283 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8284 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8285 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8286 LDKChannelAnnouncement msg_conv;
8287 msg_conv.inner = (void*)(msg & (~1));
8288 msg_conv.is_owned = false;
8289 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8290 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8291 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
8292 return (uint64_t)ret_conv;
8295 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
8296 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8297 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8298 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8299 LDKChannelUpdate msg_conv;
8300 msg_conv.inner = (void*)(msg & (~1));
8301 msg_conv.is_owned = false;
8302 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8303 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8304 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
8305 return (uint64_t)ret_conv;
8308 uint32_tArray __attribute__((export_name("TS_RoutingMessageHandler_get_next_channel_announcements"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
8309 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8310 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8311 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8312 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
8313 uint32_tArray ret_arr = NULL;
8314 ret_arr = init_uint32_tArray(ret_var.datalen);
8315 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
8316 for (size_t h = 0; h < ret_var.datalen; h++) {
8317 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
8318 *ret_conv_59_conv = ret_var.data[h];
8319 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
8326 uint32_tArray __attribute__((export_name("TS_RoutingMessageHandler_get_next_node_announcements"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
8327 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8328 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8329 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8330 LDKPublicKey starting_point_ref;
8331 CHECK(starting_point->arr_len == 33);
8332 memcpy(starting_point_ref.compressed_form, starting_point->elems, 33);
8333 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8334 uint32_tArray ret_arr = NULL;
8335 ret_arr = init_uint32_tArray(ret_var.datalen);
8336 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
8337 for (size_t s = 0; s < ret_var.datalen; s++) {
8338 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8339 uint64_t ret_conv_18_ref = 0;
8340 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8341 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8342 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
8343 ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8344 if (ret_conv_18_var.is_owned) {
8345 ret_conv_18_ref |= 1;
8347 ret_arr_ptr[s] = ret_conv_18_ref;
8354 void __attribute__((export_name("TS_RoutingMessageHandler_sync_routing_table"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
8355 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8356 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8357 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8358 LDKPublicKey their_node_id_ref;
8359 CHECK(their_node_id->arr_len == 33);
8360 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8362 init_conv.inner = (void*)(init & (~1));
8363 init_conv.is_owned = false;
8364 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
8365 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8368 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_reply_channel_range"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8369 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8370 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8371 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8372 LDKPublicKey their_node_id_ref;
8373 CHECK(their_node_id->arr_len == 33);
8374 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8375 LDKReplyChannelRange msg_conv;
8376 msg_conv.inner = (void*)(msg & (~1));
8377 msg_conv.is_owned = (msg & 1) || (msg == 0);
8378 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8379 msg_conv = ReplyChannelRange_clone(&msg_conv);
8380 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8381 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8382 return (uint64_t)ret_conv;
8385 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_reply_short_channel_ids_end"))) TS_RoutingMessageHandler_handle_reply_short_channel_ids_end(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8386 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8387 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8388 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8389 LDKPublicKey their_node_id_ref;
8390 CHECK(their_node_id->arr_len == 33);
8391 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8392 LDKReplyShortChannelIdsEnd msg_conv;
8393 msg_conv.inner = (void*)(msg & (~1));
8394 msg_conv.is_owned = (msg & 1) || (msg == 0);
8395 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8396 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8397 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8398 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8399 return (uint64_t)ret_conv;
8402 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_query_channel_range"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8403 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8404 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8405 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8406 LDKPublicKey their_node_id_ref;
8407 CHECK(their_node_id->arr_len == 33);
8408 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8409 LDKQueryChannelRange msg_conv;
8410 msg_conv.inner = (void*)(msg & (~1));
8411 msg_conv.is_owned = (msg & 1) || (msg == 0);
8412 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8413 msg_conv = QueryChannelRange_clone(&msg_conv);
8414 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8415 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8416 return (uint64_t)ret_conv;
8419 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_query_short_channel_ids"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8420 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8421 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8422 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8423 LDKPublicKey their_node_id_ref;
8424 CHECK(their_node_id->arr_len == 33);
8425 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8426 LDKQueryShortChannelIds msg_conv;
8427 msg_conv.inner = (void*)(msg & (~1));
8428 msg_conv.is_owned = (msg & 1) || (msg == 0);
8429 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8430 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8431 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8432 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8433 return (uint64_t)ret_conv;
8436 typedef struct LDKCustomMessageReader_JCalls {
8437 atomic_size_t refcnt;
8438 uint32_t instance_ptr;
8439 } LDKCustomMessageReader_JCalls;
8440 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
8441 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
8442 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8446 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
8447 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
8448 LDKu8slice buffer_var = buffer;
8449 int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen);
8450 memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
8451 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 75, (uint32_t)message_type, (uint32_t)buffer_arr);
8452 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8453 CHECK_ACCESS(ret_ptr);
8454 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
8458 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
8459 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
8460 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8462 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
8463 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
8464 atomic_init(&calls->refcnt, 1);
8465 calls->instance_ptr = o;
8467 LDKCustomMessageReader ret = {
8468 .this_arg = (void*) calls,
8469 .read = read_LDKCustomMessageReader_jcall,
8470 .free = LDKCustomMessageReader_JCalls_free,
8474 long __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
8475 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
8476 *res_ptr = LDKCustomMessageReader_init(o);
8477 return (long)res_ptr;
8479 uint32_t __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
8480 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8481 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8482 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
8483 LDKu8slice buffer_ref;
8484 buffer_ref.datalen = buffer->arr_len;
8485 buffer_ref.data = buffer->elems;
8486 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
8487 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
8488 return (uint64_t)ret_conv;
8491 typedef struct LDKCustomMessageHandler_JCalls {
8492 atomic_size_t refcnt;
8493 uint32_t instance_ptr;
8494 LDKCustomMessageReader_JCalls* CustomMessageReader;
8495 } LDKCustomMessageHandler_JCalls;
8496 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
8497 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
8498 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8502 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
8503 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
8504 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
8506 int8_tArray sender_node_id_arr = init_int8_tArray(33);
8507 memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
8508 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 76, (uint32_t)(uint64_t)msg_ret, (uint32_t)sender_node_id_arr);
8509 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8510 CHECK_ACCESS(ret_ptr);
8511 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
8515 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
8516 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
8517 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 77);
8518 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
8519 ret_constr.datalen = ret->arr_len;
8520 if (ret_constr.datalen > 0)
8521 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
8523 ret_constr.data = NULL;
8524 uint32_t* ret_vals = ret->elems;
8525 for (size_t z = 0; z < ret_constr.datalen; z++) {
8526 uint32_t ret_conv_25 = ret_vals[z];
8527 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
8528 CHECK_ACCESS(ret_conv_25_ptr);
8529 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
8530 FREE((void*)ret_conv_25);
8531 ret_constr.data[z] = ret_conv_25_conv;
8535 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
8536 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
8537 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8538 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
8540 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
8541 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
8542 atomic_init(&calls->refcnt, 1);
8543 calls->instance_ptr = o;
8545 LDKCustomMessageHandler ret = {
8546 .this_arg = (void*) calls,
8547 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
8548 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
8549 .free = LDKCustomMessageHandler_JCalls_free,
8550 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
8552 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
8555 long __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
8556 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
8557 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
8558 return (long)res_ptr;
8560 uint32_t __attribute__((export_name("TS_CustomMessageHandler_handle_custom_message"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
8561 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8562 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8563 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
8564 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
8565 CHECK_ACCESS(msg_ptr);
8566 LDKType msg_conv = *(LDKType*)(msg_ptr);
8567 LDKPublicKey sender_node_id_ref;
8568 CHECK(sender_node_id->arr_len == 33);
8569 memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33);
8570 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8571 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
8572 return (uint64_t)ret_conv;
8575 uint32_tArray __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
8576 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8577 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8578 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
8579 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
8580 uint32_tArray ret_arr = NULL;
8581 ret_arr = init_uint32_tArray(ret_var.datalen);
8582 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
8583 for (size_t z = 0; z < ret_var.datalen; z++) {
8584 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
8585 *ret_conv_25_conv = ret_var.data[z];
8586 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
8593 typedef struct LDKSocketDescriptor_JCalls {
8594 atomic_size_t refcnt;
8595 uint32_t instance_ptr;
8596 } LDKSocketDescriptor_JCalls;
8597 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8598 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8599 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8603 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8604 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8605 LDKu8slice data_var = data;
8606 int8_tArray data_arr = init_int8_tArray(data_var.datalen);
8607 memcpy(data_arr->elems, data_var.data, data_var.datalen);
8608 return js_invoke_function_2(j_calls->instance_ptr, 78, (uint32_t)data_arr, (uint32_t)resume_read);
8610 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8611 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8612 js_invoke_function_0(j_calls->instance_ptr, 79);
8614 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8615 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8616 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8617 *other_arg_clone = SocketDescriptor_clone(other_arg);
8618 return js_invoke_function_1(j_calls->instance_ptr, 80, (uint32_t)(uint64_t)other_arg_clone);
8620 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8621 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8622 return js_invoke_function_0(j_calls->instance_ptr, 81);
8624 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
8625 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
8626 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8628 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
8629 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8630 atomic_init(&calls->refcnt, 1);
8631 calls->instance_ptr = o;
8633 LDKSocketDescriptor ret = {
8634 .this_arg = (void*) calls,
8635 .send_data = send_data_LDKSocketDescriptor_jcall,
8636 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8637 .eq = eq_LDKSocketDescriptor_jcall,
8638 .hash = hash_LDKSocketDescriptor_jcall,
8639 .cloned = LDKSocketDescriptor_JCalls_cloned,
8640 .free = LDKSocketDescriptor_JCalls_free,
8644 long __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
8645 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8646 *res_ptr = LDKSocketDescriptor_init(o);
8647 return (long)res_ptr;
8649 int64_t __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
8650 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8651 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8652 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
8653 LDKu8slice data_ref;
8654 data_ref.datalen = data->arr_len;
8655 data_ref.data = data->elems;
8656 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8660 void __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
8661 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8662 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8663 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
8664 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8667 int64_t __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
8668 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8669 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8670 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
8671 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8675 typedef struct LDKScore_JCalls {
8676 atomic_size_t refcnt;
8677 uint32_t instance_ptr;
8679 static void LDKScore_JCalls_free(void* this_arg) {
8680 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8681 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8685 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, LDKCOption_u64Z channel_capacity_msat, const LDKNodeId * source, const LDKNodeId * target) {
8686 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8687 LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8688 *channel_capacity_msat_copy = channel_capacity_msat;
8689 uint64_t channel_capacity_msat_ref = (uint64_t)channel_capacity_msat_copy;
8690 LDKNodeId source_var = *source;
8691 uint64_t source_ref = 0;
8692 source_var = NodeId_clone(source);
8693 CHECK((((uint64_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8694 CHECK((((uint64_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8695 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8696 source_ref = (uint64_t)source_var.inner;
8697 if (source_var.is_owned) {
8700 LDKNodeId target_var = *target;
8701 uint64_t target_ref = 0;
8702 target_var = NodeId_clone(target);
8703 CHECK((((uint64_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8704 CHECK((((uint64_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8705 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8706 target_ref = (uint64_t)target_var.inner;
8707 if (target_var.is_owned) {
8710 return js_invoke_function_5(j_calls->instance_ptr, 82, (uint32_t)short_channel_id, (uint32_t)send_amt_msat, (uint32_t)channel_capacity_msat_ref, (uint32_t)source_ref, (uint32_t)target_ref);
8712 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8713 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8714 LDKCVec_RouteHopZ path_var = path;
8715 uint32_tArray path_arr = NULL;
8716 path_arr = init_uint32_tArray(path_var.datalen);
8717 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8718 for (size_t k = 0; k < path_var.datalen; k++) {
8719 LDKRouteHop path_conv_10_var = path_var.data[k];
8720 uint64_t path_conv_10_ref = 0;
8721 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8722 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8723 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8724 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
8725 if (path_conv_10_var.is_owned) {
8726 path_conv_10_ref |= 1;
8728 path_arr_ptr[k] = path_conv_10_ref;
8731 FREE(path_var.data);
8732 js_invoke_function_2(j_calls->instance_ptr, 83, (uint32_t)path_arr, (uint32_t)short_channel_id);
8734 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8735 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8736 LDKCVec_RouteHopZ path_var = path;
8737 uint32_tArray path_arr = NULL;
8738 path_arr = init_uint32_tArray(path_var.datalen);
8739 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8740 for (size_t k = 0; k < path_var.datalen; k++) {
8741 LDKRouteHop path_conv_10_var = path_var.data[k];
8742 uint64_t path_conv_10_ref = 0;
8743 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8744 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8745 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8746 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
8747 if (path_conv_10_var.is_owned) {
8748 path_conv_10_ref |= 1;
8750 path_arr_ptr[k] = path_conv_10_ref;
8753 FREE(path_var.data);
8754 js_invoke_function_1(j_calls->instance_ptr, 84, (uint32_t)path_arr);
8756 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8757 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8758 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 85);
8759 LDKCVec_u8Z ret_ref;
8760 ret_ref.datalen = ret->arr_len;
8761 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8762 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
8765 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8766 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8767 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8769 static inline LDKScore LDKScore_init (JSValue o) {
8770 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8771 atomic_init(&calls->refcnt, 1);
8772 calls->instance_ptr = o;
8775 .this_arg = (void*) calls,
8776 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8777 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8778 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8779 .write = write_LDKScore_jcall,
8780 .free = LDKScore_JCalls_free,
8784 long __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
8785 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8786 *res_ptr = LDKScore_init(o);
8787 return (long)res_ptr;
8789 int64_t __attribute__((export_name("TS_Score_channel_penalty_msat"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, uint32_t channel_capacity_msat, uint32_t source, uint32_t target) {
8790 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8791 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8792 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8793 void* channel_capacity_msat_ptr = (void*)(((uint64_t)channel_capacity_msat) & ~1);
8794 CHECK_ACCESS(channel_capacity_msat_ptr);
8795 LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr);
8796 channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)channel_capacity_msat) & ~1));
8797 LDKNodeId source_conv;
8798 source_conv.inner = (void*)(source & (~1));
8799 source_conv.is_owned = false;
8800 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8801 LDKNodeId target_conv;
8802 target_conv.inner = (void*)(target & (~1));
8803 target_conv.is_owned = false;
8804 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8805 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, channel_capacity_msat_conv, &source_conv, &target_conv);
8809 void __attribute__((export_name("TS_Score_payment_path_failed"))) TS_Score_payment_path_failed(uint32_t this_arg, uint32_tArray path, int64_t short_channel_id) {
8810 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8811 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8812 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8813 LDKCVec_RouteHopZ path_constr;
8814 path_constr.datalen = path->arr_len;
8815 if (path_constr.datalen > 0)
8816 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8818 path_constr.data = NULL;
8819 uint32_t* path_vals = path->elems;
8820 for (size_t k = 0; k < path_constr.datalen; k++) {
8821 uint32_t path_conv_10 = path_vals[k];
8822 LDKRouteHop path_conv_10_conv;
8823 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8824 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8825 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8826 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8827 path_constr.data[k] = path_conv_10_conv;
8829 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8832 void __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) {
8833 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8834 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8835 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8836 LDKCVec_RouteHopZ path_constr;
8837 path_constr.datalen = path->arr_len;
8838 if (path_constr.datalen > 0)
8839 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8841 path_constr.data = NULL;
8842 uint32_t* path_vals = path->elems;
8843 for (size_t k = 0; k < path_constr.datalen; k++) {
8844 uint32_t path_conv_10 = path_vals[k];
8845 LDKRouteHop path_conv_10_conv;
8846 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8847 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8848 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8849 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8850 path_constr.data[k] = path_conv_10_conv;
8852 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8855 int8_tArray __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint32_t this_arg) {
8856 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8857 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8858 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8859 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8860 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
8861 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8862 CVec_u8Z_free(ret_var);
8866 typedef struct LDKLockableScore_JCalls {
8867 atomic_size_t refcnt;
8868 uint32_t instance_ptr;
8869 } LDKLockableScore_JCalls;
8870 static void LDKLockableScore_JCalls_free(void* this_arg) {
8871 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8872 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8876 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
8877 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8878 uint32_t ret = js_invoke_function_0(j_calls->instance_ptr, 86);
8879 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8880 CHECK_ACCESS(ret_ptr);
8881 LDKScore ret_conv = *(LDKScore*)(ret_ptr);// Warning: we may need a move here but no clone is available for LDKScore
8885 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
8886 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
8887 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8889 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
8890 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
8891 atomic_init(&calls->refcnt, 1);
8892 calls->instance_ptr = o;
8894 LDKLockableScore ret = {
8895 .this_arg = (void*) calls,
8896 .lock = lock_LDKLockableScore_jcall,
8897 .free = LDKLockableScore_JCalls_free,
8901 long __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
8902 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
8903 *res_ptr = LDKLockableScore_init(o);
8904 return (long)res_ptr;
8906 uint32_t __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint32_t this_arg) {
8907 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8908 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8909 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
8910 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
8911 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
8912 return (uint64_t)ret_ret;
8915 jstring __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
8916 LDKStr ret_str = _ldk_get_compiled_version();
8917 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8922 jstring __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
8923 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
8924 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8929 void __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
8930 LDKTransaction _res_ref;
8931 _res_ref.datalen = _res->arr_len;
8932 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
8933 memcpy(_res_ref.data, _res->elems, _res_ref.datalen);
8934 _res_ref.data_is_owned = true;
8935 Transaction_free(_res_ref);
8938 uint32_t __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
8939 LDKCVec_u8Z script_pubkey_ref;
8940 script_pubkey_ref.datalen = script_pubkey->arr_len;
8941 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
8942 memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen);
8943 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8944 *ret_ref = TxOut_new(script_pubkey_ref, value);
8945 return (uint64_t)ret_ref;
8948 void __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint32_t _res) {
8949 if ((_res & 1) != 0) return;
8950 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8951 CHECK_ACCESS(_res_ptr);
8952 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
8954 TxOut_free(_res_conv);
8957 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
8958 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8959 *ret_ref = TxOut_clone(arg);
8960 return (uint64_t)ret_ref;
8962 int64_t __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint32_t arg) {
8963 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
8964 int64_t ret_val = TxOut_clone_ptr(arg_conv);
8968 uint32_t __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint32_t orig) {
8969 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
8970 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8971 *ret_ref = TxOut_clone(orig_conv);
8972 return (uint64_t)ret_ref;
8975 void __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
8976 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
8980 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
8981 LDKChannelConfig o_conv;
8982 o_conv.inner = (void*)(o & (~1));
8983 o_conv.is_owned = (o & 1) || (o == 0);
8984 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8985 o_conv = ChannelConfig_clone(&o_conv);
8986 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8987 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
8988 return (uint64_t)ret_conv;
8991 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
8992 LDKDecodeError e_conv;
8993 e_conv.inner = (void*)(e & (~1));
8994 e_conv.is_owned = (e & 1) || (e == 0);
8995 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8996 e_conv = DecodeError_clone(&e_conv);
8997 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8998 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
8999 return (uint64_t)ret_conv;
9002 jboolean __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
9003 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
9004 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
9008 void __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
9009 if ((_res & 1) != 0) return;
9010 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9011 CHECK_ACCESS(_res_ptr);
9012 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
9014 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
9017 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
9018 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9019 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
9020 return (uint64_t)ret_conv;
9022 int64_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
9023 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
9024 int64_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
9028 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
9029 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
9030 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9031 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
9032 return (uint64_t)ret_conv;
9035 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
9037 o_conv.inner = (void*)(o & (~1));
9038 o_conv.is_owned = (o & 1) || (o == 0);
9039 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9040 o_conv = OutPoint_clone(&o_conv);
9041 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9042 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
9043 return (uint64_t)ret_conv;
9046 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
9047 LDKDecodeError e_conv;
9048 e_conv.inner = (void*)(e & (~1));
9049 e_conv.is_owned = (e & 1) || (e == 0);
9050 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9051 e_conv = DecodeError_clone(&e_conv);
9052 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9053 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
9054 return (uint64_t)ret_conv;
9057 jboolean __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
9058 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
9059 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
9063 void __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
9064 if ((_res & 1) != 0) return;
9065 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9066 CHECK_ACCESS(_res_ptr);
9067 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
9069 CResult_OutPointDecodeErrorZ_free(_res_conv);
9072 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
9073 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9074 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
9075 return (uint64_t)ret_conv;
9077 int64_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
9078 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
9079 int64_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
9083 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
9084 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
9085 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9086 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
9087 return (uint64_t)ret_conv;
9090 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
9092 CHECK(o->arr_len == 32);
9093 memcpy(o_ref.bytes, o->elems, 32);
9094 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
9095 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
9096 return (uint64_t)ret_conv;
9099 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
9100 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9101 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
9102 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
9103 return (uint64_t)ret_conv;
9106 jboolean __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
9107 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
9108 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
9112 void __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
9113 if ((_res & 1) != 0) return;
9114 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9115 CHECK_ACCESS(_res_ptr);
9116 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
9118 CResult_SecretKeyErrorZ_free(_res_conv);
9121 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
9123 CHECK(o->arr_len == 33);
9124 memcpy(o_ref.compressed_form, o->elems, 33);
9125 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9126 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
9127 return (uint64_t)ret_conv;
9130 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
9131 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9132 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9133 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
9134 return (uint64_t)ret_conv;
9137 jboolean __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
9138 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
9139 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
9143 void __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
9144 if ((_res & 1) != 0) return;
9145 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9146 CHECK_ACCESS(_res_ptr);
9147 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
9149 CResult_PublicKeyErrorZ_free(_res_conv);
9152 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
9153 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9154 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
9155 return (uint64_t)ret_conv;
9157 int64_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
9158 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
9159 int64_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
9163 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
9164 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
9165 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9166 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
9167 return (uint64_t)ret_conv;
9170 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
9171 LDKTxCreationKeys o_conv;
9172 o_conv.inner = (void*)(o & (~1));
9173 o_conv.is_owned = (o & 1) || (o == 0);
9174 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9175 o_conv = TxCreationKeys_clone(&o_conv);
9176 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9177 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
9178 return (uint64_t)ret_conv;
9181 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
9182 LDKDecodeError e_conv;
9183 e_conv.inner = (void*)(e & (~1));
9184 e_conv.is_owned = (e & 1) || (e == 0);
9185 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9186 e_conv = DecodeError_clone(&e_conv);
9187 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9188 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
9189 return (uint64_t)ret_conv;
9192 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
9193 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
9194 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
9198 void __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
9199 if ((_res & 1) != 0) return;
9200 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9201 CHECK_ACCESS(_res_ptr);
9202 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
9204 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
9207 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
9208 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9209 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
9210 return (uint64_t)ret_conv;
9212 int64_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
9213 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
9214 int64_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
9218 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
9219 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
9220 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9221 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
9222 return (uint64_t)ret_conv;
9225 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
9226 LDKChannelPublicKeys o_conv;
9227 o_conv.inner = (void*)(o & (~1));
9228 o_conv.is_owned = (o & 1) || (o == 0);
9229 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9230 o_conv = ChannelPublicKeys_clone(&o_conv);
9231 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9232 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
9233 return (uint64_t)ret_conv;
9236 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
9237 LDKDecodeError e_conv;
9238 e_conv.inner = (void*)(e & (~1));
9239 e_conv.is_owned = (e & 1) || (e == 0);
9240 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9241 e_conv = DecodeError_clone(&e_conv);
9242 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9243 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
9244 return (uint64_t)ret_conv;
9247 jboolean __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
9248 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
9249 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
9253 void __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
9254 if ((_res & 1) != 0) return;
9255 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9256 CHECK_ACCESS(_res_ptr);
9257 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
9259 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
9262 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
9263 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9264 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
9265 return (uint64_t)ret_conv;
9267 int64_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
9268 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
9269 int64_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
9273 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
9274 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
9275 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9276 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
9277 return (uint64_t)ret_conv;
9280 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
9281 LDKTxCreationKeys o_conv;
9282 o_conv.inner = (void*)(o & (~1));
9283 o_conv.is_owned = (o & 1) || (o == 0);
9284 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9285 o_conv = TxCreationKeys_clone(&o_conv);
9286 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9287 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
9288 return (uint64_t)ret_conv;
9291 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
9292 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9293 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9294 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
9295 return (uint64_t)ret_conv;
9298 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
9299 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
9300 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
9304 void __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
9305 if ((_res & 1) != 0) return;
9306 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9307 CHECK_ACCESS(_res_ptr);
9308 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
9310 CResult_TxCreationKeysErrorZ_free(_res_conv);
9313 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
9314 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9315 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
9316 return (uint64_t)ret_conv;
9318 int64_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
9319 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
9320 int64_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
9324 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
9325 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
9326 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9327 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
9328 return (uint64_t)ret_conv;
9331 uint32_t __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
9332 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9333 *ret_copy = COption_u32Z_some(o);
9334 uint64_t ret_ref = (uint64_t)ret_copy;
9338 uint32_t __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
9339 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9340 *ret_copy = COption_u32Z_none();
9341 uint64_t ret_ref = (uint64_t)ret_copy;
9345 void __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint32_t _res) {
9346 if ((_res & 1) != 0) return;
9347 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9348 CHECK_ACCESS(_res_ptr);
9349 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
9351 COption_u32Z_free(_res_conv);
9354 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
9355 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9356 *ret_copy = COption_u32Z_clone(arg);
9357 uint64_t ret_ref = (uint64_t)ret_copy;
9360 int64_t __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
9361 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
9362 int64_t ret_val = COption_u32Z_clone_ptr(arg_conv);
9366 uint32_t __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint32_t orig) {
9367 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
9368 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9369 *ret_copy = COption_u32Z_clone(orig_conv);
9370 uint64_t ret_ref = (uint64_t)ret_copy;
9374 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
9375 LDKHTLCOutputInCommitment o_conv;
9376 o_conv.inner = (void*)(o & (~1));
9377 o_conv.is_owned = (o & 1) || (o == 0);
9378 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9379 o_conv = HTLCOutputInCommitment_clone(&o_conv);
9380 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9381 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
9382 return (uint64_t)ret_conv;
9385 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
9386 LDKDecodeError e_conv;
9387 e_conv.inner = (void*)(e & (~1));
9388 e_conv.is_owned = (e & 1) || (e == 0);
9389 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9390 e_conv = DecodeError_clone(&e_conv);
9391 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9392 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
9393 return (uint64_t)ret_conv;
9396 jboolean __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
9397 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
9398 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
9402 void __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
9403 if ((_res & 1) != 0) return;
9404 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9405 CHECK_ACCESS(_res_ptr);
9406 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
9408 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
9411 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
9412 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9413 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
9414 return (uint64_t)ret_conv;
9416 int64_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
9417 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
9418 int64_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
9422 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
9423 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
9424 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9425 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
9426 return (uint64_t)ret_conv;
9429 uint32_t __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
9430 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
9434 uint32_t __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
9435 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
9439 void __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
9440 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
9441 COption_NoneZ_free(_res_conv);
9444 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
9445 LDKCounterpartyChannelTransactionParameters o_conv;
9446 o_conv.inner = (void*)(o & (~1));
9447 o_conv.is_owned = (o & 1) || (o == 0);
9448 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9449 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
9450 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9451 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9452 return (uint64_t)ret_conv;
9455 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
9456 LDKDecodeError e_conv;
9457 e_conv.inner = (void*)(e & (~1));
9458 e_conv.is_owned = (e & 1) || (e == 0);
9459 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9460 e_conv = DecodeError_clone(&e_conv);
9461 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9462 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
9463 return (uint64_t)ret_conv;
9466 jboolean __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
9467 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
9468 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
9472 void __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
9473 if ((_res & 1) != 0) return;
9474 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9475 CHECK_ACCESS(_res_ptr);
9476 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
9478 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9481 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
9482 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9483 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
9484 return (uint64_t)ret_conv;
9486 int64_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
9487 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
9488 int64_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
9492 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
9493 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9494 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9495 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9496 return (uint64_t)ret_conv;
9499 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
9500 LDKChannelTransactionParameters o_conv;
9501 o_conv.inner = (void*)(o & (~1));
9502 o_conv.is_owned = (o & 1) || (o == 0);
9503 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9504 o_conv = ChannelTransactionParameters_clone(&o_conv);
9505 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9506 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9507 return (uint64_t)ret_conv;
9510 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
9511 LDKDecodeError e_conv;
9512 e_conv.inner = (void*)(e & (~1));
9513 e_conv.is_owned = (e & 1) || (e == 0);
9514 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9515 e_conv = DecodeError_clone(&e_conv);
9516 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9517 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
9518 return (uint64_t)ret_conv;
9521 jboolean __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
9522 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
9523 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
9527 void __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
9528 if ((_res & 1) != 0) return;
9529 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9530 CHECK_ACCESS(_res_ptr);
9531 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
9533 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9536 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
9537 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9538 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
9539 return (uint64_t)ret_conv;
9541 int64_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
9542 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
9543 int64_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
9547 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
9548 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9549 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9550 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9551 return (uint64_t)ret_conv;
9554 void __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
9555 LDKCVec_SignatureZ _res_constr;
9556 _res_constr.datalen = _res->arr_len;
9557 if (_res_constr.datalen > 0)
9558 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9560 _res_constr.data = NULL;
9561 int8_tArray* _res_vals = (void*) _res->elems;
9562 for (size_t m = 0; m < _res_constr.datalen; m++) {
9563 int8_tArray _res_conv_12 = _res_vals[m];
9564 LDKSignature _res_conv_12_ref;
9565 CHECK(_res_conv_12->arr_len == 64);
9566 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64);
9567 _res_constr.data[m] = _res_conv_12_ref;
9569 CVec_SignatureZ_free(_res_constr);
9572 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
9573 LDKHolderCommitmentTransaction o_conv;
9574 o_conv.inner = (void*)(o & (~1));
9575 o_conv.is_owned = (o & 1) || (o == 0);
9576 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9577 o_conv = HolderCommitmentTransaction_clone(&o_conv);
9578 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9579 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
9580 return (uint64_t)ret_conv;
9583 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
9584 LDKDecodeError e_conv;
9585 e_conv.inner = (void*)(e & (~1));
9586 e_conv.is_owned = (e & 1) || (e == 0);
9587 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9588 e_conv = DecodeError_clone(&e_conv);
9589 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9590 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
9591 return (uint64_t)ret_conv;
9594 jboolean __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
9595 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
9596 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
9600 void __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
9601 if ((_res & 1) != 0) return;
9602 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9603 CHECK_ACCESS(_res_ptr);
9604 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
9606 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
9609 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
9610 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9611 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
9612 return (uint64_t)ret_conv;
9614 int64_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
9615 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
9616 int64_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
9620 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
9621 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9622 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9623 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9624 return (uint64_t)ret_conv;
9627 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
9628 LDKBuiltCommitmentTransaction o_conv;
9629 o_conv.inner = (void*)(o & (~1));
9630 o_conv.is_owned = (o & 1) || (o == 0);
9631 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9632 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
9633 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9634 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
9635 return (uint64_t)ret_conv;
9638 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
9639 LDKDecodeError e_conv;
9640 e_conv.inner = (void*)(e & (~1));
9641 e_conv.is_owned = (e & 1) || (e == 0);
9642 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9643 e_conv = DecodeError_clone(&e_conv);
9644 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9645 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
9646 return (uint64_t)ret_conv;
9649 jboolean __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
9650 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
9651 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
9655 void __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
9656 if ((_res & 1) != 0) return;
9657 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9658 CHECK_ACCESS(_res_ptr);
9659 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
9661 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
9664 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
9665 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9666 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
9667 return (uint64_t)ret_conv;
9669 int64_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
9670 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
9671 int64_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
9675 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
9676 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9677 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9678 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9679 return (uint64_t)ret_conv;
9682 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
9683 LDKTrustedClosingTransaction o_conv;
9684 o_conv.inner = (void*)(o & (~1));
9685 o_conv.is_owned = (o & 1) || (o == 0);
9686 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9687 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
9688 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
9689 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
9690 return (uint64_t)ret_conv;
9693 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
9694 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
9695 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
9696 return (uint64_t)ret_conv;
9699 jboolean __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
9700 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
9701 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
9705 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
9706 if ((_res & 1) != 0) return;
9707 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9708 CHECK_ACCESS(_res_ptr);
9709 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
9711 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
9714 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
9715 LDKCommitmentTransaction o_conv;
9716 o_conv.inner = (void*)(o & (~1));
9717 o_conv.is_owned = (o & 1) || (o == 0);
9718 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9719 o_conv = CommitmentTransaction_clone(&o_conv);
9720 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9721 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9722 return (uint64_t)ret_conv;
9725 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
9726 LDKDecodeError e_conv;
9727 e_conv.inner = (void*)(e & (~1));
9728 e_conv.is_owned = (e & 1) || (e == 0);
9729 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9730 e_conv = DecodeError_clone(&e_conv);
9731 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9732 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9733 return (uint64_t)ret_conv;
9736 jboolean __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
9737 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
9738 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
9742 void __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
9743 if ((_res & 1) != 0) return;
9744 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9745 CHECK_ACCESS(_res_ptr);
9746 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
9748 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9751 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
9752 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9753 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
9754 return (uint64_t)ret_conv;
9756 int64_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
9757 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
9758 int64_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
9762 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
9763 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9764 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9765 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9766 return (uint64_t)ret_conv;
9769 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
9770 LDKTrustedCommitmentTransaction o_conv;
9771 o_conv.inner = (void*)(o & (~1));
9772 o_conv.is_owned = (o & 1) || (o == 0);
9773 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9774 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9775 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9776 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9777 return (uint64_t)ret_conv;
9780 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
9781 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9782 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9783 return (uint64_t)ret_conv;
9786 jboolean __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
9787 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
9788 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
9792 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
9793 if ((_res & 1) != 0) return;
9794 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9795 CHECK_ACCESS(_res_ptr);
9796 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
9798 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9801 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
9802 LDKCVec_SignatureZ o_constr;
9803 o_constr.datalen = o->arr_len;
9804 if (o_constr.datalen > 0)
9805 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9807 o_constr.data = NULL;
9808 int8_tArray* o_vals = (void*) o->elems;
9809 for (size_t m = 0; m < o_constr.datalen; m++) {
9810 int8_tArray o_conv_12 = o_vals[m];
9811 LDKSignature o_conv_12_ref;
9812 CHECK(o_conv_12->arr_len == 64);
9813 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64);
9814 o_constr.data[m] = o_conv_12_ref;
9816 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9817 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9818 return (uint64_t)ret_conv;
9821 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
9822 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9823 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9824 return (uint64_t)ret_conv;
9827 jboolean __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
9828 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
9829 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
9833 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
9834 if ((_res & 1) != 0) return;
9835 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9836 CHECK_ACCESS(_res_ptr);
9837 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
9839 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9842 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
9843 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9844 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
9845 return (uint64_t)ret_conv;
9847 int64_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
9848 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
9849 int64_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
9853 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
9854 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9855 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9856 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9857 return (uint64_t)ret_conv;
9860 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
9861 LDKShutdownScript o_conv;
9862 o_conv.inner = (void*)(o & (~1));
9863 o_conv.is_owned = (o & 1) || (o == 0);
9864 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9865 o_conv = ShutdownScript_clone(&o_conv);
9866 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9867 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
9868 return (uint64_t)ret_conv;
9871 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
9872 LDKDecodeError e_conv;
9873 e_conv.inner = (void*)(e & (~1));
9874 e_conv.is_owned = (e & 1) || (e == 0);
9875 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9876 e_conv = DecodeError_clone(&e_conv);
9877 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9878 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
9879 return (uint64_t)ret_conv;
9882 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
9883 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
9884 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
9888 void __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
9889 if ((_res & 1) != 0) return;
9890 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9891 CHECK_ACCESS(_res_ptr);
9892 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
9894 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
9897 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
9898 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9899 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
9900 return (uint64_t)ret_conv;
9902 int64_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
9903 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
9904 int64_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
9908 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
9909 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
9910 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9911 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
9912 return (uint64_t)ret_conv;
9915 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
9916 LDKShutdownScript o_conv;
9917 o_conv.inner = (void*)(o & (~1));
9918 o_conv.is_owned = (o & 1) || (o == 0);
9919 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9920 o_conv = ShutdownScript_clone(&o_conv);
9921 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9922 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
9923 return (uint64_t)ret_conv;
9926 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
9927 LDKInvalidShutdownScript e_conv;
9928 e_conv.inner = (void*)(e & (~1));
9929 e_conv.is_owned = (e & 1) || (e == 0);
9930 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9931 e_conv = InvalidShutdownScript_clone(&e_conv);
9932 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9933 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
9934 return (uint64_t)ret_conv;
9937 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
9938 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
9939 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
9943 void __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
9944 if ((_res & 1) != 0) return;
9945 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9946 CHECK_ACCESS(_res_ptr);
9947 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
9949 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
9952 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
9953 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9954 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
9955 return (uint64_t)ret_conv;
9957 int64_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
9958 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
9959 int64_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
9963 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
9964 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
9965 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9966 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
9967 return (uint64_t)ret_conv;
9970 uint32_t __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint32_t o) {
9971 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9972 CHECK_ACCESS(o_ptr);
9973 LDKType o_conv = *(LDKType*)(o_ptr);
9974 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9975 *ret_copy = COption_TypeZ_some(o_conv);
9976 uint64_t ret_ref = (uint64_t)ret_copy;
9980 uint32_t __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
9981 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9982 *ret_copy = COption_TypeZ_none();
9983 uint64_t ret_ref = (uint64_t)ret_copy;
9987 void __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint32_t _res) {
9988 if ((_res & 1) != 0) return;
9989 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9990 CHECK_ACCESS(_res_ptr);
9991 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
9993 COption_TypeZ_free(_res_conv);
9996 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
9997 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9998 *ret_copy = COption_TypeZ_clone(arg);
9999 uint64_t ret_ref = (uint64_t)ret_copy;
10002 int64_t __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
10003 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
10004 int64_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
10008 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint32_t orig) {
10009 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
10010 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
10011 *ret_copy = COption_TypeZ_clone(orig_conv);
10012 uint64_t ret_ref = (uint64_t)ret_copy;
10016 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
10017 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10018 CHECK_ACCESS(o_ptr);
10019 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
10020 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
10021 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10022 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
10023 return (uint64_t)ret_conv;
10026 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
10027 LDKDecodeError e_conv;
10028 e_conv.inner = (void*)(e & (~1));
10029 e_conv.is_owned = (e & 1) || (e == 0);
10030 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10031 e_conv = DecodeError_clone(&e_conv);
10032 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10033 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
10034 return (uint64_t)ret_conv;
10037 jboolean __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
10038 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
10039 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
10043 void __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
10044 if ((_res & 1) != 0) return;
10045 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10046 CHECK_ACCESS(_res_ptr);
10047 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
10049 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
10052 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
10053 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10054 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
10055 return (uint64_t)ret_conv;
10057 int64_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
10058 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
10059 int64_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
10063 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
10064 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
10065 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10066 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
10067 return (uint64_t)ret_conv;
10070 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
10071 LDKStr o_conv = str_ref_to_owned_c(o);
10072 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10073 *ret_conv = CResult_StringErrorZ_ok(o_conv);
10074 return (uint64_t)ret_conv;
10077 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
10078 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10079 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10080 *ret_conv = CResult_StringErrorZ_err(e_conv);
10081 return (uint64_t)ret_conv;
10084 jboolean __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
10085 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
10086 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
10090 void __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
10091 if ((_res & 1) != 0) return;
10092 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10093 CHECK_ACCESS(_res_ptr);
10094 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
10096 CResult_StringErrorZ_free(_res_conv);
10099 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
10100 LDKChannelMonitorUpdate o_conv;
10101 o_conv.inner = (void*)(o & (~1));
10102 o_conv.is_owned = (o & 1) || (o == 0);
10103 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10104 o_conv = ChannelMonitorUpdate_clone(&o_conv);
10105 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10106 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
10107 return (uint64_t)ret_conv;
10110 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
10111 LDKDecodeError e_conv;
10112 e_conv.inner = (void*)(e & (~1));
10113 e_conv.is_owned = (e & 1) || (e == 0);
10114 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10115 e_conv = DecodeError_clone(&e_conv);
10116 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10117 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
10118 return (uint64_t)ret_conv;
10121 jboolean __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
10122 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
10123 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
10127 void __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
10128 if ((_res & 1) != 0) return;
10129 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10130 CHECK_ACCESS(_res_ptr);
10131 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
10133 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
10136 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
10137 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10138 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
10139 return (uint64_t)ret_conv;
10141 int64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
10142 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
10143 int64_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
10147 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
10148 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
10149 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10150 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
10151 return (uint64_t)ret_conv;
10154 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint32_t o) {
10155 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10156 CHECK_ACCESS(o_ptr);
10157 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
10158 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)o) & ~1));
10159 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10160 *ret_copy = COption_MonitorEventZ_some(o_conv);
10161 uint64_t ret_ref = (uint64_t)ret_copy;
10165 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
10166 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10167 *ret_copy = COption_MonitorEventZ_none();
10168 uint64_t ret_ref = (uint64_t)ret_copy;
10172 void __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
10173 if ((_res & 1) != 0) return;
10174 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10175 CHECK_ACCESS(_res_ptr);
10176 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
10178 COption_MonitorEventZ_free(_res_conv);
10181 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
10182 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10183 *ret_copy = COption_MonitorEventZ_clone(arg);
10184 uint64_t ret_ref = (uint64_t)ret_copy;
10187 int64_t __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
10188 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
10189 int64_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
10193 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
10194 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
10195 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10196 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
10197 uint64_t ret_ref = (uint64_t)ret_copy;
10201 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
10202 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10203 CHECK_ACCESS(o_ptr);
10204 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
10205 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uint64_t)o) & ~1));
10206 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
10207 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
10208 return (uint64_t)ret_conv;
10211 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
10212 LDKDecodeError e_conv;
10213 e_conv.inner = (void*)(e & (~1));
10214 e_conv.is_owned = (e & 1) || (e == 0);
10215 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10216 e_conv = DecodeError_clone(&e_conv);
10217 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
10218 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
10219 return (uint64_t)ret_conv;
10222 jboolean __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
10223 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
10224 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
10228 void __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
10229 if ((_res & 1) != 0) return;
10230 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10231 CHECK_ACCESS(_res_ptr);
10232 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
10234 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
10237 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
10238 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
10239 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
10240 return (uint64_t)ret_conv;
10242 int64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
10243 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
10244 int64_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
10248 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
10249 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
10250 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
10251 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
10252 return (uint64_t)ret_conv;
10255 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
10256 LDKHTLCUpdate o_conv;
10257 o_conv.inner = (void*)(o & (~1));
10258 o_conv.is_owned = (o & 1) || (o == 0);
10259 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10260 o_conv = HTLCUpdate_clone(&o_conv);
10261 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10262 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
10263 return (uint64_t)ret_conv;
10266 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
10267 LDKDecodeError e_conv;
10268 e_conv.inner = (void*)(e & (~1));
10269 e_conv.is_owned = (e & 1) || (e == 0);
10270 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10271 e_conv = DecodeError_clone(&e_conv);
10272 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10273 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
10274 return (uint64_t)ret_conv;
10277 jboolean __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
10278 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
10279 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
10283 void __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
10284 if ((_res & 1) != 0) return;
10285 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10286 CHECK_ACCESS(_res_ptr);
10287 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
10289 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
10292 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
10293 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10294 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
10295 return (uint64_t)ret_conv;
10297 int64_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
10298 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
10299 int64_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
10303 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
10304 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
10305 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10306 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
10307 return (uint64_t)ret_conv;
10310 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
10311 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10312 *ret_conv = CResult_NoneNoneZ_ok();
10313 return (uint64_t)ret_conv;
10316 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
10317 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10318 *ret_conv = CResult_NoneNoneZ_err();
10319 return (uint64_t)ret_conv;
10322 jboolean __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
10323 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
10324 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
10328 void __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
10329 if ((_res & 1) != 0) return;
10330 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10331 CHECK_ACCESS(_res_ptr);
10332 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
10334 CResult_NoneNoneZ_free(_res_conv);
10337 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
10338 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10339 *ret_conv = CResult_NoneNoneZ_clone(arg);
10340 return (uint64_t)ret_conv;
10342 int64_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
10343 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
10344 int64_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
10348 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
10349 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
10350 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10351 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
10352 return (uint64_t)ret_conv;
10355 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
10356 LDKOutPoint a_conv;
10357 a_conv.inner = (void*)(a & (~1));
10358 a_conv.is_owned = (a & 1) || (a == 0);
10359 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
10360 a_conv = OutPoint_clone(&a_conv);
10362 b_ref.datalen = b->arr_len;
10363 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10364 memcpy(b_ref.data, b->elems, b_ref.datalen);
10365 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10366 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
10367 return ((uint64_t)ret_conv);
10370 void __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
10371 if ((_res & 1) != 0) return;
10372 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10373 CHECK_ACCESS(_res_ptr);
10374 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
10376 C2Tuple_OutPointScriptZ_free(_res_conv);
10379 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
10381 b_ref.datalen = b->arr_len;
10382 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10383 memcpy(b_ref.data, b->elems, b_ref.datalen);
10384 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10385 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
10386 return ((uint64_t)ret_conv);
10389 void __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
10390 if ((_res & 1) != 0) return;
10391 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10392 CHECK_ACCESS(_res_ptr);
10393 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
10395 C2Tuple_u32ScriptZ_free(_res_conv);
10398 void __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
10399 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
10400 _res_constr.datalen = _res->arr_len;
10401 if (_res_constr.datalen > 0)
10402 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10404 _res_constr.data = NULL;
10405 uint32_t* _res_vals = _res->elems;
10406 for (size_t v = 0; v < _res_constr.datalen; v++) {
10407 uint32_t _res_conv_21 = _res_vals[v];
10408 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
10409 CHECK_ACCESS(_res_conv_21_ptr);
10410 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
10411 FREE((void*)_res_conv_21);
10412 _res_constr.data[v] = _res_conv_21_conv;
10414 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
10417 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
10418 LDKThirtyTwoBytes a_ref;
10419 CHECK(a->arr_len == 32);
10420 memcpy(a_ref.data, a->elems, 32);
10421 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
10422 b_constr.datalen = b->arr_len;
10423 if (b_constr.datalen > 0)
10424 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10426 b_constr.data = NULL;
10427 uint32_t* b_vals = b->elems;
10428 for (size_t v = 0; v < b_constr.datalen; v++) {
10429 uint32_t b_conv_21 = b_vals[v];
10430 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
10431 CHECK_ACCESS(b_conv_21_ptr);
10432 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
10433 // Warning: we may need a move here but no clone is available for LDKC2Tuple_u32ScriptZ
10434 b_constr.data[v] = b_conv_21_conv;
10436 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10437 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
10438 return ((uint64_t)ret_conv);
10441 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
10442 if ((_res & 1) != 0) return;
10443 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10444 CHECK_ACCESS(_res_ptr);
10445 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
10447 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
10450 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
10451 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
10452 _res_constr.datalen = _res->arr_len;
10453 if (_res_constr.datalen > 0)
10454 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
10456 _res_constr.data = NULL;
10457 uint32_t* _res_vals = _res->elems;
10458 for (size_t o = 0; o < _res_constr.datalen; o++) {
10459 uint32_t _res_conv_40 = _res_vals[o];
10460 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
10461 CHECK_ACCESS(_res_conv_40_ptr);
10462 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
10463 FREE((void*)_res_conv_40);
10464 _res_constr.data[o] = _res_conv_40_conv;
10466 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
10469 void __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
10470 LDKCVec_MonitorEventZ _res_constr;
10471 _res_constr.datalen = _res->arr_len;
10472 if (_res_constr.datalen > 0)
10473 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
10475 _res_constr.data = NULL;
10476 uint32_t* _res_vals = _res->elems;
10477 for (size_t o = 0; o < _res_constr.datalen; o++) {
10478 uint32_t _res_conv_14 = _res_vals[o];
10479 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
10480 CHECK_ACCESS(_res_conv_14_ptr);
10481 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
10482 FREE((void*)_res_conv_14);
10483 _res_constr.data[o] = _res_conv_14_conv;
10485 CVec_MonitorEventZ_free(_res_constr);
10488 void __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint32_tArray _res) {
10489 LDKCVec_EventZ _res_constr;
10490 _res_constr.datalen = _res->arr_len;
10491 if (_res_constr.datalen > 0)
10492 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
10494 _res_constr.data = NULL;
10495 uint32_t* _res_vals = _res->elems;
10496 for (size_t h = 0; h < _res_constr.datalen; h++) {
10497 uint32_t _res_conv_7 = _res_vals[h];
10498 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
10499 CHECK_ACCESS(_res_conv_7_ptr);
10500 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
10501 FREE((void*)_res_conv_7);
10502 _res_constr.data[h] = _res_conv_7_conv;
10504 CVec_EventZ_free(_res_constr);
10507 void __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
10508 LDKCVec_TransactionZ _res_constr;
10509 _res_constr.datalen = _res->arr_len;
10510 if (_res_constr.datalen > 0)
10511 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
10513 _res_constr.data = NULL;
10514 int8_tArray* _res_vals = (void*) _res->elems;
10515 for (size_t m = 0; m < _res_constr.datalen; m++) {
10516 int8_tArray _res_conv_12 = _res_vals[m];
10517 LDKTransaction _res_conv_12_ref;
10518 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
10519 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
10520 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen);
10521 _res_conv_12_ref.data_is_owned = true;
10522 _res_constr.data[m] = _res_conv_12_ref;
10524 CVec_TransactionZ_free(_res_constr);
10527 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
10528 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10529 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
10530 return ((uint64_t)ret_conv);
10532 int64_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
10533 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
10534 int64_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
10538 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
10539 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
10540 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10541 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
10542 return ((uint64_t)ret_conv);
10545 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
10546 LDKTransaction b_ref;
10547 b_ref.datalen = b->arr_len;
10548 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
10549 memcpy(b_ref.data, b->elems, b_ref.datalen);
10550 b_ref.data_is_owned = true;
10551 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10552 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
10553 return ((uint64_t)ret_conv);
10556 void __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
10557 if ((_res & 1) != 0) return;
10558 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10559 CHECK_ACCESS(_res_ptr);
10560 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
10562 C2Tuple_usizeTransactionZ_free(_res_conv);
10565 void __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
10566 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
10567 _res_constr.datalen = _res->arr_len;
10568 if (_res_constr.datalen > 0)
10569 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10571 _res_constr.data = NULL;
10572 uint32_t* _res_vals = _res->elems;
10573 for (size_t c = 0; c < _res_constr.datalen; c++) {
10574 uint32_t _res_conv_28 = _res_vals[c];
10575 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
10576 CHECK_ACCESS(_res_conv_28_ptr);
10577 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
10578 FREE((void*)_res_conv_28);
10579 _res_constr.data[c] = _res_conv_28_conv;
10581 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
10584 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
10585 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10586 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
10587 return ((uint64_t)ret_conv);
10589 int64_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
10590 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
10591 int64_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
10595 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
10596 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
10597 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10598 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
10599 return ((uint64_t)ret_conv);
10602 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
10603 void* b_ptr = (void*)(((uint64_t)b) & ~1);
10604 CHECK_ACCESS(b_ptr);
10605 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
10606 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
10607 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10608 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
10609 return ((uint64_t)ret_conv);
10612 void __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
10613 if ((_res & 1) != 0) return;
10614 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10615 CHECK_ACCESS(_res_ptr);
10616 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
10618 C2Tuple_u32TxOutZ_free(_res_conv);
10621 void __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
10622 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
10623 _res_constr.datalen = _res->arr_len;
10624 if (_res_constr.datalen > 0)
10625 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10627 _res_constr.data = NULL;
10628 uint32_t* _res_vals = _res->elems;
10629 for (size_t u = 0; u < _res_constr.datalen; u++) {
10630 uint32_t _res_conv_20 = _res_vals[u];
10631 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
10632 CHECK_ACCESS(_res_conv_20_ptr);
10633 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
10634 FREE((void*)_res_conv_20);
10635 _res_constr.data[u] = _res_conv_20_conv;
10637 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
10640 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
10641 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10642 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
10643 return ((uint64_t)ret_conv);
10645 int64_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
10646 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
10647 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
10651 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
10652 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
10653 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10654 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
10655 return ((uint64_t)ret_conv);
10658 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
10659 LDKThirtyTwoBytes a_ref;
10660 CHECK(a->arr_len == 32);
10661 memcpy(a_ref.data, a->elems, 32);
10662 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
10663 b_constr.datalen = b->arr_len;
10664 if (b_constr.datalen > 0)
10665 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10667 b_constr.data = NULL;
10668 uint32_t* b_vals = b->elems;
10669 for (size_t u = 0; u < b_constr.datalen; u++) {
10670 uint32_t b_conv_20 = b_vals[u];
10671 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
10672 CHECK_ACCESS(b_conv_20_ptr);
10673 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
10674 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
10675 b_constr.data[u] = b_conv_20_conv;
10677 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10678 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
10679 return ((uint64_t)ret_conv);
10682 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
10683 if ((_res & 1) != 0) return;
10684 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10685 CHECK_ACCESS(_res_ptr);
10686 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
10688 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
10691 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
10692 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
10693 _res_constr.datalen = _res->arr_len;
10694 if (_res_constr.datalen > 0)
10695 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
10697 _res_constr.data = NULL;
10698 uint32_t* _res_vals = _res->elems;
10699 for (size_t n = 0; n < _res_constr.datalen; n++) {
10700 uint32_t _res_conv_39 = _res_vals[n];
10701 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
10702 CHECK_ACCESS(_res_conv_39_ptr);
10703 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
10704 FREE((void*)_res_conv_39);
10705 _res_constr.data[n] = _res_conv_39_conv;
10707 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
10710 void __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
10711 LDKCVec_TxidZ _res_constr;
10712 _res_constr.datalen = _res->arr_len;
10713 if (_res_constr.datalen > 0)
10714 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10716 _res_constr.data = NULL;
10717 int8_tArray* _res_vals = (void*) _res->elems;
10718 for (size_t m = 0; m < _res_constr.datalen; m++) {
10719 int8_tArray _res_conv_12 = _res_vals[m];
10720 LDKThirtyTwoBytes _res_conv_12_ref;
10721 CHECK(_res_conv_12->arr_len == 32);
10722 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32);
10723 _res_constr.data[m] = _res_conv_12_ref;
10725 CVec_TxidZ_free(_res_constr);
10728 void __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
10729 LDKCVec_BalanceZ _res_constr;
10730 _res_constr.datalen = _res->arr_len;
10731 if (_res_constr.datalen > 0)
10732 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
10734 _res_constr.data = NULL;
10735 uint32_t* _res_vals = _res->elems;
10736 for (size_t j = 0; j < _res_constr.datalen; j++) {
10737 uint32_t _res_conv_9 = _res_vals[j];
10738 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
10739 CHECK_ACCESS(_res_conv_9_ptr);
10740 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
10741 FREE((void*)_res_conv_9);
10742 _res_constr.data[j] = _res_conv_9_conv;
10744 CVec_BalanceZ_free(_res_constr);
10747 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
10748 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10749 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
10750 return ((uint64_t)ret_conv);
10752 int64_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
10753 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
10754 int64_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
10758 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
10759 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
10760 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10761 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
10762 return ((uint64_t)ret_conv);
10765 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
10766 LDKThirtyTwoBytes a_ref;
10767 CHECK(a->arr_len == 32);
10768 memcpy(a_ref.data, a->elems, 32);
10769 LDKChannelMonitor b_conv;
10770 b_conv.inner = (void*)(b & (~1));
10771 b_conv.is_owned = (b & 1) || (b == 0);
10772 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
10773 b_conv = ChannelMonitor_clone(&b_conv);
10774 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10775 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10776 return ((uint64_t)ret_conv);
10779 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
10780 if ((_res & 1) != 0) return;
10781 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10782 CHECK_ACCESS(_res_ptr);
10783 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
10785 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10788 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
10789 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10790 CHECK_ACCESS(o_ptr);
10791 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
10792 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
10793 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10794 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
10795 return (uint64_t)ret_conv;
10798 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
10799 LDKDecodeError e_conv;
10800 e_conv.inner = (void*)(e & (~1));
10801 e_conv.is_owned = (e & 1) || (e == 0);
10802 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10803 e_conv = DecodeError_clone(&e_conv);
10804 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10805 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
10806 return (uint64_t)ret_conv;
10809 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
10810 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
10811 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
10815 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
10816 if ((_res & 1) != 0) return;
10817 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10818 CHECK_ACCESS(_res_ptr);
10819 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
10821 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
10824 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
10825 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10826 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
10827 return (uint64_t)ret_conv;
10829 int64_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
10830 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
10831 int64_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
10835 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
10836 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
10837 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10838 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
10839 return (uint64_t)ret_conv;
10842 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
10843 LDKRouteHop o_conv;
10844 o_conv.inner = (void*)(o & (~1));
10845 o_conv.is_owned = (o & 1) || (o == 0);
10846 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10847 o_conv = RouteHop_clone(&o_conv);
10848 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10849 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
10850 return (uint64_t)ret_conv;
10853 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
10854 LDKDecodeError e_conv;
10855 e_conv.inner = (void*)(e & (~1));
10856 e_conv.is_owned = (e & 1) || (e == 0);
10857 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10858 e_conv = DecodeError_clone(&e_conv);
10859 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10860 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
10861 return (uint64_t)ret_conv;
10864 jboolean __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
10865 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
10866 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
10870 void __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
10871 if ((_res & 1) != 0) return;
10872 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10873 CHECK_ACCESS(_res_ptr);
10874 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
10876 CResult_RouteHopDecodeErrorZ_free(_res_conv);
10879 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
10880 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10881 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
10882 return (uint64_t)ret_conv;
10884 int64_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
10885 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
10886 int64_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
10890 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
10891 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
10892 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10893 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
10894 return (uint64_t)ret_conv;
10897 void __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
10898 LDKCVec_RouteHopZ _res_constr;
10899 _res_constr.datalen = _res->arr_len;
10900 if (_res_constr.datalen > 0)
10901 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10903 _res_constr.data = NULL;
10904 uint32_t* _res_vals = _res->elems;
10905 for (size_t k = 0; k < _res_constr.datalen; k++) {
10906 uint32_t _res_conv_10 = _res_vals[k];
10907 LDKRouteHop _res_conv_10_conv;
10908 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
10909 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
10910 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
10911 _res_constr.data[k] = _res_conv_10_conv;
10913 CVec_RouteHopZ_free(_res_constr);
10916 void __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
10917 LDKCVec_CVec_RouteHopZZ _res_constr;
10918 _res_constr.datalen = _res->arr_len;
10919 if (_res_constr.datalen > 0)
10920 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
10922 _res_constr.data = NULL;
10923 uint32_tArray* _res_vals = (void*) _res->elems;
10924 for (size_t m = 0; m < _res_constr.datalen; m++) {
10925 uint32_tArray _res_conv_12 = _res_vals[m];
10926 LDKCVec_RouteHopZ _res_conv_12_constr;
10927 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
10928 if (_res_conv_12_constr.datalen > 0)
10929 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10931 _res_conv_12_constr.data = NULL;
10932 uint32_t* _res_conv_12_vals = _res_conv_12->elems;
10933 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
10934 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
10935 LDKRouteHop _res_conv_12_conv_10_conv;
10936 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
10937 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
10938 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
10939 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
10941 _res_constr.data[m] = _res_conv_12_constr;
10943 CVec_CVec_RouteHopZZ_free(_res_constr);
10946 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
10948 o_conv.inner = (void*)(o & (~1));
10949 o_conv.is_owned = (o & 1) || (o == 0);
10950 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10951 o_conv = Route_clone(&o_conv);
10952 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10953 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
10954 return (uint64_t)ret_conv;
10957 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
10958 LDKDecodeError e_conv;
10959 e_conv.inner = (void*)(e & (~1));
10960 e_conv.is_owned = (e & 1) || (e == 0);
10961 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10962 e_conv = DecodeError_clone(&e_conv);
10963 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10964 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
10965 return (uint64_t)ret_conv;
10968 jboolean __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
10969 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
10970 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
10974 void __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
10975 if ((_res & 1) != 0) return;
10976 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10977 CHECK_ACCESS(_res_ptr);
10978 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
10980 CResult_RouteDecodeErrorZ_free(_res_conv);
10983 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
10984 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10985 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
10986 return (uint64_t)ret_conv;
10988 int64_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
10989 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
10990 int64_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
10994 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
10995 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
10996 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10997 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
10998 return (uint64_t)ret_conv;
11001 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
11002 LDKRouteParameters o_conv;
11003 o_conv.inner = (void*)(o & (~1));
11004 o_conv.is_owned = (o & 1) || (o == 0);
11005 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11006 o_conv = RouteParameters_clone(&o_conv);
11007 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11008 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
11009 return (uint64_t)ret_conv;
11012 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
11013 LDKDecodeError e_conv;
11014 e_conv.inner = (void*)(e & (~1));
11015 e_conv.is_owned = (e & 1) || (e == 0);
11016 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11017 e_conv = DecodeError_clone(&e_conv);
11018 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11019 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
11020 return (uint64_t)ret_conv;
11023 jboolean __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
11024 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
11025 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
11029 void __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
11030 if ((_res & 1) != 0) return;
11031 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11032 CHECK_ACCESS(_res_ptr);
11033 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
11035 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
11038 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
11039 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11040 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
11041 return (uint64_t)ret_conv;
11043 int64_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11044 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
11045 int64_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
11049 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
11050 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
11051 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11052 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
11053 return (uint64_t)ret_conv;
11056 void __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
11057 LDKCVec_RouteHintZ _res_constr;
11058 _res_constr.datalen = _res->arr_len;
11059 if (_res_constr.datalen > 0)
11060 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
11062 _res_constr.data = NULL;
11063 uint32_t* _res_vals = _res->elems;
11064 for (size_t l = 0; l < _res_constr.datalen; l++) {
11065 uint32_t _res_conv_11 = _res_vals[l];
11066 LDKRouteHint _res_conv_11_conv;
11067 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
11068 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
11069 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
11070 _res_constr.data[l] = _res_conv_11_conv;
11072 CVec_RouteHintZ_free(_res_constr);
11075 uint32_t __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
11076 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11077 *ret_copy = COption_u64Z_some(o);
11078 uint64_t ret_ref = (uint64_t)ret_copy;
11082 uint32_t __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
11083 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11084 *ret_copy = COption_u64Z_none();
11085 uint64_t ret_ref = (uint64_t)ret_copy;
11089 void __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint32_t _res) {
11090 if ((_res & 1) != 0) return;
11091 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11092 CHECK_ACCESS(_res_ptr);
11093 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
11095 COption_u64Z_free(_res_conv);
11098 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
11099 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11100 *ret_copy = COption_u64Z_clone(arg);
11101 uint64_t ret_ref = (uint64_t)ret_copy;
11104 int64_t __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
11105 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
11106 int64_t ret_val = COption_u64Z_clone_ptr(arg_conv);
11110 uint32_t __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint32_t orig) {
11111 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
11112 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11113 *ret_copy = COption_u64Z_clone(orig_conv);
11114 uint64_t ret_ref = (uint64_t)ret_copy;
11118 uint32_t __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_ok"))) TS_CResult_PayeeDecodeErrorZ_ok(uint32_t o) {
11120 o_conv.inner = (void*)(o & (~1));
11121 o_conv.is_owned = (o & 1) || (o == 0);
11122 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11123 o_conv = Payee_clone(&o_conv);
11124 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
11125 *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv);
11126 return (uint64_t)ret_conv;
11129 uint32_t __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_err"))) TS_CResult_PayeeDecodeErrorZ_err(uint32_t e) {
11130 LDKDecodeError e_conv;
11131 e_conv.inner = (void*)(e & (~1));
11132 e_conv.is_owned = (e & 1) || (e == 0);
11133 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11134 e_conv = DecodeError_clone(&e_conv);
11135 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
11136 *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv);
11137 return (uint64_t)ret_conv;
11140 jboolean __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_is_ok"))) TS_CResult_PayeeDecodeErrorZ_is_ok(uint32_t o) {
11141 LDKCResult_PayeeDecodeErrorZ* o_conv = (LDKCResult_PayeeDecodeErrorZ*)(o & ~1);
11142 jboolean ret_val = CResult_PayeeDecodeErrorZ_is_ok(o_conv);
11146 void __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_free"))) TS_CResult_PayeeDecodeErrorZ_free(uint32_t _res) {
11147 if ((_res & 1) != 0) return;
11148 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11149 CHECK_ACCESS(_res_ptr);
11150 LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr);
11152 CResult_PayeeDecodeErrorZ_free(_res_conv);
11155 static inline uintptr_t CResult_PayeeDecodeErrorZ_clone_ptr(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR arg) {
11156 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
11157 *ret_conv = CResult_PayeeDecodeErrorZ_clone(arg);
11158 return (uint64_t)ret_conv;
11160 int64_t __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_clone_ptr"))) TS_CResult_PayeeDecodeErrorZ_clone_ptr(uint32_t arg) {
11161 LDKCResult_PayeeDecodeErrorZ* arg_conv = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
11162 int64_t ret_val = CResult_PayeeDecodeErrorZ_clone_ptr(arg_conv);
11166 uint32_t __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_clone"))) TS_CResult_PayeeDecodeErrorZ_clone(uint32_t orig) {
11167 LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1);
11168 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
11169 *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv);
11170 return (uint64_t)ret_conv;
11173 void __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
11174 LDKCVec_RouteHintHopZ _res_constr;
11175 _res_constr.datalen = _res->arr_len;
11176 if (_res_constr.datalen > 0)
11177 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
11179 _res_constr.data = NULL;
11180 uint32_t* _res_vals = _res->elems;
11181 for (size_t o = 0; o < _res_constr.datalen; o++) {
11182 uint32_t _res_conv_14 = _res_vals[o];
11183 LDKRouteHintHop _res_conv_14_conv;
11184 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
11185 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
11186 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
11187 _res_constr.data[o] = _res_conv_14_conv;
11189 CVec_RouteHintHopZ_free(_res_constr);
11192 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
11193 LDKRouteHint o_conv;
11194 o_conv.inner = (void*)(o & (~1));
11195 o_conv.is_owned = (o & 1) || (o == 0);
11196 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11197 o_conv = RouteHint_clone(&o_conv);
11198 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11199 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
11200 return (uint64_t)ret_conv;
11203 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
11204 LDKDecodeError e_conv;
11205 e_conv.inner = (void*)(e & (~1));
11206 e_conv.is_owned = (e & 1) || (e == 0);
11207 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11208 e_conv = DecodeError_clone(&e_conv);
11209 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11210 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
11211 return (uint64_t)ret_conv;
11214 jboolean __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
11215 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
11216 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
11220 void __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
11221 if ((_res & 1) != 0) return;
11222 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11223 CHECK_ACCESS(_res_ptr);
11224 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
11226 CResult_RouteHintDecodeErrorZ_free(_res_conv);
11229 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
11230 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11231 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
11232 return (uint64_t)ret_conv;
11234 int64_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
11235 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
11236 int64_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
11240 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
11241 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
11242 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11243 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
11244 return (uint64_t)ret_conv;
11247 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
11248 LDKRouteHintHop o_conv;
11249 o_conv.inner = (void*)(o & (~1));
11250 o_conv.is_owned = (o & 1) || (o == 0);
11251 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11252 o_conv = RouteHintHop_clone(&o_conv);
11253 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11254 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
11255 return (uint64_t)ret_conv;
11258 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
11259 LDKDecodeError e_conv;
11260 e_conv.inner = (void*)(e & (~1));
11261 e_conv.is_owned = (e & 1) || (e == 0);
11262 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11263 e_conv = DecodeError_clone(&e_conv);
11264 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11265 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
11266 return (uint64_t)ret_conv;
11269 jboolean __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
11270 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
11271 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
11275 void __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
11276 if ((_res & 1) != 0) return;
11277 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11278 CHECK_ACCESS(_res_ptr);
11279 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
11281 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
11284 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
11285 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11286 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
11287 return (uint64_t)ret_conv;
11289 int64_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
11290 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
11291 int64_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
11295 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
11296 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
11297 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11298 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
11299 return (uint64_t)ret_conv;
11302 void __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
11303 LDKCVec_ChannelDetailsZ _res_constr;
11304 _res_constr.datalen = _res->arr_len;
11305 if (_res_constr.datalen > 0)
11306 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11308 _res_constr.data = NULL;
11309 uint32_t* _res_vals = _res->elems;
11310 for (size_t q = 0; q < _res_constr.datalen; q++) {
11311 uint32_t _res_conv_16 = _res_vals[q];
11312 LDKChannelDetails _res_conv_16_conv;
11313 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11314 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11315 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
11316 _res_constr.data[q] = _res_conv_16_conv;
11318 CVec_ChannelDetailsZ_free(_res_constr);
11321 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
11323 o_conv.inner = (void*)(o & (~1));
11324 o_conv.is_owned = (o & 1) || (o == 0);
11325 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11326 o_conv = Route_clone(&o_conv);
11327 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11328 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
11329 return (uint64_t)ret_conv;
11332 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
11333 LDKLightningError e_conv;
11334 e_conv.inner = (void*)(e & (~1));
11335 e_conv.is_owned = (e & 1) || (e == 0);
11336 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11337 e_conv = LightningError_clone(&e_conv);
11338 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11339 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
11340 return (uint64_t)ret_conv;
11343 jboolean __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
11344 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
11345 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
11349 void __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
11350 if ((_res & 1) != 0) return;
11351 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11352 CHECK_ACCESS(_res_ptr);
11353 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
11355 CResult_RouteLightningErrorZ_free(_res_conv);
11358 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
11359 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11360 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
11361 return (uint64_t)ret_conv;
11363 int64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
11364 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
11365 int64_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
11369 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
11370 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
11371 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11372 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
11373 return (uint64_t)ret_conv;
11376 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
11377 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11378 *ret_conv = CResult_NoneLightningErrorZ_ok();
11379 return (uint64_t)ret_conv;
11382 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
11383 LDKLightningError e_conv;
11384 e_conv.inner = (void*)(e & (~1));
11385 e_conv.is_owned = (e & 1) || (e == 0);
11386 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11387 e_conv = LightningError_clone(&e_conv);
11388 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11389 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11390 return (uint64_t)ret_conv;
11393 jboolean __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
11394 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
11395 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
11399 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
11400 if ((_res & 1) != 0) return;
11401 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11402 CHECK_ACCESS(_res_ptr);
11403 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
11405 CResult_NoneLightningErrorZ_free(_res_conv);
11408 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
11409 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11410 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
11411 return (uint64_t)ret_conv;
11413 int64_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
11414 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
11415 int64_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
11419 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
11420 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11421 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11422 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11423 return (uint64_t)ret_conv;
11426 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
11427 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11428 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
11429 return ((uint64_t)ret_conv);
11431 int64_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
11432 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
11433 int64_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
11437 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
11438 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
11439 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11440 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
11441 return ((uint64_t)ret_conv);
11444 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
11445 LDKPublicKey a_ref;
11446 CHECK(a->arr_len == 33);
11447 memcpy(a_ref.compressed_form, a->elems, 33);
11448 void* b_ptr = (void*)(((uint64_t)b) & ~1);
11449 CHECK_ACCESS(b_ptr);
11450 LDKType b_conv = *(LDKType*)(b_ptr);
11451 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11452 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
11453 return ((uint64_t)ret_conv);
11456 void __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
11457 if ((_res & 1) != 0) return;
11458 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11459 CHECK_ACCESS(_res_ptr);
11460 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
11462 C2Tuple_PublicKeyTypeZ_free(_res_conv);
11465 void __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
11466 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
11467 _res_constr.datalen = _res->arr_len;
11468 if (_res_constr.datalen > 0)
11469 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
11471 _res_constr.data = NULL;
11472 uint32_t* _res_vals = _res->elems;
11473 for (size_t z = 0; z < _res_constr.datalen; z++) {
11474 uint32_t _res_conv_25 = _res_vals[z];
11475 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
11476 CHECK_ACCESS(_res_conv_25_ptr);
11477 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
11478 FREE((void*)_res_conv_25);
11479 _res_constr.data[z] = _res_conv_25_conv;
11481 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
11484 void __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
11485 LDKCVec_MessageSendEventZ _res_constr;
11486 _res_constr.datalen = _res->arr_len;
11487 if (_res_constr.datalen > 0)
11488 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
11490 _res_constr.data = NULL;
11491 uint32_t* _res_vals = _res->elems;
11492 for (size_t s = 0; s < _res_constr.datalen; s++) {
11493 uint32_t _res_conv_18 = _res_vals[s];
11494 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
11495 CHECK_ACCESS(_res_conv_18_ptr);
11496 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
11497 FREE((void*)_res_conv_18);
11498 _res_constr.data[s] = _res_conv_18_conv;
11500 CVec_MessageSendEventZ_free(_res_constr);
11503 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
11504 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11505 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11506 return (uint64_t)ret_conv;
11509 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
11510 LDKLightningError e_conv;
11511 e_conv.inner = (void*)(e & (~1));
11512 e_conv.is_owned = (e & 1) || (e == 0);
11513 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11514 e_conv = LightningError_clone(&e_conv);
11515 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11516 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11517 return (uint64_t)ret_conv;
11520 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
11521 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
11522 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
11526 void __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
11527 if ((_res & 1) != 0) return;
11528 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11529 CHECK_ACCESS(_res_ptr);
11530 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
11532 CResult_boolLightningErrorZ_free(_res_conv);
11535 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
11536 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11537 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
11538 return (uint64_t)ret_conv;
11540 int64_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
11541 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
11542 int64_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
11546 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
11547 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11548 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11549 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11550 return (uint64_t)ret_conv;
11553 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
11554 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11555 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
11556 return ((uint64_t)ret_conv);
11558 int64_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
11559 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
11560 int64_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
11564 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
11565 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11566 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11567 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11568 return ((uint64_t)ret_conv);
11571 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
11572 LDKChannelAnnouncement a_conv;
11573 a_conv.inner = (void*)(a & (~1));
11574 a_conv.is_owned = (a & 1) || (a == 0);
11575 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
11576 a_conv = ChannelAnnouncement_clone(&a_conv);
11577 LDKChannelUpdate b_conv;
11578 b_conv.inner = (void*)(b & (~1));
11579 b_conv.is_owned = (b & 1) || (b == 0);
11580 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
11581 b_conv = ChannelUpdate_clone(&b_conv);
11582 LDKChannelUpdate c_conv;
11583 c_conv.inner = (void*)(c & (~1));
11584 c_conv.is_owned = (c & 1) || (c == 0);
11585 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
11586 c_conv = ChannelUpdate_clone(&c_conv);
11587 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11588 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11589 return ((uint64_t)ret_conv);
11592 void __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
11593 if ((_res & 1) != 0) return;
11594 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11595 CHECK_ACCESS(_res_ptr);
11596 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
11598 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11601 void __attribute__((export_name("TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
11602 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11603 _res_constr.datalen = _res->arr_len;
11604 if (_res_constr.datalen > 0)
11605 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11607 _res_constr.data = NULL;
11608 uint32_t* _res_vals = _res->elems;
11609 for (size_t h = 0; h < _res_constr.datalen; h++) {
11610 uint32_t _res_conv_59 = _res_vals[h];
11611 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
11612 CHECK_ACCESS(_res_conv_59_ptr);
11613 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
11614 FREE((void*)_res_conv_59);
11615 _res_constr.data[h] = _res_conv_59_conv;
11617 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11620 void __attribute__((export_name("TS_CVec_NodeAnnouncementZ_free"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
11621 LDKCVec_NodeAnnouncementZ _res_constr;
11622 _res_constr.datalen = _res->arr_len;
11623 if (_res_constr.datalen > 0)
11624 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11626 _res_constr.data = NULL;
11627 uint32_t* _res_vals = _res->elems;
11628 for (size_t s = 0; s < _res_constr.datalen; s++) {
11629 uint32_t _res_conv_18 = _res_vals[s];
11630 LDKNodeAnnouncement _res_conv_18_conv;
11631 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11632 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11633 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
11634 _res_constr.data[s] = _res_conv_18_conv;
11636 CVec_NodeAnnouncementZ_free(_res_constr);
11639 void __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
11640 LDKCVec_PublicKeyZ _res_constr;
11641 _res_constr.datalen = _res->arr_len;
11642 if (_res_constr.datalen > 0)
11643 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11645 _res_constr.data = NULL;
11646 int8_tArray* _res_vals = (void*) _res->elems;
11647 for (size_t m = 0; m < _res_constr.datalen; m++) {
11648 int8_tArray _res_conv_12 = _res_vals[m];
11649 LDKPublicKey _res_conv_12_ref;
11650 CHECK(_res_conv_12->arr_len == 33);
11651 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33);
11652 _res_constr.data[m] = _res_conv_12_ref;
11654 CVec_PublicKeyZ_free(_res_constr);
11657 void __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
11658 LDKCVec_u8Z _res_ref;
11659 _res_ref.datalen = _res->arr_len;
11660 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
11661 memcpy(_res_ref.data, _res->elems, _res_ref.datalen);
11662 CVec_u8Z_free(_res_ref);
11665 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
11667 o_ref.datalen = o->arr_len;
11668 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11669 memcpy(o_ref.data, o->elems, o_ref.datalen);
11670 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11671 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11672 return (uint64_t)ret_conv;
11675 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
11676 LDKPeerHandleError e_conv;
11677 e_conv.inner = (void*)(e & (~1));
11678 e_conv.is_owned = (e & 1) || (e == 0);
11679 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11680 e_conv = PeerHandleError_clone(&e_conv);
11681 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11682 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11683 return (uint64_t)ret_conv;
11686 jboolean __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
11687 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
11688 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
11692 void __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
11693 if ((_res & 1) != 0) return;
11694 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11695 CHECK_ACCESS(_res_ptr);
11696 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
11698 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11701 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
11702 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11703 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
11704 return (uint64_t)ret_conv;
11706 int64_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
11707 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
11708 int64_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
11712 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
11713 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11714 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11715 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11716 return (uint64_t)ret_conv;
11719 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
11720 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11721 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11722 return (uint64_t)ret_conv;
11725 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
11726 LDKPeerHandleError e_conv;
11727 e_conv.inner = (void*)(e & (~1));
11728 e_conv.is_owned = (e & 1) || (e == 0);
11729 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11730 e_conv = PeerHandleError_clone(&e_conv);
11731 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11732 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11733 return (uint64_t)ret_conv;
11736 jboolean __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
11737 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
11738 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
11742 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
11743 if ((_res & 1) != 0) return;
11744 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11745 CHECK_ACCESS(_res_ptr);
11746 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
11748 CResult_NonePeerHandleErrorZ_free(_res_conv);
11751 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
11752 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11753 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
11754 return (uint64_t)ret_conv;
11756 int64_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
11757 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
11758 int64_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
11762 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
11763 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
11764 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11765 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
11766 return (uint64_t)ret_conv;
11769 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
11770 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11771 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11772 return (uint64_t)ret_conv;
11775 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
11776 LDKPeerHandleError e_conv;
11777 e_conv.inner = (void*)(e & (~1));
11778 e_conv.is_owned = (e & 1) || (e == 0);
11779 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11780 e_conv = PeerHandleError_clone(&e_conv);
11781 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11782 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11783 return (uint64_t)ret_conv;
11786 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
11787 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
11788 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
11792 void __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
11793 if ((_res & 1) != 0) return;
11794 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11795 CHECK_ACCESS(_res_ptr);
11796 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
11798 CResult_boolPeerHandleErrorZ_free(_res_conv);
11801 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
11802 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11803 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
11804 return (uint64_t)ret_conv;
11806 int64_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
11807 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
11808 int64_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
11812 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
11813 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11814 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11815 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11816 return (uint64_t)ret_conv;
11819 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
11820 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11821 CHECK_ACCESS(o_ptr);
11822 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
11823 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
11824 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11825 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
11826 return (uint64_t)ret_conv;
11829 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
11830 LDKAccessError e_conv = LDKAccessError_from_js(e);
11831 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11832 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
11833 return (uint64_t)ret_conv;
11836 jboolean __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
11837 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
11838 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
11842 void __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
11843 if ((_res & 1) != 0) return;
11844 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11845 CHECK_ACCESS(_res_ptr);
11846 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
11848 CResult_TxOutAccessErrorZ_free(_res_conv);
11851 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
11852 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11853 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
11854 return (uint64_t)ret_conv;
11856 int64_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
11857 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
11858 int64_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
11862 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
11863 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
11864 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11865 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
11866 return (uint64_t)ret_conv;
11869 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
11870 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11871 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
11872 return (uint64_t)ret_conv;
11875 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
11876 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
11877 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11878 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
11879 return (uint64_t)ret_conv;
11882 jboolean __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
11883 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
11884 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
11888 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_free"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
11889 if ((_res & 1) != 0) return;
11890 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11891 CHECK_ACCESS(_res_ptr);
11892 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
11894 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
11897 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
11898 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11899 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
11900 return (uint64_t)ret_conv;
11902 int64_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
11903 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
11904 int64_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
11908 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
11909 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
11910 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11911 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
11912 return (uint64_t)ret_conv;
11915 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_some"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
11916 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11917 CHECK_ACCESS(o_ptr);
11918 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
11919 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
11920 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11921 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
11922 uint64_t ret_ref = (uint64_t)ret_copy;
11926 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_none"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
11927 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11928 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
11929 uint64_t ret_ref = (uint64_t)ret_copy;
11933 void __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_free"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
11934 if ((_res & 1) != 0) return;
11935 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11936 CHECK_ACCESS(_res_ptr);
11937 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
11939 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
11942 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
11943 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11944 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
11945 uint64_t ret_ref = (uint64_t)ret_copy;
11948 int64_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
11949 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
11950 int64_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
11954 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
11955 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
11956 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11957 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
11958 uint64_t ret_ref = (uint64_t)ret_copy;
11962 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
11963 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11964 CHECK_ACCESS(o_ptr);
11965 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
11966 o_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)o) & ~1));
11967 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11968 *ret_copy = COption_ClosureReasonZ_some(o_conv);
11969 uint64_t ret_ref = (uint64_t)ret_copy;
11973 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
11974 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11975 *ret_copy = COption_ClosureReasonZ_none();
11976 uint64_t ret_ref = (uint64_t)ret_copy;
11980 void __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
11981 if ((_res & 1) != 0) return;
11982 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11983 CHECK_ACCESS(_res_ptr);
11984 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
11986 COption_ClosureReasonZ_free(_res_conv);
11989 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
11990 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11991 *ret_copy = COption_ClosureReasonZ_clone(arg);
11992 uint64_t ret_ref = (uint64_t)ret_copy;
11995 int64_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
11996 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
11997 int64_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
12001 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
12002 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
12003 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12004 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
12005 uint64_t ret_ref = (uint64_t)ret_copy;
12009 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
12010 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12011 CHECK_ACCESS(o_ptr);
12012 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
12013 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uint64_t)o) & ~1));
12014 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12015 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
12016 return (uint64_t)ret_conv;
12019 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
12020 LDKDecodeError e_conv;
12021 e_conv.inner = (void*)(e & (~1));
12022 e_conv.is_owned = (e & 1) || (e == 0);
12023 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12024 e_conv = DecodeError_clone(&e_conv);
12025 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12026 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
12027 return (uint64_t)ret_conv;
12030 jboolean __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
12031 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
12032 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
12036 void __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
12037 if ((_res & 1) != 0) return;
12038 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12039 CHECK_ACCESS(_res_ptr);
12040 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
12042 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
12045 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
12046 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12047 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
12048 return (uint64_t)ret_conv;
12050 int64_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
12051 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
12052 int64_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
12056 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
12057 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
12058 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12059 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
12060 return (uint64_t)ret_conv;
12063 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
12064 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12065 CHECK_ACCESS(o_ptr);
12066 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
12067 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
12068 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12069 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
12070 uint64_t ret_ref = (uint64_t)ret_copy;
12074 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
12075 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12076 *ret_copy = COption_NetworkUpdateZ_none();
12077 uint64_t ret_ref = (uint64_t)ret_copy;
12081 void __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
12082 if ((_res & 1) != 0) return;
12083 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12084 CHECK_ACCESS(_res_ptr);
12085 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
12087 COption_NetworkUpdateZ_free(_res_conv);
12090 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
12091 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12092 *ret_copy = COption_NetworkUpdateZ_clone(arg);
12093 uint64_t ret_ref = (uint64_t)ret_copy;
12096 int64_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
12097 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
12098 int64_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
12102 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
12103 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
12104 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12105 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
12106 uint64_t ret_ref = (uint64_t)ret_copy;
12110 void __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
12111 LDKCVec_SpendableOutputDescriptorZ _res_constr;
12112 _res_constr.datalen = _res->arr_len;
12113 if (_res_constr.datalen > 0)
12114 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
12116 _res_constr.data = NULL;
12117 uint32_t* _res_vals = _res->elems;
12118 for (size_t b = 0; b < _res_constr.datalen; b++) {
12119 uint32_t _res_conv_27 = _res_vals[b];
12120 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
12121 CHECK_ACCESS(_res_conv_27_ptr);
12122 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
12123 FREE((void*)_res_conv_27);
12124 _res_constr.data[b] = _res_conv_27_conv;
12126 CVec_SpendableOutputDescriptorZ_free(_res_constr);
12129 uint32_t __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint32_t o) {
12130 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12131 CHECK_ACCESS(o_ptr);
12132 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
12133 o_conv = Event_clone((LDKEvent*)(((uint64_t)o) & ~1));
12134 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12135 *ret_copy = COption_EventZ_some(o_conv);
12136 uint64_t ret_ref = (uint64_t)ret_copy;
12140 uint32_t __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
12141 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12142 *ret_copy = COption_EventZ_none();
12143 uint64_t ret_ref = (uint64_t)ret_copy;
12147 void __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint32_t _res) {
12148 if ((_res & 1) != 0) return;
12149 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12150 CHECK_ACCESS(_res_ptr);
12151 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
12153 COption_EventZ_free(_res_conv);
12156 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
12157 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12158 *ret_copy = COption_EventZ_clone(arg);
12159 uint64_t ret_ref = (uint64_t)ret_copy;
12162 int64_t __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
12163 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
12164 int64_t ret_val = COption_EventZ_clone_ptr(arg_conv);
12168 uint32_t __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint32_t orig) {
12169 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
12170 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12171 *ret_copy = COption_EventZ_clone(orig_conv);
12172 uint64_t ret_ref = (uint64_t)ret_copy;
12176 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
12177 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12178 CHECK_ACCESS(o_ptr);
12179 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
12180 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uint64_t)o) & ~1));
12181 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12182 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
12183 return (uint64_t)ret_conv;
12186 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
12187 LDKDecodeError e_conv;
12188 e_conv.inner = (void*)(e & (~1));
12189 e_conv.is_owned = (e & 1) || (e == 0);
12190 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12191 e_conv = DecodeError_clone(&e_conv);
12192 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12193 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
12194 return (uint64_t)ret_conv;
12197 jboolean __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
12198 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
12199 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
12203 void __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
12204 if ((_res & 1) != 0) return;
12205 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12206 CHECK_ACCESS(_res_ptr);
12207 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
12209 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
12212 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
12213 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12214 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
12215 return (uint64_t)ret_conv;
12217 int64_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
12218 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
12219 int64_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
12223 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
12224 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
12225 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12226 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
12227 return (uint64_t)ret_conv;
12230 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
12232 o_conv.inner = (void*)(o & (~1));
12233 o_conv.is_owned = (o & 1) || (o == 0);
12234 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12235 o_conv = NodeId_clone(&o_conv);
12236 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12237 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
12238 return (uint64_t)ret_conv;
12241 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
12242 LDKDecodeError e_conv;
12243 e_conv.inner = (void*)(e & (~1));
12244 e_conv.is_owned = (e & 1) || (e == 0);
12245 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12246 e_conv = DecodeError_clone(&e_conv);
12247 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12248 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
12249 return (uint64_t)ret_conv;
12252 jboolean __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
12253 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
12254 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
12258 void __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
12259 if ((_res & 1) != 0) return;
12260 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12261 CHECK_ACCESS(_res_ptr);
12262 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
12264 CResult_NodeIdDecodeErrorZ_free(_res_conv);
12267 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
12268 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12269 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
12270 return (uint64_t)ret_conv;
12272 int64_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
12273 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
12274 int64_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
12278 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
12279 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
12280 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12281 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
12282 return (uint64_t)ret_conv;
12285 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
12286 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12287 CHECK_ACCESS(o_ptr);
12288 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
12289 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)o) & ~1));
12290 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12291 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
12292 return (uint64_t)ret_conv;
12295 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
12296 LDKDecodeError e_conv;
12297 e_conv.inner = (void*)(e & (~1));
12298 e_conv.is_owned = (e & 1) || (e == 0);
12299 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12300 e_conv = DecodeError_clone(&e_conv);
12301 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12302 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
12303 return (uint64_t)ret_conv;
12306 jboolean __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
12307 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
12308 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
12312 void __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
12313 if ((_res & 1) != 0) return;
12314 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12315 CHECK_ACCESS(_res_ptr);
12316 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
12318 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
12321 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
12322 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12323 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
12324 return (uint64_t)ret_conv;
12326 int64_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
12327 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
12328 int64_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
12332 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
12333 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
12334 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12335 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
12336 return (uint64_t)ret_conv;
12339 uint32_t __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint32_t o) {
12340 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12341 CHECK_ACCESS(o_ptr);
12342 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
12343 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
12344 *ret_copy = COption_AccessZ_some(o_conv);
12345 uint64_t ret_ref = (uint64_t)ret_copy;
12349 uint32_t __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
12350 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
12351 *ret_copy = COption_AccessZ_none();
12352 uint64_t ret_ref = (uint64_t)ret_copy;
12356 void __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint32_t _res) {
12357 if ((_res & 1) != 0) return;
12358 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12359 CHECK_ACCESS(_res_ptr);
12360 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
12362 COption_AccessZ_free(_res_conv);
12365 uint32_t __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
12366 LDKDirectionalChannelInfo o_conv;
12367 o_conv.inner = (void*)(o & (~1));
12368 o_conv.is_owned = (o & 1) || (o == 0);
12369 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12370 o_conv = DirectionalChannelInfo_clone(&o_conv);
12371 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12372 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
12373 return (uint64_t)ret_conv;
12376 uint32_t __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_err"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
12377 LDKDecodeError e_conv;
12378 e_conv.inner = (void*)(e & (~1));
12379 e_conv.is_owned = (e & 1) || (e == 0);
12380 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12381 e_conv = DecodeError_clone(&e_conv);
12382 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12383 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
12384 return (uint64_t)ret_conv;
12387 jboolean __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
12388 LDKCResult_DirectionalChannelInfoDecodeErrorZ* o_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(o & ~1);
12389 jboolean ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o_conv);
12393 void __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_free"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
12394 if ((_res & 1) != 0) return;
12395 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12396 CHECK_ACCESS(_res_ptr);
12397 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
12399 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
12402 static inline uintptr_t CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
12403 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12404 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(arg);
12405 return (uint64_t)ret_conv;
12407 int64_t __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12408 LDKCResult_DirectionalChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
12409 int64_t ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
12413 uint32_t __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
12414 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
12415 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12416 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
12417 return (uint64_t)ret_conv;
12420 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
12421 LDKChannelInfo o_conv;
12422 o_conv.inner = (void*)(o & (~1));
12423 o_conv.is_owned = (o & 1) || (o == 0);
12424 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12425 o_conv = ChannelInfo_clone(&o_conv);
12426 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12427 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
12428 return (uint64_t)ret_conv;
12431 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
12432 LDKDecodeError e_conv;
12433 e_conv.inner = (void*)(e & (~1));
12434 e_conv.is_owned = (e & 1) || (e == 0);
12435 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12436 e_conv = DecodeError_clone(&e_conv);
12437 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12438 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
12439 return (uint64_t)ret_conv;
12442 jboolean __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
12443 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
12444 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
12448 void __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
12449 if ((_res & 1) != 0) return;
12450 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12451 CHECK_ACCESS(_res_ptr);
12452 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
12454 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
12457 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
12458 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12459 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
12460 return (uint64_t)ret_conv;
12462 int64_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12463 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
12464 int64_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
12468 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
12469 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
12470 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12471 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
12472 return (uint64_t)ret_conv;
12475 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
12476 LDKRoutingFees o_conv;
12477 o_conv.inner = (void*)(o & (~1));
12478 o_conv.is_owned = (o & 1) || (o == 0);
12479 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12480 o_conv = RoutingFees_clone(&o_conv);
12481 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12482 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
12483 return (uint64_t)ret_conv;
12486 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
12487 LDKDecodeError e_conv;
12488 e_conv.inner = (void*)(e & (~1));
12489 e_conv.is_owned = (e & 1) || (e == 0);
12490 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12491 e_conv = DecodeError_clone(&e_conv);
12492 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12493 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
12494 return (uint64_t)ret_conv;
12497 jboolean __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
12498 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
12499 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
12503 void __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
12504 if ((_res & 1) != 0) return;
12505 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12506 CHECK_ACCESS(_res_ptr);
12507 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
12509 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
12512 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
12513 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12514 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
12515 return (uint64_t)ret_conv;
12517 int64_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
12518 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
12519 int64_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
12523 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
12524 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
12525 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12526 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
12527 return (uint64_t)ret_conv;
12530 void __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
12531 LDKCVec_NetAddressZ _res_constr;
12532 _res_constr.datalen = _res->arr_len;
12533 if (_res_constr.datalen > 0)
12534 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12536 _res_constr.data = NULL;
12537 uint32_t* _res_vals = _res->elems;
12538 for (size_t m = 0; m < _res_constr.datalen; m++) {
12539 uint32_t _res_conv_12 = _res_vals[m];
12540 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
12541 CHECK_ACCESS(_res_conv_12_ptr);
12542 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
12543 FREE((void*)_res_conv_12);
12544 _res_constr.data[m] = _res_conv_12_conv;
12546 CVec_NetAddressZ_free(_res_constr);
12549 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
12550 LDKNodeAnnouncementInfo o_conv;
12551 o_conv.inner = (void*)(o & (~1));
12552 o_conv.is_owned = (o & 1) || (o == 0);
12553 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12554 o_conv = NodeAnnouncementInfo_clone(&o_conv);
12555 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12556 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
12557 return (uint64_t)ret_conv;
12560 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
12561 LDKDecodeError e_conv;
12562 e_conv.inner = (void*)(e & (~1));
12563 e_conv.is_owned = (e & 1) || (e == 0);
12564 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12565 e_conv = DecodeError_clone(&e_conv);
12566 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12567 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
12568 return (uint64_t)ret_conv;
12571 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
12572 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
12573 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
12577 void __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
12578 if ((_res & 1) != 0) return;
12579 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12580 CHECK_ACCESS(_res_ptr);
12581 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
12583 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
12586 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
12587 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12588 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
12589 return (uint64_t)ret_conv;
12591 int64_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12592 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
12593 int64_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
12597 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
12598 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
12599 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12600 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
12601 return (uint64_t)ret_conv;
12604 void __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
12605 LDKCVec_u64Z _res_constr;
12606 _res_constr.datalen = _res->arr_len;
12607 if (_res_constr.datalen > 0)
12608 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12610 _res_constr.data = NULL;
12611 int64_t* _res_vals = _res->elems;
12612 for (size_t i = 0; i < _res_constr.datalen; i++) {
12613 int64_t _res_conv_8 = _res_vals[i];
12614 _res_constr.data[i] = _res_conv_8;
12616 CVec_u64Z_free(_res_constr);
12619 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
12620 LDKNodeInfo o_conv;
12621 o_conv.inner = (void*)(o & (~1));
12622 o_conv.is_owned = (o & 1) || (o == 0);
12623 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12624 o_conv = NodeInfo_clone(&o_conv);
12625 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12626 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
12627 return (uint64_t)ret_conv;
12630 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
12631 LDKDecodeError e_conv;
12632 e_conv.inner = (void*)(e & (~1));
12633 e_conv.is_owned = (e & 1) || (e == 0);
12634 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12635 e_conv = DecodeError_clone(&e_conv);
12636 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12637 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
12638 return (uint64_t)ret_conv;
12641 jboolean __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
12642 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
12643 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
12647 void __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
12648 if ((_res & 1) != 0) return;
12649 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12650 CHECK_ACCESS(_res_ptr);
12651 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
12653 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
12656 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
12657 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12658 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
12659 return (uint64_t)ret_conv;
12661 int64_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12662 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
12663 int64_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
12667 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
12668 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
12669 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12670 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
12671 return (uint64_t)ret_conv;
12674 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
12675 LDKNetworkGraph o_conv;
12676 o_conv.inner = (void*)(o & (~1));
12677 o_conv.is_owned = (o & 1) || (o == 0);
12678 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12679 o_conv = NetworkGraph_clone(&o_conv);
12680 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12681 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
12682 return (uint64_t)ret_conv;
12685 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
12686 LDKDecodeError e_conv;
12687 e_conv.inner = (void*)(e & (~1));
12688 e_conv.is_owned = (e & 1) || (e == 0);
12689 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12690 e_conv = DecodeError_clone(&e_conv);
12691 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12692 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
12693 return (uint64_t)ret_conv;
12696 jboolean __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
12697 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
12698 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
12702 void __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
12703 if ((_res & 1) != 0) return;
12704 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12705 CHECK_ACCESS(_res_ptr);
12706 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
12708 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
12711 static inline uintptr_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
12712 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12713 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
12714 return (uint64_t)ret_conv;
12716 int64_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr"))) TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr(uint32_t arg) {
12717 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
12718 int64_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
12722 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_clone"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
12723 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
12724 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12725 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
12726 return (uint64_t)ret_conv;
12729 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
12730 LDKCVec_NetAddressZ o_constr;
12731 o_constr.datalen = o->arr_len;
12732 if (o_constr.datalen > 0)
12733 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12735 o_constr.data = NULL;
12736 uint32_t* o_vals = o->elems;
12737 for (size_t m = 0; m < o_constr.datalen; m++) {
12738 uint32_t o_conv_12 = o_vals[m];
12739 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
12740 CHECK_ACCESS(o_conv_12_ptr);
12741 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
12742 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
12743 o_constr.data[m] = o_conv_12_conv;
12745 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12746 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
12747 uint64_t ret_ref = (uint64_t)ret_copy;
12751 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
12752 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12753 *ret_copy = COption_CVec_NetAddressZZ_none();
12754 uint64_t ret_ref = (uint64_t)ret_copy;
12758 void __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
12759 if ((_res & 1) != 0) return;
12760 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12761 CHECK_ACCESS(_res_ptr);
12762 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
12764 COption_CVec_NetAddressZZ_free(_res_conv);
12767 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
12768 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12769 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
12770 uint64_t ret_ref = (uint64_t)ret_copy;
12773 int64_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
12774 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
12775 int64_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
12779 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
12780 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
12781 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12782 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
12783 uint64_t ret_ref = (uint64_t)ret_copy;
12787 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_ok"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) {
12788 LDKScoringParameters o_conv;
12789 o_conv.inner = (void*)(o & (~1));
12790 o_conv.is_owned = (o & 1) || (o == 0);
12791 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12792 // Warning: we need a move here but no clone is available for LDKScoringParameters
12793 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12794 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
12795 return (uint64_t)ret_conv;
12798 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_err"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) {
12799 LDKDecodeError e_conv;
12800 e_conv.inner = (void*)(e & (~1));
12801 e_conv.is_owned = (e & 1) || (e == 0);
12802 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12803 e_conv = DecodeError_clone(&e_conv);
12804 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12805 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
12806 return (uint64_t)ret_conv;
12809 jboolean __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_is_ok"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) {
12810 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
12811 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
12815 void __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_free"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) {
12816 if ((_res & 1) != 0) return;
12817 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12818 CHECK_ACCESS(_res_ptr);
12819 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
12821 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
12824 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
12825 LDKInitFeatures o_conv;
12826 o_conv.inner = (void*)(o & (~1));
12827 o_conv.is_owned = (o & 1) || (o == 0);
12828 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12829 o_conv = InitFeatures_clone(&o_conv);
12830 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12831 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
12832 return (uint64_t)ret_conv;
12835 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
12836 LDKDecodeError e_conv;
12837 e_conv.inner = (void*)(e & (~1));
12838 e_conv.is_owned = (e & 1) || (e == 0);
12839 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12840 e_conv = DecodeError_clone(&e_conv);
12841 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12842 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
12843 return (uint64_t)ret_conv;
12846 jboolean __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12847 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
12848 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
12852 void __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
12853 if ((_res & 1) != 0) return;
12854 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12855 CHECK_ACCESS(_res_ptr);
12856 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
12858 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
12861 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
12862 LDKChannelFeatures o_conv;
12863 o_conv.inner = (void*)(o & (~1));
12864 o_conv.is_owned = (o & 1) || (o == 0);
12865 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12866 o_conv = ChannelFeatures_clone(&o_conv);
12867 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12868 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
12869 return (uint64_t)ret_conv;
12872 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
12873 LDKDecodeError e_conv;
12874 e_conv.inner = (void*)(e & (~1));
12875 e_conv.is_owned = (e & 1) || (e == 0);
12876 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12877 e_conv = DecodeError_clone(&e_conv);
12878 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12879 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
12880 return (uint64_t)ret_conv;
12883 jboolean __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12884 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
12885 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
12889 void __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
12890 if ((_res & 1) != 0) return;
12891 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12892 CHECK_ACCESS(_res_ptr);
12893 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
12895 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
12898 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
12899 LDKNodeFeatures o_conv;
12900 o_conv.inner = (void*)(o & (~1));
12901 o_conv.is_owned = (o & 1) || (o == 0);
12902 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12903 o_conv = NodeFeatures_clone(&o_conv);
12904 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12905 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
12906 return (uint64_t)ret_conv;
12909 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
12910 LDKDecodeError e_conv;
12911 e_conv.inner = (void*)(e & (~1));
12912 e_conv.is_owned = (e & 1) || (e == 0);
12913 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12914 e_conv = DecodeError_clone(&e_conv);
12915 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12916 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
12917 return (uint64_t)ret_conv;
12920 jboolean __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12921 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
12922 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
12926 void __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
12927 if ((_res & 1) != 0) return;
12928 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12929 CHECK_ACCESS(_res_ptr);
12930 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
12932 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
12935 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
12936 LDKInvoiceFeatures o_conv;
12937 o_conv.inner = (void*)(o & (~1));
12938 o_conv.is_owned = (o & 1) || (o == 0);
12939 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12940 o_conv = InvoiceFeatures_clone(&o_conv);
12941 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12942 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
12943 return (uint64_t)ret_conv;
12946 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
12947 LDKDecodeError e_conv;
12948 e_conv.inner = (void*)(e & (~1));
12949 e_conv.is_owned = (e & 1) || (e == 0);
12950 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12951 e_conv = DecodeError_clone(&e_conv);
12952 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12953 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
12954 return (uint64_t)ret_conv;
12957 jboolean __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12958 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
12959 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
12963 void __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
12964 if ((_res & 1) != 0) return;
12965 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12966 CHECK_ACCESS(_res_ptr);
12967 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
12969 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
12972 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) {
12973 LDKChannelTypeFeatures o_conv;
12974 o_conv.inner = (void*)(o & (~1));
12975 o_conv.is_owned = (o & 1) || (o == 0);
12976 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12977 o_conv = ChannelTypeFeatures_clone(&o_conv);
12978 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12979 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
12980 return (uint64_t)ret_conv;
12983 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) {
12984 LDKDecodeError e_conv;
12985 e_conv.inner = (void*)(e & (~1));
12986 e_conv.is_owned = (e & 1) || (e == 0);
12987 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12988 e_conv = DecodeError_clone(&e_conv);
12989 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12990 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
12991 return (uint64_t)ret_conv;
12994 jboolean __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12995 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
12996 jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
13000 void __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) {
13001 if ((_res & 1) != 0) return;
13002 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13003 CHECK_ACCESS(_res_ptr);
13004 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
13006 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
13009 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
13010 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13011 CHECK_ACCESS(o_ptr);
13012 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
13013 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
13014 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13015 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
13016 return (uint64_t)ret_conv;
13019 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
13020 LDKDecodeError e_conv;
13021 e_conv.inner = (void*)(e & (~1));
13022 e_conv.is_owned = (e & 1) || (e == 0);
13023 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13024 e_conv = DecodeError_clone(&e_conv);
13025 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13026 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
13027 return (uint64_t)ret_conv;
13030 jboolean __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
13031 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
13032 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
13036 void __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
13037 if ((_res & 1) != 0) return;
13038 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13039 CHECK_ACCESS(_res_ptr);
13040 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
13042 CResult_NetAddressDecodeErrorZ_free(_res_conv);
13045 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
13046 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13047 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
13048 return (uint64_t)ret_conv;
13050 int64_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
13051 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
13052 int64_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
13056 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
13057 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
13058 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13059 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
13060 return (uint64_t)ret_conv;
13063 void __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
13064 LDKCVec_UpdateAddHTLCZ _res_constr;
13065 _res_constr.datalen = _res->arr_len;
13066 if (_res_constr.datalen > 0)
13067 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13069 _res_constr.data = NULL;
13070 uint32_t* _res_vals = _res->elems;
13071 for (size_t p = 0; p < _res_constr.datalen; p++) {
13072 uint32_t _res_conv_15 = _res_vals[p];
13073 LDKUpdateAddHTLC _res_conv_15_conv;
13074 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
13075 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
13076 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
13077 _res_constr.data[p] = _res_conv_15_conv;
13079 CVec_UpdateAddHTLCZ_free(_res_constr);
13082 void __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
13083 LDKCVec_UpdateFulfillHTLCZ _res_constr;
13084 _res_constr.datalen = _res->arr_len;
13085 if (_res_constr.datalen > 0)
13086 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13088 _res_constr.data = NULL;
13089 uint32_t* _res_vals = _res->elems;
13090 for (size_t t = 0; t < _res_constr.datalen; t++) {
13091 uint32_t _res_conv_19 = _res_vals[t];
13092 LDKUpdateFulfillHTLC _res_conv_19_conv;
13093 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
13094 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
13095 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
13096 _res_constr.data[t] = _res_conv_19_conv;
13098 CVec_UpdateFulfillHTLCZ_free(_res_constr);
13101 void __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
13102 LDKCVec_UpdateFailHTLCZ _res_constr;
13103 _res_constr.datalen = _res->arr_len;
13104 if (_res_constr.datalen > 0)
13105 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13107 _res_constr.data = NULL;
13108 uint32_t* _res_vals = _res->elems;
13109 for (size_t q = 0; q < _res_constr.datalen; q++) {
13110 uint32_t _res_conv_16 = _res_vals[q];
13111 LDKUpdateFailHTLC _res_conv_16_conv;
13112 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
13113 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
13114 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
13115 _res_constr.data[q] = _res_conv_16_conv;
13117 CVec_UpdateFailHTLCZ_free(_res_constr);
13120 void __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
13121 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
13122 _res_constr.datalen = _res->arr_len;
13123 if (_res_constr.datalen > 0)
13124 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13126 _res_constr.data = NULL;
13127 uint32_t* _res_vals = _res->elems;
13128 for (size_t z = 0; z < _res_constr.datalen; z++) {
13129 uint32_t _res_conv_25 = _res_vals[z];
13130 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
13131 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
13132 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
13133 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
13134 _res_constr.data[z] = _res_conv_25_conv;
13136 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
13139 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
13140 LDKAcceptChannel o_conv;
13141 o_conv.inner = (void*)(o & (~1));
13142 o_conv.is_owned = (o & 1) || (o == 0);
13143 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13144 o_conv = AcceptChannel_clone(&o_conv);
13145 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13146 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
13147 return (uint64_t)ret_conv;
13150 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
13151 LDKDecodeError e_conv;
13152 e_conv.inner = (void*)(e & (~1));
13153 e_conv.is_owned = (e & 1) || (e == 0);
13154 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13155 e_conv = DecodeError_clone(&e_conv);
13156 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13157 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
13158 return (uint64_t)ret_conv;
13161 jboolean __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
13162 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
13163 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
13167 void __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
13168 if ((_res & 1) != 0) return;
13169 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13170 CHECK_ACCESS(_res_ptr);
13171 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
13173 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
13176 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
13177 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13178 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
13179 return (uint64_t)ret_conv;
13181 int64_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
13182 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
13183 int64_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
13187 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
13188 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
13189 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13190 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
13191 return (uint64_t)ret_conv;
13194 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
13195 LDKAnnouncementSignatures o_conv;
13196 o_conv.inner = (void*)(o & (~1));
13197 o_conv.is_owned = (o & 1) || (o == 0);
13198 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13199 o_conv = AnnouncementSignatures_clone(&o_conv);
13200 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13201 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
13202 return (uint64_t)ret_conv;
13205 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
13206 LDKDecodeError e_conv;
13207 e_conv.inner = (void*)(e & (~1));
13208 e_conv.is_owned = (e & 1) || (e == 0);
13209 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13210 e_conv = DecodeError_clone(&e_conv);
13211 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13212 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
13213 return (uint64_t)ret_conv;
13216 jboolean __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
13217 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
13218 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
13222 void __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
13223 if ((_res & 1) != 0) return;
13224 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13225 CHECK_ACCESS(_res_ptr);
13226 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
13228 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
13231 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
13232 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13233 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
13234 return (uint64_t)ret_conv;
13236 int64_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13237 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
13238 int64_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
13242 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
13243 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
13244 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13245 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
13246 return (uint64_t)ret_conv;
13249 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
13250 LDKChannelReestablish o_conv;
13251 o_conv.inner = (void*)(o & (~1));
13252 o_conv.is_owned = (o & 1) || (o == 0);
13253 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13254 o_conv = ChannelReestablish_clone(&o_conv);
13255 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13256 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
13257 return (uint64_t)ret_conv;
13260 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
13261 LDKDecodeError e_conv;
13262 e_conv.inner = (void*)(e & (~1));
13263 e_conv.is_owned = (e & 1) || (e == 0);
13264 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13265 e_conv = DecodeError_clone(&e_conv);
13266 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13267 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
13268 return (uint64_t)ret_conv;
13271 jboolean __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
13272 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
13273 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
13277 void __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
13278 if ((_res & 1) != 0) return;
13279 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13280 CHECK_ACCESS(_res_ptr);
13281 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
13283 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
13286 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
13287 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13288 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
13289 return (uint64_t)ret_conv;
13291 int64_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
13292 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
13293 int64_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
13297 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
13298 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
13299 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13300 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
13301 return (uint64_t)ret_conv;
13304 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
13305 LDKClosingSigned o_conv;
13306 o_conv.inner = (void*)(o & (~1));
13307 o_conv.is_owned = (o & 1) || (o == 0);
13308 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13309 o_conv = ClosingSigned_clone(&o_conv);
13310 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13311 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
13312 return (uint64_t)ret_conv;
13315 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
13316 LDKDecodeError e_conv;
13317 e_conv.inner = (void*)(e & (~1));
13318 e_conv.is_owned = (e & 1) || (e == 0);
13319 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13320 e_conv = DecodeError_clone(&e_conv);
13321 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13322 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
13323 return (uint64_t)ret_conv;
13326 jboolean __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
13327 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
13328 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
13332 void __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
13333 if ((_res & 1) != 0) return;
13334 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13335 CHECK_ACCESS(_res_ptr);
13336 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
13338 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
13341 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
13342 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13343 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
13344 return (uint64_t)ret_conv;
13346 int64_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
13347 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
13348 int64_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
13352 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
13353 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
13354 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13355 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
13356 return (uint64_t)ret_conv;
13359 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
13360 LDKClosingSignedFeeRange o_conv;
13361 o_conv.inner = (void*)(o & (~1));
13362 o_conv.is_owned = (o & 1) || (o == 0);
13363 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13364 o_conv = ClosingSignedFeeRange_clone(&o_conv);
13365 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13366 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
13367 return (uint64_t)ret_conv;
13370 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
13371 LDKDecodeError e_conv;
13372 e_conv.inner = (void*)(e & (~1));
13373 e_conv.is_owned = (e & 1) || (e == 0);
13374 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13375 e_conv = DecodeError_clone(&e_conv);
13376 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13377 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
13378 return (uint64_t)ret_conv;
13381 jboolean __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
13382 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
13383 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
13387 void __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
13388 if ((_res & 1) != 0) return;
13389 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13390 CHECK_ACCESS(_res_ptr);
13391 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
13393 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
13396 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
13397 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13398 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
13399 return (uint64_t)ret_conv;
13401 int64_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
13402 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
13403 int64_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
13407 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
13408 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
13409 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13410 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
13411 return (uint64_t)ret_conv;
13414 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
13415 LDKCommitmentSigned o_conv;
13416 o_conv.inner = (void*)(o & (~1));
13417 o_conv.is_owned = (o & 1) || (o == 0);
13418 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13419 o_conv = CommitmentSigned_clone(&o_conv);
13420 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13421 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
13422 return (uint64_t)ret_conv;
13425 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
13426 LDKDecodeError e_conv;
13427 e_conv.inner = (void*)(e & (~1));
13428 e_conv.is_owned = (e & 1) || (e == 0);
13429 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13430 e_conv = DecodeError_clone(&e_conv);
13431 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13432 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
13433 return (uint64_t)ret_conv;
13436 jboolean __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
13437 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
13438 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
13442 void __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
13443 if ((_res & 1) != 0) return;
13444 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13445 CHECK_ACCESS(_res_ptr);
13446 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
13448 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
13451 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
13452 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13453 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
13454 return (uint64_t)ret_conv;
13456 int64_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
13457 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
13458 int64_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
13462 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
13463 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
13464 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13465 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
13466 return (uint64_t)ret_conv;
13469 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
13470 LDKFundingCreated o_conv;
13471 o_conv.inner = (void*)(o & (~1));
13472 o_conv.is_owned = (o & 1) || (o == 0);
13473 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13474 o_conv = FundingCreated_clone(&o_conv);
13475 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13476 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
13477 return (uint64_t)ret_conv;
13480 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
13481 LDKDecodeError e_conv;
13482 e_conv.inner = (void*)(e & (~1));
13483 e_conv.is_owned = (e & 1) || (e == 0);
13484 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13485 e_conv = DecodeError_clone(&e_conv);
13486 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13487 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
13488 return (uint64_t)ret_conv;
13491 jboolean __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
13492 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
13493 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
13497 void __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
13498 if ((_res & 1) != 0) return;
13499 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13500 CHECK_ACCESS(_res_ptr);
13501 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
13503 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
13506 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
13507 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13508 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
13509 return (uint64_t)ret_conv;
13511 int64_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
13512 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
13513 int64_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
13517 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
13518 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
13519 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13520 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
13521 return (uint64_t)ret_conv;
13524 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
13525 LDKFundingSigned o_conv;
13526 o_conv.inner = (void*)(o & (~1));
13527 o_conv.is_owned = (o & 1) || (o == 0);
13528 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13529 o_conv = FundingSigned_clone(&o_conv);
13530 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13531 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
13532 return (uint64_t)ret_conv;
13535 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
13536 LDKDecodeError e_conv;
13537 e_conv.inner = (void*)(e & (~1));
13538 e_conv.is_owned = (e & 1) || (e == 0);
13539 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13540 e_conv = DecodeError_clone(&e_conv);
13541 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13542 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
13543 return (uint64_t)ret_conv;
13546 jboolean __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
13547 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
13548 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
13552 void __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
13553 if ((_res & 1) != 0) return;
13554 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13555 CHECK_ACCESS(_res_ptr);
13556 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
13558 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
13561 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
13562 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13563 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
13564 return (uint64_t)ret_conv;
13566 int64_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
13567 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
13568 int64_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
13572 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
13573 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
13574 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13575 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
13576 return (uint64_t)ret_conv;
13579 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_ok"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
13580 LDKFundingLocked o_conv;
13581 o_conv.inner = (void*)(o & (~1));
13582 o_conv.is_owned = (o & 1) || (o == 0);
13583 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13584 o_conv = FundingLocked_clone(&o_conv);
13585 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13586 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
13587 return (uint64_t)ret_conv;
13590 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_err"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
13591 LDKDecodeError e_conv;
13592 e_conv.inner = (void*)(e & (~1));
13593 e_conv.is_owned = (e & 1) || (e == 0);
13594 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13595 e_conv = DecodeError_clone(&e_conv);
13596 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13597 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
13598 return (uint64_t)ret_conv;
13601 jboolean __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_is_ok"))) TS_CResult_FundingLockedDecodeErrorZ_is_ok(uint32_t o) {
13602 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
13603 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
13607 void __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_free"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
13608 if ((_res & 1) != 0) return;
13609 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13610 CHECK_ACCESS(_res_ptr);
13611 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
13613 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
13616 static inline uintptr_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
13617 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13618 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
13619 return (uint64_t)ret_conv;
13621 int64_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingLockedDecodeErrorZ_clone_ptr(uint32_t arg) {
13622 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
13623 int64_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
13627 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_clone"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
13628 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
13629 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13630 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
13631 return (uint64_t)ret_conv;
13634 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
13636 o_conv.inner = (void*)(o & (~1));
13637 o_conv.is_owned = (o & 1) || (o == 0);
13638 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13639 o_conv = Init_clone(&o_conv);
13640 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13641 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
13642 return (uint64_t)ret_conv;
13645 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
13646 LDKDecodeError e_conv;
13647 e_conv.inner = (void*)(e & (~1));
13648 e_conv.is_owned = (e & 1) || (e == 0);
13649 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13650 e_conv = DecodeError_clone(&e_conv);
13651 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13652 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
13653 return (uint64_t)ret_conv;
13656 jboolean __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
13657 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
13658 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
13662 void __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
13663 if ((_res & 1) != 0) return;
13664 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13665 CHECK_ACCESS(_res_ptr);
13666 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
13668 CResult_InitDecodeErrorZ_free(_res_conv);
13671 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
13672 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13673 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
13674 return (uint64_t)ret_conv;
13676 int64_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
13677 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
13678 int64_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
13682 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
13683 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
13684 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13685 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
13686 return (uint64_t)ret_conv;
13689 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
13690 LDKOpenChannel o_conv;
13691 o_conv.inner = (void*)(o & (~1));
13692 o_conv.is_owned = (o & 1) || (o == 0);
13693 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13694 o_conv = OpenChannel_clone(&o_conv);
13695 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13696 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
13697 return (uint64_t)ret_conv;
13700 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
13701 LDKDecodeError e_conv;
13702 e_conv.inner = (void*)(e & (~1));
13703 e_conv.is_owned = (e & 1) || (e == 0);
13704 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13705 e_conv = DecodeError_clone(&e_conv);
13706 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13707 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
13708 return (uint64_t)ret_conv;
13711 jboolean __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
13712 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
13713 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
13717 void __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
13718 if ((_res & 1) != 0) return;
13719 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13720 CHECK_ACCESS(_res_ptr);
13721 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
13723 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
13726 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
13727 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13728 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
13729 return (uint64_t)ret_conv;
13731 int64_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
13732 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
13733 int64_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
13737 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
13738 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
13739 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13740 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
13741 return (uint64_t)ret_conv;
13744 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
13745 LDKRevokeAndACK o_conv;
13746 o_conv.inner = (void*)(o & (~1));
13747 o_conv.is_owned = (o & 1) || (o == 0);
13748 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13749 o_conv = RevokeAndACK_clone(&o_conv);
13750 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13751 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
13752 return (uint64_t)ret_conv;
13755 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
13756 LDKDecodeError e_conv;
13757 e_conv.inner = (void*)(e & (~1));
13758 e_conv.is_owned = (e & 1) || (e == 0);
13759 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13760 e_conv = DecodeError_clone(&e_conv);
13761 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13762 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
13763 return (uint64_t)ret_conv;
13766 jboolean __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
13767 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
13768 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
13772 void __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
13773 if ((_res & 1) != 0) return;
13774 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13775 CHECK_ACCESS(_res_ptr);
13776 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
13778 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
13781 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
13782 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13783 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
13784 return (uint64_t)ret_conv;
13786 int64_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
13787 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
13788 int64_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
13792 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
13793 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
13794 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13795 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
13796 return (uint64_t)ret_conv;
13799 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
13800 LDKShutdown o_conv;
13801 o_conv.inner = (void*)(o & (~1));
13802 o_conv.is_owned = (o & 1) || (o == 0);
13803 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13804 o_conv = Shutdown_clone(&o_conv);
13805 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13806 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
13807 return (uint64_t)ret_conv;
13810 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
13811 LDKDecodeError e_conv;
13812 e_conv.inner = (void*)(e & (~1));
13813 e_conv.is_owned = (e & 1) || (e == 0);
13814 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13815 e_conv = DecodeError_clone(&e_conv);
13816 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13817 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
13818 return (uint64_t)ret_conv;
13821 jboolean __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
13822 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
13823 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
13827 void __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
13828 if ((_res & 1) != 0) return;
13829 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13830 CHECK_ACCESS(_res_ptr);
13831 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
13833 CResult_ShutdownDecodeErrorZ_free(_res_conv);
13836 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
13837 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13838 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
13839 return (uint64_t)ret_conv;
13841 int64_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
13842 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
13843 int64_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
13847 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
13848 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
13849 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13850 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
13851 return (uint64_t)ret_conv;
13854 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
13855 LDKUpdateFailHTLC o_conv;
13856 o_conv.inner = (void*)(o & (~1));
13857 o_conv.is_owned = (o & 1) || (o == 0);
13858 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13859 o_conv = UpdateFailHTLC_clone(&o_conv);
13860 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13861 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
13862 return (uint64_t)ret_conv;
13865 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
13866 LDKDecodeError e_conv;
13867 e_conv.inner = (void*)(e & (~1));
13868 e_conv.is_owned = (e & 1) || (e == 0);
13869 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13870 e_conv = DecodeError_clone(&e_conv);
13871 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13872 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
13873 return (uint64_t)ret_conv;
13876 jboolean __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
13877 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
13878 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
13882 void __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
13883 if ((_res & 1) != 0) return;
13884 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13885 CHECK_ACCESS(_res_ptr);
13886 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
13888 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
13891 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
13892 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13893 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
13894 return (uint64_t)ret_conv;
13896 int64_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
13897 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
13898 int64_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
13902 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
13903 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
13904 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13905 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
13906 return (uint64_t)ret_conv;
13909 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
13910 LDKUpdateFailMalformedHTLC o_conv;
13911 o_conv.inner = (void*)(o & (~1));
13912 o_conv.is_owned = (o & 1) || (o == 0);
13913 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13914 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
13915 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13916 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
13917 return (uint64_t)ret_conv;
13920 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
13921 LDKDecodeError e_conv;
13922 e_conv.inner = (void*)(e & (~1));
13923 e_conv.is_owned = (e & 1) || (e == 0);
13924 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13925 e_conv = DecodeError_clone(&e_conv);
13926 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13927 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
13928 return (uint64_t)ret_conv;
13931 jboolean __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
13932 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
13933 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
13937 void __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
13938 if ((_res & 1) != 0) return;
13939 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13940 CHECK_ACCESS(_res_ptr);
13941 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
13943 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
13946 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
13947 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13948 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
13949 return (uint64_t)ret_conv;
13951 int64_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
13952 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
13953 int64_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
13957 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
13958 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
13959 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13960 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
13961 return (uint64_t)ret_conv;
13964 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
13965 LDKUpdateFee o_conv;
13966 o_conv.inner = (void*)(o & (~1));
13967 o_conv.is_owned = (o & 1) || (o == 0);
13968 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13969 o_conv = UpdateFee_clone(&o_conv);
13970 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13971 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
13972 return (uint64_t)ret_conv;
13975 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
13976 LDKDecodeError e_conv;
13977 e_conv.inner = (void*)(e & (~1));
13978 e_conv.is_owned = (e & 1) || (e == 0);
13979 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13980 e_conv = DecodeError_clone(&e_conv);
13981 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13982 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
13983 return (uint64_t)ret_conv;
13986 jboolean __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
13987 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
13988 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
13992 void __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
13993 if ((_res & 1) != 0) return;
13994 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13995 CHECK_ACCESS(_res_ptr);
13996 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
13998 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
14001 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
14002 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14003 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
14004 return (uint64_t)ret_conv;
14006 int64_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
14007 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
14008 int64_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
14012 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
14013 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
14014 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14015 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
14016 return (uint64_t)ret_conv;
14019 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
14020 LDKUpdateFulfillHTLC o_conv;
14021 o_conv.inner = (void*)(o & (~1));
14022 o_conv.is_owned = (o & 1) || (o == 0);
14023 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14024 o_conv = UpdateFulfillHTLC_clone(&o_conv);
14025 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14026 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
14027 return (uint64_t)ret_conv;
14030 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
14031 LDKDecodeError e_conv;
14032 e_conv.inner = (void*)(e & (~1));
14033 e_conv.is_owned = (e & 1) || (e == 0);
14034 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14035 e_conv = DecodeError_clone(&e_conv);
14036 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14037 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
14038 return (uint64_t)ret_conv;
14041 jboolean __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
14042 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
14043 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
14047 void __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
14048 if ((_res & 1) != 0) return;
14049 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14050 CHECK_ACCESS(_res_ptr);
14051 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
14053 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
14056 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
14057 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14058 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
14059 return (uint64_t)ret_conv;
14061 int64_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
14062 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
14063 int64_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
14067 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
14068 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
14069 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14070 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
14071 return (uint64_t)ret_conv;
14074 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
14075 LDKUpdateAddHTLC o_conv;
14076 o_conv.inner = (void*)(o & (~1));
14077 o_conv.is_owned = (o & 1) || (o == 0);
14078 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14079 o_conv = UpdateAddHTLC_clone(&o_conv);
14080 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14081 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
14082 return (uint64_t)ret_conv;
14085 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
14086 LDKDecodeError e_conv;
14087 e_conv.inner = (void*)(e & (~1));
14088 e_conv.is_owned = (e & 1) || (e == 0);
14089 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14090 e_conv = DecodeError_clone(&e_conv);
14091 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14092 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
14093 return (uint64_t)ret_conv;
14096 jboolean __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
14097 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
14098 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
14102 void __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
14103 if ((_res & 1) != 0) return;
14104 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14105 CHECK_ACCESS(_res_ptr);
14106 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
14108 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
14111 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
14112 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14113 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
14114 return (uint64_t)ret_conv;
14116 int64_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
14117 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
14118 int64_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
14122 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
14123 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
14124 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14125 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
14126 return (uint64_t)ret_conv;
14129 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
14131 o_conv.inner = (void*)(o & (~1));
14132 o_conv.is_owned = (o & 1) || (o == 0);
14133 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14134 o_conv = Ping_clone(&o_conv);
14135 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14136 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
14137 return (uint64_t)ret_conv;
14140 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
14141 LDKDecodeError e_conv;
14142 e_conv.inner = (void*)(e & (~1));
14143 e_conv.is_owned = (e & 1) || (e == 0);
14144 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14145 e_conv = DecodeError_clone(&e_conv);
14146 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14147 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
14148 return (uint64_t)ret_conv;
14151 jboolean __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
14152 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
14153 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
14157 void __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
14158 if ((_res & 1) != 0) return;
14159 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14160 CHECK_ACCESS(_res_ptr);
14161 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
14163 CResult_PingDecodeErrorZ_free(_res_conv);
14166 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
14167 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14168 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
14169 return (uint64_t)ret_conv;
14171 int64_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
14172 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
14173 int64_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
14177 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
14178 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
14179 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14180 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
14181 return (uint64_t)ret_conv;
14184 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
14186 o_conv.inner = (void*)(o & (~1));
14187 o_conv.is_owned = (o & 1) || (o == 0);
14188 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14189 o_conv = Pong_clone(&o_conv);
14190 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14191 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
14192 return (uint64_t)ret_conv;
14195 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
14196 LDKDecodeError e_conv;
14197 e_conv.inner = (void*)(e & (~1));
14198 e_conv.is_owned = (e & 1) || (e == 0);
14199 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14200 e_conv = DecodeError_clone(&e_conv);
14201 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14202 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
14203 return (uint64_t)ret_conv;
14206 jboolean __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
14207 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
14208 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
14212 void __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
14213 if ((_res & 1) != 0) return;
14214 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14215 CHECK_ACCESS(_res_ptr);
14216 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
14218 CResult_PongDecodeErrorZ_free(_res_conv);
14221 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
14222 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14223 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
14224 return (uint64_t)ret_conv;
14226 int64_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
14227 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
14228 int64_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
14232 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
14233 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
14234 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14235 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
14236 return (uint64_t)ret_conv;
14239 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
14240 LDKUnsignedChannelAnnouncement o_conv;
14241 o_conv.inner = (void*)(o & (~1));
14242 o_conv.is_owned = (o & 1) || (o == 0);
14243 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14244 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
14245 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14246 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
14247 return (uint64_t)ret_conv;
14250 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
14251 LDKDecodeError e_conv;
14252 e_conv.inner = (void*)(e & (~1));
14253 e_conv.is_owned = (e & 1) || (e == 0);
14254 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14255 e_conv = DecodeError_clone(&e_conv);
14256 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14257 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
14258 return (uint64_t)ret_conv;
14261 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14262 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
14263 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
14267 void __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
14268 if ((_res & 1) != 0) return;
14269 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14270 CHECK_ACCESS(_res_ptr);
14271 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
14273 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
14276 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14277 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14278 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
14279 return (uint64_t)ret_conv;
14281 int64_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14282 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
14283 int64_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14287 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14288 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14289 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14290 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14291 return (uint64_t)ret_conv;
14294 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
14295 LDKChannelAnnouncement o_conv;
14296 o_conv.inner = (void*)(o & (~1));
14297 o_conv.is_owned = (o & 1) || (o == 0);
14298 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14299 o_conv = ChannelAnnouncement_clone(&o_conv);
14300 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14301 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
14302 return (uint64_t)ret_conv;
14305 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
14306 LDKDecodeError e_conv;
14307 e_conv.inner = (void*)(e & (~1));
14308 e_conv.is_owned = (e & 1) || (e == 0);
14309 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14310 e_conv = DecodeError_clone(&e_conv);
14311 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14312 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
14313 return (uint64_t)ret_conv;
14316 jboolean __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14317 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
14318 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
14322 void __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
14323 if ((_res & 1) != 0) return;
14324 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14325 CHECK_ACCESS(_res_ptr);
14326 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
14328 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
14331 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14332 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14333 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
14334 return (uint64_t)ret_conv;
14336 int64_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14337 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
14338 int64_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14342 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14343 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14344 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14345 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14346 return (uint64_t)ret_conv;
14349 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
14350 LDKUnsignedChannelUpdate o_conv;
14351 o_conv.inner = (void*)(o & (~1));
14352 o_conv.is_owned = (o & 1) || (o == 0);
14353 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14354 o_conv = UnsignedChannelUpdate_clone(&o_conv);
14355 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14356 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
14357 return (uint64_t)ret_conv;
14360 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
14361 LDKDecodeError e_conv;
14362 e_conv.inner = (void*)(e & (~1));
14363 e_conv.is_owned = (e & 1) || (e == 0);
14364 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14365 e_conv = DecodeError_clone(&e_conv);
14366 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14367 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
14368 return (uint64_t)ret_conv;
14371 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
14372 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
14373 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
14377 void __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
14378 if ((_res & 1) != 0) return;
14379 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14380 CHECK_ACCESS(_res_ptr);
14381 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
14383 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
14386 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
14387 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14388 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
14389 return (uint64_t)ret_conv;
14391 int64_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
14392 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
14393 int64_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
14397 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
14398 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
14399 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14400 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
14401 return (uint64_t)ret_conv;
14404 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
14405 LDKChannelUpdate o_conv;
14406 o_conv.inner = (void*)(o & (~1));
14407 o_conv.is_owned = (o & 1) || (o == 0);
14408 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14409 o_conv = ChannelUpdate_clone(&o_conv);
14410 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14411 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
14412 return (uint64_t)ret_conv;
14415 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
14416 LDKDecodeError e_conv;
14417 e_conv.inner = (void*)(e & (~1));
14418 e_conv.is_owned = (e & 1) || (e == 0);
14419 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14420 e_conv = DecodeError_clone(&e_conv);
14421 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14422 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
14423 return (uint64_t)ret_conv;
14426 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
14427 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
14428 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
14432 void __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
14433 if ((_res & 1) != 0) return;
14434 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14435 CHECK_ACCESS(_res_ptr);
14436 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
14438 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
14441 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
14442 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14443 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
14444 return (uint64_t)ret_conv;
14446 int64_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
14447 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
14448 int64_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
14452 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
14453 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
14454 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14455 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
14456 return (uint64_t)ret_conv;
14459 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
14460 LDKErrorMessage o_conv;
14461 o_conv.inner = (void*)(o & (~1));
14462 o_conv.is_owned = (o & 1) || (o == 0);
14463 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14464 o_conv = ErrorMessage_clone(&o_conv);
14465 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14466 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
14467 return (uint64_t)ret_conv;
14470 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
14471 LDKDecodeError e_conv;
14472 e_conv.inner = (void*)(e & (~1));
14473 e_conv.is_owned = (e & 1) || (e == 0);
14474 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14475 e_conv = DecodeError_clone(&e_conv);
14476 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14477 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
14478 return (uint64_t)ret_conv;
14481 jboolean __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
14482 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
14483 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
14487 void __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
14488 if ((_res & 1) != 0) return;
14489 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14490 CHECK_ACCESS(_res_ptr);
14491 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
14493 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
14496 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
14497 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14498 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
14499 return (uint64_t)ret_conv;
14501 int64_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
14502 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
14503 int64_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
14507 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
14508 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
14509 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14510 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
14511 return (uint64_t)ret_conv;
14514 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
14515 LDKUnsignedNodeAnnouncement o_conv;
14516 o_conv.inner = (void*)(o & (~1));
14517 o_conv.is_owned = (o & 1) || (o == 0);
14518 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14519 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
14520 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14521 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
14522 return (uint64_t)ret_conv;
14525 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
14526 LDKDecodeError e_conv;
14527 e_conv.inner = (void*)(e & (~1));
14528 e_conv.is_owned = (e & 1) || (e == 0);
14529 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14530 e_conv = DecodeError_clone(&e_conv);
14531 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14532 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
14533 return (uint64_t)ret_conv;
14536 jboolean __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14537 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
14538 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
14542 void __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
14543 if ((_res & 1) != 0) return;
14544 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14545 CHECK_ACCESS(_res_ptr);
14546 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
14548 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
14551 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14552 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14553 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
14554 return (uint64_t)ret_conv;
14556 int64_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14557 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
14558 int64_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14562 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14563 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
14564 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14565 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
14566 return (uint64_t)ret_conv;
14569 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
14570 LDKNodeAnnouncement o_conv;
14571 o_conv.inner = (void*)(o & (~1));
14572 o_conv.is_owned = (o & 1) || (o == 0);
14573 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14574 o_conv = NodeAnnouncement_clone(&o_conv);
14575 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14576 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
14577 return (uint64_t)ret_conv;
14580 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
14581 LDKDecodeError e_conv;
14582 e_conv.inner = (void*)(e & (~1));
14583 e_conv.is_owned = (e & 1) || (e == 0);
14584 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14585 e_conv = DecodeError_clone(&e_conv);
14586 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14587 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
14588 return (uint64_t)ret_conv;
14591 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14592 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
14593 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
14597 void __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
14598 if ((_res & 1) != 0) return;
14599 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14600 CHECK_ACCESS(_res_ptr);
14601 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
14603 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
14606 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14607 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14608 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
14609 return (uint64_t)ret_conv;
14611 int64_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14612 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
14613 int64_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14617 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14618 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
14619 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14620 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
14621 return (uint64_t)ret_conv;
14624 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
14625 LDKQueryShortChannelIds o_conv;
14626 o_conv.inner = (void*)(o & (~1));
14627 o_conv.is_owned = (o & 1) || (o == 0);
14628 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14629 o_conv = QueryShortChannelIds_clone(&o_conv);
14630 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14631 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
14632 return (uint64_t)ret_conv;
14635 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
14636 LDKDecodeError e_conv;
14637 e_conv.inner = (void*)(e & (~1));
14638 e_conv.is_owned = (e & 1) || (e == 0);
14639 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14640 e_conv = DecodeError_clone(&e_conv);
14641 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14642 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
14643 return (uint64_t)ret_conv;
14646 jboolean __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
14647 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
14648 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
14652 void __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
14653 if ((_res & 1) != 0) return;
14654 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14655 CHECK_ACCESS(_res_ptr);
14656 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
14658 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
14661 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
14662 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14663 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
14664 return (uint64_t)ret_conv;
14666 int64_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
14667 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
14668 int64_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
14672 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
14673 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
14674 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14675 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
14676 return (uint64_t)ret_conv;
14679 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
14680 LDKReplyShortChannelIdsEnd o_conv;
14681 o_conv.inner = (void*)(o & (~1));
14682 o_conv.is_owned = (o & 1) || (o == 0);
14683 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14684 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
14685 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14686 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
14687 return (uint64_t)ret_conv;
14690 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
14691 LDKDecodeError e_conv;
14692 e_conv.inner = (void*)(e & (~1));
14693 e_conv.is_owned = (e & 1) || (e == 0);
14694 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14695 e_conv = DecodeError_clone(&e_conv);
14696 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14697 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
14698 return (uint64_t)ret_conv;
14701 jboolean __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
14702 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
14703 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
14707 void __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
14708 if ((_res & 1) != 0) return;
14709 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14710 CHECK_ACCESS(_res_ptr);
14711 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
14713 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
14716 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
14717 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14718 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
14719 return (uint64_t)ret_conv;
14721 int64_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
14722 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
14723 int64_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
14727 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
14728 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
14729 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14730 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
14731 return (uint64_t)ret_conv;
14734 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
14735 LDKQueryChannelRange o_conv;
14736 o_conv.inner = (void*)(o & (~1));
14737 o_conv.is_owned = (o & 1) || (o == 0);
14738 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14739 o_conv = QueryChannelRange_clone(&o_conv);
14740 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14741 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
14742 return (uint64_t)ret_conv;
14745 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
14746 LDKDecodeError e_conv;
14747 e_conv.inner = (void*)(e & (~1));
14748 e_conv.is_owned = (e & 1) || (e == 0);
14749 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14750 e_conv = DecodeError_clone(&e_conv);
14751 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14752 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
14753 return (uint64_t)ret_conv;
14756 jboolean __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
14757 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
14758 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
14762 void __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
14763 if ((_res & 1) != 0) return;
14764 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14765 CHECK_ACCESS(_res_ptr);
14766 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
14768 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
14771 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
14772 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14773 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
14774 return (uint64_t)ret_conv;
14776 int64_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
14777 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
14778 int64_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
14782 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
14783 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
14784 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14785 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
14786 return (uint64_t)ret_conv;
14789 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
14790 LDKReplyChannelRange o_conv;
14791 o_conv.inner = (void*)(o & (~1));
14792 o_conv.is_owned = (o & 1) || (o == 0);
14793 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14794 o_conv = ReplyChannelRange_clone(&o_conv);
14795 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14796 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
14797 return (uint64_t)ret_conv;
14800 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
14801 LDKDecodeError e_conv;
14802 e_conv.inner = (void*)(e & (~1));
14803 e_conv.is_owned = (e & 1) || (e == 0);
14804 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14805 e_conv = DecodeError_clone(&e_conv);
14806 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14807 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
14808 return (uint64_t)ret_conv;
14811 jboolean __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
14812 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
14813 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
14817 void __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
14818 if ((_res & 1) != 0) return;
14819 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14820 CHECK_ACCESS(_res_ptr);
14821 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
14823 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
14826 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
14827 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14828 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
14829 return (uint64_t)ret_conv;
14831 int64_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
14832 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
14833 int64_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
14837 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
14838 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
14839 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14840 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
14841 return (uint64_t)ret_conv;
14844 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
14845 LDKGossipTimestampFilter o_conv;
14846 o_conv.inner = (void*)(o & (~1));
14847 o_conv.is_owned = (o & 1) || (o == 0);
14848 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14849 o_conv = GossipTimestampFilter_clone(&o_conv);
14850 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14851 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
14852 return (uint64_t)ret_conv;
14855 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
14856 LDKDecodeError e_conv;
14857 e_conv.inner = (void*)(e & (~1));
14858 e_conv.is_owned = (e & 1) || (e == 0);
14859 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14860 e_conv = DecodeError_clone(&e_conv);
14861 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14862 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
14863 return (uint64_t)ret_conv;
14866 jboolean __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
14867 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
14868 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
14872 void __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
14873 if ((_res & 1) != 0) return;
14874 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14875 CHECK_ACCESS(_res_ptr);
14876 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
14878 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
14881 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
14882 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14883 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
14884 return (uint64_t)ret_conv;
14886 int64_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
14887 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
14888 int64_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
14892 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
14893 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
14894 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14895 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
14896 return (uint64_t)ret_conv;
14899 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14900 LDKDelayedPaymentOutputDescriptor o_conv;
14901 o_conv.inner = (void*)(o & (~1));
14902 o_conv.is_owned = (o & 1) || (o == 0);
14903 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14904 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
14905 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14906 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14907 return (uint64_t)ret_conv;
14910 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14911 LDKDecodeError e_conv;
14912 e_conv.inner = (void*)(e & (~1));
14913 e_conv.is_owned = (e & 1) || (e == 0);
14914 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14915 e_conv = DecodeError_clone(&e_conv);
14916 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14917 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14918 return (uint64_t)ret_conv;
14921 jboolean __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14922 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14923 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14927 void __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14928 if ((_res & 1) != 0) return;
14929 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14930 CHECK_ACCESS(_res_ptr);
14931 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14933 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14936 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14937 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14938 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14939 return (uint64_t)ret_conv;
14941 int64_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14942 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14943 int64_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14947 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14948 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
14949 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14950 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14951 return (uint64_t)ret_conv;
14954 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14955 LDKStaticPaymentOutputDescriptor o_conv;
14956 o_conv.inner = (void*)(o & (~1));
14957 o_conv.is_owned = (o & 1) || (o == 0);
14958 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14959 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
14960 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14961 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14962 return (uint64_t)ret_conv;
14965 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14966 LDKDecodeError e_conv;
14967 e_conv.inner = (void*)(e & (~1));
14968 e_conv.is_owned = (e & 1) || (e == 0);
14969 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14970 e_conv = DecodeError_clone(&e_conv);
14971 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14972 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14973 return (uint64_t)ret_conv;
14976 jboolean __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14977 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14978 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14982 void __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14983 if ((_res & 1) != 0) return;
14984 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14985 CHECK_ACCESS(_res_ptr);
14986 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14988 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14991 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14992 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14993 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14994 return (uint64_t)ret_conv;
14996 int64_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14997 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14998 int64_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15002 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
15003 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
15004 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15005 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15006 return (uint64_t)ret_conv;
15009 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
15010 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15011 CHECK_ACCESS(o_ptr);
15012 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
15013 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
15014 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15015 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
15016 return (uint64_t)ret_conv;
15019 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
15020 LDKDecodeError e_conv;
15021 e_conv.inner = (void*)(e & (~1));
15022 e_conv.is_owned = (e & 1) || (e == 0);
15023 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15024 e_conv = DecodeError_clone(&e_conv);
15025 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15026 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
15027 return (uint64_t)ret_conv;
15030 jboolean __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
15031 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
15032 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15036 void __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
15037 if ((_res & 1) != 0) return;
15038 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15039 CHECK_ACCESS(_res_ptr);
15040 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
15042 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
15045 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15046 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15047 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
15048 return (uint64_t)ret_conv;
15050 int64_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
15051 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
15052 int64_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15056 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
15057 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
15058 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15059 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
15060 return (uint64_t)ret_conv;
15063 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
15064 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15065 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
15066 return ((uint64_t)ret_conv);
15068 int64_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
15069 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
15070 int64_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
15074 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
15075 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
15076 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15077 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
15078 return ((uint64_t)ret_conv);
15081 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
15082 LDKSignature a_ref;
15083 CHECK(a->arr_len == 64);
15084 memcpy(a_ref.compact_form, a->elems, 64);
15085 LDKCVec_SignatureZ b_constr;
15086 b_constr.datalen = b->arr_len;
15087 if (b_constr.datalen > 0)
15088 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15090 b_constr.data = NULL;
15091 int8_tArray* b_vals = (void*) b->elems;
15092 for (size_t m = 0; m < b_constr.datalen; m++) {
15093 int8_tArray b_conv_12 = b_vals[m];
15094 LDKSignature b_conv_12_ref;
15095 CHECK(b_conv_12->arr_len == 64);
15096 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64);
15097 b_constr.data[m] = b_conv_12_ref;
15099 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15100 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
15101 return ((uint64_t)ret_conv);
15104 void __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
15105 if ((_res & 1) != 0) return;
15106 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15107 CHECK_ACCESS(_res_ptr);
15108 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
15110 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
15113 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
15114 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15115 CHECK_ACCESS(o_ptr);
15116 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
15117 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
15118 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15119 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
15120 return (uint64_t)ret_conv;
15123 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
15124 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15125 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
15126 return (uint64_t)ret_conv;
15129 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
15130 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
15131 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
15135 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
15136 if ((_res & 1) != 0) return;
15137 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15138 CHECK_ACCESS(_res_ptr);
15139 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
15141 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
15144 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
15145 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15146 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
15147 return (uint64_t)ret_conv;
15149 int64_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
15150 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
15151 int64_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
15155 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
15156 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
15157 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15158 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
15159 return (uint64_t)ret_conv;
15162 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
15163 LDKSignature o_ref;
15164 CHECK(o->arr_len == 64);
15165 memcpy(o_ref.compact_form, o->elems, 64);
15166 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15167 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
15168 return (uint64_t)ret_conv;
15171 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
15172 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15173 *ret_conv = CResult_SignatureNoneZ_err();
15174 return (uint64_t)ret_conv;
15177 jboolean __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
15178 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
15179 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
15183 void __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
15184 if ((_res & 1) != 0) return;
15185 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15186 CHECK_ACCESS(_res_ptr);
15187 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
15189 CResult_SignatureNoneZ_free(_res_conv);
15192 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
15193 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15194 *ret_conv = CResult_SignatureNoneZ_clone(arg);
15195 return (uint64_t)ret_conv;
15197 int64_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
15198 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
15199 int64_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
15203 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
15204 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
15205 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15206 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
15207 return (uint64_t)ret_conv;
15210 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
15211 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15212 CHECK_ACCESS(o_ptr);
15213 LDKSign o_conv = *(LDKSign*)(o_ptr);
15214 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15215 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
15216 return (uint64_t)ret_conv;
15219 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
15220 LDKDecodeError e_conv;
15221 e_conv.inner = (void*)(e & (~1));
15222 e_conv.is_owned = (e & 1) || (e == 0);
15223 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15224 e_conv = DecodeError_clone(&e_conv);
15225 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15226 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
15227 return (uint64_t)ret_conv;
15230 jboolean __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
15231 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
15232 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
15236 void __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
15237 if ((_res & 1) != 0) return;
15238 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15239 CHECK_ACCESS(_res_ptr);
15240 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
15242 CResult_SignDecodeErrorZ_free(_res_conv);
15245 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
15246 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15247 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
15248 return (uint64_t)ret_conv;
15250 int64_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
15251 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
15252 int64_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
15256 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
15257 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
15258 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15259 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
15260 return (uint64_t)ret_conv;
15263 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
15264 LDKRecoverableSignature o_ref;
15265 CHECK(o->arr_len == 68);
15266 memcpy(o_ref.serialized_form, o->elems, 68);
15267 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15268 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
15269 return (uint64_t)ret_conv;
15272 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
15273 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15274 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
15275 return (uint64_t)ret_conv;
15278 jboolean __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
15279 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
15280 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
15284 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
15285 if ((_res & 1) != 0) return;
15286 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15287 CHECK_ACCESS(_res_ptr);
15288 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
15290 CResult_RecoverableSignatureNoneZ_free(_res_conv);
15293 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
15294 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15295 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
15296 return (uint64_t)ret_conv;
15298 int64_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
15299 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
15300 int64_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
15304 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
15305 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
15306 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15307 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
15308 return (uint64_t)ret_conv;
15311 void __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
15312 LDKCVec_CVec_u8ZZ _res_constr;
15313 _res_constr.datalen = _res->arr_len;
15314 if (_res_constr.datalen > 0)
15315 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15317 _res_constr.data = NULL;
15318 int8_tArray* _res_vals = (void*) _res->elems;
15319 for (size_t m = 0; m < _res_constr.datalen; m++) {
15320 int8_tArray _res_conv_12 = _res_vals[m];
15321 LDKCVec_u8Z _res_conv_12_ref;
15322 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
15323 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15324 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen);
15325 _res_constr.data[m] = _res_conv_12_ref;
15327 CVec_CVec_u8ZZ_free(_res_constr);
15330 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
15331 LDKCVec_CVec_u8ZZ o_constr;
15332 o_constr.datalen = o->arr_len;
15333 if (o_constr.datalen > 0)
15334 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15336 o_constr.data = NULL;
15337 int8_tArray* o_vals = (void*) o->elems;
15338 for (size_t m = 0; m < o_constr.datalen; m++) {
15339 int8_tArray o_conv_12 = o_vals[m];
15340 LDKCVec_u8Z o_conv_12_ref;
15341 o_conv_12_ref.datalen = o_conv_12->arr_len;
15342 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15343 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen);
15344 o_constr.data[m] = o_conv_12_ref;
15346 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15347 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
15348 return (uint64_t)ret_conv;
15351 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
15352 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15353 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
15354 return (uint64_t)ret_conv;
15357 jboolean __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
15358 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
15359 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
15363 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
15364 if ((_res & 1) != 0) return;
15365 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15366 CHECK_ACCESS(_res_ptr);
15367 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
15369 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
15372 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
15373 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15374 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
15375 return (uint64_t)ret_conv;
15377 int64_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
15378 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
15379 int64_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
15383 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
15384 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
15385 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15386 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
15387 return (uint64_t)ret_conv;
15390 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
15391 LDKInMemorySigner o_conv;
15392 o_conv.inner = (void*)(o & (~1));
15393 o_conv.is_owned = (o & 1) || (o == 0);
15394 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15395 o_conv = InMemorySigner_clone(&o_conv);
15396 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15397 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
15398 return (uint64_t)ret_conv;
15401 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
15402 LDKDecodeError e_conv;
15403 e_conv.inner = (void*)(e & (~1));
15404 e_conv.is_owned = (e & 1) || (e == 0);
15405 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15406 e_conv = DecodeError_clone(&e_conv);
15407 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15408 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
15409 return (uint64_t)ret_conv;
15412 jboolean __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
15413 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
15414 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
15418 void __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
15419 if ((_res & 1) != 0) return;
15420 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15421 CHECK_ACCESS(_res_ptr);
15422 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
15424 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
15427 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
15428 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15429 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
15430 return (uint64_t)ret_conv;
15432 int64_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
15433 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
15434 int64_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
15438 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
15439 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
15440 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15441 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
15442 return (uint64_t)ret_conv;
15445 void __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
15446 LDKCVec_TxOutZ _res_constr;
15447 _res_constr.datalen = _res->arr_len;
15448 if (_res_constr.datalen > 0)
15449 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15451 _res_constr.data = NULL;
15452 uint32_t* _res_vals = _res->elems;
15453 for (size_t h = 0; h < _res_constr.datalen; h++) {
15454 uint32_t _res_conv_7 = _res_vals[h];
15455 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
15456 CHECK_ACCESS(_res_conv_7_ptr);
15457 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15458 FREE((void*)_res_conv_7);
15459 _res_constr.data[h] = _res_conv_7_conv;
15461 CVec_TxOutZ_free(_res_constr);
15464 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
15465 LDKTransaction o_ref;
15466 o_ref.datalen = o->arr_len;
15467 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
15468 memcpy(o_ref.data, o->elems, o_ref.datalen);
15469 o_ref.data_is_owned = true;
15470 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15471 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
15472 return (uint64_t)ret_conv;
15475 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
15476 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15477 *ret_conv = CResult_TransactionNoneZ_err();
15478 return (uint64_t)ret_conv;
15481 jboolean __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
15482 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
15483 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
15487 void __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
15488 if ((_res & 1) != 0) return;
15489 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15490 CHECK_ACCESS(_res_ptr);
15491 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
15493 CResult_TransactionNoneZ_free(_res_conv);
15496 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
15497 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15498 *ret_conv = CResult_TransactionNoneZ_clone(arg);
15499 return (uint64_t)ret_conv;
15501 int64_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
15502 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
15503 int64_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
15507 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
15508 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
15509 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15510 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
15511 return (uint64_t)ret_conv;
15514 uint32_t __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint32_t o) {
15515 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15516 CHECK_ACCESS(o_ptr);
15517 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
15518 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15519 *ret_copy = COption_FilterZ_some(o_conv);
15520 uint64_t ret_ref = (uint64_t)ret_copy;
15524 uint32_t __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
15525 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15526 *ret_copy = COption_FilterZ_none();
15527 uint64_t ret_ref = (uint64_t)ret_copy;
15531 void __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint32_t _res) {
15532 if ((_res & 1) != 0) return;
15533 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15534 CHECK_ACCESS(_res_ptr);
15535 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
15537 COption_FilterZ_free(_res_conv);
15540 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
15541 LDKLockedChannelMonitor o_conv;
15542 o_conv.inner = (void*)(o & (~1));
15543 o_conv.is_owned = (o & 1) || (o == 0);
15544 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15545 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
15546 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15547 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
15548 return (uint64_t)ret_conv;
15551 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
15552 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15553 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
15554 return (uint64_t)ret_conv;
15557 jboolean __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
15558 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
15559 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
15563 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
15564 if ((_res & 1) != 0) return;
15565 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15566 CHECK_ACCESS(_res_ptr);
15567 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
15569 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
15572 void __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
15573 LDKCVec_OutPointZ _res_constr;
15574 _res_constr.datalen = _res->arr_len;
15575 if (_res_constr.datalen > 0)
15576 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
15578 _res_constr.data = NULL;
15579 uint32_t* _res_vals = _res->elems;
15580 for (size_t k = 0; k < _res_constr.datalen; k++) {
15581 uint32_t _res_conv_10 = _res_vals[k];
15582 LDKOutPoint _res_conv_10_conv;
15583 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
15584 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
15585 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
15586 _res_constr.data[k] = _res_conv_10_conv;
15588 CVec_OutPointZ_free(_res_constr);
15591 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15592 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15593 *ret_conv = CResult_NoneAPIErrorZ_ok();
15594 return (uint64_t)ret_conv;
15597 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
15598 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15599 CHECK_ACCESS(e_ptr);
15600 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15601 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15602 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15603 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15604 return (uint64_t)ret_conv;
15607 jboolean __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
15608 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
15609 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
15613 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
15614 if ((_res & 1) != 0) return;
15615 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15616 CHECK_ACCESS(_res_ptr);
15617 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15619 CResult_NoneAPIErrorZ_free(_res_conv);
15622 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15623 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15624 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15625 return (uint64_t)ret_conv;
15627 int64_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
15628 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
15629 int64_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15633 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
15634 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
15635 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15636 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15637 return (uint64_t)ret_conv;
15640 uint32_t __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
15641 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15642 *ret_copy = COption_u16Z_some(o);
15643 uint64_t ret_ref = (uint64_t)ret_copy;
15647 uint32_t __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
15648 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15649 *ret_copy = COption_u16Z_none();
15650 uint64_t ret_ref = (uint64_t)ret_copy;
15654 void __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint32_t _res) {
15655 if ((_res & 1) != 0) return;
15656 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15657 CHECK_ACCESS(_res_ptr);
15658 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
15660 COption_u16Z_free(_res_conv);
15663 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
15664 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15665 *ret_copy = COption_u16Z_clone(arg);
15666 uint64_t ret_ref = (uint64_t)ret_copy;
15669 int64_t __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
15670 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
15671 int64_t ret_val = COption_u16Z_clone_ptr(arg_conv);
15675 uint32_t __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint32_t orig) {
15676 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
15677 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15678 *ret_copy = COption_u16Z_clone(orig_conv);
15679 uint64_t ret_ref = (uint64_t)ret_copy;
15683 void __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
15684 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15685 _res_constr.datalen = _res->arr_len;
15686 if (_res_constr.datalen > 0)
15687 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15689 _res_constr.data = NULL;
15690 uint32_t* _res_vals = _res->elems;
15691 for (size_t w = 0; w < _res_constr.datalen; w++) {
15692 uint32_t _res_conv_22 = _res_vals[w];
15693 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
15694 CHECK_ACCESS(_res_conv_22_ptr);
15695 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15696 FREE((void*)_res_conv_22);
15697 _res_constr.data[w] = _res_conv_22_conv;
15699 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15702 void __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
15703 LDKCVec_APIErrorZ _res_constr;
15704 _res_constr.datalen = _res->arr_len;
15705 if (_res_constr.datalen > 0)
15706 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15708 _res_constr.data = NULL;
15709 uint32_t* _res_vals = _res->elems;
15710 for (size_t k = 0; k < _res_constr.datalen; k++) {
15711 uint32_t _res_conv_10 = _res_vals[k];
15712 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
15713 CHECK_ACCESS(_res_conv_10_ptr);
15714 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15715 FREE((void*)_res_conv_10);
15716 _res_constr.data[k] = _res_conv_10_conv;
15718 CVec_APIErrorZ_free(_res_constr);
15721 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
15722 LDKThirtyTwoBytes o_ref;
15723 CHECK(o->arr_len == 32);
15724 memcpy(o_ref.data, o->elems, 32);
15725 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15726 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
15727 return (uint64_t)ret_conv;
15730 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
15731 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15732 CHECK_ACCESS(e_ptr);
15733 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15734 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15735 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15736 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
15737 return (uint64_t)ret_conv;
15740 jboolean __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
15741 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
15742 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
15746 void __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
15747 if ((_res & 1) != 0) return;
15748 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15749 CHECK_ACCESS(_res_ptr);
15750 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
15752 CResult__u832APIErrorZ_free(_res_conv);
15755 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
15756 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15757 *ret_conv = CResult__u832APIErrorZ_clone(arg);
15758 return (uint64_t)ret_conv;
15760 int64_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
15761 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
15762 int64_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
15766 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
15767 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
15768 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15769 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
15770 return (uint64_t)ret_conv;
15773 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
15774 LDKThirtyTwoBytes o_ref;
15775 CHECK(o->arr_len == 32);
15776 memcpy(o_ref.data, o->elems, 32);
15777 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15778 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
15779 return (uint64_t)ret_conv;
15782 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
15783 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15784 CHECK_ACCESS(e_ptr);
15785 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15786 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
15787 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15788 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
15789 return (uint64_t)ret_conv;
15792 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
15793 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
15794 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
15798 void __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
15799 if ((_res & 1) != 0) return;
15800 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15801 CHECK_ACCESS(_res_ptr);
15802 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
15804 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
15807 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
15808 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15809 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
15810 return (uint64_t)ret_conv;
15812 int64_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15813 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
15814 int64_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
15818 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
15819 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
15820 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15821 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
15822 return (uint64_t)ret_conv;
15825 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
15826 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15827 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
15828 return (uint64_t)ret_conv;
15831 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
15832 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15833 CHECK_ACCESS(e_ptr);
15834 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15835 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
15836 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15837 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
15838 return (uint64_t)ret_conv;
15841 jboolean __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
15842 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
15843 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
15847 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
15848 if ((_res & 1) != 0) return;
15849 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15850 CHECK_ACCESS(_res_ptr);
15851 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
15853 CResult_NonePaymentSendFailureZ_free(_res_conv);
15856 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
15857 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15858 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
15859 return (uint64_t)ret_conv;
15861 int64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
15862 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
15863 int64_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
15867 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
15868 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
15869 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15870 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
15871 return (uint64_t)ret_conv;
15874 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
15875 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15876 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
15877 return ((uint64_t)ret_conv);
15879 int64_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
15880 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
15881 int64_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
15885 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
15886 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
15887 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15888 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
15889 return ((uint64_t)ret_conv);
15892 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
15893 LDKThirtyTwoBytes a_ref;
15894 CHECK(a->arr_len == 32);
15895 memcpy(a_ref.data, a->elems, 32);
15896 LDKThirtyTwoBytes b_ref;
15897 CHECK(b->arr_len == 32);
15898 memcpy(b_ref.data, b->elems, 32);
15899 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15900 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
15901 return ((uint64_t)ret_conv);
15904 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
15905 if ((_res & 1) != 0) return;
15906 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15907 CHECK_ACCESS(_res_ptr);
15908 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
15910 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
15913 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
15914 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15915 CHECK_ACCESS(o_ptr);
15916 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
15917 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
15918 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15919 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
15920 return (uint64_t)ret_conv;
15923 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
15924 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15925 CHECK_ACCESS(e_ptr);
15926 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15927 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
15928 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15929 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
15930 return (uint64_t)ret_conv;
15933 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
15934 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
15935 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
15939 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
15940 if ((_res & 1) != 0) return;
15941 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15942 CHECK_ACCESS(_res_ptr);
15943 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
15945 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
15948 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
15949 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15950 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
15951 return (uint64_t)ret_conv;
15953 int64_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15954 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
15955 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
15959 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
15960 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
15961 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15962 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
15963 return (uint64_t)ret_conv;
15966 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
15967 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15968 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
15969 return ((uint64_t)ret_conv);
15971 int64_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
15972 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
15973 int64_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
15977 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
15978 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
15979 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15980 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
15981 return ((uint64_t)ret_conv);
15984 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
15985 LDKThirtyTwoBytes a_ref;
15986 CHECK(a->arr_len == 32);
15987 memcpy(a_ref.data, a->elems, 32);
15988 LDKThirtyTwoBytes b_ref;
15989 CHECK(b->arr_len == 32);
15990 memcpy(b_ref.data, b->elems, 32);
15991 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15992 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
15993 return ((uint64_t)ret_conv);
15996 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
15997 if ((_res & 1) != 0) return;
15998 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15999 CHECK_ACCESS(_res_ptr);
16000 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
16002 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
16005 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) {
16006 void* o_ptr = (void*)(((uint64_t)o) & ~1);
16007 CHECK_ACCESS(o_ptr);
16008 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16009 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1));
16010 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16011 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
16012 return (uint64_t)ret_conv;
16015 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
16016 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16017 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
16018 return (uint64_t)ret_conv;
16021 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) {
16022 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
16023 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
16027 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) {
16028 if ((_res & 1) != 0) return;
16029 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16030 CHECK_ACCESS(_res_ptr);
16031 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
16033 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
16036 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
16037 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16038 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
16039 return (uint64_t)ret_conv;
16041 int64_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) {
16042 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
16043 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
16047 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) {
16048 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
16049 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16050 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
16051 return (uint64_t)ret_conv;
16054 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) {
16055 void* o_ptr = (void*)(((uint64_t)o) & ~1);
16056 CHECK_ACCESS(o_ptr);
16057 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16058 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1));
16059 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16060 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
16061 return (uint64_t)ret_conv;
16064 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) {
16065 void* e_ptr = (void*)(((uint64_t)e) & ~1);
16066 CHECK_ACCESS(e_ptr);
16067 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16068 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
16069 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16070 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
16071 return (uint64_t)ret_conv;
16074 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) {
16075 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
16076 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
16080 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint32_t _res) {
16081 if ((_res & 1) != 0) return;
16082 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16083 CHECK_ACCESS(_res_ptr);
16084 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
16086 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
16089 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
16090 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16091 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
16092 return (uint64_t)ret_conv;
16094 int64_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) {
16095 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
16096 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
16100 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) {
16101 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
16102 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16103 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
16104 return (uint64_t)ret_conv;
16107 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
16108 LDKThirtyTwoBytes o_ref;
16109 CHECK(o->arr_len == 32);
16110 memcpy(o_ref.data, o->elems, 32);
16111 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16112 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
16113 return (uint64_t)ret_conv;
16116 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
16117 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16118 *ret_conv = CResult_PaymentSecretNoneZ_err();
16119 return (uint64_t)ret_conv;
16122 jboolean __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) {
16123 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
16124 jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv);
16128 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) {
16129 if ((_res & 1) != 0) return;
16130 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16131 CHECK_ACCESS(_res_ptr);
16132 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
16134 CResult_PaymentSecretNoneZ_free(_res_conv);
16137 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
16138 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16139 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
16140 return (uint64_t)ret_conv;
16142 int64_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) {
16143 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
16144 int64_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
16148 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) {
16149 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
16150 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16151 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
16152 return (uint64_t)ret_conv;
16155 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
16156 LDKThirtyTwoBytes o_ref;
16157 CHECK(o->arr_len == 32);
16158 memcpy(o_ref.data, o->elems, 32);
16159 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16160 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
16161 return (uint64_t)ret_conv;
16164 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
16165 void* e_ptr = (void*)(((uint64_t)e) & ~1);
16166 CHECK_ACCESS(e_ptr);
16167 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16168 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
16169 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16170 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
16171 return (uint64_t)ret_conv;
16174 jboolean __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
16175 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
16176 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
16180 void __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
16181 if ((_res & 1) != 0) return;
16182 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16183 CHECK_ACCESS(_res_ptr);
16184 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
16186 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
16189 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
16190 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16191 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
16192 return (uint64_t)ret_conv;
16194 int64_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
16195 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
16196 int64_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
16200 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
16201 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
16202 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16203 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
16204 return (uint64_t)ret_conv;
16207 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
16208 LDKThirtyTwoBytes o_ref;
16209 CHECK(o->arr_len == 32);
16210 memcpy(o_ref.data, o->elems, 32);
16211 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16212 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
16213 return (uint64_t)ret_conv;
16216 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) {
16217 void* e_ptr = (void*)(((uint64_t)e) & ~1);
16218 CHECK_ACCESS(e_ptr);
16219 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16220 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
16221 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16222 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
16223 return (uint64_t)ret_conv;
16226 jboolean __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) {
16227 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
16228 jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
16232 void __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) {
16233 if ((_res & 1) != 0) return;
16234 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16235 CHECK_ACCESS(_res_ptr);
16236 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
16238 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
16241 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
16242 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16243 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
16244 return (uint64_t)ret_conv;
16246 int64_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) {
16247 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
16248 int64_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
16252 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) {
16253 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
16254 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16255 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
16256 return (uint64_t)ret_conv;
16259 void __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
16260 LDKCVec_ChannelMonitorZ _res_constr;
16261 _res_constr.datalen = _res->arr_len;
16262 if (_res_constr.datalen > 0)
16263 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16265 _res_constr.data = NULL;
16266 uint32_t* _res_vals = _res->elems;
16267 for (size_t q = 0; q < _res_constr.datalen; q++) {
16268 uint32_t _res_conv_16 = _res_vals[q];
16269 LDKChannelMonitor _res_conv_16_conv;
16270 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
16271 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
16272 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16273 _res_constr.data[q] = _res_conv_16_conv;
16275 CVec_ChannelMonitorZ_free(_res_constr);
16278 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
16279 LDKThirtyTwoBytes a_ref;
16280 CHECK(a->arr_len == 32);
16281 memcpy(a_ref.data, a->elems, 32);
16282 LDKChannelManager b_conv;
16283 b_conv.inner = (void*)(b & (~1));
16284 b_conv.is_owned = (b & 1) || (b == 0);
16285 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16286 // Warning: we need a move here but no clone is available for LDKChannelManager
16287 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
16288 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
16289 return ((uint64_t)ret_conv);
16292 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
16293 if ((_res & 1) != 0) return;
16294 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16295 CHECK_ACCESS(_res_ptr);
16296 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
16298 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
16301 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
16302 void* o_ptr = (void*)(((uint64_t)o) & ~1);
16303 CHECK_ACCESS(o_ptr);
16304 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
16305 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
16306 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16307 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
16308 return (uint64_t)ret_conv;
16311 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
16312 LDKDecodeError e_conv;
16313 e_conv.inner = (void*)(e & (~1));
16314 e_conv.is_owned = (e & 1) || (e == 0);
16315 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16316 e_conv = DecodeError_clone(&e_conv);
16317 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16318 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16319 return (uint64_t)ret_conv;
16322 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
16323 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
16324 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16328 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
16329 if ((_res & 1) != 0) return;
16330 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16331 CHECK_ACCESS(_res_ptr);
16332 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16334 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16337 void __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
16338 if ((this_ptr & 1) != 0) return;
16339 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16340 CHECK_ACCESS(this_ptr_ptr);
16341 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
16342 FREE((void*)this_ptr);
16343 PaymentPurpose_free(this_ptr_conv);
16346 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
16347 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16348 *ret_copy = PaymentPurpose_clone(arg);
16349 uint64_t ret_ref = (uint64_t)ret_copy;
16352 int64_t __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
16353 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
16354 int64_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
16358 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint32_t orig) {
16359 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
16360 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16361 *ret_copy = PaymentPurpose_clone(orig_conv);
16362 uint64_t ret_ref = (uint64_t)ret_copy;
16366 uint32_t __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
16367 LDKThirtyTwoBytes payment_preimage_ref;
16368 CHECK(payment_preimage->arr_len == 32);
16369 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
16370 LDKThirtyTwoBytes payment_secret_ref;
16371 CHECK(payment_secret->arr_len == 32);
16372 memcpy(payment_secret_ref.data, payment_secret->elems, 32);
16373 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16374 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
16375 uint64_t ret_ref = (uint64_t)ret_copy;
16379 uint32_t __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
16380 LDKThirtyTwoBytes a_ref;
16381 CHECK(a->arr_len == 32);
16382 memcpy(a_ref.data, a->elems, 32);
16383 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16384 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
16385 uint64_t ret_ref = (uint64_t)ret_copy;
16389 void __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint32_t this_ptr) {
16390 if ((this_ptr & 1) != 0) return;
16391 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16392 CHECK_ACCESS(this_ptr_ptr);
16393 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
16394 FREE((void*)this_ptr);
16395 ClosureReason_free(this_ptr_conv);
16398 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
16399 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16400 *ret_copy = ClosureReason_clone(arg);
16401 uint64_t ret_ref = (uint64_t)ret_copy;
16404 int64_t __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
16405 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
16406 int64_t ret_val = ClosureReason_clone_ptr(arg_conv);
16410 uint32_t __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint32_t orig) {
16411 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
16412 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16413 *ret_copy = ClosureReason_clone(orig_conv);
16414 uint64_t ret_ref = (uint64_t)ret_copy;
16418 uint32_t __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
16419 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
16420 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16421 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
16422 uint64_t ret_ref = (uint64_t)ret_copy;
16426 uint32_t __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
16427 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16428 *ret_copy = ClosureReason_holder_force_closed();
16429 uint64_t ret_ref = (uint64_t)ret_copy;
16433 uint32_t __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
16434 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16435 *ret_copy = ClosureReason_cooperative_closure();
16436 uint64_t ret_ref = (uint64_t)ret_copy;
16440 uint32_t __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
16441 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16442 *ret_copy = ClosureReason_commitment_tx_confirmed();
16443 uint64_t ret_ref = (uint64_t)ret_copy;
16447 uint32_t __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
16448 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16449 *ret_copy = ClosureReason_funding_timed_out();
16450 uint64_t ret_ref = (uint64_t)ret_copy;
16454 uint32_t __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
16455 LDKStr err_conv = str_ref_to_owned_c(err);
16456 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16457 *ret_copy = ClosureReason_processing_error(err_conv);
16458 uint64_t ret_ref = (uint64_t)ret_copy;
16462 uint32_t __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
16463 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16464 *ret_copy = ClosureReason_disconnected_peer();
16465 uint64_t ret_ref = (uint64_t)ret_copy;
16469 uint32_t __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
16470 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16471 *ret_copy = ClosureReason_outdated_channel_manager();
16472 uint64_t ret_ref = (uint64_t)ret_copy;
16476 int8_tArray __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint32_t obj) {
16477 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
16478 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
16479 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
16480 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16481 CVec_u8Z_free(ret_var);
16485 uint32_t __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
16486 LDKu8slice ser_ref;
16487 ser_ref.datalen = ser->arr_len;
16488 ser_ref.data = ser->elems;
16489 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16490 *ret_conv = ClosureReason_read(ser_ref);
16491 return (uint64_t)ret_conv;
16494 void __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint32_t this_ptr) {
16495 if ((this_ptr & 1) != 0) return;
16496 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16497 CHECK_ACCESS(this_ptr_ptr);
16498 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
16499 FREE((void*)this_ptr);
16500 Event_free(this_ptr_conv);
16503 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
16504 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16505 *ret_copy = Event_clone(arg);
16506 uint64_t ret_ref = (uint64_t)ret_copy;
16509 int64_t __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint32_t arg) {
16510 LDKEvent* arg_conv = (LDKEvent*)arg;
16511 int64_t ret_val = Event_clone_ptr(arg_conv);
16515 uint32_t __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint32_t orig) {
16516 LDKEvent* orig_conv = (LDKEvent*)orig;
16517 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16518 *ret_copy = Event_clone(orig_conv);
16519 uint64_t ret_ref = (uint64_t)ret_copy;
16523 uint32_t __attribute__((export_name("TS_Event_funding_generation_ready"))) TS_Event_funding_generation_ready(int8_tArray temporary_channel_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
16524 LDKThirtyTwoBytes temporary_channel_id_ref;
16525 CHECK(temporary_channel_id->arr_len == 32);
16526 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32);
16527 LDKCVec_u8Z output_script_ref;
16528 output_script_ref.datalen = output_script->arr_len;
16529 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
16530 memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen);
16531 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16532 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
16533 uint64_t ret_ref = (uint64_t)ret_copy;
16537 uint32_t __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
16538 LDKThirtyTwoBytes payment_hash_ref;
16539 CHECK(payment_hash->arr_len == 32);
16540 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16541 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
16542 CHECK_ACCESS(purpose_ptr);
16543 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
16544 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
16545 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16546 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
16547 uint64_t ret_ref = (uint64_t)ret_copy;
16551 uint32_t __attribute__((export_name("TS_Event_payment_sent"))) TS_Event_payment_sent(int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, uint32_t fee_paid_msat) {
16552 LDKThirtyTwoBytes payment_id_ref;
16553 CHECK(payment_id->arr_len == 32);
16554 memcpy(payment_id_ref.data, payment_id->elems, 32);
16555 LDKThirtyTwoBytes payment_preimage_ref;
16556 CHECK(payment_preimage->arr_len == 32);
16557 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
16558 LDKThirtyTwoBytes payment_hash_ref;
16559 CHECK(payment_hash->arr_len == 32);
16560 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16561 void* fee_paid_msat_ptr = (void*)(((uint64_t)fee_paid_msat) & ~1);
16562 CHECK_ACCESS(fee_paid_msat_ptr);
16563 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
16564 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_paid_msat) & ~1));
16565 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16566 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
16567 uint64_t ret_ref = (uint64_t)ret_copy;
16571 uint32_t __attribute__((export_name("TS_Event_payment_path_failed"))) TS_Event_payment_path_failed(int8_tArray payment_id, int8_tArray payment_hash, jboolean rejected_by_dest, uint32_t network_update, jboolean all_paths_failed, uint32_tArray path, uint32_t short_channel_id, uint32_t retry) {
16572 LDKThirtyTwoBytes payment_id_ref;
16573 CHECK(payment_id->arr_len == 32);
16574 memcpy(payment_id_ref.data, payment_id->elems, 32);
16575 LDKThirtyTwoBytes payment_hash_ref;
16576 CHECK(payment_hash->arr_len == 32);
16577 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16578 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
16579 CHECK_ACCESS(network_update_ptr);
16580 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
16581 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
16582 LDKCVec_RouteHopZ path_constr;
16583 path_constr.datalen = path->arr_len;
16584 if (path_constr.datalen > 0)
16585 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16587 path_constr.data = NULL;
16588 uint32_t* path_vals = path->elems;
16589 for (size_t k = 0; k < path_constr.datalen; k++) {
16590 uint32_t path_conv_10 = path_vals[k];
16591 LDKRouteHop path_conv_10_conv;
16592 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16593 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16594 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
16595 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16596 path_constr.data[k] = path_conv_10_conv;
16598 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
16599 CHECK_ACCESS(short_channel_id_ptr);
16600 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
16601 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
16602 LDKRouteParameters retry_conv;
16603 retry_conv.inner = (void*)(retry & (~1));
16604 retry_conv.is_owned = (retry & 1) || (retry == 0);
16605 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
16606 retry_conv = RouteParameters_clone(&retry_conv);
16607 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16608 *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv);
16609 uint64_t ret_ref = (uint64_t)ret_copy;
16613 uint32_t __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
16614 LDKThirtyTwoBytes payment_id_ref;
16615 CHECK(payment_id->arr_len == 32);
16616 memcpy(payment_id_ref.data, payment_id->elems, 32);
16617 LDKThirtyTwoBytes payment_hash_ref;
16618 CHECK(payment_hash->arr_len == 32);
16619 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16620 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16621 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
16622 uint64_t ret_ref = (uint64_t)ret_copy;
16626 uint32_t __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
16627 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16628 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
16629 uint64_t ret_ref = (uint64_t)ret_copy;
16633 uint32_t __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
16634 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
16635 outputs_constr.datalen = outputs->arr_len;
16636 if (outputs_constr.datalen > 0)
16637 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16639 outputs_constr.data = NULL;
16640 uint32_t* outputs_vals = outputs->elems;
16641 for (size_t b = 0; b < outputs_constr.datalen; b++) {
16642 uint32_t outputs_conv_27 = outputs_vals[b];
16643 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
16644 CHECK_ACCESS(outputs_conv_27_ptr);
16645 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
16646 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
16647 outputs_constr.data[b] = outputs_conv_27_conv;
16649 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16650 *ret_copy = Event_spendable_outputs(outputs_constr);
16651 uint64_t ret_ref = (uint64_t)ret_copy;
16655 uint32_t __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
16656 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
16657 CHECK_ACCESS(fee_earned_msat_ptr);
16658 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
16659 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
16660 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16661 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
16662 uint64_t ret_ref = (uint64_t)ret_copy;
16666 uint32_t __attribute__((export_name("TS_Event_channel_closed"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) {
16667 LDKThirtyTwoBytes channel_id_ref;
16668 CHECK(channel_id->arr_len == 32);
16669 memcpy(channel_id_ref.data, channel_id->elems, 32);
16670 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
16671 CHECK_ACCESS(reason_ptr);
16672 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
16673 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
16674 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16675 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
16676 uint64_t ret_ref = (uint64_t)ret_copy;
16680 uint32_t __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
16681 LDKThirtyTwoBytes channel_id_ref;
16682 CHECK(channel_id->arr_len == 32);
16683 memcpy(channel_id_ref.data, channel_id->elems, 32);
16684 LDKTransaction transaction_ref;
16685 transaction_ref.datalen = transaction->arr_len;
16686 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
16687 memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen);
16688 transaction_ref.data_is_owned = true;
16689 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16690 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
16691 uint64_t ret_ref = (uint64_t)ret_copy;
16695 uint32_t __attribute__((export_name("TS_Event_payment_path_successful"))) TS_Event_payment_path_successful(int8_tArray payment_id, int8_tArray payment_hash, uint32_tArray path) {
16696 LDKThirtyTwoBytes payment_id_ref;
16697 CHECK(payment_id->arr_len == 32);
16698 memcpy(payment_id_ref.data, payment_id->elems, 32);
16699 LDKThirtyTwoBytes payment_hash_ref;
16700 CHECK(payment_hash->arr_len == 32);
16701 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16702 LDKCVec_RouteHopZ path_constr;
16703 path_constr.datalen = path->arr_len;
16704 if (path_constr.datalen > 0)
16705 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16707 path_constr.data = NULL;
16708 uint32_t* path_vals = path->elems;
16709 for (size_t k = 0; k < path_constr.datalen; k++) {
16710 uint32_t path_conv_10 = path_vals[k];
16711 LDKRouteHop path_conv_10_conv;
16712 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16713 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16714 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
16715 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16716 path_constr.data[k] = path_conv_10_conv;
16718 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16719 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
16720 uint64_t ret_ref = (uint64_t)ret_copy;
16724 int8_tArray __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint32_t obj) {
16725 LDKEvent* obj_conv = (LDKEvent*)obj;
16726 LDKCVec_u8Z ret_var = Event_write(obj_conv);
16727 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
16728 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16729 CVec_u8Z_free(ret_var);
16733 uint32_t __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
16734 LDKu8slice ser_ref;
16735 ser_ref.datalen = ser->arr_len;
16736 ser_ref.data = ser->elems;
16737 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16738 *ret_conv = Event_read(ser_ref);
16739 return (uint64_t)ret_conv;
16742 void __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
16743 if ((this_ptr & 1) != 0) return;
16744 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16745 CHECK_ACCESS(this_ptr_ptr);
16746 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
16747 FREE((void*)this_ptr);
16748 MessageSendEvent_free(this_ptr_conv);
16751 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
16752 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16753 *ret_copy = MessageSendEvent_clone(arg);
16754 uint64_t ret_ref = (uint64_t)ret_copy;
16757 int64_t __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
16758 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
16759 int64_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
16763 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint32_t orig) {
16764 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
16765 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16766 *ret_copy = MessageSendEvent_clone(orig_conv);
16767 uint64_t ret_ref = (uint64_t)ret_copy;
16771 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
16772 LDKPublicKey node_id_ref;
16773 CHECK(node_id->arr_len == 33);
16774 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16775 LDKAcceptChannel msg_conv;
16776 msg_conv.inner = (void*)(msg & (~1));
16777 msg_conv.is_owned = (msg & 1) || (msg == 0);
16778 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16779 msg_conv = AcceptChannel_clone(&msg_conv);
16780 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16781 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
16782 uint64_t ret_ref = (uint64_t)ret_copy;
16786 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
16787 LDKPublicKey node_id_ref;
16788 CHECK(node_id->arr_len == 33);
16789 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16790 LDKOpenChannel msg_conv;
16791 msg_conv.inner = (void*)(msg & (~1));
16792 msg_conv.is_owned = (msg & 1) || (msg == 0);
16793 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16794 msg_conv = OpenChannel_clone(&msg_conv);
16795 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16796 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
16797 uint64_t ret_ref = (uint64_t)ret_copy;
16801 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
16802 LDKPublicKey node_id_ref;
16803 CHECK(node_id->arr_len == 33);
16804 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16805 LDKFundingCreated msg_conv;
16806 msg_conv.inner = (void*)(msg & (~1));
16807 msg_conv.is_owned = (msg & 1) || (msg == 0);
16808 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16809 msg_conv = FundingCreated_clone(&msg_conv);
16810 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16811 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
16812 uint64_t ret_ref = (uint64_t)ret_copy;
16816 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
16817 LDKPublicKey node_id_ref;
16818 CHECK(node_id->arr_len == 33);
16819 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16820 LDKFundingSigned msg_conv;
16821 msg_conv.inner = (void*)(msg & (~1));
16822 msg_conv.is_owned = (msg & 1) || (msg == 0);
16823 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16824 msg_conv = FundingSigned_clone(&msg_conv);
16825 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16826 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
16827 uint64_t ret_ref = (uint64_t)ret_copy;
16831 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_locked"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
16832 LDKPublicKey node_id_ref;
16833 CHECK(node_id->arr_len == 33);
16834 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16835 LDKFundingLocked msg_conv;
16836 msg_conv.inner = (void*)(msg & (~1));
16837 msg_conv.is_owned = (msg & 1) || (msg == 0);
16838 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16839 msg_conv = FundingLocked_clone(&msg_conv);
16840 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16841 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
16842 uint64_t ret_ref = (uint64_t)ret_copy;
16846 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
16847 LDKPublicKey node_id_ref;
16848 CHECK(node_id->arr_len == 33);
16849 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16850 LDKAnnouncementSignatures msg_conv;
16851 msg_conv.inner = (void*)(msg & (~1));
16852 msg_conv.is_owned = (msg & 1) || (msg == 0);
16853 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16854 msg_conv = AnnouncementSignatures_clone(&msg_conv);
16855 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16856 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
16857 uint64_t ret_ref = (uint64_t)ret_copy;
16861 uint32_t __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
16862 LDKPublicKey node_id_ref;
16863 CHECK(node_id->arr_len == 33);
16864 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16865 LDKCommitmentUpdate updates_conv;
16866 updates_conv.inner = (void*)(updates & (~1));
16867 updates_conv.is_owned = (updates & 1) || (updates == 0);
16868 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
16869 updates_conv = CommitmentUpdate_clone(&updates_conv);
16870 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16871 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
16872 uint64_t ret_ref = (uint64_t)ret_copy;
16876 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
16877 LDKPublicKey node_id_ref;
16878 CHECK(node_id->arr_len == 33);
16879 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16880 LDKRevokeAndACK msg_conv;
16881 msg_conv.inner = (void*)(msg & (~1));
16882 msg_conv.is_owned = (msg & 1) || (msg == 0);
16883 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16884 msg_conv = RevokeAndACK_clone(&msg_conv);
16885 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16886 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
16887 uint64_t ret_ref = (uint64_t)ret_copy;
16891 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
16892 LDKPublicKey node_id_ref;
16893 CHECK(node_id->arr_len == 33);
16894 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16895 LDKClosingSigned msg_conv;
16896 msg_conv.inner = (void*)(msg & (~1));
16897 msg_conv.is_owned = (msg & 1) || (msg == 0);
16898 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16899 msg_conv = ClosingSigned_clone(&msg_conv);
16900 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16901 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
16902 uint64_t ret_ref = (uint64_t)ret_copy;
16906 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
16907 LDKPublicKey node_id_ref;
16908 CHECK(node_id->arr_len == 33);
16909 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16910 LDKShutdown msg_conv;
16911 msg_conv.inner = (void*)(msg & (~1));
16912 msg_conv.is_owned = (msg & 1) || (msg == 0);
16913 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16914 msg_conv = Shutdown_clone(&msg_conv);
16915 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16916 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
16917 uint64_t ret_ref = (uint64_t)ret_copy;
16921 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
16922 LDKPublicKey node_id_ref;
16923 CHECK(node_id->arr_len == 33);
16924 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16925 LDKChannelReestablish msg_conv;
16926 msg_conv.inner = (void*)(msg & (~1));
16927 msg_conv.is_owned = (msg & 1) || (msg == 0);
16928 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16929 msg_conv = ChannelReestablish_clone(&msg_conv);
16930 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16931 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
16932 uint64_t ret_ref = (uint64_t)ret_copy;
16936 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
16937 LDKChannelAnnouncement msg_conv;
16938 msg_conv.inner = (void*)(msg & (~1));
16939 msg_conv.is_owned = (msg & 1) || (msg == 0);
16940 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16941 msg_conv = ChannelAnnouncement_clone(&msg_conv);
16942 LDKChannelUpdate update_msg_conv;
16943 update_msg_conv.inner = (void*)(update_msg & (~1));
16944 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
16945 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
16946 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
16947 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16948 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
16949 uint64_t ret_ref = (uint64_t)ret_copy;
16953 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
16954 LDKNodeAnnouncement msg_conv;
16955 msg_conv.inner = (void*)(msg & (~1));
16956 msg_conv.is_owned = (msg & 1) || (msg == 0);
16957 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16958 msg_conv = NodeAnnouncement_clone(&msg_conv);
16959 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16960 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
16961 uint64_t ret_ref = (uint64_t)ret_copy;
16965 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
16966 LDKChannelUpdate msg_conv;
16967 msg_conv.inner = (void*)(msg & (~1));
16968 msg_conv.is_owned = (msg & 1) || (msg == 0);
16969 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16970 msg_conv = ChannelUpdate_clone(&msg_conv);
16971 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16972 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
16973 uint64_t ret_ref = (uint64_t)ret_copy;
16977 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
16978 LDKPublicKey node_id_ref;
16979 CHECK(node_id->arr_len == 33);
16980 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16981 LDKChannelUpdate msg_conv;
16982 msg_conv.inner = (void*)(msg & (~1));
16983 msg_conv.is_owned = (msg & 1) || (msg == 0);
16984 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16985 msg_conv = ChannelUpdate_clone(&msg_conv);
16986 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16987 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
16988 uint64_t ret_ref = (uint64_t)ret_copy;
16992 uint32_t __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
16993 LDKPublicKey node_id_ref;
16994 CHECK(node_id->arr_len == 33);
16995 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16996 void* action_ptr = (void*)(((uint64_t)action) & ~1);
16997 CHECK_ACCESS(action_ptr);
16998 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
16999 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
17000 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17001 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
17002 uint64_t ret_ref = (uint64_t)ret_copy;
17006 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
17007 LDKPublicKey node_id_ref;
17008 CHECK(node_id->arr_len == 33);
17009 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
17010 LDKQueryChannelRange msg_conv;
17011 msg_conv.inner = (void*)(msg & (~1));
17012 msg_conv.is_owned = (msg & 1) || (msg == 0);
17013 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17014 msg_conv = QueryChannelRange_clone(&msg_conv);
17015 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17016 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
17017 uint64_t ret_ref = (uint64_t)ret_copy;
17021 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
17022 LDKPublicKey node_id_ref;
17023 CHECK(node_id->arr_len == 33);
17024 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
17025 LDKQueryShortChannelIds msg_conv;
17026 msg_conv.inner = (void*)(msg & (~1));
17027 msg_conv.is_owned = (msg & 1) || (msg == 0);
17028 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17029 msg_conv = QueryShortChannelIds_clone(&msg_conv);
17030 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17031 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
17032 uint64_t ret_ref = (uint64_t)ret_copy;
17036 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
17037 LDKPublicKey node_id_ref;
17038 CHECK(node_id->arr_len == 33);
17039 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
17040 LDKReplyChannelRange msg_conv;
17041 msg_conv.inner = (void*)(msg & (~1));
17042 msg_conv.is_owned = (msg & 1) || (msg == 0);
17043 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17044 msg_conv = ReplyChannelRange_clone(&msg_conv);
17045 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17046 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
17047 uint64_t ret_ref = (uint64_t)ret_copy;
17051 void __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
17052 if ((this_ptr & 1) != 0) return;
17053 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17054 CHECK_ACCESS(this_ptr_ptr);
17055 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
17056 FREE((void*)this_ptr);
17057 MessageSendEventsProvider_free(this_ptr_conv);
17060 void __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint32_t this_ptr) {
17061 if ((this_ptr & 1) != 0) return;
17062 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17063 CHECK_ACCESS(this_ptr_ptr);
17064 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
17065 FREE((void*)this_ptr);
17066 EventsProvider_free(this_ptr_conv);
17069 void __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint32_t this_ptr) {
17070 if ((this_ptr & 1) != 0) return;
17071 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17072 CHECK_ACCESS(this_ptr_ptr);
17073 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
17074 FREE((void*)this_ptr);
17075 EventHandler_free(this_ptr_conv);
17078 void __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint32_t this_ptr) {
17079 if ((this_ptr & 1) != 0) return;
17080 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17081 CHECK_ACCESS(this_ptr_ptr);
17082 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
17083 FREE((void*)this_ptr);
17084 APIError_free(this_ptr_conv);
17087 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
17088 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17089 *ret_copy = APIError_clone(arg);
17090 uint64_t ret_ref = (uint64_t)ret_copy;
17093 int64_t __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint32_t arg) {
17094 LDKAPIError* arg_conv = (LDKAPIError*)arg;
17095 int64_t ret_val = APIError_clone_ptr(arg_conv);
17099 uint32_t __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint32_t orig) {
17100 LDKAPIError* orig_conv = (LDKAPIError*)orig;
17101 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17102 *ret_copy = APIError_clone(orig_conv);
17103 uint64_t ret_ref = (uint64_t)ret_copy;
17107 uint32_t __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
17108 LDKStr err_conv = str_ref_to_owned_c(err);
17109 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17110 *ret_copy = APIError_apimisuse_error(err_conv);
17111 uint64_t ret_ref = (uint64_t)ret_copy;
17115 uint32_t __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
17116 LDKStr err_conv = str_ref_to_owned_c(err);
17117 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17118 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
17119 uint64_t ret_ref = (uint64_t)ret_copy;
17123 uint32_t __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
17124 LDKStr err_conv = str_ref_to_owned_c(err);
17125 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17126 *ret_copy = APIError_route_error(err_conv);
17127 uint64_t ret_ref = (uint64_t)ret_copy;
17131 uint32_t __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
17132 LDKStr err_conv = str_ref_to_owned_c(err);
17133 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17134 *ret_copy = APIError_channel_unavailable(err_conv);
17135 uint64_t ret_ref = (uint64_t)ret_copy;
17139 uint32_t __attribute__((export_name("TS_APIError_monitor_update_failed"))) TS_APIError_monitor_update_failed() {
17140 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17141 *ret_copy = APIError_monitor_update_failed();
17142 uint64_t ret_ref = (uint64_t)ret_copy;
17146 uint32_t __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
17147 LDKShutdownScript script_conv;
17148 script_conv.inner = (void*)(script & (~1));
17149 script_conv.is_owned = (script & 1) || (script == 0);
17150 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
17151 script_conv = ShutdownScript_clone(&script_conv);
17152 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17153 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
17154 uint64_t ret_ref = (uint64_t)ret_copy;
17158 uint32_t __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
17159 LDKu8slice msg_ref;
17160 msg_ref.datalen = msg->arr_len;
17161 msg_ref.data = msg->elems;
17162 unsigned char sk_arr[32];
17163 CHECK(sk->arr_len == 32);
17164 memcpy(sk_arr, sk->elems, 32);
17165 unsigned char (*sk_ref)[32] = &sk_arr;
17166 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17167 *ret_conv = sign(msg_ref, sk_ref);
17168 return (uint64_t)ret_conv;
17171 uint32_t __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
17172 LDKu8slice msg_ref;
17173 msg_ref.datalen = msg->arr_len;
17174 msg_ref.data = msg->elems;
17175 LDKStr sig_conv = str_ref_to_owned_c(sig);
17176 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17177 *ret_conv = recover_pk(msg_ref, sig_conv);
17178 return (uint64_t)ret_conv;
17181 jboolean __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
17182 LDKu8slice msg_ref;
17183 msg_ref.datalen = msg->arr_len;
17184 msg_ref.data = msg->elems;
17185 LDKStr sig_conv = str_ref_to_owned_c(sig);
17186 LDKPublicKey pk_ref;
17187 CHECK(pk->arr_len == 33);
17188 memcpy(pk_ref.compressed_form, pk->elems, 33);
17189 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
17193 uint32_t __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint32_t orig) {
17194 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
17195 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
17199 uint32_t __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
17200 uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
17204 uint32_t __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
17205 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
17209 uint32_t __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
17210 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
17214 uint32_t __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
17215 uint32_t ret_conv = LDKLevel_to_js(Level_info());
17219 uint32_t __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
17220 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
17224 uint32_t __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
17225 uint32_t ret_conv = LDKLevel_to_js(Level_error());
17229 jboolean __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint32_t a, uint32_t b) {
17230 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
17231 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
17232 jboolean ret_val = Level_eq(a_conv, b_conv);
17236 int64_t __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint32_t o) {
17237 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
17238 int64_t ret_val = Level_hash(o_conv);
17242 uint32_t __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
17243 uint32_t ret_conv = LDKLevel_to_js(Level_max());
17247 void __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint32_t this_obj) {
17248 LDKRecord this_obj_conv;
17249 this_obj_conv.inner = (void*)(this_obj & (~1));
17250 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17252 Record_free(this_obj_conv);
17255 uint32_t __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint32_t this_ptr) {
17256 LDKRecord this_ptr_conv;
17257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17258 this_ptr_conv.is_owned = false;
17259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17260 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
17264 void __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
17265 LDKRecord this_ptr_conv;
17266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17267 this_ptr_conv.is_owned = false;
17268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17269 LDKLevel val_conv = LDKLevel_from_js(val);
17270 Record_set_level(&this_ptr_conv, val_conv);
17273 jstring __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint32_t this_ptr) {
17274 LDKRecord this_ptr_conv;
17275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17276 this_ptr_conv.is_owned = false;
17277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17278 LDKStr ret_str = Record_get_args(&this_ptr_conv);
17279 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17284 void __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
17285 LDKRecord this_ptr_conv;
17286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17287 this_ptr_conv.is_owned = false;
17288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17289 LDKStr val_conv = str_ref_to_owned_c(val);
17290 Record_set_args(&this_ptr_conv, val_conv);
17293 jstring __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint32_t this_ptr) {
17294 LDKRecord this_ptr_conv;
17295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17296 this_ptr_conv.is_owned = false;
17297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17298 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
17299 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17304 void __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
17305 LDKRecord this_ptr_conv;
17306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17307 this_ptr_conv.is_owned = false;
17308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17309 LDKStr val_conv = str_ref_to_owned_c(val);
17310 Record_set_module_path(&this_ptr_conv, val_conv);
17313 jstring __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint32_t this_ptr) {
17314 LDKRecord this_ptr_conv;
17315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17316 this_ptr_conv.is_owned = false;
17317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17318 LDKStr ret_str = Record_get_file(&this_ptr_conv);
17319 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17324 void __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
17325 LDKRecord this_ptr_conv;
17326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17327 this_ptr_conv.is_owned = false;
17328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17329 LDKStr val_conv = str_ref_to_owned_c(val);
17330 Record_set_file(&this_ptr_conv, val_conv);
17333 int32_t __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint32_t this_ptr) {
17334 LDKRecord this_ptr_conv;
17335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17336 this_ptr_conv.is_owned = false;
17337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17338 int32_t ret_val = Record_get_line(&this_ptr_conv);
17342 void __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
17343 LDKRecord this_ptr_conv;
17344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17345 this_ptr_conv.is_owned = false;
17346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17347 Record_set_line(&this_ptr_conv, val);
17350 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
17351 LDKRecord ret_var = Record_clone(arg);
17352 uint64_t ret_ref = 0;
17353 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17354 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17355 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17356 ret_ref = (uint64_t)ret_var.inner;
17357 if (ret_var.is_owned) {
17362 int64_t __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint32_t arg) {
17363 LDKRecord arg_conv;
17364 arg_conv.inner = (void*)(arg & (~1));
17365 arg_conv.is_owned = false;
17366 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17367 int64_t ret_val = Record_clone_ptr(&arg_conv);
17371 uint32_t __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint32_t orig) {
17372 LDKRecord orig_conv;
17373 orig_conv.inner = (void*)(orig & (~1));
17374 orig_conv.is_owned = false;
17375 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17376 LDKRecord ret_var = Record_clone(&orig_conv);
17377 uint64_t ret_ref = 0;
17378 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17379 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17381 ret_ref = (uint64_t)ret_var.inner;
17382 if (ret_var.is_owned) {
17388 void __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint32_t this_ptr) {
17389 if ((this_ptr & 1) != 0) return;
17390 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17391 CHECK_ACCESS(this_ptr_ptr);
17392 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
17393 FREE((void*)this_ptr);
17394 Logger_free(this_ptr_conv);
17397 void __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
17398 LDKChannelHandshakeConfig this_obj_conv;
17399 this_obj_conv.inner = (void*)(this_obj & (~1));
17400 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17402 ChannelHandshakeConfig_free(this_obj_conv);
17405 int32_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
17406 LDKChannelHandshakeConfig this_ptr_conv;
17407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17408 this_ptr_conv.is_owned = false;
17409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17410 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
17414 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
17415 LDKChannelHandshakeConfig this_ptr_conv;
17416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17417 this_ptr_conv.is_owned = false;
17418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17419 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
17422 int16_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
17423 LDKChannelHandshakeConfig this_ptr_conv;
17424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17425 this_ptr_conv.is_owned = false;
17426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17427 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
17431 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_our_to_self_delay"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
17432 LDKChannelHandshakeConfig this_ptr_conv;
17433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17434 this_ptr_conv.is_owned = false;
17435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17436 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
17439 int64_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
17440 LDKChannelHandshakeConfig this_ptr_conv;
17441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17442 this_ptr_conv.is_owned = false;
17443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17444 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
17448 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17449 LDKChannelHandshakeConfig this_ptr_conv;
17450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17451 this_ptr_conv.is_owned = false;
17452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17453 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
17456 uint32_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) {
17457 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
17458 uint64_t ret_ref = 0;
17459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17462 ret_ref = (uint64_t)ret_var.inner;
17463 if (ret_var.is_owned) {
17469 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
17470 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
17471 uint64_t ret_ref = 0;
17472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17475 ret_ref = (uint64_t)ret_var.inner;
17476 if (ret_var.is_owned) {
17481 int64_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
17482 LDKChannelHandshakeConfig arg_conv;
17483 arg_conv.inner = (void*)(arg & (~1));
17484 arg_conv.is_owned = false;
17485 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17486 int64_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
17490 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
17491 LDKChannelHandshakeConfig orig_conv;
17492 orig_conv.inner = (void*)(orig & (~1));
17493 orig_conv.is_owned = false;
17494 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17495 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
17496 uint64_t ret_ref = 0;
17497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17500 ret_ref = (uint64_t)ret_var.inner;
17501 if (ret_var.is_owned) {
17507 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
17508 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
17509 uint64_t ret_ref = 0;
17510 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17511 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17513 ret_ref = (uint64_t)ret_var.inner;
17514 if (ret_var.is_owned) {
17520 void __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
17521 LDKChannelHandshakeLimits this_obj_conv;
17522 this_obj_conv.inner = (void*)(this_obj & (~1));
17523 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17525 ChannelHandshakeLimits_free(this_obj_conv);
17528 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
17529 LDKChannelHandshakeLimits this_ptr_conv;
17530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17531 this_ptr_conv.is_owned = false;
17532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17533 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
17537 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
17538 LDKChannelHandshakeLimits this_ptr_conv;
17539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17540 this_ptr_conv.is_owned = false;
17541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17542 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
17545 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
17546 LDKChannelHandshakeLimits this_ptr_conv;
17547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17548 this_ptr_conv.is_owned = false;
17549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17550 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
17554 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17555 LDKChannelHandshakeLimits this_ptr_conv;
17556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17557 this_ptr_conv.is_owned = false;
17558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17559 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
17562 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(uint32_t this_ptr) {
17563 LDKChannelHandshakeLimits this_ptr_conv;
17564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17565 this_ptr_conv.is_owned = false;
17566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17567 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
17571 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
17572 LDKChannelHandshakeLimits this_ptr_conv;
17573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17574 this_ptr_conv.is_owned = false;
17575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17576 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17579 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
17580 LDKChannelHandshakeLimits this_ptr_conv;
17581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17582 this_ptr_conv.is_owned = false;
17583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17584 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
17588 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
17589 LDKChannelHandshakeLimits this_ptr_conv;
17590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17591 this_ptr_conv.is_owned = false;
17592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17593 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
17596 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
17597 LDKChannelHandshakeLimits this_ptr_conv;
17598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17599 this_ptr_conv.is_owned = false;
17600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17601 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
17605 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
17606 LDKChannelHandshakeLimits this_ptr_conv;
17607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17608 this_ptr_conv.is_owned = false;
17609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17610 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
17613 int32_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
17614 LDKChannelHandshakeLimits this_ptr_conv;
17615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17616 this_ptr_conv.is_owned = false;
17617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17618 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
17622 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
17623 LDKChannelHandshakeLimits this_ptr_conv;
17624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17625 this_ptr_conv.is_owned = false;
17626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17627 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
17630 jboolean __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
17631 LDKChannelHandshakeLimits this_ptr_conv;
17632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17633 this_ptr_conv.is_owned = false;
17634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17635 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
17639 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
17640 LDKChannelHandshakeLimits this_ptr_conv;
17641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17642 this_ptr_conv.is_owned = false;
17643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17644 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
17647 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
17648 LDKChannelHandshakeLimits this_ptr_conv;
17649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17650 this_ptr_conv.is_owned = false;
17651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17652 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
17656 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_their_to_self_delay"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
17657 LDKChannelHandshakeLimits this_ptr_conv;
17658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17659 this_ptr_conv.is_owned = false;
17660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17661 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
17664 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_new"))) TS_ChannelHandshakeLimits_new(int64_t min_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 force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
17665 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_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, force_announced_channel_preference_arg, their_to_self_delay_arg);
17666 uint64_t ret_ref = 0;
17667 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17668 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17670 ret_ref = (uint64_t)ret_var.inner;
17671 if (ret_var.is_owned) {
17677 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
17678 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
17679 uint64_t ret_ref = 0;
17680 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17681 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17683 ret_ref = (uint64_t)ret_var.inner;
17684 if (ret_var.is_owned) {
17689 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
17690 LDKChannelHandshakeLimits arg_conv;
17691 arg_conv.inner = (void*)(arg & (~1));
17692 arg_conv.is_owned = false;
17693 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17694 int64_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
17698 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
17699 LDKChannelHandshakeLimits orig_conv;
17700 orig_conv.inner = (void*)(orig & (~1));
17701 orig_conv.is_owned = false;
17702 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17703 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
17704 uint64_t ret_ref = 0;
17705 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17706 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17708 ret_ref = (uint64_t)ret_var.inner;
17709 if (ret_var.is_owned) {
17715 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
17716 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
17717 uint64_t ret_ref = 0;
17718 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17719 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17720 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17721 ret_ref = (uint64_t)ret_var.inner;
17722 if (ret_var.is_owned) {
17728 void __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint32_t this_obj) {
17729 LDKChannelConfig this_obj_conv;
17730 this_obj_conv.inner = (void*)(this_obj & (~1));
17731 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17733 ChannelConfig_free(this_obj_conv);
17736 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
17737 LDKChannelConfig this_ptr_conv;
17738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17739 this_ptr_conv.is_owned = false;
17740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17741 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
17745 void __attribute__((export_name("TS_ChannelConfig_set_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
17746 LDKChannelConfig this_ptr_conv;
17747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17748 this_ptr_conv.is_owned = false;
17749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17750 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
17753 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
17754 LDKChannelConfig this_ptr_conv;
17755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17756 this_ptr_conv.is_owned = false;
17757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17758 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
17762 void __attribute__((export_name("TS_ChannelConfig_set_forwarding_fee_base_msat"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
17763 LDKChannelConfig this_ptr_conv;
17764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17765 this_ptr_conv.is_owned = false;
17766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17767 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
17770 int16_t __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
17771 LDKChannelConfig this_ptr_conv;
17772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17773 this_ptr_conv.is_owned = false;
17774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17775 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
17779 void __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17780 LDKChannelConfig this_ptr_conv;
17781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17782 this_ptr_conv.is_owned = false;
17783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17784 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
17787 jboolean __attribute__((export_name("TS_ChannelConfig_get_announced_channel"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
17788 LDKChannelConfig this_ptr_conv;
17789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17790 this_ptr_conv.is_owned = false;
17791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17792 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
17796 void __attribute__((export_name("TS_ChannelConfig_set_announced_channel"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
17797 LDKChannelConfig this_ptr_conv;
17798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17799 this_ptr_conv.is_owned = false;
17800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17801 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
17804 jboolean __attribute__((export_name("TS_ChannelConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
17805 LDKChannelConfig this_ptr_conv;
17806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17807 this_ptr_conv.is_owned = false;
17808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17809 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
17813 void __attribute__((export_name("TS_ChannelConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
17814 LDKChannelConfig this_ptr_conv;
17815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17816 this_ptr_conv.is_owned = false;
17817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17818 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
17821 int64_t __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure_msat"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
17822 LDKChannelConfig this_ptr_conv;
17823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17824 this_ptr_conv.is_owned = false;
17825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17826 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
17830 void __attribute__((export_name("TS_ChannelConfig_set_max_dust_htlc_exposure_msat"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
17831 LDKChannelConfig this_ptr_conv;
17832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17833 this_ptr_conv.is_owned = false;
17834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17835 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
17838 int64_t __attribute__((export_name("TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
17839 LDKChannelConfig this_ptr_conv;
17840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17841 this_ptr_conv.is_owned = false;
17842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17843 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
17847 void __attribute__((export_name("TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
17848 LDKChannelConfig this_ptr_conv;
17849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17850 this_ptr_conv.is_owned = false;
17851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17852 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
17855 uint32_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, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
17856 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
17857 uint64_t ret_ref = 0;
17858 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17859 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17860 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17861 ret_ref = (uint64_t)ret_var.inner;
17862 if (ret_var.is_owned) {
17868 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
17869 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
17870 uint64_t ret_ref = 0;
17871 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17872 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17873 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17874 ret_ref = (uint64_t)ret_var.inner;
17875 if (ret_var.is_owned) {
17880 int64_t __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
17881 LDKChannelConfig arg_conv;
17882 arg_conv.inner = (void*)(arg & (~1));
17883 arg_conv.is_owned = false;
17884 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17885 int64_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
17889 uint32_t __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint32_t orig) {
17890 LDKChannelConfig orig_conv;
17891 orig_conv.inner = (void*)(orig & (~1));
17892 orig_conv.is_owned = false;
17893 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17894 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
17895 uint64_t ret_ref = 0;
17896 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17897 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17898 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17899 ret_ref = (uint64_t)ret_var.inner;
17900 if (ret_var.is_owned) {
17906 uint32_t __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
17907 LDKChannelConfig ret_var = ChannelConfig_default();
17908 uint64_t ret_ref = 0;
17909 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17910 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17911 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17912 ret_ref = (uint64_t)ret_var.inner;
17913 if (ret_var.is_owned) {
17919 int8_tArray __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint32_t obj) {
17920 LDKChannelConfig obj_conv;
17921 obj_conv.inner = (void*)(obj & (~1));
17922 obj_conv.is_owned = false;
17923 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
17924 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
17925 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
17926 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17927 CVec_u8Z_free(ret_var);
17931 uint32_t __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
17932 LDKu8slice ser_ref;
17933 ser_ref.datalen = ser->arr_len;
17934 ser_ref.data = ser->elems;
17935 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17936 *ret_conv = ChannelConfig_read(ser_ref);
17937 return (uint64_t)ret_conv;
17940 void __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint32_t this_obj) {
17941 LDKUserConfig this_obj_conv;
17942 this_obj_conv.inner = (void*)(this_obj & (~1));
17943 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17945 UserConfig_free(this_obj_conv);
17948 uint32_t __attribute__((export_name("TS_UserConfig_get_own_channel_config"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
17949 LDKUserConfig this_ptr_conv;
17950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17951 this_ptr_conv.is_owned = false;
17952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17953 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
17954 uint64_t ret_ref = 0;
17955 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17956 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17957 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17958 ret_ref = (uint64_t)ret_var.inner;
17959 if (ret_var.is_owned) {
17965 void __attribute__((export_name("TS_UserConfig_set_own_channel_config"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
17966 LDKUserConfig this_ptr_conv;
17967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17968 this_ptr_conv.is_owned = false;
17969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17970 LDKChannelHandshakeConfig val_conv;
17971 val_conv.inner = (void*)(val & (~1));
17972 val_conv.is_owned = (val & 1) || (val == 0);
17973 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17974 val_conv = ChannelHandshakeConfig_clone(&val_conv);
17975 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
17978 uint32_t __attribute__((export_name("TS_UserConfig_get_peer_channel_config_limits"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
17979 LDKUserConfig this_ptr_conv;
17980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17981 this_ptr_conv.is_owned = false;
17982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17983 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
17984 uint64_t ret_ref = 0;
17985 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17986 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17987 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17988 ret_ref = (uint64_t)ret_var.inner;
17989 if (ret_var.is_owned) {
17995 void __attribute__((export_name("TS_UserConfig_set_peer_channel_config_limits"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
17996 LDKUserConfig this_ptr_conv;
17997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17998 this_ptr_conv.is_owned = false;
17999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18000 LDKChannelHandshakeLimits val_conv;
18001 val_conv.inner = (void*)(val & (~1));
18002 val_conv.is_owned = (val & 1) || (val == 0);
18003 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
18004 val_conv = ChannelHandshakeLimits_clone(&val_conv);
18005 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
18008 uint32_t __attribute__((export_name("TS_UserConfig_get_channel_options"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
18009 LDKUserConfig this_ptr_conv;
18010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18011 this_ptr_conv.is_owned = false;
18012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18013 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
18014 uint64_t ret_ref = 0;
18015 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18016 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18017 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18018 ret_ref = (uint64_t)ret_var.inner;
18019 if (ret_var.is_owned) {
18025 void __attribute__((export_name("TS_UserConfig_set_channel_options"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
18026 LDKUserConfig this_ptr_conv;
18027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18028 this_ptr_conv.is_owned = false;
18029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18030 LDKChannelConfig val_conv;
18031 val_conv.inner = (void*)(val & (~1));
18032 val_conv.is_owned = (val & 1) || (val == 0);
18033 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
18034 val_conv = ChannelConfig_clone(&val_conv);
18035 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
18038 jboolean __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
18039 LDKUserConfig this_ptr_conv;
18040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18041 this_ptr_conv.is_owned = false;
18042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18043 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
18047 void __attribute__((export_name("TS_UserConfig_set_accept_forwards_to_priv_channels"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
18048 LDKUserConfig this_ptr_conv;
18049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18050 this_ptr_conv.is_owned = false;
18051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18052 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
18055 jboolean __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) {
18056 LDKUserConfig this_ptr_conv;
18057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18058 this_ptr_conv.is_owned = false;
18059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18060 jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
18064 void __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
18065 LDKUserConfig this_ptr_conv;
18066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18067 this_ptr_conv.is_owned = false;
18068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18069 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
18072 uint32_t __attribute__((export_name("TS_UserConfig_new"))) TS_UserConfig_new(uint32_t own_channel_config_arg, uint32_t peer_channel_config_limits_arg, uint32_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg) {
18073 LDKChannelHandshakeConfig own_channel_config_arg_conv;
18074 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
18075 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
18076 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
18077 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
18078 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
18079 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
18080 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
18081 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
18082 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
18083 LDKChannelConfig channel_options_arg_conv;
18084 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
18085 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
18086 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
18087 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
18088 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg);
18089 uint64_t ret_ref = 0;
18090 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18091 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18092 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18093 ret_ref = (uint64_t)ret_var.inner;
18094 if (ret_var.is_owned) {
18100 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
18101 LDKUserConfig ret_var = UserConfig_clone(arg);
18102 uint64_t ret_ref = 0;
18103 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18104 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18105 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18106 ret_ref = (uint64_t)ret_var.inner;
18107 if (ret_var.is_owned) {
18112 int64_t __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint32_t arg) {
18113 LDKUserConfig arg_conv;
18114 arg_conv.inner = (void*)(arg & (~1));
18115 arg_conv.is_owned = false;
18116 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18117 int64_t ret_val = UserConfig_clone_ptr(&arg_conv);
18121 uint32_t __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint32_t orig) {
18122 LDKUserConfig orig_conv;
18123 orig_conv.inner = (void*)(orig & (~1));
18124 orig_conv.is_owned = false;
18125 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18126 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
18127 uint64_t ret_ref = 0;
18128 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18129 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18130 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18131 ret_ref = (uint64_t)ret_var.inner;
18132 if (ret_var.is_owned) {
18138 uint32_t __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
18139 LDKUserConfig ret_var = UserConfig_default();
18140 uint64_t ret_ref = 0;
18141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18144 ret_ref = (uint64_t)ret_var.inner;
18145 if (ret_var.is_owned) {
18151 void __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint32_t this_obj) {
18152 LDKBestBlock this_obj_conv;
18153 this_obj_conv.inner = (void*)(this_obj & (~1));
18154 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18156 BestBlock_free(this_obj_conv);
18159 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
18160 LDKBestBlock ret_var = BestBlock_clone(arg);
18161 uint64_t ret_ref = 0;
18162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18165 ret_ref = (uint64_t)ret_var.inner;
18166 if (ret_var.is_owned) {
18171 int64_t __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint32_t arg) {
18172 LDKBestBlock arg_conv;
18173 arg_conv.inner = (void*)(arg & (~1));
18174 arg_conv.is_owned = false;
18175 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18176 int64_t ret_val = BestBlock_clone_ptr(&arg_conv);
18180 uint32_t __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint32_t orig) {
18181 LDKBestBlock orig_conv;
18182 orig_conv.inner = (void*)(orig & (~1));
18183 orig_conv.is_owned = false;
18184 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18185 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
18186 uint64_t ret_ref = 0;
18187 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18188 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18190 ret_ref = (uint64_t)ret_var.inner;
18191 if (ret_var.is_owned) {
18197 uint32_t __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
18198 LDKNetwork network_conv = LDKNetwork_from_js(network);
18199 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
18200 uint64_t ret_ref = 0;
18201 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18202 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18204 ret_ref = (uint64_t)ret_var.inner;
18205 if (ret_var.is_owned) {
18211 uint32_t __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
18212 LDKThirtyTwoBytes block_hash_ref;
18213 CHECK(block_hash->arr_len == 32);
18214 memcpy(block_hash_ref.data, block_hash->elems, 32);
18215 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
18216 uint64_t ret_ref = 0;
18217 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18218 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18220 ret_ref = (uint64_t)ret_var.inner;
18221 if (ret_var.is_owned) {
18227 int8_tArray __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint32_t this_arg) {
18228 LDKBestBlock this_arg_conv;
18229 this_arg_conv.inner = (void*)(this_arg & (~1));
18230 this_arg_conv.is_owned = false;
18231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18232 int8_tArray ret_arr = init_int8_tArray(32);
18233 memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
18237 int32_t __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint32_t this_arg) {
18238 LDKBestBlock this_arg_conv;
18239 this_arg_conv.inner = (void*)(this_arg & (~1));
18240 this_arg_conv.is_owned = false;
18241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18242 int32_t ret_val = BestBlock_height(&this_arg_conv);
18246 uint32_t __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint32_t orig) {
18247 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
18248 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
18252 uint32_t __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
18253 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
18257 uint32_t __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
18258 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
18262 void __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint32_t this_ptr) {
18263 if ((this_ptr & 1) != 0) return;
18264 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18265 CHECK_ACCESS(this_ptr_ptr);
18266 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
18267 FREE((void*)this_ptr);
18268 Access_free(this_ptr_conv);
18271 void __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint32_t this_ptr) {
18272 if ((this_ptr & 1) != 0) return;
18273 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18274 CHECK_ACCESS(this_ptr_ptr);
18275 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
18276 FREE((void*)this_ptr);
18277 Listen_free(this_ptr_conv);
18280 void __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint32_t this_ptr) {
18281 if ((this_ptr & 1) != 0) return;
18282 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18283 CHECK_ACCESS(this_ptr_ptr);
18284 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
18285 FREE((void*)this_ptr);
18286 Confirm_free(this_ptr_conv);
18289 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_clone"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
18290 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
18291 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
18295 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_temporary_failure"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
18296 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
18300 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_permanent_failure"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
18301 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
18305 void __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint32_t this_ptr) {
18306 if ((this_ptr & 1) != 0) return;
18307 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18308 CHECK_ACCESS(this_ptr_ptr);
18309 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
18310 FREE((void*)this_ptr);
18311 Watch_free(this_ptr_conv);
18314 void __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint32_t this_ptr) {
18315 if ((this_ptr & 1) != 0) return;
18316 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18317 CHECK_ACCESS(this_ptr_ptr);
18318 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
18319 FREE((void*)this_ptr);
18320 Filter_free(this_ptr_conv);
18323 void __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint32_t this_obj) {
18324 LDKWatchedOutput this_obj_conv;
18325 this_obj_conv.inner = (void*)(this_obj & (~1));
18326 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18328 WatchedOutput_free(this_obj_conv);
18331 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
18332 LDKWatchedOutput this_ptr_conv;
18333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18334 this_ptr_conv.is_owned = false;
18335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18336 int8_tArray ret_arr = init_int8_tArray(32);
18337 memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
18341 void __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
18342 LDKWatchedOutput this_ptr_conv;
18343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18344 this_ptr_conv.is_owned = false;
18345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18346 LDKThirtyTwoBytes val_ref;
18347 CHECK(val->arr_len == 32);
18348 memcpy(val_ref.data, val->elems, 32);
18349 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
18352 uint32_t __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
18353 LDKWatchedOutput this_ptr_conv;
18354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18355 this_ptr_conv.is_owned = false;
18356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18357 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
18358 uint64_t ret_ref = 0;
18359 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18360 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18361 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18362 ret_ref = (uint64_t)ret_var.inner;
18363 if (ret_var.is_owned) {
18369 void __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
18370 LDKWatchedOutput this_ptr_conv;
18371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18372 this_ptr_conv.is_owned = false;
18373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18374 LDKOutPoint val_conv;
18375 val_conv.inner = (void*)(val & (~1));
18376 val_conv.is_owned = (val & 1) || (val == 0);
18377 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
18378 val_conv = OutPoint_clone(&val_conv);
18379 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
18382 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
18383 LDKWatchedOutput this_ptr_conv;
18384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18385 this_ptr_conv.is_owned = false;
18386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18387 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
18388 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18389 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18393 void __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
18394 LDKWatchedOutput this_ptr_conv;
18395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18396 this_ptr_conv.is_owned = false;
18397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18398 LDKCVec_u8Z val_ref;
18399 val_ref.datalen = val->arr_len;
18400 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
18401 memcpy(val_ref.data, val->elems, val_ref.datalen);
18402 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
18405 uint32_t __attribute__((export_name("TS_WatchedOutput_new"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
18406 LDKThirtyTwoBytes block_hash_arg_ref;
18407 CHECK(block_hash_arg->arr_len == 32);
18408 memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32);
18409 LDKOutPoint outpoint_arg_conv;
18410 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
18411 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
18412 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
18413 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
18414 LDKCVec_u8Z script_pubkey_arg_ref;
18415 script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
18416 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
18417 memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen);
18418 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
18419 uint64_t ret_ref = 0;
18420 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18421 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18423 ret_ref = (uint64_t)ret_var.inner;
18424 if (ret_var.is_owned) {
18430 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
18431 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
18432 uint64_t ret_ref = 0;
18433 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18434 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18435 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18436 ret_ref = (uint64_t)ret_var.inner;
18437 if (ret_var.is_owned) {
18442 int64_t __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
18443 LDKWatchedOutput arg_conv;
18444 arg_conv.inner = (void*)(arg & (~1));
18445 arg_conv.is_owned = false;
18446 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18447 int64_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
18451 uint32_t __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint32_t orig) {
18452 LDKWatchedOutput orig_conv;
18453 orig_conv.inner = (void*)(orig & (~1));
18454 orig_conv.is_owned = false;
18455 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18456 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
18457 uint64_t ret_ref = 0;
18458 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18459 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18461 ret_ref = (uint64_t)ret_var.inner;
18462 if (ret_var.is_owned) {
18468 int64_t __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint32_t o) {
18469 LDKWatchedOutput o_conv;
18470 o_conv.inner = (void*)(o & (~1));
18471 o_conv.is_owned = false;
18472 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18473 int64_t ret_val = WatchedOutput_hash(&o_conv);
18477 void __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
18478 if ((this_ptr & 1) != 0) return;
18479 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18480 CHECK_ACCESS(this_ptr_ptr);
18481 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
18482 FREE((void*)this_ptr);
18483 BroadcasterInterface_free(this_ptr_conv);
18486 uint32_t __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint32_t orig) {
18487 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
18488 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
18492 uint32_t __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
18493 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
18497 uint32_t __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
18498 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
18502 uint32_t __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
18503 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
18507 jboolean __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
18508 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
18509 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
18510 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
18514 void __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint32_t this_ptr) {
18515 if ((this_ptr & 1) != 0) return;
18516 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18517 CHECK_ACCESS(this_ptr_ptr);
18518 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
18519 FREE((void*)this_ptr);
18520 FeeEstimator_free(this_ptr_conv);
18523 void __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
18524 LDKMonitorUpdateId this_obj_conv;
18525 this_obj_conv.inner = (void*)(this_obj & (~1));
18526 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18528 MonitorUpdateId_free(this_obj_conv);
18531 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
18532 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
18533 uint64_t ret_ref = 0;
18534 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18535 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18536 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18537 ret_ref = (uint64_t)ret_var.inner;
18538 if (ret_var.is_owned) {
18543 int64_t __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
18544 LDKMonitorUpdateId arg_conv;
18545 arg_conv.inner = (void*)(arg & (~1));
18546 arg_conv.is_owned = false;
18547 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18548 int64_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
18552 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint32_t orig) {
18553 LDKMonitorUpdateId orig_conv;
18554 orig_conv.inner = (void*)(orig & (~1));
18555 orig_conv.is_owned = false;
18556 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18557 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
18558 uint64_t ret_ref = 0;
18559 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18560 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18562 ret_ref = (uint64_t)ret_var.inner;
18563 if (ret_var.is_owned) {
18569 int64_t __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint32_t o) {
18570 LDKMonitorUpdateId o_conv;
18571 o_conv.inner = (void*)(o & (~1));
18572 o_conv.is_owned = false;
18573 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18574 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
18578 jboolean __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
18579 LDKMonitorUpdateId a_conv;
18580 a_conv.inner = (void*)(a & (~1));
18581 a_conv.is_owned = false;
18582 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18583 LDKMonitorUpdateId b_conv;
18584 b_conv.inner = (void*)(b & (~1));
18585 b_conv.is_owned = false;
18586 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18587 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
18591 void __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint32_t this_ptr) {
18592 if ((this_ptr & 1) != 0) return;
18593 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18594 CHECK_ACCESS(this_ptr_ptr);
18595 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
18596 FREE((void*)this_ptr);
18597 Persist_free(this_ptr_conv);
18600 void __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
18601 LDKLockedChannelMonitor this_obj_conv;
18602 this_obj_conv.inner = (void*)(this_obj & (~1));
18603 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18605 LockedChannelMonitor_free(this_obj_conv);
18608 void __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint32_t this_obj) {
18609 LDKChainMonitor this_obj_conv;
18610 this_obj_conv.inner = (void*)(this_obj & (~1));
18611 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18613 ChainMonitor_free(this_obj_conv);
18616 uint32_t __attribute__((export_name("TS_ChainMonitor_new"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
18617 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
18618 CHECK_ACCESS(chain_source_ptr);
18619 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
18620 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
18621 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
18622 // Manually implement clone for Java trait instances
18624 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18625 CHECK_ACCESS(broadcaster_ptr);
18626 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18627 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18628 CHECK_ACCESS(logger_ptr);
18629 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18630 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
18631 CHECK_ACCESS(feeest_ptr);
18632 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
18633 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
18634 CHECK_ACCESS(persister_ptr);
18635 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
18636 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
18637 uint64_t ret_ref = 0;
18638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18641 ret_ref = (uint64_t)ret_var.inner;
18642 if (ret_var.is_owned) {
18648 uint32_tArray __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
18649 LDKChainMonitor this_arg_conv;
18650 this_arg_conv.inner = (void*)(this_arg & (~1));
18651 this_arg_conv.is_owned = false;
18652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18653 LDKCVec_ChannelDetailsZ ignored_channels_constr;
18654 ignored_channels_constr.datalen = ignored_channels->arr_len;
18655 if (ignored_channels_constr.datalen > 0)
18656 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18658 ignored_channels_constr.data = NULL;
18659 uint32_t* ignored_channels_vals = ignored_channels->elems;
18660 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
18661 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
18662 LDKChannelDetails ignored_channels_conv_16_conv;
18663 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
18664 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
18665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
18666 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
18667 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
18669 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
18670 uint32_tArray ret_arr = NULL;
18671 ret_arr = init_uint32_tArray(ret_var.datalen);
18672 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
18673 for (size_t j = 0; j < ret_var.datalen; j++) {
18674 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18675 *ret_conv_9_copy = ret_var.data[j];
18676 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
18677 ret_arr_ptr[j] = ret_conv_9_ref;
18680 FREE(ret_var.data);
18684 uint32_t __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
18685 LDKChainMonitor this_arg_conv;
18686 this_arg_conv.inner = (void*)(this_arg & (~1));
18687 this_arg_conv.is_owned = false;
18688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18689 LDKOutPoint funding_txo_conv;
18690 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18691 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18692 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18693 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18694 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
18695 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
18696 return (uint64_t)ret_conv;
18699 uint32_tArray __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
18700 LDKChainMonitor this_arg_conv;
18701 this_arg_conv.inner = (void*)(this_arg & (~1));
18702 this_arg_conv.is_owned = false;
18703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18704 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
18705 uint32_tArray ret_arr = NULL;
18706 ret_arr = init_uint32_tArray(ret_var.datalen);
18707 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
18708 for (size_t k = 0; k < ret_var.datalen; k++) {
18709 LDKOutPoint ret_conv_10_var = ret_var.data[k];
18710 uint64_t ret_conv_10_ref = 0;
18711 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18712 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18713 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
18714 ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
18715 if (ret_conv_10_var.is_owned) {
18716 ret_conv_10_ref |= 1;
18718 ret_arr_ptr[k] = ret_conv_10_ref;
18721 FREE(ret_var.data);
18725 uint32_t __attribute__((export_name("TS_ChainMonitor_channel_monitor_updated"))) TS_ChainMonitor_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, uint32_t completed_update_id) {
18726 LDKChainMonitor this_arg_conv;
18727 this_arg_conv.inner = (void*)(this_arg & (~1));
18728 this_arg_conv.is_owned = false;
18729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18730 LDKOutPoint funding_txo_conv;
18731 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18732 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18733 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18734 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18735 LDKMonitorUpdateId completed_update_id_conv;
18736 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
18737 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
18738 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
18739 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
18740 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18741 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
18742 return (uint64_t)ret_conv;
18745 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
18746 LDKChainMonitor this_arg_conv;
18747 this_arg_conv.inner = (void*)(this_arg & (~1));
18748 this_arg_conv.is_owned = false;
18749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18750 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
18751 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
18752 return (uint64_t)ret_ret;
18755 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
18756 LDKChainMonitor this_arg_conv;
18757 this_arg_conv.inner = (void*)(this_arg & (~1));
18758 this_arg_conv.is_owned = false;
18759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18760 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18761 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
18762 return (uint64_t)ret_ret;
18765 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
18766 LDKChainMonitor this_arg_conv;
18767 this_arg_conv.inner = (void*)(this_arg & (~1));
18768 this_arg_conv.is_owned = false;
18769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18770 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
18771 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
18772 return (uint64_t)ret_ret;
18775 uint32_t __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
18776 LDKChainMonitor this_arg_conv;
18777 this_arg_conv.inner = (void*)(this_arg & (~1));
18778 this_arg_conv.is_owned = false;
18779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18780 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18781 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
18782 return (uint64_t)ret_ret;
18785 void __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
18786 LDKChannelMonitorUpdate this_obj_conv;
18787 this_obj_conv.inner = (void*)(this_obj & (~1));
18788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18790 ChannelMonitorUpdate_free(this_obj_conv);
18793 int64_t __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
18794 LDKChannelMonitorUpdate this_ptr_conv;
18795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18796 this_ptr_conv.is_owned = false;
18797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18798 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
18802 void __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
18803 LDKChannelMonitorUpdate this_ptr_conv;
18804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18805 this_ptr_conv.is_owned = false;
18806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18807 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
18810 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
18811 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
18812 uint64_t ret_ref = 0;
18813 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18814 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18815 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18816 ret_ref = (uint64_t)ret_var.inner;
18817 if (ret_var.is_owned) {
18822 int64_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
18823 LDKChannelMonitorUpdate arg_conv;
18824 arg_conv.inner = (void*)(arg & (~1));
18825 arg_conv.is_owned = false;
18826 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18827 int64_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
18831 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
18832 LDKChannelMonitorUpdate orig_conv;
18833 orig_conv.inner = (void*)(orig & (~1));
18834 orig_conv.is_owned = false;
18835 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18836 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
18837 uint64_t ret_ref = 0;
18838 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18839 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18840 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18841 ret_ref = (uint64_t)ret_var.inner;
18842 if (ret_var.is_owned) {
18848 int8_tArray __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
18849 LDKChannelMonitorUpdate obj_conv;
18850 obj_conv.inner = (void*)(obj & (~1));
18851 obj_conv.is_owned = false;
18852 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18853 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
18854 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18855 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18856 CVec_u8Z_free(ret_var);
18860 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
18861 LDKu8slice ser_ref;
18862 ser_ref.datalen = ser->arr_len;
18863 ser_ref.data = ser->elems;
18864 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18865 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
18866 return (uint64_t)ret_conv;
18869 void __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint32_t this_ptr) {
18870 if ((this_ptr & 1) != 0) return;
18871 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18872 CHECK_ACCESS(this_ptr_ptr);
18873 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
18874 FREE((void*)this_ptr);
18875 MonitorEvent_free(this_ptr_conv);
18878 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
18879 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18880 *ret_copy = MonitorEvent_clone(arg);
18881 uint64_t ret_ref = (uint64_t)ret_copy;
18884 int64_t __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
18885 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
18886 int64_t ret_val = MonitorEvent_clone_ptr(arg_conv);
18890 uint32_t __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint32_t orig) {
18891 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
18892 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18893 *ret_copy = MonitorEvent_clone(orig_conv);
18894 uint64_t ret_ref = (uint64_t)ret_copy;
18898 uint32_t __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint32_t a) {
18899 LDKHTLCUpdate a_conv;
18900 a_conv.inner = (void*)(a & (~1));
18901 a_conv.is_owned = (a & 1) || (a == 0);
18902 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18903 a_conv = HTLCUpdate_clone(&a_conv);
18904 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18905 *ret_copy = MonitorEvent_htlcevent(a_conv);
18906 uint64_t ret_ref = (uint64_t)ret_copy;
18910 uint32_t __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
18911 LDKOutPoint a_conv;
18912 a_conv.inner = (void*)(a & (~1));
18913 a_conv.is_owned = (a & 1) || (a == 0);
18914 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18915 a_conv = OutPoint_clone(&a_conv);
18916 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18917 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
18918 uint64_t ret_ref = (uint64_t)ret_copy;
18922 uint32_t __attribute__((export_name("TS_MonitorEvent_update_completed"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
18923 LDKOutPoint funding_txo_conv;
18924 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18925 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18926 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18927 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18928 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18929 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
18930 uint64_t ret_ref = (uint64_t)ret_copy;
18934 uint32_t __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint32_t a) {
18935 LDKOutPoint a_conv;
18936 a_conv.inner = (void*)(a & (~1));
18937 a_conv.is_owned = (a & 1) || (a == 0);
18938 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18939 a_conv = OutPoint_clone(&a_conv);
18940 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18941 *ret_copy = MonitorEvent_update_failed(a_conv);
18942 uint64_t ret_ref = (uint64_t)ret_copy;
18946 int8_tArray __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint32_t obj) {
18947 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
18948 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
18949 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18950 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18951 CVec_u8Z_free(ret_var);
18955 uint32_t __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
18956 LDKu8slice ser_ref;
18957 ser_ref.datalen = ser->arr_len;
18958 ser_ref.data = ser->elems;
18959 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18960 *ret_conv = MonitorEvent_read(ser_ref);
18961 return (uint64_t)ret_conv;
18964 void __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint32_t this_obj) {
18965 LDKHTLCUpdate this_obj_conv;
18966 this_obj_conv.inner = (void*)(this_obj & (~1));
18967 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18969 HTLCUpdate_free(this_obj_conv);
18972 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
18973 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
18974 uint64_t ret_ref = 0;
18975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18978 ret_ref = (uint64_t)ret_var.inner;
18979 if (ret_var.is_owned) {
18984 int64_t __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
18985 LDKHTLCUpdate arg_conv;
18986 arg_conv.inner = (void*)(arg & (~1));
18987 arg_conv.is_owned = false;
18988 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18989 int64_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
18993 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint32_t orig) {
18994 LDKHTLCUpdate orig_conv;
18995 orig_conv.inner = (void*)(orig & (~1));
18996 orig_conv.is_owned = false;
18997 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18998 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
18999 uint64_t ret_ref = 0;
19000 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19001 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19002 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19003 ret_ref = (uint64_t)ret_var.inner;
19004 if (ret_var.is_owned) {
19010 int8_tArray __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint32_t obj) {
19011 LDKHTLCUpdate obj_conv;
19012 obj_conv.inner = (void*)(obj & (~1));
19013 obj_conv.is_owned = false;
19014 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19015 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
19016 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19017 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19018 CVec_u8Z_free(ret_var);
19022 uint32_t __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
19023 LDKu8slice ser_ref;
19024 ser_ref.datalen = ser->arr_len;
19025 ser_ref.data = ser->elems;
19026 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19027 *ret_conv = HTLCUpdate_read(ser_ref);
19028 return (uint64_t)ret_conv;
19031 void __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint32_t this_ptr) {
19032 if ((this_ptr & 1) != 0) return;
19033 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19034 CHECK_ACCESS(this_ptr_ptr);
19035 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
19036 FREE((void*)this_ptr);
19037 Balance_free(this_ptr_conv);
19040 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
19041 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19042 *ret_copy = Balance_clone(arg);
19043 uint64_t ret_ref = (uint64_t)ret_copy;
19046 int64_t __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint32_t arg) {
19047 LDKBalance* arg_conv = (LDKBalance*)arg;
19048 int64_t ret_val = Balance_clone_ptr(arg_conv);
19052 uint32_t __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint32_t orig) {
19053 LDKBalance* orig_conv = (LDKBalance*)orig;
19054 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19055 *ret_copy = Balance_clone(orig_conv);
19056 uint64_t ret_ref = (uint64_t)ret_copy;
19060 uint32_t __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
19061 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19062 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
19063 uint64_t ret_ref = (uint64_t)ret_copy;
19067 uint32_t __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
19068 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19069 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
19070 uint64_t ret_ref = (uint64_t)ret_copy;
19074 uint32_t __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
19075 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19076 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
19077 uint64_t ret_ref = (uint64_t)ret_copy;
19081 uint32_t __attribute__((export_name("TS_Balance_maybe_claimable_htlcawaiting_timeout"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
19082 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19083 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
19084 uint64_t ret_ref = (uint64_t)ret_copy;
19088 jboolean __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint32_t a, uint32_t b) {
19089 LDKBalance* a_conv = (LDKBalance*)a;
19090 LDKBalance* b_conv = (LDKBalance*)b;
19091 jboolean ret_val = Balance_eq(a_conv, b_conv);
19095 void __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint32_t this_obj) {
19096 LDKChannelMonitor this_obj_conv;
19097 this_obj_conv.inner = (void*)(this_obj & (~1));
19098 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19100 ChannelMonitor_free(this_obj_conv);
19103 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
19104 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
19105 uint64_t ret_ref = 0;
19106 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19107 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19109 ret_ref = (uint64_t)ret_var.inner;
19110 if (ret_var.is_owned) {
19115 int64_t __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
19116 LDKChannelMonitor arg_conv;
19117 arg_conv.inner = (void*)(arg & (~1));
19118 arg_conv.is_owned = false;
19119 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19120 int64_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
19124 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint32_t orig) {
19125 LDKChannelMonitor orig_conv;
19126 orig_conv.inner = (void*)(orig & (~1));
19127 orig_conv.is_owned = false;
19128 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19129 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
19130 uint64_t ret_ref = 0;
19131 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19132 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19133 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19134 ret_ref = (uint64_t)ret_var.inner;
19135 if (ret_var.is_owned) {
19141 int8_tArray __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint32_t obj) {
19142 LDKChannelMonitor obj_conv;
19143 obj_conv.inner = (void*)(obj & (~1));
19144 obj_conv.is_owned = false;
19145 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19146 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
19147 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19148 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19149 CVec_u8Z_free(ret_var);
19153 uint32_t __attribute__((export_name("TS_ChannelMonitor_update_monitor"))) TS_ChannelMonitor_update_monitor(uint32_t this_arg, uint32_t updates, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
19154 LDKChannelMonitor this_arg_conv;
19155 this_arg_conv.inner = (void*)(this_arg & (~1));
19156 this_arg_conv.is_owned = false;
19157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19158 LDKChannelMonitorUpdate updates_conv;
19159 updates_conv.inner = (void*)(updates & (~1));
19160 updates_conv.is_owned = false;
19161 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
19162 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19163 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
19164 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
19165 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19166 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
19167 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
19168 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19169 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
19170 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
19171 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19172 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
19173 return (uint64_t)ret_conv;
19176 int64_t __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
19177 LDKChannelMonitor this_arg_conv;
19178 this_arg_conv.inner = (void*)(this_arg & (~1));
19179 this_arg_conv.is_owned = false;
19180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19181 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
19185 uint32_t __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
19186 LDKChannelMonitor this_arg_conv;
19187 this_arg_conv.inner = (void*)(this_arg & (~1));
19188 this_arg_conv.is_owned = false;
19189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19190 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19191 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
19192 return ((uint64_t)ret_conv);
19195 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
19196 LDKChannelMonitor this_arg_conv;
19197 this_arg_conv.inner = (void*)(this_arg & (~1));
19198 this_arg_conv.is_owned = false;
19199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19200 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
19201 uint32_tArray ret_arr = NULL;
19202 ret_arr = init_uint32_tArray(ret_var.datalen);
19203 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19204 for (size_t o = 0; o < ret_var.datalen; o++) {
19205 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19206 *ret_conv_40_conv = ret_var.data[o];
19207 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
19210 FREE(ret_var.data);
19214 void __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
19215 LDKChannelMonitor this_arg_conv;
19216 this_arg_conv.inner = (void*)(this_arg & (~1));
19217 this_arg_conv.is_owned = false;
19218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19219 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
19220 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
19221 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
19222 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
19225 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_monitor_events"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
19226 LDKChannelMonitor this_arg_conv;
19227 this_arg_conv.inner = (void*)(this_arg & (~1));
19228 this_arg_conv.is_owned = false;
19229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19230 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
19231 uint32_tArray ret_arr = NULL;
19232 ret_arr = init_uint32_tArray(ret_var.datalen);
19233 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19234 for (size_t o = 0; o < ret_var.datalen; o++) {
19235 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19236 *ret_conv_14_copy = ret_var.data[o];
19237 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
19238 ret_arr_ptr[o] = ret_conv_14_ref;
19241 FREE(ret_var.data);
19245 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
19246 LDKChannelMonitor this_arg_conv;
19247 this_arg_conv.inner = (void*)(this_arg & (~1));
19248 this_arg_conv.is_owned = false;
19249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19250 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
19251 uint32_tArray ret_arr = NULL;
19252 ret_arr = init_uint32_tArray(ret_var.datalen);
19253 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19254 for (size_t h = 0; h < ret_var.datalen; h++) {
19255 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19256 *ret_conv_7_copy = ret_var.data[h];
19257 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
19258 ret_arr_ptr[h] = ret_conv_7_ref;
19261 FREE(ret_var.data);
19265 ptrArray __attribute__((export_name("TS_ChannelMonitor_get_latest_holder_commitment_txn"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
19266 LDKChannelMonitor this_arg_conv;
19267 this_arg_conv.inner = (void*)(this_arg & (~1));
19268 this_arg_conv.is_owned = false;
19269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19270 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19271 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
19272 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
19273 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
19274 ptrArray ret_arr = NULL;
19275 ret_arr = init_ptrArray(ret_var.datalen);
19276 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
19277 for (size_t m = 0; m < ret_var.datalen; m++) {
19278 LDKTransaction ret_conv_12_var = ret_var.data[m];
19279 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen);
19280 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
19281 Transaction_free(ret_conv_12_var);
19282 ret_arr_ptr[m] = ret_conv_12_arr;
19285 FREE(ret_var.data);
19289 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_block_connected"))) TS_ChannelMonitor_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
19290 LDKChannelMonitor this_arg_conv;
19291 this_arg_conv.inner = (void*)(this_arg & (~1));
19292 this_arg_conv.is_owned = false;
19293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19294 unsigned char header_arr[80];
19295 CHECK(header->arr_len == 80);
19296 memcpy(header_arr, header->elems, 80);
19297 unsigned char (*header_ref)[80] = &header_arr;
19298 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
19299 txdata_constr.datalen = txdata->arr_len;
19300 if (txdata_constr.datalen > 0)
19301 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19303 txdata_constr.data = NULL;
19304 uint32_t* txdata_vals = txdata->elems;
19305 for (size_t c = 0; c < txdata_constr.datalen; c++) {
19306 uint32_t txdata_conv_28 = txdata_vals[c];
19307 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19308 CHECK_ACCESS(txdata_conv_28_ptr);
19309 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19310 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19311 txdata_constr.data[c] = txdata_conv_28_conv;
19313 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19314 CHECK_ACCESS(broadcaster_ptr);
19315 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19316 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19317 CHECK_ACCESS(fee_estimator_ptr);
19318 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19319 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19320 CHECK_ACCESS(logger_ptr);
19321 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19322 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19323 uint32_tArray ret_arr = NULL;
19324 ret_arr = init_uint32_tArray(ret_var.datalen);
19325 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19326 for (size_t n = 0; n < ret_var.datalen; n++) {
19327 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19328 *ret_conv_39_conv = ret_var.data[n];
19329 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19332 FREE(ret_var.data);
19336 void __attribute__((export_name("TS_ChannelMonitor_block_disconnected"))) TS_ChannelMonitor_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
19337 LDKChannelMonitor this_arg_conv;
19338 this_arg_conv.inner = (void*)(this_arg & (~1));
19339 this_arg_conv.is_owned = false;
19340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19341 unsigned char header_arr[80];
19342 CHECK(header->arr_len == 80);
19343 memcpy(header_arr, header->elems, 80);
19344 unsigned char (*header_ref)[80] = &header_arr;
19345 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19346 CHECK_ACCESS(broadcaster_ptr);
19347 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19348 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19349 CHECK_ACCESS(fee_estimator_ptr);
19350 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19351 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19352 CHECK_ACCESS(logger_ptr);
19353 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19354 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19357 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_transactions_confirmed"))) TS_ChannelMonitor_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
19358 LDKChannelMonitor this_arg_conv;
19359 this_arg_conv.inner = (void*)(this_arg & (~1));
19360 this_arg_conv.is_owned = false;
19361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19362 unsigned char header_arr[80];
19363 CHECK(header->arr_len == 80);
19364 memcpy(header_arr, header->elems, 80);
19365 unsigned char (*header_ref)[80] = &header_arr;
19366 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
19367 txdata_constr.datalen = txdata->arr_len;
19368 if (txdata_constr.datalen > 0)
19369 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19371 txdata_constr.data = NULL;
19372 uint32_t* txdata_vals = txdata->elems;
19373 for (size_t c = 0; c < txdata_constr.datalen; c++) {
19374 uint32_t txdata_conv_28 = txdata_vals[c];
19375 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19376 CHECK_ACCESS(txdata_conv_28_ptr);
19377 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19378 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19379 txdata_constr.data[c] = txdata_conv_28_conv;
19381 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19382 CHECK_ACCESS(broadcaster_ptr);
19383 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19384 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19385 CHECK_ACCESS(fee_estimator_ptr);
19386 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19387 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19388 CHECK_ACCESS(logger_ptr);
19389 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19390 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19391 uint32_tArray ret_arr = NULL;
19392 ret_arr = init_uint32_tArray(ret_var.datalen);
19393 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19394 for (size_t n = 0; n < ret_var.datalen; n++) {
19395 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19396 *ret_conv_39_conv = ret_var.data[n];
19397 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19400 FREE(ret_var.data);
19404 void __attribute__((export_name("TS_ChannelMonitor_transaction_unconfirmed"))) TS_ChannelMonitor_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
19405 LDKChannelMonitor this_arg_conv;
19406 this_arg_conv.inner = (void*)(this_arg & (~1));
19407 this_arg_conv.is_owned = false;
19408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19409 unsigned char txid_arr[32];
19410 CHECK(txid->arr_len == 32);
19411 memcpy(txid_arr, txid->elems, 32);
19412 unsigned char (*txid_ref)[32] = &txid_arr;
19413 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19414 CHECK_ACCESS(broadcaster_ptr);
19415 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19416 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19417 CHECK_ACCESS(fee_estimator_ptr);
19418 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19419 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19420 CHECK_ACCESS(logger_ptr);
19421 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19422 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
19425 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_best_block_updated"))) TS_ChannelMonitor_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
19426 LDKChannelMonitor this_arg_conv;
19427 this_arg_conv.inner = (void*)(this_arg & (~1));
19428 this_arg_conv.is_owned = false;
19429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19430 unsigned char header_arr[80];
19431 CHECK(header->arr_len == 80);
19432 memcpy(header_arr, header->elems, 80);
19433 unsigned char (*header_ref)[80] = &header_arr;
19434 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19435 CHECK_ACCESS(broadcaster_ptr);
19436 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19437 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19438 CHECK_ACCESS(fee_estimator_ptr);
19439 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19440 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19441 CHECK_ACCESS(logger_ptr);
19442 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19443 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19444 uint32_tArray ret_arr = NULL;
19445 ret_arr = init_uint32_tArray(ret_var.datalen);
19446 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19447 for (size_t n = 0; n < ret_var.datalen; n++) {
19448 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19449 *ret_conv_39_conv = ret_var.data[n];
19450 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19453 FREE(ret_var.data);
19457 ptrArray __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
19458 LDKChannelMonitor this_arg_conv;
19459 this_arg_conv.inner = (void*)(this_arg & (~1));
19460 this_arg_conv.is_owned = false;
19461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19462 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
19463 ptrArray ret_arr = NULL;
19464 ret_arr = init_ptrArray(ret_var.datalen);
19465 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
19466 for (size_t m = 0; m < ret_var.datalen; m++) {
19467 int8_tArray ret_conv_12_arr = init_int8_tArray(32);
19468 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
19469 ret_arr_ptr[m] = ret_conv_12_arr;
19472 FREE(ret_var.data);
19476 uint32_t __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
19477 LDKChannelMonitor this_arg_conv;
19478 this_arg_conv.inner = (void*)(this_arg & (~1));
19479 this_arg_conv.is_owned = false;
19480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19481 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
19482 uint64_t ret_ref = 0;
19483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19486 ret_ref = (uint64_t)ret_var.inner;
19487 if (ret_var.is_owned) {
19493 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
19494 LDKChannelMonitor this_arg_conv;
19495 this_arg_conv.inner = (void*)(this_arg & (~1));
19496 this_arg_conv.is_owned = false;
19497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19498 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
19499 uint32_tArray ret_arr = NULL;
19500 ret_arr = init_uint32_tArray(ret_var.datalen);
19501 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19502 for (size_t j = 0; j < ret_var.datalen; j++) {
19503 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19504 *ret_conv_9_copy = ret_var.data[j];
19505 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
19506 ret_arr_ptr[j] = ret_conv_9_ref;
19509 FREE(ret_var.data);
19513 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
19514 LDKu8slice ser_ref;
19515 ser_ref.datalen = ser->arr_len;
19516 ser_ref.data = ser->elems;
19517 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
19518 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
19519 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
19520 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19521 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
19522 return (uint64_t)ret_conv;
19525 void __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint32_t this_obj) {
19526 LDKOutPoint this_obj_conv;
19527 this_obj_conv.inner = (void*)(this_obj & (~1));
19528 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19530 OutPoint_free(this_obj_conv);
19533 int8_tArray __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
19534 LDKOutPoint this_ptr_conv;
19535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19536 this_ptr_conv.is_owned = false;
19537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19538 int8_tArray ret_arr = init_int8_tArray(32);
19539 memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
19543 void __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
19544 LDKOutPoint this_ptr_conv;
19545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19546 this_ptr_conv.is_owned = false;
19547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19548 LDKThirtyTwoBytes val_ref;
19549 CHECK(val->arr_len == 32);
19550 memcpy(val_ref.data, val->elems, 32);
19551 OutPoint_set_txid(&this_ptr_conv, val_ref);
19554 int16_t __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint32_t this_ptr) {
19555 LDKOutPoint this_ptr_conv;
19556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19557 this_ptr_conv.is_owned = false;
19558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19559 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
19563 void __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
19564 LDKOutPoint this_ptr_conv;
19565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19566 this_ptr_conv.is_owned = false;
19567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19568 OutPoint_set_index(&this_ptr_conv, val);
19571 uint32_t __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
19572 LDKThirtyTwoBytes txid_arg_ref;
19573 CHECK(txid_arg->arr_len == 32);
19574 memcpy(txid_arg_ref.data, txid_arg->elems, 32);
19575 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
19576 uint64_t ret_ref = 0;
19577 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19578 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19580 ret_ref = (uint64_t)ret_var.inner;
19581 if (ret_var.is_owned) {
19587 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
19588 LDKOutPoint ret_var = OutPoint_clone(arg);
19589 uint64_t ret_ref = 0;
19590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19593 ret_ref = (uint64_t)ret_var.inner;
19594 if (ret_var.is_owned) {
19599 int64_t __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint32_t arg) {
19600 LDKOutPoint arg_conv;
19601 arg_conv.inner = (void*)(arg & (~1));
19602 arg_conv.is_owned = false;
19603 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19604 int64_t ret_val = OutPoint_clone_ptr(&arg_conv);
19608 uint32_t __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint32_t orig) {
19609 LDKOutPoint orig_conv;
19610 orig_conv.inner = (void*)(orig & (~1));
19611 orig_conv.is_owned = false;
19612 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19613 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
19614 uint64_t ret_ref = 0;
19615 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19616 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19618 ret_ref = (uint64_t)ret_var.inner;
19619 if (ret_var.is_owned) {
19625 jboolean __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
19626 LDKOutPoint a_conv;
19627 a_conv.inner = (void*)(a & (~1));
19628 a_conv.is_owned = false;
19629 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19630 LDKOutPoint b_conv;
19631 b_conv.inner = (void*)(b & (~1));
19632 b_conv.is_owned = false;
19633 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19634 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
19638 int64_t __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint32_t o) {
19639 LDKOutPoint o_conv;
19640 o_conv.inner = (void*)(o & (~1));
19641 o_conv.is_owned = false;
19642 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19643 int64_t ret_val = OutPoint_hash(&o_conv);
19647 int8_tArray __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
19648 LDKOutPoint this_arg_conv;
19649 this_arg_conv.inner = (void*)(this_arg & (~1));
19650 this_arg_conv.is_owned = false;
19651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19652 int8_tArray ret_arr = init_int8_tArray(32);
19653 memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
19657 int8_tArray __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint32_t obj) {
19658 LDKOutPoint obj_conv;
19659 obj_conv.inner = (void*)(obj & (~1));
19660 obj_conv.is_owned = false;
19661 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19662 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
19663 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19664 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19665 CVec_u8Z_free(ret_var);
19669 uint32_t __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
19670 LDKu8slice ser_ref;
19671 ser_ref.datalen = ser->arr_len;
19672 ser_ref.data = ser->elems;
19673 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19674 *ret_conv = OutPoint_read(ser_ref);
19675 return (uint64_t)ret_conv;
19678 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
19679 LDKDelayedPaymentOutputDescriptor this_obj_conv;
19680 this_obj_conv.inner = (void*)(this_obj & (~1));
19681 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19683 DelayedPaymentOutputDescriptor_free(this_obj_conv);
19686 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19687 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19689 this_ptr_conv.is_owned = false;
19690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19691 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19692 uint64_t ret_ref = 0;
19693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19696 ret_ref = (uint64_t)ret_var.inner;
19697 if (ret_var.is_owned) {
19703 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19704 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19706 this_ptr_conv.is_owned = false;
19707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19708 LDKOutPoint val_conv;
19709 val_conv.inner = (void*)(val & (~1));
19710 val_conv.is_owned = (val & 1) || (val == 0);
19711 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19712 val_conv = OutPoint_clone(&val_conv);
19713 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19716 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
19717 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19719 this_ptr_conv.is_owned = false;
19720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19721 int8_tArray ret_arr = init_int8_tArray(33);
19722 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19726 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19727 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19729 this_ptr_conv.is_owned = false;
19730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19731 LDKPublicKey val_ref;
19732 CHECK(val->arr_len == 33);
19733 memcpy(val_ref.compressed_form, val->elems, 33);
19734 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
19737 int16_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
19738 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19740 this_ptr_conv.is_owned = false;
19741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19742 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
19746 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
19747 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19749 this_ptr_conv.is_owned = false;
19750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19751 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
19754 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19755 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19757 this_ptr_conv.is_owned = false;
19758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19759 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19760 CHECK_ACCESS(val_ptr);
19761 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19762 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19763 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19766 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
19767 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19769 this_ptr_conv.is_owned = false;
19770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19771 int8_tArray ret_arr = init_int8_tArray(33);
19772 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
19776 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
19777 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19779 this_ptr_conv.is_owned = false;
19780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19781 LDKPublicKey val_ref;
19782 CHECK(val->arr_len == 33);
19783 memcpy(val_ref.compressed_form, val->elems, 33);
19784 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
19787 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19788 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19790 this_ptr_conv.is_owned = false;
19791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19792 int8_tArray ret_arr = init_int8_tArray(32);
19793 memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19797 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19798 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19800 this_ptr_conv.is_owned = false;
19801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19802 LDKThirtyTwoBytes val_ref;
19803 CHECK(val->arr_len == 32);
19804 memcpy(val_ref.data, val->elems, 32);
19805 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19808 int64_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19809 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19811 this_ptr_conv.is_owned = false;
19812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19813 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19817 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19818 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19820 this_ptr_conv.is_owned = false;
19821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19822 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
19825 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_new"))) TS_DelayedPaymentOutputDescriptor_new(uint32_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, uint32_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
19826 LDKOutPoint outpoint_arg_conv;
19827 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
19828 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
19829 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
19830 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
19831 LDKPublicKey per_commitment_point_arg_ref;
19832 CHECK(per_commitment_point_arg->arr_len == 33);
19833 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33);
19834 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
19835 CHECK_ACCESS(output_arg_ptr);
19836 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
19837 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
19838 LDKPublicKey revocation_pubkey_arg_ref;
19839 CHECK(revocation_pubkey_arg->arr_len == 33);
19840 memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33);
19841 LDKThirtyTwoBytes channel_keys_id_arg_ref;
19842 CHECK(channel_keys_id_arg->arr_len == 32);
19843 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32);
19844 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg);
19845 uint64_t ret_ref = 0;
19846 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19847 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19848 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19849 ret_ref = (uint64_t)ret_var.inner;
19850 if (ret_var.is_owned) {
19856 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
19857 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
19858 uint64_t ret_ref = 0;
19859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19862 ret_ref = (uint64_t)ret_var.inner;
19863 if (ret_var.is_owned) {
19868 int64_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
19869 LDKDelayedPaymentOutputDescriptor arg_conv;
19870 arg_conv.inner = (void*)(arg & (~1));
19871 arg_conv.is_owned = false;
19872 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19873 int64_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
19877 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
19878 LDKDelayedPaymentOutputDescriptor orig_conv;
19879 orig_conv.inner = (void*)(orig & (~1));
19880 orig_conv.is_owned = false;
19881 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19882 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
19883 uint64_t ret_ref = 0;
19884 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19885 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19887 ret_ref = (uint64_t)ret_var.inner;
19888 if (ret_var.is_owned) {
19894 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
19895 LDKDelayedPaymentOutputDescriptor obj_conv;
19896 obj_conv.inner = (void*)(obj & (~1));
19897 obj_conv.is_owned = false;
19898 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19899 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
19900 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19901 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19902 CVec_u8Z_free(ret_var);
19906 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
19907 LDKu8slice ser_ref;
19908 ser_ref.datalen = ser->arr_len;
19909 ser_ref.data = ser->elems;
19910 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19911 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
19912 return (uint64_t)ret_conv;
19915 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
19916 LDKStaticPaymentOutputDescriptor this_obj_conv;
19917 this_obj_conv.inner = (void*)(this_obj & (~1));
19918 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19920 StaticPaymentOutputDescriptor_free(this_obj_conv);
19923 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19924 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19926 this_ptr_conv.is_owned = false;
19927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19928 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19929 uint64_t ret_ref = 0;
19930 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19931 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19932 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19933 ret_ref = (uint64_t)ret_var.inner;
19934 if (ret_var.is_owned) {
19940 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19941 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19943 this_ptr_conv.is_owned = false;
19944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19945 LDKOutPoint val_conv;
19946 val_conv.inner = (void*)(val & (~1));
19947 val_conv.is_owned = (val & 1) || (val == 0);
19948 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19949 val_conv = OutPoint_clone(&val_conv);
19950 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19953 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19954 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19956 this_ptr_conv.is_owned = false;
19957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19958 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19959 CHECK_ACCESS(val_ptr);
19960 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19961 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19962 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19965 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19966 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19968 this_ptr_conv.is_owned = false;
19969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19970 int8_tArray ret_arr = init_int8_tArray(32);
19971 memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19975 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19976 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19978 this_ptr_conv.is_owned = false;
19979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19980 LDKThirtyTwoBytes val_ref;
19981 CHECK(val->arr_len == 32);
19982 memcpy(val_ref.data, val->elems, 32);
19983 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19986 int64_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19987 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19989 this_ptr_conv.is_owned = false;
19990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19991 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19995 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19996 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19998 this_ptr_conv.is_owned = false;
19999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20000 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
20003 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_new"))) TS_StaticPaymentOutputDescriptor_new(uint32_t outpoint_arg, uint32_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
20004 LDKOutPoint outpoint_arg_conv;
20005 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
20006 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
20007 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
20008 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
20009 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
20010 CHECK_ACCESS(output_arg_ptr);
20011 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
20012 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
20013 LDKThirtyTwoBytes channel_keys_id_arg_ref;
20014 CHECK(channel_keys_id_arg->arr_len == 32);
20015 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32);
20016 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
20017 uint64_t ret_ref = 0;
20018 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20019 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20021 ret_ref = (uint64_t)ret_var.inner;
20022 if (ret_var.is_owned) {
20028 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
20029 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
20030 uint64_t ret_ref = 0;
20031 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20032 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20034 ret_ref = (uint64_t)ret_var.inner;
20035 if (ret_var.is_owned) {
20040 int64_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
20041 LDKStaticPaymentOutputDescriptor arg_conv;
20042 arg_conv.inner = (void*)(arg & (~1));
20043 arg_conv.is_owned = false;
20044 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20045 int64_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
20049 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
20050 LDKStaticPaymentOutputDescriptor orig_conv;
20051 orig_conv.inner = (void*)(orig & (~1));
20052 orig_conv.is_owned = false;
20053 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20054 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
20055 uint64_t ret_ref = 0;
20056 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20057 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20059 ret_ref = (uint64_t)ret_var.inner;
20060 if (ret_var.is_owned) {
20066 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
20067 LDKStaticPaymentOutputDescriptor obj_conv;
20068 obj_conv.inner = (void*)(obj & (~1));
20069 obj_conv.is_owned = false;
20070 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20071 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
20072 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
20073 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20074 CVec_u8Z_free(ret_var);
20078 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
20079 LDKu8slice ser_ref;
20080 ser_ref.datalen = ser->arr_len;
20081 ser_ref.data = ser->elems;
20082 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
20083 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
20084 return (uint64_t)ret_conv;
20087 void __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
20088 if ((this_ptr & 1) != 0) return;
20089 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20090 CHECK_ACCESS(this_ptr_ptr);
20091 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
20092 FREE((void*)this_ptr);
20093 SpendableOutputDescriptor_free(this_ptr_conv);
20096 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
20097 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20098 *ret_copy = SpendableOutputDescriptor_clone(arg);
20099 uint64_t ret_ref = (uint64_t)ret_copy;
20102 int64_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
20103 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
20104 int64_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
20108 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
20109 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
20110 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20111 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
20112 uint64_t ret_ref = (uint64_t)ret_copy;
20116 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
20117 LDKOutPoint outpoint_conv;
20118 outpoint_conv.inner = (void*)(outpoint & (~1));
20119 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
20120 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
20121 outpoint_conv = OutPoint_clone(&outpoint_conv);
20122 void* output_ptr = (void*)(((uint64_t)output) & ~1);
20123 CHECK_ACCESS(output_ptr);
20124 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
20125 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
20126 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20127 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
20128 uint64_t ret_ref = (uint64_t)ret_copy;
20132 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
20133 LDKDelayedPaymentOutputDescriptor a_conv;
20134 a_conv.inner = (void*)(a & (~1));
20135 a_conv.is_owned = (a & 1) || (a == 0);
20136 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20137 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
20138 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20139 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
20140 uint64_t ret_ref = (uint64_t)ret_copy;
20144 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
20145 LDKStaticPaymentOutputDescriptor a_conv;
20146 a_conv.inner = (void*)(a & (~1));
20147 a_conv.is_owned = (a & 1) || (a == 0);
20148 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20149 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
20150 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20151 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
20152 uint64_t ret_ref = (uint64_t)ret_copy;
20156 int8_tArray __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
20157 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
20158 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
20159 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
20160 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20161 CVec_u8Z_free(ret_var);
20165 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
20166 LDKu8slice ser_ref;
20167 ser_ref.datalen = ser->arr_len;
20168 ser_ref.data = ser->elems;
20169 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
20170 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
20171 return (uint64_t)ret_conv;
20174 void __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint32_t this_ptr) {
20175 if ((this_ptr & 1) != 0) return;
20176 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20177 CHECK_ACCESS(this_ptr_ptr);
20178 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
20179 FREE((void*)this_ptr);
20180 BaseSign_free(this_ptr_conv);
20183 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
20184 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20185 *ret_ret = Sign_clone(arg);
20186 return (uint64_t)ret_ret;
20188 int64_t __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint32_t arg) {
20189 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
20190 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
20191 LDKSign* arg_conv = (LDKSign*)arg_ptr;
20192 int64_t ret_val = Sign_clone_ptr(arg_conv);
20196 uint32_t __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint32_t orig) {
20197 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
20198 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
20199 LDKSign* orig_conv = (LDKSign*)orig_ptr;
20200 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20201 *ret_ret = Sign_clone(orig_conv);
20202 return (uint64_t)ret_ret;
20205 void __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint32_t this_ptr) {
20206 if ((this_ptr & 1) != 0) return;
20207 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20208 CHECK_ACCESS(this_ptr_ptr);
20209 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
20210 FREE((void*)this_ptr);
20211 Sign_free(this_ptr_conv);
20214 void __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint32_t this_ptr) {
20215 if ((this_ptr & 1) != 0) return;
20216 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20217 CHECK_ACCESS(this_ptr_ptr);
20218 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
20219 FREE((void*)this_ptr);
20220 KeysInterface_free(this_ptr_conv);
20223 void __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint32_t this_obj) {
20224 LDKInMemorySigner this_obj_conv;
20225 this_obj_conv.inner = (void*)(this_obj & (~1));
20226 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20228 InMemorySigner_free(this_obj_conv);
20231 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
20232 LDKInMemorySigner this_ptr_conv;
20233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20234 this_ptr_conv.is_owned = false;
20235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20236 int8_tArray ret_arr = init_int8_tArray(32);
20237 memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
20241 void __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
20242 LDKInMemorySigner this_ptr_conv;
20243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20244 this_ptr_conv.is_owned = false;
20245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20246 LDKSecretKey val_ref;
20247 CHECK(val->arr_len == 32);
20248 memcpy(val_ref.bytes, val->elems, 32);
20249 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
20252 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
20253 LDKInMemorySigner this_ptr_conv;
20254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20255 this_ptr_conv.is_owned = false;
20256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20257 int8_tArray ret_arr = init_int8_tArray(32);
20258 memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
20262 void __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
20263 LDKInMemorySigner this_ptr_conv;
20264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20265 this_ptr_conv.is_owned = false;
20266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20267 LDKSecretKey val_ref;
20268 CHECK(val->arr_len == 32);
20269 memcpy(val_ref.bytes, val->elems, 32);
20270 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
20273 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
20274 LDKInMemorySigner this_ptr_conv;
20275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20276 this_ptr_conv.is_owned = false;
20277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20278 int8_tArray ret_arr = init_int8_tArray(32);
20279 memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
20283 void __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
20284 LDKInMemorySigner this_ptr_conv;
20285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20286 this_ptr_conv.is_owned = false;
20287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20288 LDKSecretKey val_ref;
20289 CHECK(val->arr_len == 32);
20290 memcpy(val_ref.bytes, val->elems, 32);
20291 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
20294 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
20295 LDKInMemorySigner this_ptr_conv;
20296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20297 this_ptr_conv.is_owned = false;
20298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20299 int8_tArray ret_arr = init_int8_tArray(32);
20300 memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
20304 void __attribute__((export_name("TS_InMemorySigner_set_delayed_payment_base_key"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
20305 LDKInMemorySigner this_ptr_conv;
20306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20307 this_ptr_conv.is_owned = false;
20308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20309 LDKSecretKey val_ref;
20310 CHECK(val->arr_len == 32);
20311 memcpy(val_ref.bytes, val->elems, 32);
20312 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
20315 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
20316 LDKInMemorySigner this_ptr_conv;
20317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20318 this_ptr_conv.is_owned = false;
20319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20320 int8_tArray ret_arr = init_int8_tArray(32);
20321 memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
20325 void __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
20326 LDKInMemorySigner this_ptr_conv;
20327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20328 this_ptr_conv.is_owned = false;
20329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20330 LDKSecretKey val_ref;
20331 CHECK(val->arr_len == 32);
20332 memcpy(val_ref.bytes, val->elems, 32);
20333 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
20336 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
20337 LDKInMemorySigner this_ptr_conv;
20338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20339 this_ptr_conv.is_owned = false;
20340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20341 int8_tArray ret_arr = init_int8_tArray(32);
20342 memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
20346 void __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
20347 LDKInMemorySigner this_ptr_conv;
20348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20349 this_ptr_conv.is_owned = false;
20350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20351 LDKThirtyTwoBytes val_ref;
20352 CHECK(val->arr_len == 32);
20353 memcpy(val_ref.data, val->elems, 32);
20354 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
20357 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
20358 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
20359 uint64_t ret_ref = 0;
20360 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20361 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20363 ret_ref = (uint64_t)ret_var.inner;
20364 if (ret_var.is_owned) {
20369 int64_t __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
20370 LDKInMemorySigner arg_conv;
20371 arg_conv.inner = (void*)(arg & (~1));
20372 arg_conv.is_owned = false;
20373 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20374 int64_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
20378 uint32_t __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint32_t orig) {
20379 LDKInMemorySigner orig_conv;
20380 orig_conv.inner = (void*)(orig & (~1));
20381 orig_conv.is_owned = false;
20382 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20383 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
20384 uint64_t ret_ref = 0;
20385 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20386 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20387 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20388 ret_ref = (uint64_t)ret_var.inner;
20389 if (ret_var.is_owned) {
20395 uint32_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) {
20396 LDKSecretKey funding_key_ref;
20397 CHECK(funding_key->arr_len == 32);
20398 memcpy(funding_key_ref.bytes, funding_key->elems, 32);
20399 LDKSecretKey revocation_base_key_ref;
20400 CHECK(revocation_base_key->arr_len == 32);
20401 memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32);
20402 LDKSecretKey payment_key_ref;
20403 CHECK(payment_key->arr_len == 32);
20404 memcpy(payment_key_ref.bytes, payment_key->elems, 32);
20405 LDKSecretKey delayed_payment_base_key_ref;
20406 CHECK(delayed_payment_base_key->arr_len == 32);
20407 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32);
20408 LDKSecretKey htlc_base_key_ref;
20409 CHECK(htlc_base_key->arr_len == 32);
20410 memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32);
20411 LDKThirtyTwoBytes commitment_seed_ref;
20412 CHECK(commitment_seed->arr_len == 32);
20413 memcpy(commitment_seed_ref.data, commitment_seed->elems, 32);
20414 LDKThirtyTwoBytes channel_keys_id_ref;
20415 CHECK(channel_keys_id->arr_len == 32);
20416 memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32);
20417 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);
20418 uint64_t ret_ref = 0;
20419 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20420 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20422 ret_ref = (uint64_t)ret_var.inner;
20423 if (ret_var.is_owned) {
20429 uint32_t __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
20430 LDKInMemorySigner this_arg_conv;
20431 this_arg_conv.inner = (void*)(this_arg & (~1));
20432 this_arg_conv.is_owned = false;
20433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20434 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
20435 uint64_t ret_ref = 0;
20436 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20437 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20439 ret_ref = (uint64_t)ret_var.inner;
20440 if (ret_var.is_owned) {
20446 int16_t __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
20447 LDKInMemorySigner this_arg_conv;
20448 this_arg_conv.inner = (void*)(this_arg & (~1));
20449 this_arg_conv.is_owned = false;
20450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20451 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
20455 int16_t __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
20456 LDKInMemorySigner this_arg_conv;
20457 this_arg_conv.inner = (void*)(this_arg & (~1));
20458 this_arg_conv.is_owned = false;
20459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20460 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
20464 jboolean __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
20465 LDKInMemorySigner this_arg_conv;
20466 this_arg_conv.inner = (void*)(this_arg & (~1));
20467 this_arg_conv.is_owned = false;
20468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20469 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
20473 uint32_t __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
20474 LDKInMemorySigner this_arg_conv;
20475 this_arg_conv.inner = (void*)(this_arg & (~1));
20476 this_arg_conv.is_owned = false;
20477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20478 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
20479 uint64_t ret_ref = 0;
20480 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20481 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20482 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20483 ret_ref = (uint64_t)ret_var.inner;
20484 if (ret_var.is_owned) {
20490 uint32_t __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
20491 LDKInMemorySigner this_arg_conv;
20492 this_arg_conv.inner = (void*)(this_arg & (~1));
20493 this_arg_conv.is_owned = false;
20494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20495 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
20496 uint64_t ret_ref = 0;
20497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20500 ret_ref = (uint64_t)ret_var.inner;
20501 if (ret_var.is_owned) {
20507 jboolean __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) {
20508 LDKInMemorySigner this_arg_conv;
20509 this_arg_conv.inner = (void*)(this_arg & (~1));
20510 this_arg_conv.is_owned = false;
20511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20512 jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv);
20516 uint32_t __attribute__((export_name("TS_InMemorySigner_sign_counterparty_payment_input"))) TS_InMemorySigner_sign_counterparty_payment_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) {
20517 LDKInMemorySigner this_arg_conv;
20518 this_arg_conv.inner = (void*)(this_arg & (~1));
20519 this_arg_conv.is_owned = false;
20520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20521 LDKTransaction spend_tx_ref;
20522 spend_tx_ref.datalen = spend_tx->arr_len;
20523 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20524 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen);
20525 spend_tx_ref.data_is_owned = true;
20526 LDKStaticPaymentOutputDescriptor descriptor_conv;
20527 descriptor_conv.inner = (void*)(descriptor & (~1));
20528 descriptor_conv.is_owned = false;
20529 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20530 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20531 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20532 return (uint64_t)ret_conv;
20535 uint32_t __attribute__((export_name("TS_InMemorySigner_sign_dynamic_p2wsh_input"))) TS_InMemorySigner_sign_dynamic_p2wsh_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) {
20536 LDKInMemorySigner this_arg_conv;
20537 this_arg_conv.inner = (void*)(this_arg & (~1));
20538 this_arg_conv.is_owned = false;
20539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20540 LDKTransaction spend_tx_ref;
20541 spend_tx_ref.datalen = spend_tx->arr_len;
20542 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20543 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen);
20544 spend_tx_ref.data_is_owned = true;
20545 LDKDelayedPaymentOutputDescriptor descriptor_conv;
20546 descriptor_conv.inner = (void*)(descriptor & (~1));
20547 descriptor_conv.is_owned = false;
20548 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20549 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20550 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20551 return (uint64_t)ret_conv;
20554 uint32_t __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
20555 LDKInMemorySigner this_arg_conv;
20556 this_arg_conv.inner = (void*)(this_arg & (~1));
20557 this_arg_conv.is_owned = false;
20558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20559 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
20560 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
20561 return (uint64_t)ret_ret;
20564 uint32_t __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
20565 LDKInMemorySigner this_arg_conv;
20566 this_arg_conv.inner = (void*)(this_arg & (~1));
20567 this_arg_conv.is_owned = false;
20568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20569 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20570 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
20571 return (uint64_t)ret_ret;
20574 int8_tArray __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint32_t obj) {
20575 LDKInMemorySigner obj_conv;
20576 obj_conv.inner = (void*)(obj & (~1));
20577 obj_conv.is_owned = false;
20578 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20579 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
20580 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
20581 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20582 CVec_u8Z_free(ret_var);
20586 uint32_t __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser) {
20587 LDKu8slice ser_ref;
20588 ser_ref.datalen = ser->arr_len;
20589 ser_ref.data = ser->elems;
20590 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20591 *ret_conv = InMemorySigner_read(ser_ref);
20592 return (uint64_t)ret_conv;
20595 void __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint32_t this_obj) {
20596 LDKKeysManager this_obj_conv;
20597 this_obj_conv.inner = (void*)(this_obj & (~1));
20598 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20600 KeysManager_free(this_obj_conv);
20603 uint32_t __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
20604 unsigned char seed_arr[32];
20605 CHECK(seed->arr_len == 32);
20606 memcpy(seed_arr, seed->elems, 32);
20607 unsigned char (*seed_ref)[32] = &seed_arr;
20608 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
20609 uint64_t ret_ref = 0;
20610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20613 ret_ref = (uint64_t)ret_var.inner;
20614 if (ret_var.is_owned) {
20620 uint32_t __attribute__((export_name("TS_KeysManager_derive_channel_keys"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
20621 LDKKeysManager this_arg_conv;
20622 this_arg_conv.inner = (void*)(this_arg & (~1));
20623 this_arg_conv.is_owned = false;
20624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20625 unsigned char params_arr[32];
20626 CHECK(params->arr_len == 32);
20627 memcpy(params_arr, params->elems, 32);
20628 unsigned char (*params_ref)[32] = ¶ms_arr;
20629 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
20630 uint64_t ret_ref = 0;
20631 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20632 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20634 ret_ref = (uint64_t)ret_var.inner;
20635 if (ret_var.is_owned) {
20641 uint32_t __attribute__((export_name("TS_KeysManager_spend_spendable_outputs"))) TS_KeysManager_spend_spendable_outputs(uint32_t this_arg, uint32_tArray descriptors, uint32_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) {
20642 LDKKeysManager this_arg_conv;
20643 this_arg_conv.inner = (void*)(this_arg & (~1));
20644 this_arg_conv.is_owned = false;
20645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20646 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
20647 descriptors_constr.datalen = descriptors->arr_len;
20648 if (descriptors_constr.datalen > 0)
20649 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20651 descriptors_constr.data = NULL;
20652 uint32_t* descriptors_vals = descriptors->elems;
20653 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
20654 uint32_t descriptors_conv_27 = descriptors_vals[b];
20655 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
20656 CHECK_ACCESS(descriptors_conv_27_ptr);
20657 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
20658 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
20659 descriptors_constr.data[b] = descriptors_conv_27_conv;
20661 LDKCVec_TxOutZ outputs_constr;
20662 outputs_constr.datalen = outputs->arr_len;
20663 if (outputs_constr.datalen > 0)
20664 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
20666 outputs_constr.data = NULL;
20667 uint32_t* outputs_vals = outputs->elems;
20668 for (size_t h = 0; h < outputs_constr.datalen; h++) {
20669 uint32_t outputs_conv_7 = outputs_vals[h];
20670 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
20671 CHECK_ACCESS(outputs_conv_7_ptr);
20672 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
20673 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
20674 outputs_constr.data[h] = outputs_conv_7_conv;
20676 LDKCVec_u8Z change_destination_script_ref;
20677 change_destination_script_ref.datalen = change_destination_script->arr_len;
20678 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
20679 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen);
20680 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20681 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
20682 return (uint64_t)ret_conv;
20685 uint32_t __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
20686 LDKKeysManager this_arg_conv;
20687 this_arg_conv.inner = (void*)(this_arg & (~1));
20688 this_arg_conv.is_owned = false;
20689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20690 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
20691 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
20692 return (uint64_t)ret_ret;
20695 void __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint32_t this_obj) {
20696 LDKChannelManager this_obj_conv;
20697 this_obj_conv.inner = (void*)(this_obj & (~1));
20698 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20700 ChannelManager_free(this_obj_conv);
20703 void __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint32_t this_obj) {
20704 LDKChainParameters this_obj_conv;
20705 this_obj_conv.inner = (void*)(this_obj & (~1));
20706 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20708 ChainParameters_free(this_obj_conv);
20711 uint32_t __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
20712 LDKChainParameters this_ptr_conv;
20713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20714 this_ptr_conv.is_owned = false;
20715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20716 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
20720 void __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
20721 LDKChainParameters this_ptr_conv;
20722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20723 this_ptr_conv.is_owned = false;
20724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20725 LDKNetwork val_conv = LDKNetwork_from_js(val);
20726 ChainParameters_set_network(&this_ptr_conv, val_conv);
20729 uint32_t __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
20730 LDKChainParameters this_ptr_conv;
20731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20732 this_ptr_conv.is_owned = false;
20733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20734 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
20735 uint64_t ret_ref = 0;
20736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20739 ret_ref = (uint64_t)ret_var.inner;
20740 if (ret_var.is_owned) {
20746 void __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
20747 LDKChainParameters this_ptr_conv;
20748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20749 this_ptr_conv.is_owned = false;
20750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20751 LDKBestBlock val_conv;
20752 val_conv.inner = (void*)(val & (~1));
20753 val_conv.is_owned = (val & 1) || (val == 0);
20754 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20755 val_conv = BestBlock_clone(&val_conv);
20756 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
20759 uint32_t __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
20760 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
20761 LDKBestBlock best_block_arg_conv;
20762 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
20763 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
20764 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
20765 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
20766 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
20767 uint64_t ret_ref = 0;
20768 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20769 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20771 ret_ref = (uint64_t)ret_var.inner;
20772 if (ret_var.is_owned) {
20778 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
20779 LDKChainParameters ret_var = ChainParameters_clone(arg);
20780 uint64_t ret_ref = 0;
20781 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20782 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20783 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20784 ret_ref = (uint64_t)ret_var.inner;
20785 if (ret_var.is_owned) {
20790 int64_t __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
20791 LDKChainParameters arg_conv;
20792 arg_conv.inner = (void*)(arg & (~1));
20793 arg_conv.is_owned = false;
20794 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20795 int64_t ret_val = ChainParameters_clone_ptr(&arg_conv);
20799 uint32_t __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint32_t orig) {
20800 LDKChainParameters orig_conv;
20801 orig_conv.inner = (void*)(orig & (~1));
20802 orig_conv.is_owned = false;
20803 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20804 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
20805 uint64_t ret_ref = 0;
20806 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20807 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20809 ret_ref = (uint64_t)ret_var.inner;
20810 if (ret_var.is_owned) {
20816 void __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
20817 LDKCounterpartyForwardingInfo this_obj_conv;
20818 this_obj_conv.inner = (void*)(this_obj & (~1));
20819 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20821 CounterpartyForwardingInfo_free(this_obj_conv);
20824 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
20825 LDKCounterpartyForwardingInfo this_ptr_conv;
20826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20827 this_ptr_conv.is_owned = false;
20828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20829 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
20833 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
20834 LDKCounterpartyForwardingInfo this_ptr_conv;
20835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20836 this_ptr_conv.is_owned = false;
20837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20838 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
20841 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
20842 LDKCounterpartyForwardingInfo this_ptr_conv;
20843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20844 this_ptr_conv.is_owned = false;
20845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20846 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
20850 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
20851 LDKCounterpartyForwardingInfo this_ptr_conv;
20852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20853 this_ptr_conv.is_owned = false;
20854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20855 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
20858 int16_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
20859 LDKCounterpartyForwardingInfo this_ptr_conv;
20860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20861 this_ptr_conv.is_owned = false;
20862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20863 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
20867 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
20868 LDKCounterpartyForwardingInfo this_ptr_conv;
20869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20870 this_ptr_conv.is_owned = false;
20871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20872 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
20875 uint32_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) {
20876 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
20877 uint64_t ret_ref = 0;
20878 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20879 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20881 ret_ref = (uint64_t)ret_var.inner;
20882 if (ret_var.is_owned) {
20888 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
20889 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
20890 uint64_t ret_ref = 0;
20891 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20892 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20893 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20894 ret_ref = (uint64_t)ret_var.inner;
20895 if (ret_var.is_owned) {
20900 int64_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
20901 LDKCounterpartyForwardingInfo arg_conv;
20902 arg_conv.inner = (void*)(arg & (~1));
20903 arg_conv.is_owned = false;
20904 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20905 int64_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
20909 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
20910 LDKCounterpartyForwardingInfo orig_conv;
20911 orig_conv.inner = (void*)(orig & (~1));
20912 orig_conv.is_owned = false;
20913 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20914 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
20915 uint64_t ret_ref = 0;
20916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20919 ret_ref = (uint64_t)ret_var.inner;
20920 if (ret_var.is_owned) {
20926 void __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
20927 LDKChannelCounterparty this_obj_conv;
20928 this_obj_conv.inner = (void*)(this_obj & (~1));
20929 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20931 ChannelCounterparty_free(this_obj_conv);
20934 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
20935 LDKChannelCounterparty this_ptr_conv;
20936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20937 this_ptr_conv.is_owned = false;
20938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20939 int8_tArray ret_arr = init_int8_tArray(33);
20940 memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
20944 void __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
20945 LDKChannelCounterparty this_ptr_conv;
20946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20947 this_ptr_conv.is_owned = false;
20948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20949 LDKPublicKey val_ref;
20950 CHECK(val->arr_len == 33);
20951 memcpy(val_ref.compressed_form, val->elems, 33);
20952 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
20955 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
20956 LDKChannelCounterparty this_ptr_conv;
20957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20958 this_ptr_conv.is_owned = false;
20959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20960 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
20961 uint64_t ret_ref = 0;
20962 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20963 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20965 ret_ref = (uint64_t)ret_var.inner;
20966 if (ret_var.is_owned) {
20972 void __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
20973 LDKChannelCounterparty this_ptr_conv;
20974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20975 this_ptr_conv.is_owned = false;
20976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20977 LDKInitFeatures val_conv;
20978 val_conv.inner = (void*)(val & (~1));
20979 val_conv.is_owned = (val & 1) || (val == 0);
20980 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20981 val_conv = InitFeatures_clone(&val_conv);
20982 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
20985 int64_t __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
20986 LDKChannelCounterparty this_ptr_conv;
20987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20988 this_ptr_conv.is_owned = false;
20989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20990 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
20994 void __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
20995 LDKChannelCounterparty this_ptr_conv;
20996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20997 this_ptr_conv.is_owned = false;
20998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20999 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
21002 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
21003 LDKChannelCounterparty this_ptr_conv;
21004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21005 this_ptr_conv.is_owned = false;
21006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21007 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
21008 uint64_t ret_ref = 0;
21009 if ((uint64_t)ret_var.inner > 4096) {
21010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21013 ret_ref = (uint64_t)ret_var.inner;
21014 if (ret_var.is_owned) {
21021 void __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
21022 LDKChannelCounterparty this_ptr_conv;
21023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21024 this_ptr_conv.is_owned = false;
21025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21026 LDKCounterpartyForwardingInfo val_conv;
21027 val_conv.inner = (void*)(val & (~1));
21028 val_conv.is_owned = (val & 1) || (val == 0);
21029 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21030 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
21031 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
21034 uint32_t __attribute__((export_name("TS_ChannelCounterparty_new"))) TS_ChannelCounterparty_new(int8_tArray node_id_arg, uint32_t features_arg, int64_t unspendable_punishment_reserve_arg, uint32_t forwarding_info_arg) {
21035 LDKPublicKey node_id_arg_ref;
21036 CHECK(node_id_arg->arr_len == 33);
21037 memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33);
21038 LDKInitFeatures features_arg_conv;
21039 features_arg_conv.inner = (void*)(features_arg & (~1));
21040 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
21041 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
21042 features_arg_conv = InitFeatures_clone(&features_arg_conv);
21043 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
21044 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
21045 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
21046 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
21047 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
21048 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
21049 uint64_t ret_ref = 0;
21050 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21051 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21053 ret_ref = (uint64_t)ret_var.inner;
21054 if (ret_var.is_owned) {
21060 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
21061 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
21062 uint64_t ret_ref = 0;
21063 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21064 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21065 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21066 ret_ref = (uint64_t)ret_var.inner;
21067 if (ret_var.is_owned) {
21072 int64_t __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
21073 LDKChannelCounterparty arg_conv;
21074 arg_conv.inner = (void*)(arg & (~1));
21075 arg_conv.is_owned = false;
21076 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21077 int64_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
21081 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint32_t orig) {
21082 LDKChannelCounterparty orig_conv;
21083 orig_conv.inner = (void*)(orig & (~1));
21084 orig_conv.is_owned = false;
21085 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21086 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
21087 uint64_t ret_ref = 0;
21088 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21089 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21091 ret_ref = (uint64_t)ret_var.inner;
21092 if (ret_var.is_owned) {
21098 void __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint32_t this_obj) {
21099 LDKChannelDetails this_obj_conv;
21100 this_obj_conv.inner = (void*)(this_obj & (~1));
21101 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21103 ChannelDetails_free(this_obj_conv);
21106 int8_tArray __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
21107 LDKChannelDetails this_ptr_conv;
21108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21109 this_ptr_conv.is_owned = false;
21110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21111 int8_tArray ret_arr = init_int8_tArray(32);
21112 memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
21116 void __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
21117 LDKChannelDetails this_ptr_conv;
21118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21119 this_ptr_conv.is_owned = false;
21120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21121 LDKThirtyTwoBytes val_ref;
21122 CHECK(val->arr_len == 32);
21123 memcpy(val_ref.data, val->elems, 32);
21124 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
21127 uint32_t __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
21128 LDKChannelDetails this_ptr_conv;
21129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21130 this_ptr_conv.is_owned = false;
21131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21132 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
21133 uint64_t ret_ref = 0;
21134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21137 ret_ref = (uint64_t)ret_var.inner;
21138 if (ret_var.is_owned) {
21144 void __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
21145 LDKChannelDetails this_ptr_conv;
21146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21147 this_ptr_conv.is_owned = false;
21148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21149 LDKChannelCounterparty val_conv;
21150 val_conv.inner = (void*)(val & (~1));
21151 val_conv.is_owned = (val & 1) || (val == 0);
21152 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21153 val_conv = ChannelCounterparty_clone(&val_conv);
21154 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
21157 uint32_t __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
21158 LDKChannelDetails this_ptr_conv;
21159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21160 this_ptr_conv.is_owned = false;
21161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21162 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
21163 uint64_t ret_ref = 0;
21164 if ((uint64_t)ret_var.inner > 4096) {
21165 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21166 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21168 ret_ref = (uint64_t)ret_var.inner;
21169 if (ret_var.is_owned) {
21176 void __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
21177 LDKChannelDetails this_ptr_conv;
21178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21179 this_ptr_conv.is_owned = false;
21180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21181 LDKOutPoint val_conv;
21182 val_conv.inner = (void*)(val & (~1));
21183 val_conv.is_owned = (val & 1) || (val == 0);
21184 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21185 val_conv = OutPoint_clone(&val_conv);
21186 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
21189 uint32_t __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
21190 LDKChannelDetails this_ptr_conv;
21191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21192 this_ptr_conv.is_owned = false;
21193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21194 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21195 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
21196 uint64_t ret_ref = (uint64_t)ret_copy;
21200 void __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
21201 LDKChannelDetails this_ptr_conv;
21202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21203 this_ptr_conv.is_owned = false;
21204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21205 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21206 CHECK_ACCESS(val_ptr);
21207 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
21208 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
21209 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
21212 int64_t __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
21213 LDKChannelDetails this_ptr_conv;
21214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21215 this_ptr_conv.is_owned = false;
21216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21217 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
21221 void __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
21222 LDKChannelDetails this_ptr_conv;
21223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21224 this_ptr_conv.is_owned = false;
21225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21226 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
21229 uint32_t __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
21230 LDKChannelDetails this_ptr_conv;
21231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21232 this_ptr_conv.is_owned = false;
21233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21234 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21235 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
21236 uint64_t ret_ref = (uint64_t)ret_copy;
21240 void __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
21241 LDKChannelDetails this_ptr_conv;
21242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21243 this_ptr_conv.is_owned = false;
21244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21245 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21246 CHECK_ACCESS(val_ptr);
21247 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
21248 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
21249 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
21252 int64_t __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
21253 LDKChannelDetails this_ptr_conv;
21254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21255 this_ptr_conv.is_owned = false;
21256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21257 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
21261 void __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
21262 LDKChannelDetails this_ptr_conv;
21263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21264 this_ptr_conv.is_owned = false;
21265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21266 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
21269 int64_t __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) {
21270 LDKChannelDetails this_ptr_conv;
21271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21272 this_ptr_conv.is_owned = false;
21273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21274 int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv);
21278 void __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_t val) {
21279 LDKChannelDetails this_ptr_conv;
21280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21281 this_ptr_conv.is_owned = false;
21282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21283 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
21286 int64_t __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
21287 LDKChannelDetails this_ptr_conv;
21288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21289 this_ptr_conv.is_owned = false;
21290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21291 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
21295 void __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
21296 LDKChannelDetails this_ptr_conv;
21297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21298 this_ptr_conv.is_owned = false;
21299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21300 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
21303 int64_t __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
21304 LDKChannelDetails this_ptr_conv;
21305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21306 this_ptr_conv.is_owned = false;
21307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21308 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
21312 void __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
21313 LDKChannelDetails this_ptr_conv;
21314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21315 this_ptr_conv.is_owned = false;
21316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21317 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
21320 uint32_t __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
21321 LDKChannelDetails this_ptr_conv;
21322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21323 this_ptr_conv.is_owned = false;
21324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21325 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21326 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
21327 uint64_t ret_ref = (uint64_t)ret_copy;
21331 void __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
21332 LDKChannelDetails this_ptr_conv;
21333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21334 this_ptr_conv.is_owned = false;
21335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21336 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21337 CHECK_ACCESS(val_ptr);
21338 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
21339 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
21340 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
21343 uint32_t __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
21344 LDKChannelDetails this_ptr_conv;
21345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21346 this_ptr_conv.is_owned = false;
21347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21348 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
21349 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
21350 uint64_t ret_ref = (uint64_t)ret_copy;
21354 void __attribute__((export_name("TS_ChannelDetails_set_force_close_spend_delay"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
21355 LDKChannelDetails this_ptr_conv;
21356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21357 this_ptr_conv.is_owned = false;
21358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21359 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21360 CHECK_ACCESS(val_ptr);
21361 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
21362 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
21363 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
21366 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
21367 LDKChannelDetails this_ptr_conv;
21368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21369 this_ptr_conv.is_owned = false;
21370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21371 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
21375 void __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
21376 LDKChannelDetails this_ptr_conv;
21377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21378 this_ptr_conv.is_owned = false;
21379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21380 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
21383 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_funding_locked"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
21384 LDKChannelDetails this_ptr_conv;
21385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21386 this_ptr_conv.is_owned = false;
21387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21388 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
21392 void __attribute__((export_name("TS_ChannelDetails_set_is_funding_locked"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
21393 LDKChannelDetails this_ptr_conv;
21394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21395 this_ptr_conv.is_owned = false;
21396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21397 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
21400 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
21401 LDKChannelDetails this_ptr_conv;
21402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21403 this_ptr_conv.is_owned = false;
21404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21405 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
21409 void __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
21410 LDKChannelDetails this_ptr_conv;
21411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21412 this_ptr_conv.is_owned = false;
21413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21414 ChannelDetails_set_is_usable(&this_ptr_conv, val);
21417 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
21418 LDKChannelDetails this_ptr_conv;
21419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21420 this_ptr_conv.is_owned = false;
21421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21422 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
21426 void __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
21427 LDKChannelDetails this_ptr_conv;
21428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21429 this_ptr_conv.is_owned = false;
21430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21431 ChannelDetails_set_is_public(&this_ptr_conv, val);
21434 uint32_t __attribute__((export_name("TS_ChannelDetails_new"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
21435 LDKThirtyTwoBytes channel_id_arg_ref;
21436 CHECK(channel_id_arg->arr_len == 32);
21437 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
21438 LDKChannelCounterparty counterparty_arg_conv;
21439 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
21440 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
21441 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
21442 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
21443 LDKOutPoint funding_txo_arg_conv;
21444 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
21445 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
21446 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
21447 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
21448 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
21449 CHECK_ACCESS(short_channel_id_arg_ptr);
21450 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
21451 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
21452 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
21453 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
21454 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
21455 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
21456 CHECK_ACCESS(confirmations_required_arg_ptr);
21457 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
21458 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
21459 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
21460 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
21461 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
21462 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
21463 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
21464 uint64_t ret_ref = 0;
21465 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21466 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21467 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21468 ret_ref = (uint64_t)ret_var.inner;
21469 if (ret_var.is_owned) {
21475 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
21476 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
21477 uint64_t ret_ref = 0;
21478 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21479 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21480 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21481 ret_ref = (uint64_t)ret_var.inner;
21482 if (ret_var.is_owned) {
21487 int64_t __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
21488 LDKChannelDetails arg_conv;
21489 arg_conv.inner = (void*)(arg & (~1));
21490 arg_conv.is_owned = false;
21491 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21492 int64_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
21496 uint32_t __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint32_t orig) {
21497 LDKChannelDetails orig_conv;
21498 orig_conv.inner = (void*)(orig & (~1));
21499 orig_conv.is_owned = false;
21500 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21501 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
21502 uint64_t ret_ref = 0;
21503 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21504 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21506 ret_ref = (uint64_t)ret_var.inner;
21507 if (ret_var.is_owned) {
21513 void __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
21514 if ((this_ptr & 1) != 0) return;
21515 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21516 CHECK_ACCESS(this_ptr_ptr);
21517 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
21518 FREE((void*)this_ptr);
21519 PaymentSendFailure_free(this_ptr_conv);
21522 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
21523 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21524 *ret_copy = PaymentSendFailure_clone(arg);
21525 uint64_t ret_ref = (uint64_t)ret_copy;
21528 int64_t __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
21529 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
21530 int64_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
21534 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint32_t orig) {
21535 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
21536 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21537 *ret_copy = PaymentSendFailure_clone(orig_conv);
21538 uint64_t ret_ref = (uint64_t)ret_copy;
21542 uint32_t __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
21543 void* a_ptr = (void*)(((uint64_t)a) & ~1);
21544 CHECK_ACCESS(a_ptr);
21545 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
21546 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
21547 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21548 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
21549 uint64_t ret_ref = (uint64_t)ret_copy;
21553 uint32_t __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
21554 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
21555 a_constr.datalen = a->arr_len;
21556 if (a_constr.datalen > 0)
21557 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21559 a_constr.data = NULL;
21560 uint32_t* a_vals = a->elems;
21561 for (size_t w = 0; w < a_constr.datalen; w++) {
21562 uint32_t a_conv_22 = a_vals[w];
21563 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
21564 CHECK_ACCESS(a_conv_22_ptr);
21565 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
21566 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
21567 a_constr.data[w] = a_conv_22_conv;
21569 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21570 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
21571 uint64_t ret_ref = (uint64_t)ret_copy;
21575 uint32_t __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
21576 LDKCVec_APIErrorZ a_constr;
21577 a_constr.datalen = a->arr_len;
21578 if (a_constr.datalen > 0)
21579 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
21581 a_constr.data = NULL;
21582 uint32_t* a_vals = a->elems;
21583 for (size_t k = 0; k < a_constr.datalen; k++) {
21584 uint32_t a_conv_10 = a_vals[k];
21585 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
21586 CHECK_ACCESS(a_conv_10_ptr);
21587 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
21588 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
21589 a_constr.data[k] = a_conv_10_conv;
21591 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21592 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
21593 uint64_t ret_ref = (uint64_t)ret_copy;
21597 uint32_t __attribute__((export_name("TS_PaymentSendFailure_partial_failure"))) TS_PaymentSendFailure_partial_failure(uint32_tArray results, uint32_t failed_paths_retry, int8_tArray payment_id) {
21598 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
21599 results_constr.datalen = results->arr_len;
21600 if (results_constr.datalen > 0)
21601 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21603 results_constr.data = NULL;
21604 uint32_t* results_vals = results->elems;
21605 for (size_t w = 0; w < results_constr.datalen; w++) {
21606 uint32_t results_conv_22 = results_vals[w];
21607 void* results_conv_22_ptr = (void*)(((uint64_t)results_conv_22) & ~1);
21608 CHECK_ACCESS(results_conv_22_ptr);
21609 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
21610 results_constr.data[w] = results_conv_22_conv;
21612 LDKRouteParameters failed_paths_retry_conv;
21613 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
21614 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
21615 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
21616 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
21617 LDKThirtyTwoBytes payment_id_ref;
21618 CHECK(payment_id->arr_len == 32);
21619 memcpy(payment_id_ref.data, payment_id->elems, 32);
21620 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21621 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
21622 uint64_t ret_ref = (uint64_t)ret_copy;
21626 uint32_t __attribute__((export_name("TS_ChannelManager_new"))) TS_ChannelManager_new(uint32_t fee_est, uint32_t chain_monitor, uint32_t tx_broadcaster, uint32_t logger, uint32_t keys_manager, uint32_t config, uint32_t params) {
21627 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
21628 CHECK_ACCESS(fee_est_ptr);
21629 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
21630 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21631 CHECK_ACCESS(chain_monitor_ptr);
21632 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21633 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21634 CHECK_ACCESS(tx_broadcaster_ptr);
21635 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21636 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21637 CHECK_ACCESS(logger_ptr);
21638 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21639 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21640 CHECK_ACCESS(keys_manager_ptr);
21641 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21642 LDKUserConfig config_conv;
21643 config_conv.inner = (void*)(config & (~1));
21644 config_conv.is_owned = (config & 1) || (config == 0);
21645 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
21646 config_conv = UserConfig_clone(&config_conv);
21647 LDKChainParameters params_conv;
21648 params_conv.inner = (void*)(params & (~1));
21649 params_conv.is_owned = (params & 1) || (params == 0);
21650 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
21651 params_conv = ChainParameters_clone(¶ms_conv);
21652 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
21653 uint64_t ret_ref = 0;
21654 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21655 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21656 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21657 ret_ref = (uint64_t)ret_var.inner;
21658 if (ret_var.is_owned) {
21664 uint32_t __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
21665 LDKChannelManager this_arg_conv;
21666 this_arg_conv.inner = (void*)(this_arg & (~1));
21667 this_arg_conv.is_owned = false;
21668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21669 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
21670 uint64_t ret_ref = 0;
21671 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21672 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21674 ret_ref = (uint64_t)ret_var.inner;
21675 if (ret_var.is_owned) {
21681 uint32_t __attribute__((export_name("TS_ChannelManager_create_channel"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, uint32_t override_config) {
21682 LDKChannelManager this_arg_conv;
21683 this_arg_conv.inner = (void*)(this_arg & (~1));
21684 this_arg_conv.is_owned = false;
21685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21686 LDKPublicKey their_network_key_ref;
21687 CHECK(their_network_key->arr_len == 33);
21688 memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33);
21689 LDKUserConfig override_config_conv;
21690 override_config_conv.inner = (void*)(override_config & (~1));
21691 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
21692 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
21693 override_config_conv = UserConfig_clone(&override_config_conv);
21694 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
21695 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
21696 return (uint64_t)ret_conv;
21699 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
21700 LDKChannelManager this_arg_conv;
21701 this_arg_conv.inner = (void*)(this_arg & (~1));
21702 this_arg_conv.is_owned = false;
21703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21704 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
21705 uint32_tArray ret_arr = NULL;
21706 ret_arr = init_uint32_tArray(ret_var.datalen);
21707 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
21708 for (size_t q = 0; q < ret_var.datalen; q++) {
21709 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21710 uint64_t ret_conv_16_ref = 0;
21711 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21712 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21713 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21714 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21715 if (ret_conv_16_var.is_owned) {
21716 ret_conv_16_ref |= 1;
21718 ret_arr_ptr[q] = ret_conv_16_ref;
21721 FREE(ret_var.data);
21725 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
21726 LDKChannelManager this_arg_conv;
21727 this_arg_conv.inner = (void*)(this_arg & (~1));
21728 this_arg_conv.is_owned = false;
21729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21730 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
21731 uint32_tArray ret_arr = NULL;
21732 ret_arr = init_uint32_tArray(ret_var.datalen);
21733 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
21734 for (size_t q = 0; q < ret_var.datalen; q++) {
21735 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21736 uint64_t ret_conv_16_ref = 0;
21737 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21738 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21740 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21741 if (ret_conv_16_var.is_owned) {
21742 ret_conv_16_ref |= 1;
21744 ret_arr_ptr[q] = ret_conv_16_ref;
21747 FREE(ret_var.data);
21751 uint32_t __attribute__((export_name("TS_ChannelManager_close_channel"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21752 LDKChannelManager this_arg_conv;
21753 this_arg_conv.inner = (void*)(this_arg & (~1));
21754 this_arg_conv.is_owned = false;
21755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21756 unsigned char channel_id_arr[32];
21757 CHECK(channel_id->arr_len == 32);
21758 memcpy(channel_id_arr, channel_id->elems, 32);
21759 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21760 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21761 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
21762 return (uint64_t)ret_conv;
21765 uint32_t __attribute__((export_name("TS_ChannelManager_close_channel_with_target_feerate"))) TS_ChannelManager_close_channel_with_target_feerate(uint32_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
21766 LDKChannelManager this_arg_conv;
21767 this_arg_conv.inner = (void*)(this_arg & (~1));
21768 this_arg_conv.is_owned = false;
21769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21770 unsigned char channel_id_arr[32];
21771 CHECK(channel_id->arr_len == 32);
21772 memcpy(channel_id_arr, channel_id->elems, 32);
21773 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21774 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21775 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
21776 return (uint64_t)ret_conv;
21779 uint32_t __attribute__((export_name("TS_ChannelManager_force_close_channel"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21780 LDKChannelManager this_arg_conv;
21781 this_arg_conv.inner = (void*)(this_arg & (~1));
21782 this_arg_conv.is_owned = false;
21783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21784 unsigned char channel_id_arr[32];
21785 CHECK(channel_id->arr_len == 32);
21786 memcpy(channel_id_arr, channel_id->elems, 32);
21787 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21788 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21789 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
21790 return (uint64_t)ret_conv;
21793 void __attribute__((export_name("TS_ChannelManager_force_close_all_channels"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
21794 LDKChannelManager this_arg_conv;
21795 this_arg_conv.inner = (void*)(this_arg & (~1));
21796 this_arg_conv.is_owned = false;
21797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21798 ChannelManager_force_close_all_channels(&this_arg_conv);
21801 uint32_t __attribute__((export_name("TS_ChannelManager_send_payment"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
21802 LDKChannelManager this_arg_conv;
21803 this_arg_conv.inner = (void*)(this_arg & (~1));
21804 this_arg_conv.is_owned = false;
21805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21806 LDKRoute route_conv;
21807 route_conv.inner = (void*)(route & (~1));
21808 route_conv.is_owned = false;
21809 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21810 LDKThirtyTwoBytes payment_hash_ref;
21811 CHECK(payment_hash->arr_len == 32);
21812 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
21813 LDKThirtyTwoBytes payment_secret_ref;
21814 CHECK(payment_secret->arr_len == 32);
21815 memcpy(payment_secret_ref.data, payment_secret->elems, 32);
21816 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
21817 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
21818 return (uint64_t)ret_conv;
21821 uint32_t __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
21822 LDKChannelManager this_arg_conv;
21823 this_arg_conv.inner = (void*)(this_arg & (~1));
21824 this_arg_conv.is_owned = false;
21825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21826 LDKRoute route_conv;
21827 route_conv.inner = (void*)(route & (~1));
21828 route_conv.is_owned = false;
21829 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21830 LDKThirtyTwoBytes payment_id_ref;
21831 CHECK(payment_id->arr_len == 32);
21832 memcpy(payment_id_ref.data, payment_id->elems, 32);
21833 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21834 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
21835 return (uint64_t)ret_conv;
21838 void __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
21839 LDKChannelManager this_arg_conv;
21840 this_arg_conv.inner = (void*)(this_arg & (~1));
21841 this_arg_conv.is_owned = false;
21842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21843 LDKThirtyTwoBytes payment_id_ref;
21844 CHECK(payment_id->arr_len == 32);
21845 memcpy(payment_id_ref.data, payment_id->elems, 32);
21846 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
21849 uint32_t __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
21850 LDKChannelManager this_arg_conv;
21851 this_arg_conv.inner = (void*)(this_arg & (~1));
21852 this_arg_conv.is_owned = false;
21853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21854 LDKRoute route_conv;
21855 route_conv.inner = (void*)(route & (~1));
21856 route_conv.is_owned = false;
21857 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21858 LDKThirtyTwoBytes payment_preimage_ref;
21859 CHECK(payment_preimage->arr_len == 32);
21860 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
21861 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
21862 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
21863 return (uint64_t)ret_conv;
21866 uint32_t __attribute__((export_name("TS_ChannelManager_funding_transaction_generated"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
21867 LDKChannelManager this_arg_conv;
21868 this_arg_conv.inner = (void*)(this_arg & (~1));
21869 this_arg_conv.is_owned = false;
21870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21871 unsigned char temporary_channel_id_arr[32];
21872 CHECK(temporary_channel_id->arr_len == 32);
21873 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32);
21874 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
21875 LDKTransaction funding_transaction_ref;
21876 funding_transaction_ref.datalen = funding_transaction->arr_len;
21877 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
21878 memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen);
21879 funding_transaction_ref.data_is_owned = true;
21880 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21881 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
21882 return (uint64_t)ret_conv;
21885 void __attribute__((export_name("TS_ChannelManager_broadcast_node_announcement"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
21886 LDKChannelManager this_arg_conv;
21887 this_arg_conv.inner = (void*)(this_arg & (~1));
21888 this_arg_conv.is_owned = false;
21889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21890 LDKThreeBytes rgb_ref;
21891 CHECK(rgb->arr_len == 3);
21892 memcpy(rgb_ref.data, rgb->elems, 3);
21893 LDKThirtyTwoBytes alias_ref;
21894 CHECK(alias->arr_len == 32);
21895 memcpy(alias_ref.data, alias->elems, 32);
21896 LDKCVec_NetAddressZ addresses_constr;
21897 addresses_constr.datalen = addresses->arr_len;
21898 if (addresses_constr.datalen > 0)
21899 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
21901 addresses_constr.data = NULL;
21902 uint32_t* addresses_vals = addresses->elems;
21903 for (size_t m = 0; m < addresses_constr.datalen; m++) {
21904 uint32_t addresses_conv_12 = addresses_vals[m];
21905 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
21906 CHECK_ACCESS(addresses_conv_12_ptr);
21907 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
21908 addresses_constr.data[m] = addresses_conv_12_conv;
21910 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
21913 void __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
21914 LDKChannelManager this_arg_conv;
21915 this_arg_conv.inner = (void*)(this_arg & (~1));
21916 this_arg_conv.is_owned = false;
21917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21918 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
21921 void __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
21922 LDKChannelManager this_arg_conv;
21923 this_arg_conv.inner = (void*)(this_arg & (~1));
21924 this_arg_conv.is_owned = false;
21925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21926 ChannelManager_timer_tick_occurred(&this_arg_conv);
21929 jboolean __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
21930 LDKChannelManager this_arg_conv;
21931 this_arg_conv.inner = (void*)(this_arg & (~1));
21932 this_arg_conv.is_owned = false;
21933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21934 unsigned char payment_hash_arr[32];
21935 CHECK(payment_hash->arr_len == 32);
21936 memcpy(payment_hash_arr, payment_hash->elems, 32);
21937 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
21938 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
21942 jboolean __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
21943 LDKChannelManager this_arg_conv;
21944 this_arg_conv.inner = (void*)(this_arg & (~1));
21945 this_arg_conv.is_owned = false;
21946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21947 LDKThirtyTwoBytes payment_preimage_ref;
21948 CHECK(payment_preimage->arr_len == 32);
21949 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
21950 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
21954 int8_tArray __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
21955 LDKChannelManager this_arg_conv;
21956 this_arg_conv.inner = (void*)(this_arg & (~1));
21957 this_arg_conv.is_owned = false;
21958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21959 int8_tArray ret_arr = init_int8_tArray(33);
21960 memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
21964 uint32_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment"))) TS_ChannelManager_create_inbound_payment(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) {
21965 LDKChannelManager this_arg_conv;
21966 this_arg_conv.inner = (void*)(this_arg & (~1));
21967 this_arg_conv.is_owned = false;
21968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21969 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21970 CHECK_ACCESS(min_value_msat_ptr);
21971 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21972 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21973 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
21974 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
21975 return (uint64_t)ret_conv;
21978 uint32_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment_legacy"))) TS_ChannelManager_create_inbound_payment_legacy(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) {
21979 LDKChannelManager this_arg_conv;
21980 this_arg_conv.inner = (void*)(this_arg & (~1));
21981 this_arg_conv.is_owned = false;
21982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21983 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21984 CHECK_ACCESS(min_value_msat_ptr);
21985 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21986 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21987 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
21988 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
21989 return (uint64_t)ret_conv;
21992 uint32_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment_for_hash"))) TS_ChannelManager_create_inbound_payment_for_hash(uint32_t this_arg, int8_tArray payment_hash, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) {
21993 LDKChannelManager this_arg_conv;
21994 this_arg_conv.inner = (void*)(this_arg & (~1));
21995 this_arg_conv.is_owned = false;
21996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21997 LDKThirtyTwoBytes payment_hash_ref;
21998 CHECK(payment_hash->arr_len == 32);
21999 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
22000 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
22001 CHECK_ACCESS(min_value_msat_ptr);
22002 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
22003 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
22004 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
22005 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
22006 return (uint64_t)ret_conv;
22009 uint32_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment_for_hash_legacy"))) TS_ChannelManager_create_inbound_payment_for_hash_legacy(uint32_t this_arg, int8_tArray payment_hash, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) {
22010 LDKChannelManager this_arg_conv;
22011 this_arg_conv.inner = (void*)(this_arg & (~1));
22012 this_arg_conv.is_owned = false;
22013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22014 LDKThirtyTwoBytes payment_hash_ref;
22015 CHECK(payment_hash->arr_len == 32);
22016 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
22017 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
22018 CHECK_ACCESS(min_value_msat_ptr);
22019 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
22020 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
22021 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
22022 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
22023 return (uint64_t)ret_conv;
22026 uint32_t __attribute__((export_name("TS_ChannelManager_get_payment_preimage"))) TS_ChannelManager_get_payment_preimage(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
22027 LDKChannelManager this_arg_conv;
22028 this_arg_conv.inner = (void*)(this_arg & (~1));
22029 this_arg_conv.is_owned = false;
22030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22031 LDKThirtyTwoBytes payment_hash_ref;
22032 CHECK(payment_hash->arr_len == 32);
22033 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
22034 LDKThirtyTwoBytes payment_secret_ref;
22035 CHECK(payment_secret->arr_len == 32);
22036 memcpy(payment_secret_ref.data, payment_secret->elems, 32);
22037 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
22038 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
22039 return (uint64_t)ret_conv;
22042 uint32_t __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
22043 LDKChannelManager this_arg_conv;
22044 this_arg_conv.inner = (void*)(this_arg & (~1));
22045 this_arg_conv.is_owned = false;
22046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22047 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
22048 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
22049 return (uint64_t)ret_ret;
22052 uint32_t __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
22053 LDKChannelManager this_arg_conv;
22054 this_arg_conv.inner = (void*)(this_arg & (~1));
22055 this_arg_conv.is_owned = false;
22056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22057 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
22058 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
22059 return (uint64_t)ret_ret;
22062 uint32_t __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
22063 LDKChannelManager this_arg_conv;
22064 this_arg_conv.inner = (void*)(this_arg & (~1));
22065 this_arg_conv.is_owned = false;
22066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22067 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
22068 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
22069 return (uint64_t)ret_ret;
22072 uint32_t __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
22073 LDKChannelManager this_arg_conv;
22074 this_arg_conv.inner = (void*)(this_arg & (~1));
22075 this_arg_conv.is_owned = false;
22076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22077 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
22078 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
22079 return (uint64_t)ret_ret;
22082 void __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
22083 LDKChannelManager this_arg_conv;
22084 this_arg_conv.inner = (void*)(this_arg & (~1));
22085 this_arg_conv.is_owned = false;
22086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22087 ChannelManager_await_persistable_update(&this_arg_conv);
22090 uint32_t __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
22091 LDKChannelManager this_arg_conv;
22092 this_arg_conv.inner = (void*)(this_arg & (~1));
22093 this_arg_conv.is_owned = false;
22094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22095 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
22096 uint64_t ret_ref = 0;
22097 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22098 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22099 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22100 ret_ref = (uint64_t)ret_var.inner;
22101 if (ret_var.is_owned) {
22107 uint32_t __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
22108 LDKChannelManager this_arg_conv;
22109 this_arg_conv.inner = (void*)(this_arg & (~1));
22110 this_arg_conv.is_owned = false;
22111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22112 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
22113 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
22114 return (uint64_t)ret_ret;
22117 int8_tArray __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint32_t obj) {
22118 LDKChannelManager obj_conv;
22119 obj_conv.inner = (void*)(obj & (~1));
22120 obj_conv.is_owned = false;
22121 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22122 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
22123 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
22124 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22125 CVec_u8Z_free(ret_var);
22129 void __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
22130 LDKChannelManagerReadArgs this_obj_conv;
22131 this_obj_conv.inner = (void*)(this_obj & (~1));
22132 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22134 ChannelManagerReadArgs_free(this_obj_conv);
22137 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
22138 LDKChannelManagerReadArgs this_ptr_conv;
22139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22140 this_ptr_conv.is_owned = false;
22141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22142 // WARNING: This object doesn't live past this scope, needs clone!
22143 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
22147 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
22148 LDKChannelManagerReadArgs this_ptr_conv;
22149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22150 this_ptr_conv.is_owned = false;
22151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22152 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22153 CHECK_ACCESS(val_ptr);
22154 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
22155 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
22158 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
22159 LDKChannelManagerReadArgs this_ptr_conv;
22160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22161 this_ptr_conv.is_owned = false;
22162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22163 // WARNING: This object doesn't live past this scope, needs clone!
22164 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
22168 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
22169 LDKChannelManagerReadArgs this_ptr_conv;
22170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22171 this_ptr_conv.is_owned = false;
22172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22173 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22174 CHECK_ACCESS(val_ptr);
22175 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
22176 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
22179 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
22180 LDKChannelManagerReadArgs this_ptr_conv;
22181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22182 this_ptr_conv.is_owned = false;
22183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22184 // WARNING: This object doesn't live past this scope, needs clone!
22185 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
22189 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
22190 LDKChannelManagerReadArgs this_ptr_conv;
22191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22192 this_ptr_conv.is_owned = false;
22193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22194 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22195 CHECK_ACCESS(val_ptr);
22196 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
22197 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
22200 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
22201 LDKChannelManagerReadArgs this_ptr_conv;
22202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22203 this_ptr_conv.is_owned = false;
22204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22205 // WARNING: This object doesn't live past this scope, needs clone!
22206 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
22210 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
22211 LDKChannelManagerReadArgs this_ptr_conv;
22212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22213 this_ptr_conv.is_owned = false;
22214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22215 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22216 CHECK_ACCESS(val_ptr);
22217 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
22218 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
22221 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
22222 LDKChannelManagerReadArgs this_ptr_conv;
22223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22224 this_ptr_conv.is_owned = false;
22225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22226 // WARNING: This object doesn't live past this scope, needs clone!
22227 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
22231 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
22232 LDKChannelManagerReadArgs this_ptr_conv;
22233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22234 this_ptr_conv.is_owned = false;
22235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22236 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22237 CHECK_ACCESS(val_ptr);
22238 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
22239 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
22242 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
22243 LDKChannelManagerReadArgs this_ptr_conv;
22244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22245 this_ptr_conv.is_owned = false;
22246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22247 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
22248 uint64_t ret_ref = 0;
22249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22252 ret_ref = (uint64_t)ret_var.inner;
22253 if (ret_var.is_owned) {
22259 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
22260 LDKChannelManagerReadArgs this_ptr_conv;
22261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22262 this_ptr_conv.is_owned = false;
22263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22264 LDKUserConfig val_conv;
22265 val_conv.inner = (void*)(val & (~1));
22266 val_conv.is_owned = (val & 1) || (val == 0);
22267 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22268 val_conv = UserConfig_clone(&val_conv);
22269 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
22272 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_new"))) TS_ChannelManagerReadArgs_new(uint32_t keys_manager, uint32_t fee_estimator, uint32_t chain_monitor, uint32_t tx_broadcaster, uint32_t logger, uint32_t default_config, uint32_tArray channel_monitors) {
22273 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
22274 CHECK_ACCESS(keys_manager_ptr);
22275 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
22276 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
22277 CHECK_ACCESS(fee_estimator_ptr);
22278 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22279 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
22280 CHECK_ACCESS(chain_monitor_ptr);
22281 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
22282 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
22283 CHECK_ACCESS(tx_broadcaster_ptr);
22284 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
22285 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
22286 CHECK_ACCESS(logger_ptr);
22287 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22288 LDKUserConfig default_config_conv;
22289 default_config_conv.inner = (void*)(default_config & (~1));
22290 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
22291 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
22292 default_config_conv = UserConfig_clone(&default_config_conv);
22293 LDKCVec_ChannelMonitorZ channel_monitors_constr;
22294 channel_monitors_constr.datalen = channel_monitors->arr_len;
22295 if (channel_monitors_constr.datalen > 0)
22296 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
22298 channel_monitors_constr.data = NULL;
22299 uint32_t* channel_monitors_vals = channel_monitors->elems;
22300 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
22301 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
22302 LDKChannelMonitor channel_monitors_conv_16_conv;
22303 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
22304 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
22305 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
22306 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
22308 LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
22309 uint64_t ret_ref = 0;
22310 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22311 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22312 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22313 ret_ref = (uint64_t)ret_var.inner;
22314 if (ret_var.is_owned) {
22320 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
22321 LDKu8slice ser_ref;
22322 ser_ref.datalen = ser->arr_len;
22323 ser_ref.data = ser->elems;
22324 LDKChannelManagerReadArgs arg_conv;
22325 arg_conv.inner = (void*)(arg & (~1));
22326 arg_conv.is_owned = (arg & 1) || (arg == 0);
22327 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22328 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
22329 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
22330 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
22331 return (uint64_t)ret_conv;
22334 void __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint32_t this_obj) {
22335 LDKDecodeError this_obj_conv;
22336 this_obj_conv.inner = (void*)(this_obj & (~1));
22337 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22339 DecodeError_free(this_obj_conv);
22342 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
22343 LDKDecodeError ret_var = DecodeError_clone(arg);
22344 uint64_t ret_ref = 0;
22345 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22346 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22347 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22348 ret_ref = (uint64_t)ret_var.inner;
22349 if (ret_var.is_owned) {
22354 int64_t __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint32_t arg) {
22355 LDKDecodeError arg_conv;
22356 arg_conv.inner = (void*)(arg & (~1));
22357 arg_conv.is_owned = false;
22358 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22359 int64_t ret_val = DecodeError_clone_ptr(&arg_conv);
22363 uint32_t __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint32_t orig) {
22364 LDKDecodeError orig_conv;
22365 orig_conv.inner = (void*)(orig & (~1));
22366 orig_conv.is_owned = false;
22367 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22368 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
22369 uint64_t ret_ref = 0;
22370 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22371 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22373 ret_ref = (uint64_t)ret_var.inner;
22374 if (ret_var.is_owned) {
22380 void __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint32_t this_obj) {
22381 LDKInit this_obj_conv;
22382 this_obj_conv.inner = (void*)(this_obj & (~1));
22383 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22385 Init_free(this_obj_conv);
22388 uint32_t __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint32_t this_ptr) {
22389 LDKInit this_ptr_conv;
22390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22391 this_ptr_conv.is_owned = false;
22392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22393 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
22394 uint64_t ret_ref = 0;
22395 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22396 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22397 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22398 ret_ref = (uint64_t)ret_var.inner;
22399 if (ret_var.is_owned) {
22405 void __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
22406 LDKInit this_ptr_conv;
22407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22408 this_ptr_conv.is_owned = false;
22409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22410 LDKInitFeatures val_conv;
22411 val_conv.inner = (void*)(val & (~1));
22412 val_conv.is_owned = (val & 1) || (val == 0);
22413 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22414 val_conv = InitFeatures_clone(&val_conv);
22415 Init_set_features(&this_ptr_conv, val_conv);
22418 uint32_t __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint32_t features_arg) {
22419 LDKInitFeatures features_arg_conv;
22420 features_arg_conv.inner = (void*)(features_arg & (~1));
22421 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
22422 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
22423 features_arg_conv = InitFeatures_clone(&features_arg_conv);
22424 LDKInit ret_var = Init_new(features_arg_conv);
22425 uint64_t ret_ref = 0;
22426 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22427 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22428 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22429 ret_ref = (uint64_t)ret_var.inner;
22430 if (ret_var.is_owned) {
22436 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
22437 LDKInit ret_var = Init_clone(arg);
22438 uint64_t ret_ref = 0;
22439 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22440 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22442 ret_ref = (uint64_t)ret_var.inner;
22443 if (ret_var.is_owned) {
22448 int64_t __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint32_t arg) {
22450 arg_conv.inner = (void*)(arg & (~1));
22451 arg_conv.is_owned = false;
22452 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22453 int64_t ret_val = Init_clone_ptr(&arg_conv);
22457 uint32_t __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint32_t orig) {
22459 orig_conv.inner = (void*)(orig & (~1));
22460 orig_conv.is_owned = false;
22461 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22462 LDKInit ret_var = Init_clone(&orig_conv);
22463 uint64_t ret_ref = 0;
22464 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22465 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22467 ret_ref = (uint64_t)ret_var.inner;
22468 if (ret_var.is_owned) {
22474 void __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint32_t this_obj) {
22475 LDKErrorMessage this_obj_conv;
22476 this_obj_conv.inner = (void*)(this_obj & (~1));
22477 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22479 ErrorMessage_free(this_obj_conv);
22482 int8_tArray __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
22483 LDKErrorMessage this_ptr_conv;
22484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22485 this_ptr_conv.is_owned = false;
22486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22487 int8_tArray ret_arr = init_int8_tArray(32);
22488 memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
22492 void __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
22493 LDKErrorMessage this_ptr_conv;
22494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22495 this_ptr_conv.is_owned = false;
22496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22497 LDKThirtyTwoBytes val_ref;
22498 CHECK(val->arr_len == 32);
22499 memcpy(val_ref.data, val->elems, 32);
22500 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
22503 jstring __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
22504 LDKErrorMessage this_ptr_conv;
22505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22506 this_ptr_conv.is_owned = false;
22507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22508 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
22509 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22514 void __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
22515 LDKErrorMessage this_ptr_conv;
22516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22517 this_ptr_conv.is_owned = false;
22518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22519 LDKStr val_conv = str_ref_to_owned_c(val);
22520 ErrorMessage_set_data(&this_ptr_conv, val_conv);
22523 uint32_t __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
22524 LDKThirtyTwoBytes channel_id_arg_ref;
22525 CHECK(channel_id_arg->arr_len == 32);
22526 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
22527 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
22528 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
22529 uint64_t ret_ref = 0;
22530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22533 ret_ref = (uint64_t)ret_var.inner;
22534 if (ret_var.is_owned) {
22540 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
22541 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
22542 uint64_t ret_ref = 0;
22543 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22544 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22545 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22546 ret_ref = (uint64_t)ret_var.inner;
22547 if (ret_var.is_owned) {
22552 int64_t __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
22553 LDKErrorMessage arg_conv;
22554 arg_conv.inner = (void*)(arg & (~1));
22555 arg_conv.is_owned = false;
22556 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22557 int64_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
22561 uint32_t __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint32_t orig) {
22562 LDKErrorMessage orig_conv;
22563 orig_conv.inner = (void*)(orig & (~1));
22564 orig_conv.is_owned = false;
22565 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22566 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
22567 uint64_t ret_ref = 0;
22568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22571 ret_ref = (uint64_t)ret_var.inner;
22572 if (ret_var.is_owned) {
22578 void __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint32_t this_obj) {
22579 LDKPing this_obj_conv;
22580 this_obj_conv.inner = (void*)(this_obj & (~1));
22581 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22583 Ping_free(this_obj_conv);
22586 int16_t __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
22587 LDKPing this_ptr_conv;
22588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22589 this_ptr_conv.is_owned = false;
22590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22591 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
22595 void __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
22596 LDKPing this_ptr_conv;
22597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22598 this_ptr_conv.is_owned = false;
22599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22600 Ping_set_ponglen(&this_ptr_conv, val);
22603 int16_t __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
22604 LDKPing this_ptr_conv;
22605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22606 this_ptr_conv.is_owned = false;
22607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22608 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
22612 void __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
22613 LDKPing this_ptr_conv;
22614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22615 this_ptr_conv.is_owned = false;
22616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22617 Ping_set_byteslen(&this_ptr_conv, val);
22620 uint32_t __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
22621 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
22622 uint64_t ret_ref = 0;
22623 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22624 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22626 ret_ref = (uint64_t)ret_var.inner;
22627 if (ret_var.is_owned) {
22633 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
22634 LDKPing ret_var = Ping_clone(arg);
22635 uint64_t ret_ref = 0;
22636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22639 ret_ref = (uint64_t)ret_var.inner;
22640 if (ret_var.is_owned) {
22645 int64_t __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint32_t arg) {
22647 arg_conv.inner = (void*)(arg & (~1));
22648 arg_conv.is_owned = false;
22649 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22650 int64_t ret_val = Ping_clone_ptr(&arg_conv);
22654 uint32_t __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint32_t orig) {
22656 orig_conv.inner = (void*)(orig & (~1));
22657 orig_conv.is_owned = false;
22658 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22659 LDKPing ret_var = Ping_clone(&orig_conv);
22660 uint64_t ret_ref = 0;
22661 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22662 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22663 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22664 ret_ref = (uint64_t)ret_var.inner;
22665 if (ret_var.is_owned) {
22671 void __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint32_t this_obj) {
22672 LDKPong this_obj_conv;
22673 this_obj_conv.inner = (void*)(this_obj & (~1));
22674 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22676 Pong_free(this_obj_conv);
22679 int16_t __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
22680 LDKPong this_ptr_conv;
22681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22682 this_ptr_conv.is_owned = false;
22683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22684 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
22688 void __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
22689 LDKPong this_ptr_conv;
22690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22691 this_ptr_conv.is_owned = false;
22692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22693 Pong_set_byteslen(&this_ptr_conv, val);
22696 uint32_t __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
22697 LDKPong ret_var = Pong_new(byteslen_arg);
22698 uint64_t ret_ref = 0;
22699 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22700 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22702 ret_ref = (uint64_t)ret_var.inner;
22703 if (ret_var.is_owned) {
22709 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
22710 LDKPong ret_var = Pong_clone(arg);
22711 uint64_t ret_ref = 0;
22712 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22713 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22715 ret_ref = (uint64_t)ret_var.inner;
22716 if (ret_var.is_owned) {
22721 int64_t __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint32_t arg) {
22723 arg_conv.inner = (void*)(arg & (~1));
22724 arg_conv.is_owned = false;
22725 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22726 int64_t ret_val = Pong_clone_ptr(&arg_conv);
22730 uint32_t __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint32_t orig) {
22732 orig_conv.inner = (void*)(orig & (~1));
22733 orig_conv.is_owned = false;
22734 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22735 LDKPong ret_var = Pong_clone(&orig_conv);
22736 uint64_t ret_ref = 0;
22737 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22738 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22740 ret_ref = (uint64_t)ret_var.inner;
22741 if (ret_var.is_owned) {
22747 void __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint32_t this_obj) {
22748 LDKOpenChannel this_obj_conv;
22749 this_obj_conv.inner = (void*)(this_obj & (~1));
22750 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22752 OpenChannel_free(this_obj_conv);
22755 int8_tArray __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
22756 LDKOpenChannel this_ptr_conv;
22757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22758 this_ptr_conv.is_owned = false;
22759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22760 int8_tArray ret_arr = init_int8_tArray(32);
22761 memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
22765 void __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
22766 LDKOpenChannel this_ptr_conv;
22767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22768 this_ptr_conv.is_owned = false;
22769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22770 LDKThirtyTwoBytes val_ref;
22771 CHECK(val->arr_len == 32);
22772 memcpy(val_ref.data, val->elems, 32);
22773 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
22776 int8_tArray __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
22777 LDKOpenChannel this_ptr_conv;
22778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22779 this_ptr_conv.is_owned = false;
22780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22781 int8_tArray ret_arr = init_int8_tArray(32);
22782 memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
22786 void __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
22787 LDKOpenChannel this_ptr_conv;
22788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22789 this_ptr_conv.is_owned = false;
22790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22791 LDKThirtyTwoBytes val_ref;
22792 CHECK(val->arr_len == 32);
22793 memcpy(val_ref.data, val->elems, 32);
22794 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22797 int64_t __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
22798 LDKOpenChannel this_ptr_conv;
22799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22800 this_ptr_conv.is_owned = false;
22801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22802 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
22806 void __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
22807 LDKOpenChannel this_ptr_conv;
22808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22809 this_ptr_conv.is_owned = false;
22810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22811 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
22814 int64_t __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
22815 LDKOpenChannel this_ptr_conv;
22816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22817 this_ptr_conv.is_owned = false;
22818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22819 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
22823 void __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
22824 LDKOpenChannel this_ptr_conv;
22825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22826 this_ptr_conv.is_owned = false;
22827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22828 OpenChannel_set_push_msat(&this_ptr_conv, val);
22831 int64_t __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
22832 LDKOpenChannel this_ptr_conv;
22833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22834 this_ptr_conv.is_owned = false;
22835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22836 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
22840 void __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
22841 LDKOpenChannel this_ptr_conv;
22842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22843 this_ptr_conv.is_owned = false;
22844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22845 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22848 int64_t __attribute__((export_name("TS_OpenChannel_get_max_htlc_value_in_flight_msat"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
22849 LDKOpenChannel this_ptr_conv;
22850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22851 this_ptr_conv.is_owned = false;
22852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22853 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22857 void __attribute__((export_name("TS_OpenChannel_set_max_htlc_value_in_flight_msat"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
22858 LDKOpenChannel this_ptr_conv;
22859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22860 this_ptr_conv.is_owned = false;
22861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22862 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22865 int64_t __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
22866 LDKOpenChannel this_ptr_conv;
22867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22868 this_ptr_conv.is_owned = false;
22869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22870 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
22874 void __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
22875 LDKOpenChannel this_ptr_conv;
22876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22877 this_ptr_conv.is_owned = false;
22878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22879 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
22882 int64_t __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
22883 LDKOpenChannel this_ptr_conv;
22884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22885 this_ptr_conv.is_owned = false;
22886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22887 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
22891 void __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
22892 LDKOpenChannel this_ptr_conv;
22893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22894 this_ptr_conv.is_owned = false;
22895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22896 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
22899 int32_t __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
22900 LDKOpenChannel this_ptr_conv;
22901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22902 this_ptr_conv.is_owned = false;
22903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22904 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
22908 void __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
22909 LDKOpenChannel this_ptr_conv;
22910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22911 this_ptr_conv.is_owned = false;
22912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22913 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
22916 int16_t __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
22917 LDKOpenChannel this_ptr_conv;
22918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22919 this_ptr_conv.is_owned = false;
22920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22921 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
22925 void __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
22926 LDKOpenChannel this_ptr_conv;
22927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22928 this_ptr_conv.is_owned = false;
22929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22930 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
22933 int16_t __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
22934 LDKOpenChannel this_ptr_conv;
22935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22936 this_ptr_conv.is_owned = false;
22937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22938 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
22942 void __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
22943 LDKOpenChannel this_ptr_conv;
22944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22945 this_ptr_conv.is_owned = false;
22946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22947 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
22950 int8_tArray __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
22951 LDKOpenChannel this_ptr_conv;
22952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22953 this_ptr_conv.is_owned = false;
22954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22955 int8_tArray ret_arr = init_int8_tArray(33);
22956 memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
22960 void __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
22961 LDKOpenChannel this_ptr_conv;
22962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22963 this_ptr_conv.is_owned = false;
22964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22965 LDKPublicKey val_ref;
22966 CHECK(val->arr_len == 33);
22967 memcpy(val_ref.compressed_form, val->elems, 33);
22968 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
22971 int8_tArray __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
22972 LDKOpenChannel this_ptr_conv;
22973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22974 this_ptr_conv.is_owned = false;
22975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22976 int8_tArray ret_arr = init_int8_tArray(33);
22977 memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
22981 void __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
22982 LDKOpenChannel this_ptr_conv;
22983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22984 this_ptr_conv.is_owned = false;
22985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22986 LDKPublicKey val_ref;
22987 CHECK(val->arr_len == 33);
22988 memcpy(val_ref.compressed_form, val->elems, 33);
22989 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
22992 int8_tArray __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
22993 LDKOpenChannel this_ptr_conv;
22994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22995 this_ptr_conv.is_owned = false;
22996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22997 int8_tArray ret_arr = init_int8_tArray(33);
22998 memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
23002 void __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
23003 LDKOpenChannel this_ptr_conv;
23004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23005 this_ptr_conv.is_owned = false;
23006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23007 LDKPublicKey val_ref;
23008 CHECK(val->arr_len == 33);
23009 memcpy(val_ref.compressed_form, val->elems, 33);
23010 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
23013 int8_tArray __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
23014 LDKOpenChannel this_ptr_conv;
23015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23016 this_ptr_conv.is_owned = false;
23017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23018 int8_tArray ret_arr = init_int8_tArray(33);
23019 memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
23023 void __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
23024 LDKOpenChannel this_ptr_conv;
23025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23026 this_ptr_conv.is_owned = false;
23027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23028 LDKPublicKey val_ref;
23029 CHECK(val->arr_len == 33);
23030 memcpy(val_ref.compressed_form, val->elems, 33);
23031 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
23034 int8_tArray __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
23035 LDKOpenChannel this_ptr_conv;
23036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23037 this_ptr_conv.is_owned = false;
23038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23039 int8_tArray ret_arr = init_int8_tArray(33);
23040 memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
23044 void __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
23045 LDKOpenChannel this_ptr_conv;
23046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23047 this_ptr_conv.is_owned = false;
23048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23049 LDKPublicKey val_ref;
23050 CHECK(val->arr_len == 33);
23051 memcpy(val_ref.compressed_form, val->elems, 33);
23052 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
23055 int8_tArray __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
23056 LDKOpenChannel this_ptr_conv;
23057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23058 this_ptr_conv.is_owned = false;
23059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23060 int8_tArray ret_arr = init_int8_tArray(33);
23061 memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23065 void __attribute__((export_name("TS_OpenChannel_set_first_per_commitment_point"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23066 LDKOpenChannel this_ptr_conv;
23067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23068 this_ptr_conv.is_owned = false;
23069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23070 LDKPublicKey val_ref;
23071 CHECK(val->arr_len == 33);
23072 memcpy(val_ref.compressed_form, val->elems, 33);
23073 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
23076 int8_t __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
23077 LDKOpenChannel this_ptr_conv;
23078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23079 this_ptr_conv.is_owned = false;
23080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23081 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
23085 void __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
23086 LDKOpenChannel this_ptr_conv;
23087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23088 this_ptr_conv.is_owned = false;
23089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23090 OpenChannel_set_channel_flags(&this_ptr_conv, val);
23093 uint32_t __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) {
23094 LDKOpenChannel this_ptr_conv;
23095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23096 this_ptr_conv.is_owned = false;
23097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23098 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
23099 uint64_t ret_ref = 0;
23100 if ((uint64_t)ret_var.inner > 4096) {
23101 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23102 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23103 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23104 ret_ref = (uint64_t)ret_var.inner;
23105 if (ret_var.is_owned) {
23112 void __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
23113 LDKOpenChannel this_ptr_conv;
23114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23115 this_ptr_conv.is_owned = false;
23116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23117 LDKChannelTypeFeatures val_conv;
23118 val_conv.inner = (void*)(val & (~1));
23119 val_conv.is_owned = (val & 1) || (val == 0);
23120 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23121 val_conv = ChannelTypeFeatures_clone(&val_conv);
23122 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
23125 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
23126 LDKOpenChannel ret_var = OpenChannel_clone(arg);
23127 uint64_t ret_ref = 0;
23128 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23129 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23130 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23131 ret_ref = (uint64_t)ret_var.inner;
23132 if (ret_var.is_owned) {
23137 int64_t __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
23138 LDKOpenChannel arg_conv;
23139 arg_conv.inner = (void*)(arg & (~1));
23140 arg_conv.is_owned = false;
23141 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23142 int64_t ret_val = OpenChannel_clone_ptr(&arg_conv);
23146 uint32_t __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint32_t orig) {
23147 LDKOpenChannel orig_conv;
23148 orig_conv.inner = (void*)(orig & (~1));
23149 orig_conv.is_owned = false;
23150 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23151 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
23152 uint64_t ret_ref = 0;
23153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23156 ret_ref = (uint64_t)ret_var.inner;
23157 if (ret_var.is_owned) {
23163 void __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint32_t this_obj) {
23164 LDKAcceptChannel this_obj_conv;
23165 this_obj_conv.inner = (void*)(this_obj & (~1));
23166 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23168 AcceptChannel_free(this_obj_conv);
23171 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
23172 LDKAcceptChannel this_ptr_conv;
23173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23174 this_ptr_conv.is_owned = false;
23175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23176 int8_tArray ret_arr = init_int8_tArray(32);
23177 memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
23181 void __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
23182 LDKAcceptChannel this_ptr_conv;
23183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23184 this_ptr_conv.is_owned = false;
23185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23186 LDKThirtyTwoBytes val_ref;
23187 CHECK(val->arr_len == 32);
23188 memcpy(val_ref.data, val->elems, 32);
23189 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
23192 int64_t __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
23193 LDKAcceptChannel this_ptr_conv;
23194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23195 this_ptr_conv.is_owned = false;
23196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23197 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
23201 void __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
23202 LDKAcceptChannel this_ptr_conv;
23203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23204 this_ptr_conv.is_owned = false;
23205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23206 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
23209 int64_t __attribute__((export_name("TS_AcceptChannel_get_max_htlc_value_in_flight_msat"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
23210 LDKAcceptChannel this_ptr_conv;
23211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23212 this_ptr_conv.is_owned = false;
23213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23214 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
23218 void __attribute__((export_name("TS_AcceptChannel_set_max_htlc_value_in_flight_msat"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
23219 LDKAcceptChannel this_ptr_conv;
23220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23221 this_ptr_conv.is_owned = false;
23222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23223 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23226 int64_t __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
23227 LDKAcceptChannel this_ptr_conv;
23228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23229 this_ptr_conv.is_owned = false;
23230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23231 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
23235 void __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
23236 LDKAcceptChannel this_ptr_conv;
23237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23238 this_ptr_conv.is_owned = false;
23239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23240 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
23243 int64_t __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
23244 LDKAcceptChannel this_ptr_conv;
23245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23246 this_ptr_conv.is_owned = false;
23247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23248 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
23252 void __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
23253 LDKAcceptChannel this_ptr_conv;
23254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23255 this_ptr_conv.is_owned = false;
23256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23257 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
23260 int32_t __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
23261 LDKAcceptChannel this_ptr_conv;
23262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23263 this_ptr_conv.is_owned = false;
23264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23265 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
23269 void __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
23270 LDKAcceptChannel this_ptr_conv;
23271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23272 this_ptr_conv.is_owned = false;
23273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23274 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
23277 int16_t __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
23278 LDKAcceptChannel this_ptr_conv;
23279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23280 this_ptr_conv.is_owned = false;
23281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23282 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
23286 void __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
23287 LDKAcceptChannel this_ptr_conv;
23288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23289 this_ptr_conv.is_owned = false;
23290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23291 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
23294 int16_t __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
23295 LDKAcceptChannel this_ptr_conv;
23296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23297 this_ptr_conv.is_owned = false;
23298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23299 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
23303 void __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
23304 LDKAcceptChannel this_ptr_conv;
23305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23306 this_ptr_conv.is_owned = false;
23307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23308 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
23311 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
23312 LDKAcceptChannel this_ptr_conv;
23313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23314 this_ptr_conv.is_owned = false;
23315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23316 int8_tArray ret_arr = init_int8_tArray(33);
23317 memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
23321 void __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
23322 LDKAcceptChannel this_ptr_conv;
23323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23324 this_ptr_conv.is_owned = false;
23325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23326 LDKPublicKey val_ref;
23327 CHECK(val->arr_len == 33);
23328 memcpy(val_ref.compressed_form, val->elems, 33);
23329 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
23332 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
23333 LDKAcceptChannel this_ptr_conv;
23334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23335 this_ptr_conv.is_owned = false;
23336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23337 int8_tArray ret_arr = init_int8_tArray(33);
23338 memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
23342 void __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
23343 LDKAcceptChannel this_ptr_conv;
23344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23345 this_ptr_conv.is_owned = false;
23346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23347 LDKPublicKey val_ref;
23348 CHECK(val->arr_len == 33);
23349 memcpy(val_ref.compressed_form, val->elems, 33);
23350 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
23353 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
23354 LDKAcceptChannel this_ptr_conv;
23355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23356 this_ptr_conv.is_owned = false;
23357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23358 int8_tArray ret_arr = init_int8_tArray(33);
23359 memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
23363 void __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
23364 LDKAcceptChannel this_ptr_conv;
23365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23366 this_ptr_conv.is_owned = false;
23367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23368 LDKPublicKey val_ref;
23369 CHECK(val->arr_len == 33);
23370 memcpy(val_ref.compressed_form, val->elems, 33);
23371 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
23374 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
23375 LDKAcceptChannel this_ptr_conv;
23376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23377 this_ptr_conv.is_owned = false;
23378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23379 int8_tArray ret_arr = init_int8_tArray(33);
23380 memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
23384 void __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
23385 LDKAcceptChannel this_ptr_conv;
23386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23387 this_ptr_conv.is_owned = false;
23388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23389 LDKPublicKey val_ref;
23390 CHECK(val->arr_len == 33);
23391 memcpy(val_ref.compressed_form, val->elems, 33);
23392 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
23395 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
23396 LDKAcceptChannel this_ptr_conv;
23397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23398 this_ptr_conv.is_owned = false;
23399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23400 int8_tArray ret_arr = init_int8_tArray(33);
23401 memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
23405 void __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
23406 LDKAcceptChannel this_ptr_conv;
23407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23408 this_ptr_conv.is_owned = false;
23409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23410 LDKPublicKey val_ref;
23411 CHECK(val->arr_len == 33);
23412 memcpy(val_ref.compressed_form, val->elems, 33);
23413 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
23416 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
23417 LDKAcceptChannel this_ptr_conv;
23418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23419 this_ptr_conv.is_owned = false;
23420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23421 int8_tArray ret_arr = init_int8_tArray(33);
23422 memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23426 void __attribute__((export_name("TS_AcceptChannel_set_first_per_commitment_point"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23427 LDKAcceptChannel this_ptr_conv;
23428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23429 this_ptr_conv.is_owned = false;
23430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23431 LDKPublicKey val_ref;
23432 CHECK(val->arr_len == 33);
23433 memcpy(val_ref.compressed_form, val->elems, 33);
23434 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
23437 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
23438 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
23439 uint64_t ret_ref = 0;
23440 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23441 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23443 ret_ref = (uint64_t)ret_var.inner;
23444 if (ret_var.is_owned) {
23449 int64_t __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
23450 LDKAcceptChannel arg_conv;
23451 arg_conv.inner = (void*)(arg & (~1));
23452 arg_conv.is_owned = false;
23453 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23454 int64_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
23458 uint32_t __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint32_t orig) {
23459 LDKAcceptChannel orig_conv;
23460 orig_conv.inner = (void*)(orig & (~1));
23461 orig_conv.is_owned = false;
23462 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23463 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
23464 uint64_t ret_ref = 0;
23465 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23466 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23467 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23468 ret_ref = (uint64_t)ret_var.inner;
23469 if (ret_var.is_owned) {
23475 void __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint32_t this_obj) {
23476 LDKFundingCreated this_obj_conv;
23477 this_obj_conv.inner = (void*)(this_obj & (~1));
23478 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23480 FundingCreated_free(this_obj_conv);
23483 int8_tArray __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
23484 LDKFundingCreated this_ptr_conv;
23485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23486 this_ptr_conv.is_owned = false;
23487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23488 int8_tArray ret_arr = init_int8_tArray(32);
23489 memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
23493 void __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
23494 LDKFundingCreated this_ptr_conv;
23495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23496 this_ptr_conv.is_owned = false;
23497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23498 LDKThirtyTwoBytes val_ref;
23499 CHECK(val->arr_len == 32);
23500 memcpy(val_ref.data, val->elems, 32);
23501 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
23504 int8_tArray __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
23505 LDKFundingCreated this_ptr_conv;
23506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23507 this_ptr_conv.is_owned = false;
23508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23509 int8_tArray ret_arr = init_int8_tArray(32);
23510 memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
23514 void __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
23515 LDKFundingCreated this_ptr_conv;
23516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23517 this_ptr_conv.is_owned = false;
23518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23519 LDKThirtyTwoBytes val_ref;
23520 CHECK(val->arr_len == 32);
23521 memcpy(val_ref.data, val->elems, 32);
23522 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
23525 int16_t __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
23526 LDKFundingCreated this_ptr_conv;
23527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23528 this_ptr_conv.is_owned = false;
23529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23530 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
23534 void __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
23535 LDKFundingCreated this_ptr_conv;
23536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23537 this_ptr_conv.is_owned = false;
23538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23539 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
23542 int8_tArray __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
23543 LDKFundingCreated this_ptr_conv;
23544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23545 this_ptr_conv.is_owned = false;
23546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23547 int8_tArray ret_arr = init_int8_tArray(64);
23548 memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
23552 void __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
23553 LDKFundingCreated this_ptr_conv;
23554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23555 this_ptr_conv.is_owned = false;
23556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23557 LDKSignature val_ref;
23558 CHECK(val->arr_len == 64);
23559 memcpy(val_ref.compact_form, val->elems, 64);
23560 FundingCreated_set_signature(&this_ptr_conv, val_ref);
23563 uint32_t __attribute__((export_name("TS_FundingCreated_new"))) TS_FundingCreated_new(int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
23564 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
23565 CHECK(temporary_channel_id_arg->arr_len == 32);
23566 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32);
23567 LDKThirtyTwoBytes funding_txid_arg_ref;
23568 CHECK(funding_txid_arg->arr_len == 32);
23569 memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32);
23570 LDKSignature signature_arg_ref;
23571 CHECK(signature_arg->arr_len == 64);
23572 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
23573 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
23574 uint64_t ret_ref = 0;
23575 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23576 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23578 ret_ref = (uint64_t)ret_var.inner;
23579 if (ret_var.is_owned) {
23585 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
23586 LDKFundingCreated ret_var = FundingCreated_clone(arg);
23587 uint64_t ret_ref = 0;
23588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23590 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23591 ret_ref = (uint64_t)ret_var.inner;
23592 if (ret_var.is_owned) {
23597 int64_t __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
23598 LDKFundingCreated arg_conv;
23599 arg_conv.inner = (void*)(arg & (~1));
23600 arg_conv.is_owned = false;
23601 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23602 int64_t ret_val = FundingCreated_clone_ptr(&arg_conv);
23606 uint32_t __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint32_t orig) {
23607 LDKFundingCreated orig_conv;
23608 orig_conv.inner = (void*)(orig & (~1));
23609 orig_conv.is_owned = false;
23610 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23611 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
23612 uint64_t ret_ref = 0;
23613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23615 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23616 ret_ref = (uint64_t)ret_var.inner;
23617 if (ret_var.is_owned) {
23623 void __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint32_t this_obj) {
23624 LDKFundingSigned this_obj_conv;
23625 this_obj_conv.inner = (void*)(this_obj & (~1));
23626 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23628 FundingSigned_free(this_obj_conv);
23631 int8_tArray __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
23632 LDKFundingSigned this_ptr_conv;
23633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23634 this_ptr_conv.is_owned = false;
23635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23636 int8_tArray ret_arr = init_int8_tArray(32);
23637 memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
23641 void __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23642 LDKFundingSigned this_ptr_conv;
23643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23644 this_ptr_conv.is_owned = false;
23645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23646 LDKThirtyTwoBytes val_ref;
23647 CHECK(val->arr_len == 32);
23648 memcpy(val_ref.data, val->elems, 32);
23649 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
23652 int8_tArray __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
23653 LDKFundingSigned this_ptr_conv;
23654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23655 this_ptr_conv.is_owned = false;
23656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23657 int8_tArray ret_arr = init_int8_tArray(64);
23658 memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
23662 void __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
23663 LDKFundingSigned this_ptr_conv;
23664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23665 this_ptr_conv.is_owned = false;
23666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23667 LDKSignature val_ref;
23668 CHECK(val->arr_len == 64);
23669 memcpy(val_ref.compact_form, val->elems, 64);
23670 FundingSigned_set_signature(&this_ptr_conv, val_ref);
23673 uint32_t __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
23674 LDKThirtyTwoBytes channel_id_arg_ref;
23675 CHECK(channel_id_arg->arr_len == 32);
23676 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23677 LDKSignature signature_arg_ref;
23678 CHECK(signature_arg->arr_len == 64);
23679 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
23680 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
23681 uint64_t ret_ref = 0;
23682 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23683 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23684 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23685 ret_ref = (uint64_t)ret_var.inner;
23686 if (ret_var.is_owned) {
23692 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
23693 LDKFundingSigned ret_var = FundingSigned_clone(arg);
23694 uint64_t ret_ref = 0;
23695 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23696 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23698 ret_ref = (uint64_t)ret_var.inner;
23699 if (ret_var.is_owned) {
23704 int64_t __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
23705 LDKFundingSigned arg_conv;
23706 arg_conv.inner = (void*)(arg & (~1));
23707 arg_conv.is_owned = false;
23708 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23709 int64_t ret_val = FundingSigned_clone_ptr(&arg_conv);
23713 uint32_t __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint32_t orig) {
23714 LDKFundingSigned orig_conv;
23715 orig_conv.inner = (void*)(orig & (~1));
23716 orig_conv.is_owned = false;
23717 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23718 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
23719 uint64_t ret_ref = 0;
23720 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23721 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23723 ret_ref = (uint64_t)ret_var.inner;
23724 if (ret_var.is_owned) {
23730 void __attribute__((export_name("TS_FundingLocked_free"))) TS_FundingLocked_free(uint32_t this_obj) {
23731 LDKFundingLocked this_obj_conv;
23732 this_obj_conv.inner = (void*)(this_obj & (~1));
23733 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23735 FundingLocked_free(this_obj_conv);
23738 int8_tArray __attribute__((export_name("TS_FundingLocked_get_channel_id"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
23739 LDKFundingLocked this_ptr_conv;
23740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23741 this_ptr_conv.is_owned = false;
23742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23743 int8_tArray ret_arr = init_int8_tArray(32);
23744 memcpy(ret_arr->elems, *FundingLocked_get_channel_id(&this_ptr_conv), 32);
23748 void __attribute__((export_name("TS_FundingLocked_set_channel_id"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23749 LDKFundingLocked this_ptr_conv;
23750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23751 this_ptr_conv.is_owned = false;
23752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23753 LDKThirtyTwoBytes val_ref;
23754 CHECK(val->arr_len == 32);
23755 memcpy(val_ref.data, val->elems, 32);
23756 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
23759 int8_tArray __attribute__((export_name("TS_FundingLocked_get_next_per_commitment_point"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
23760 LDKFundingLocked this_ptr_conv;
23761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23762 this_ptr_conv.is_owned = false;
23763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23764 int8_tArray ret_arr = init_int8_tArray(33);
23765 memcpy(ret_arr->elems, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23769 void __attribute__((export_name("TS_FundingLocked_set_next_per_commitment_point"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23770 LDKFundingLocked this_ptr_conv;
23771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23772 this_ptr_conv.is_owned = false;
23773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23774 LDKPublicKey val_ref;
23775 CHECK(val->arr_len == 33);
23776 memcpy(val_ref.compressed_form, val->elems, 33);
23777 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
23780 uint32_t __attribute__((export_name("TS_FundingLocked_new"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
23781 LDKThirtyTwoBytes channel_id_arg_ref;
23782 CHECK(channel_id_arg->arr_len == 32);
23783 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23784 LDKPublicKey next_per_commitment_point_arg_ref;
23785 CHECK(next_per_commitment_point_arg->arr_len == 33);
23786 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33);
23787 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
23788 uint64_t ret_ref = 0;
23789 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23790 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23791 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23792 ret_ref = (uint64_t)ret_var.inner;
23793 if (ret_var.is_owned) {
23799 static inline uintptr_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
23800 LDKFundingLocked ret_var = FundingLocked_clone(arg);
23801 uint64_t ret_ref = 0;
23802 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23803 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23804 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23805 ret_ref = (uint64_t)ret_var.inner;
23806 if (ret_var.is_owned) {
23811 int64_t __attribute__((export_name("TS_FundingLocked_clone_ptr"))) TS_FundingLocked_clone_ptr(uint32_t arg) {
23812 LDKFundingLocked arg_conv;
23813 arg_conv.inner = (void*)(arg & (~1));
23814 arg_conv.is_owned = false;
23815 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23816 int64_t ret_val = FundingLocked_clone_ptr(&arg_conv);
23820 uint32_t __attribute__((export_name("TS_FundingLocked_clone"))) TS_FundingLocked_clone(uint32_t orig) {
23821 LDKFundingLocked orig_conv;
23822 orig_conv.inner = (void*)(orig & (~1));
23823 orig_conv.is_owned = false;
23824 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23825 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
23826 uint64_t ret_ref = 0;
23827 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23828 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23830 ret_ref = (uint64_t)ret_var.inner;
23831 if (ret_var.is_owned) {
23837 void __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint32_t this_obj) {
23838 LDKShutdown this_obj_conv;
23839 this_obj_conv.inner = (void*)(this_obj & (~1));
23840 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23842 Shutdown_free(this_obj_conv);
23845 int8_tArray __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
23846 LDKShutdown this_ptr_conv;
23847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23848 this_ptr_conv.is_owned = false;
23849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23850 int8_tArray ret_arr = init_int8_tArray(32);
23851 memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
23855 void __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23856 LDKShutdown this_ptr_conv;
23857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23858 this_ptr_conv.is_owned = false;
23859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23860 LDKThirtyTwoBytes val_ref;
23861 CHECK(val->arr_len == 32);
23862 memcpy(val_ref.data, val->elems, 32);
23863 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
23866 int8_tArray __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
23867 LDKShutdown this_ptr_conv;
23868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23869 this_ptr_conv.is_owned = false;
23870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23871 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
23872 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
23873 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23877 void __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
23878 LDKShutdown this_ptr_conv;
23879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23880 this_ptr_conv.is_owned = false;
23881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23882 LDKCVec_u8Z val_ref;
23883 val_ref.datalen = val->arr_len;
23884 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23885 memcpy(val_ref.data, val->elems, val_ref.datalen);
23886 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
23889 uint32_t __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
23890 LDKThirtyTwoBytes channel_id_arg_ref;
23891 CHECK(channel_id_arg->arr_len == 32);
23892 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23893 LDKCVec_u8Z scriptpubkey_arg_ref;
23894 scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
23895 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23896 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen);
23897 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
23898 uint64_t ret_ref = 0;
23899 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23900 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23901 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23902 ret_ref = (uint64_t)ret_var.inner;
23903 if (ret_var.is_owned) {
23909 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
23910 LDKShutdown ret_var = Shutdown_clone(arg);
23911 uint64_t ret_ref = 0;
23912 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23913 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23915 ret_ref = (uint64_t)ret_var.inner;
23916 if (ret_var.is_owned) {
23921 int64_t __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint32_t arg) {
23922 LDKShutdown arg_conv;
23923 arg_conv.inner = (void*)(arg & (~1));
23924 arg_conv.is_owned = false;
23925 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23926 int64_t ret_val = Shutdown_clone_ptr(&arg_conv);
23930 uint32_t __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint32_t orig) {
23931 LDKShutdown orig_conv;
23932 orig_conv.inner = (void*)(orig & (~1));
23933 orig_conv.is_owned = false;
23934 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23935 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
23936 uint64_t ret_ref = 0;
23937 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23938 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23940 ret_ref = (uint64_t)ret_var.inner;
23941 if (ret_var.is_owned) {
23947 void __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
23948 LDKClosingSignedFeeRange this_obj_conv;
23949 this_obj_conv.inner = (void*)(this_obj & (~1));
23950 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23952 ClosingSignedFeeRange_free(this_obj_conv);
23955 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
23956 LDKClosingSignedFeeRange this_ptr_conv;
23957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23958 this_ptr_conv.is_owned = false;
23959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23960 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
23964 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
23965 LDKClosingSignedFeeRange this_ptr_conv;
23966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23967 this_ptr_conv.is_owned = false;
23968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23969 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
23972 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
23973 LDKClosingSignedFeeRange this_ptr_conv;
23974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23975 this_ptr_conv.is_owned = false;
23976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23977 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
23981 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
23982 LDKClosingSignedFeeRange this_ptr_conv;
23983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23984 this_ptr_conv.is_owned = false;
23985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23986 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
23989 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
23990 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
23991 uint64_t ret_ref = 0;
23992 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23993 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23995 ret_ref = (uint64_t)ret_var.inner;
23996 if (ret_var.is_owned) {
24002 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
24003 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
24004 uint64_t ret_ref = 0;
24005 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24006 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24007 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24008 ret_ref = (uint64_t)ret_var.inner;
24009 if (ret_var.is_owned) {
24014 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
24015 LDKClosingSignedFeeRange arg_conv;
24016 arg_conv.inner = (void*)(arg & (~1));
24017 arg_conv.is_owned = false;
24018 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24019 int64_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
24023 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
24024 LDKClosingSignedFeeRange orig_conv;
24025 orig_conv.inner = (void*)(orig & (~1));
24026 orig_conv.is_owned = false;
24027 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24028 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
24029 uint64_t ret_ref = 0;
24030 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24031 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24033 ret_ref = (uint64_t)ret_var.inner;
24034 if (ret_var.is_owned) {
24040 void __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint32_t this_obj) {
24041 LDKClosingSigned this_obj_conv;
24042 this_obj_conv.inner = (void*)(this_obj & (~1));
24043 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24045 ClosingSigned_free(this_obj_conv);
24048 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
24049 LDKClosingSigned this_ptr_conv;
24050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24051 this_ptr_conv.is_owned = false;
24052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24053 int8_tArray ret_arr = init_int8_tArray(32);
24054 memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
24058 void __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24059 LDKClosingSigned this_ptr_conv;
24060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24061 this_ptr_conv.is_owned = false;
24062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24063 LDKThirtyTwoBytes val_ref;
24064 CHECK(val->arr_len == 32);
24065 memcpy(val_ref.data, val->elems, 32);
24066 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
24069 int64_t __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
24070 LDKClosingSigned this_ptr_conv;
24071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24072 this_ptr_conv.is_owned = false;
24073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24074 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
24078 void __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
24079 LDKClosingSigned this_ptr_conv;
24080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24081 this_ptr_conv.is_owned = false;
24082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24083 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
24086 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
24087 LDKClosingSigned this_ptr_conv;
24088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24089 this_ptr_conv.is_owned = false;
24090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24091 int8_tArray ret_arr = init_int8_tArray(64);
24092 memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
24096 void __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
24097 LDKClosingSigned this_ptr_conv;
24098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24099 this_ptr_conv.is_owned = false;
24100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24101 LDKSignature val_ref;
24102 CHECK(val->arr_len == 64);
24103 memcpy(val_ref.compact_form, val->elems, 64);
24104 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
24107 uint32_t __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
24108 LDKClosingSigned this_ptr_conv;
24109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24110 this_ptr_conv.is_owned = false;
24111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24112 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
24113 uint64_t ret_ref = 0;
24114 if ((uint64_t)ret_var.inner > 4096) {
24115 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24116 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24118 ret_ref = (uint64_t)ret_var.inner;
24119 if (ret_var.is_owned) {
24126 void __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
24127 LDKClosingSigned this_ptr_conv;
24128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24129 this_ptr_conv.is_owned = false;
24130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24131 LDKClosingSignedFeeRange val_conv;
24132 val_conv.inner = (void*)(val & (~1));
24133 val_conv.is_owned = (val & 1) || (val == 0);
24134 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24135 val_conv = ClosingSignedFeeRange_clone(&val_conv);
24136 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
24139 uint32_t __attribute__((export_name("TS_ClosingSigned_new"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, uint32_t fee_range_arg) {
24140 LDKThirtyTwoBytes channel_id_arg_ref;
24141 CHECK(channel_id_arg->arr_len == 32);
24142 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24143 LDKSignature signature_arg_ref;
24144 CHECK(signature_arg->arr_len == 64);
24145 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
24146 LDKClosingSignedFeeRange fee_range_arg_conv;
24147 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
24148 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
24149 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
24150 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
24151 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
24152 uint64_t ret_ref = 0;
24153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24156 ret_ref = (uint64_t)ret_var.inner;
24157 if (ret_var.is_owned) {
24163 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
24164 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
24165 uint64_t ret_ref = 0;
24166 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24167 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24168 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24169 ret_ref = (uint64_t)ret_var.inner;
24170 if (ret_var.is_owned) {
24175 int64_t __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
24176 LDKClosingSigned arg_conv;
24177 arg_conv.inner = (void*)(arg & (~1));
24178 arg_conv.is_owned = false;
24179 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24180 int64_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
24184 uint32_t __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint32_t orig) {
24185 LDKClosingSigned orig_conv;
24186 orig_conv.inner = (void*)(orig & (~1));
24187 orig_conv.is_owned = false;
24188 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24189 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
24190 uint64_t ret_ref = 0;
24191 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24192 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24194 ret_ref = (uint64_t)ret_var.inner;
24195 if (ret_var.is_owned) {
24201 void __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
24202 LDKUpdateAddHTLC this_obj_conv;
24203 this_obj_conv.inner = (void*)(this_obj & (~1));
24204 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24206 UpdateAddHTLC_free(this_obj_conv);
24209 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
24210 LDKUpdateAddHTLC this_ptr_conv;
24211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24212 this_ptr_conv.is_owned = false;
24213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24214 int8_tArray ret_arr = init_int8_tArray(32);
24215 memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
24219 void __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24220 LDKUpdateAddHTLC this_ptr_conv;
24221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24222 this_ptr_conv.is_owned = false;
24223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24224 LDKThirtyTwoBytes val_ref;
24225 CHECK(val->arr_len == 32);
24226 memcpy(val_ref.data, val->elems, 32);
24227 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
24230 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
24231 LDKUpdateAddHTLC this_ptr_conv;
24232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24233 this_ptr_conv.is_owned = false;
24234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24235 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
24239 void __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24240 LDKUpdateAddHTLC this_ptr_conv;
24241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24242 this_ptr_conv.is_owned = false;
24243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24244 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
24247 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
24248 LDKUpdateAddHTLC this_ptr_conv;
24249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24250 this_ptr_conv.is_owned = false;
24251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24252 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
24256 void __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
24257 LDKUpdateAddHTLC this_ptr_conv;
24258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24259 this_ptr_conv.is_owned = false;
24260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24261 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
24264 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
24265 LDKUpdateAddHTLC this_ptr_conv;
24266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24267 this_ptr_conv.is_owned = false;
24268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24269 int8_tArray ret_arr = init_int8_tArray(32);
24270 memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
24274 void __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
24275 LDKUpdateAddHTLC this_ptr_conv;
24276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24277 this_ptr_conv.is_owned = false;
24278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24279 LDKThirtyTwoBytes val_ref;
24280 CHECK(val->arr_len == 32);
24281 memcpy(val_ref.data, val->elems, 32);
24282 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
24285 int32_t __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
24286 LDKUpdateAddHTLC this_ptr_conv;
24287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24288 this_ptr_conv.is_owned = false;
24289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24290 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
24294 void __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
24295 LDKUpdateAddHTLC this_ptr_conv;
24296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24297 this_ptr_conv.is_owned = false;
24298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24299 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
24302 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
24303 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
24304 uint64_t ret_ref = 0;
24305 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24306 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24308 ret_ref = (uint64_t)ret_var.inner;
24309 if (ret_var.is_owned) {
24314 int64_t __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
24315 LDKUpdateAddHTLC arg_conv;
24316 arg_conv.inner = (void*)(arg & (~1));
24317 arg_conv.is_owned = false;
24318 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24319 int64_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
24323 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
24324 LDKUpdateAddHTLC orig_conv;
24325 orig_conv.inner = (void*)(orig & (~1));
24326 orig_conv.is_owned = false;
24327 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24328 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
24329 uint64_t ret_ref = 0;
24330 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24331 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24333 ret_ref = (uint64_t)ret_var.inner;
24334 if (ret_var.is_owned) {
24340 void __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
24341 LDKUpdateFulfillHTLC this_obj_conv;
24342 this_obj_conv.inner = (void*)(this_obj & (~1));
24343 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24345 UpdateFulfillHTLC_free(this_obj_conv);
24348 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
24349 LDKUpdateFulfillHTLC this_ptr_conv;
24350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24351 this_ptr_conv.is_owned = false;
24352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24353 int8_tArray ret_arr = init_int8_tArray(32);
24354 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
24358 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24359 LDKUpdateFulfillHTLC this_ptr_conv;
24360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24361 this_ptr_conv.is_owned = false;
24362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24363 LDKThirtyTwoBytes val_ref;
24364 CHECK(val->arr_len == 32);
24365 memcpy(val_ref.data, val->elems, 32);
24366 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
24369 int64_t __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
24370 LDKUpdateFulfillHTLC this_ptr_conv;
24371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24372 this_ptr_conv.is_owned = false;
24373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24374 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
24378 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24379 LDKUpdateFulfillHTLC this_ptr_conv;
24380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24381 this_ptr_conv.is_owned = false;
24382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24383 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
24386 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
24387 LDKUpdateFulfillHTLC this_ptr_conv;
24388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24389 this_ptr_conv.is_owned = false;
24390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24391 int8_tArray ret_arr = init_int8_tArray(32);
24392 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
24396 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
24397 LDKUpdateFulfillHTLC this_ptr_conv;
24398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24399 this_ptr_conv.is_owned = false;
24400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24401 LDKThirtyTwoBytes val_ref;
24402 CHECK(val->arr_len == 32);
24403 memcpy(val_ref.data, val->elems, 32);
24404 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
24407 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_new"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
24408 LDKThirtyTwoBytes channel_id_arg_ref;
24409 CHECK(channel_id_arg->arr_len == 32);
24410 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24411 LDKThirtyTwoBytes payment_preimage_arg_ref;
24412 CHECK(payment_preimage_arg->arr_len == 32);
24413 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32);
24414 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
24415 uint64_t ret_ref = 0;
24416 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24417 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24419 ret_ref = (uint64_t)ret_var.inner;
24420 if (ret_var.is_owned) {
24426 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
24427 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
24428 uint64_t ret_ref = 0;
24429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24432 ret_ref = (uint64_t)ret_var.inner;
24433 if (ret_var.is_owned) {
24438 int64_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
24439 LDKUpdateFulfillHTLC arg_conv;
24440 arg_conv.inner = (void*)(arg & (~1));
24441 arg_conv.is_owned = false;
24442 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24443 int64_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
24447 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
24448 LDKUpdateFulfillHTLC orig_conv;
24449 orig_conv.inner = (void*)(orig & (~1));
24450 orig_conv.is_owned = false;
24451 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24452 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
24453 uint64_t ret_ref = 0;
24454 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24455 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24456 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24457 ret_ref = (uint64_t)ret_var.inner;
24458 if (ret_var.is_owned) {
24464 void __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
24465 LDKUpdateFailHTLC this_obj_conv;
24466 this_obj_conv.inner = (void*)(this_obj & (~1));
24467 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24469 UpdateFailHTLC_free(this_obj_conv);
24472 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
24473 LDKUpdateFailHTLC this_ptr_conv;
24474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24475 this_ptr_conv.is_owned = false;
24476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24477 int8_tArray ret_arr = init_int8_tArray(32);
24478 memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
24482 void __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24483 LDKUpdateFailHTLC this_ptr_conv;
24484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24485 this_ptr_conv.is_owned = false;
24486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24487 LDKThirtyTwoBytes val_ref;
24488 CHECK(val->arr_len == 32);
24489 memcpy(val_ref.data, val->elems, 32);
24490 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
24493 int64_t __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
24494 LDKUpdateFailHTLC this_ptr_conv;
24495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24496 this_ptr_conv.is_owned = false;
24497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24498 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
24502 void __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24503 LDKUpdateFailHTLC this_ptr_conv;
24504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24505 this_ptr_conv.is_owned = false;
24506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24507 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
24510 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
24511 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
24512 uint64_t ret_ref = 0;
24513 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24514 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24515 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24516 ret_ref = (uint64_t)ret_var.inner;
24517 if (ret_var.is_owned) {
24522 int64_t __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
24523 LDKUpdateFailHTLC arg_conv;
24524 arg_conv.inner = (void*)(arg & (~1));
24525 arg_conv.is_owned = false;
24526 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24527 int64_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
24531 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
24532 LDKUpdateFailHTLC orig_conv;
24533 orig_conv.inner = (void*)(orig & (~1));
24534 orig_conv.is_owned = false;
24535 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24536 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
24537 uint64_t ret_ref = 0;
24538 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24539 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24540 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24541 ret_ref = (uint64_t)ret_var.inner;
24542 if (ret_var.is_owned) {
24548 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
24549 LDKUpdateFailMalformedHTLC this_obj_conv;
24550 this_obj_conv.inner = (void*)(this_obj & (~1));
24551 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24553 UpdateFailMalformedHTLC_free(this_obj_conv);
24556 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
24557 LDKUpdateFailMalformedHTLC this_ptr_conv;
24558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24559 this_ptr_conv.is_owned = false;
24560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24561 int8_tArray ret_arr = init_int8_tArray(32);
24562 memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
24566 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24567 LDKUpdateFailMalformedHTLC this_ptr_conv;
24568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24569 this_ptr_conv.is_owned = false;
24570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24571 LDKThirtyTwoBytes val_ref;
24572 CHECK(val->arr_len == 32);
24573 memcpy(val_ref.data, val->elems, 32);
24574 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
24577 int64_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
24578 LDKUpdateFailMalformedHTLC this_ptr_conv;
24579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24580 this_ptr_conv.is_owned = false;
24581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24582 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
24586 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24587 LDKUpdateFailMalformedHTLC this_ptr_conv;
24588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24589 this_ptr_conv.is_owned = false;
24590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24591 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
24594 int16_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
24595 LDKUpdateFailMalformedHTLC this_ptr_conv;
24596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24597 this_ptr_conv.is_owned = false;
24598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24599 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
24603 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
24604 LDKUpdateFailMalformedHTLC this_ptr_conv;
24605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24606 this_ptr_conv.is_owned = false;
24607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24608 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
24611 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
24612 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
24613 uint64_t ret_ref = 0;
24614 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24615 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24617 ret_ref = (uint64_t)ret_var.inner;
24618 if (ret_var.is_owned) {
24623 int64_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
24624 LDKUpdateFailMalformedHTLC arg_conv;
24625 arg_conv.inner = (void*)(arg & (~1));
24626 arg_conv.is_owned = false;
24627 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24628 int64_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
24632 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
24633 LDKUpdateFailMalformedHTLC orig_conv;
24634 orig_conv.inner = (void*)(orig & (~1));
24635 orig_conv.is_owned = false;
24636 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24637 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
24638 uint64_t ret_ref = 0;
24639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24641 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24642 ret_ref = (uint64_t)ret_var.inner;
24643 if (ret_var.is_owned) {
24649 void __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint32_t this_obj) {
24650 LDKCommitmentSigned this_obj_conv;
24651 this_obj_conv.inner = (void*)(this_obj & (~1));
24652 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24654 CommitmentSigned_free(this_obj_conv);
24657 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
24658 LDKCommitmentSigned this_ptr_conv;
24659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24660 this_ptr_conv.is_owned = false;
24661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24662 int8_tArray ret_arr = init_int8_tArray(32);
24663 memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
24667 void __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24668 LDKCommitmentSigned this_ptr_conv;
24669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24670 this_ptr_conv.is_owned = false;
24671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24672 LDKThirtyTwoBytes val_ref;
24673 CHECK(val->arr_len == 32);
24674 memcpy(val_ref.data, val->elems, 32);
24675 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
24678 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
24679 LDKCommitmentSigned this_ptr_conv;
24680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24681 this_ptr_conv.is_owned = false;
24682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24683 int8_tArray ret_arr = init_int8_tArray(64);
24684 memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
24688 void __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
24689 LDKCommitmentSigned this_ptr_conv;
24690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24691 this_ptr_conv.is_owned = false;
24692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24693 LDKSignature val_ref;
24694 CHECK(val->arr_len == 64);
24695 memcpy(val_ref.compact_form, val->elems, 64);
24696 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
24699 void __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
24700 LDKCommitmentSigned this_ptr_conv;
24701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24702 this_ptr_conv.is_owned = false;
24703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24704 LDKCVec_SignatureZ val_constr;
24705 val_constr.datalen = val->arr_len;
24706 if (val_constr.datalen > 0)
24707 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24709 val_constr.data = NULL;
24710 int8_tArray* val_vals = (void*) val->elems;
24711 for (size_t m = 0; m < val_constr.datalen; m++) {
24712 int8_tArray val_conv_12 = val_vals[m];
24713 LDKSignature val_conv_12_ref;
24714 CHECK(val_conv_12->arr_len == 64);
24715 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64);
24716 val_constr.data[m] = val_conv_12_ref;
24718 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
24721 uint32_t __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
24722 LDKThirtyTwoBytes channel_id_arg_ref;
24723 CHECK(channel_id_arg->arr_len == 32);
24724 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24725 LDKSignature signature_arg_ref;
24726 CHECK(signature_arg->arr_len == 64);
24727 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
24728 LDKCVec_SignatureZ htlc_signatures_arg_constr;
24729 htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
24730 if (htlc_signatures_arg_constr.datalen > 0)
24731 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24733 htlc_signatures_arg_constr.data = NULL;
24734 int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
24735 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
24736 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
24737 LDKSignature htlc_signatures_arg_conv_12_ref;
24738 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
24739 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64);
24740 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
24742 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
24743 uint64_t ret_ref = 0;
24744 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24745 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24747 ret_ref = (uint64_t)ret_var.inner;
24748 if (ret_var.is_owned) {
24754 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
24755 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
24756 uint64_t ret_ref = 0;
24757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24760 ret_ref = (uint64_t)ret_var.inner;
24761 if (ret_var.is_owned) {
24766 int64_t __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
24767 LDKCommitmentSigned arg_conv;
24768 arg_conv.inner = (void*)(arg & (~1));
24769 arg_conv.is_owned = false;
24770 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24771 int64_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
24775 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint32_t orig) {
24776 LDKCommitmentSigned orig_conv;
24777 orig_conv.inner = (void*)(orig & (~1));
24778 orig_conv.is_owned = false;
24779 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24780 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
24781 uint64_t ret_ref = 0;
24782 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24783 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24785 ret_ref = (uint64_t)ret_var.inner;
24786 if (ret_var.is_owned) {
24792 void __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint32_t this_obj) {
24793 LDKRevokeAndACK this_obj_conv;
24794 this_obj_conv.inner = (void*)(this_obj & (~1));
24795 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24797 RevokeAndACK_free(this_obj_conv);
24800 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
24801 LDKRevokeAndACK this_ptr_conv;
24802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24803 this_ptr_conv.is_owned = false;
24804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24805 int8_tArray ret_arr = init_int8_tArray(32);
24806 memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
24810 void __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24811 LDKRevokeAndACK this_ptr_conv;
24812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24813 this_ptr_conv.is_owned = false;
24814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24815 LDKThirtyTwoBytes val_ref;
24816 CHECK(val->arr_len == 32);
24817 memcpy(val_ref.data, val->elems, 32);
24818 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
24821 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
24822 LDKRevokeAndACK this_ptr_conv;
24823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24824 this_ptr_conv.is_owned = false;
24825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24826 int8_tArray ret_arr = init_int8_tArray(32);
24827 memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
24831 void __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
24832 LDKRevokeAndACK this_ptr_conv;
24833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24834 this_ptr_conv.is_owned = false;
24835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24836 LDKThirtyTwoBytes val_ref;
24837 CHECK(val->arr_len == 32);
24838 memcpy(val_ref.data, val->elems, 32);
24839 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
24842 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
24843 LDKRevokeAndACK this_ptr_conv;
24844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24845 this_ptr_conv.is_owned = false;
24846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24847 int8_tArray ret_arr = init_int8_tArray(33);
24848 memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24852 void __attribute__((export_name("TS_RevokeAndACK_set_next_per_commitment_point"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
24853 LDKRevokeAndACK this_ptr_conv;
24854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24855 this_ptr_conv.is_owned = false;
24856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24857 LDKPublicKey val_ref;
24858 CHECK(val->arr_len == 33);
24859 memcpy(val_ref.compressed_form, val->elems, 33);
24860 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
24863 uint32_t __attribute__((export_name("TS_RevokeAndACK_new"))) TS_RevokeAndACK_new(int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
24864 LDKThirtyTwoBytes channel_id_arg_ref;
24865 CHECK(channel_id_arg->arr_len == 32);
24866 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24867 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
24868 CHECK(per_commitment_secret_arg->arr_len == 32);
24869 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32);
24870 LDKPublicKey next_per_commitment_point_arg_ref;
24871 CHECK(next_per_commitment_point_arg->arr_len == 33);
24872 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33);
24873 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
24874 uint64_t ret_ref = 0;
24875 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24876 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24877 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24878 ret_ref = (uint64_t)ret_var.inner;
24879 if (ret_var.is_owned) {
24885 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
24886 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
24887 uint64_t ret_ref = 0;
24888 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24889 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24891 ret_ref = (uint64_t)ret_var.inner;
24892 if (ret_var.is_owned) {
24897 int64_t __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
24898 LDKRevokeAndACK arg_conv;
24899 arg_conv.inner = (void*)(arg & (~1));
24900 arg_conv.is_owned = false;
24901 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24902 int64_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
24906 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint32_t orig) {
24907 LDKRevokeAndACK orig_conv;
24908 orig_conv.inner = (void*)(orig & (~1));
24909 orig_conv.is_owned = false;
24910 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24911 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
24912 uint64_t ret_ref = 0;
24913 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24914 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24915 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24916 ret_ref = (uint64_t)ret_var.inner;
24917 if (ret_var.is_owned) {
24923 void __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint32_t this_obj) {
24924 LDKUpdateFee this_obj_conv;
24925 this_obj_conv.inner = (void*)(this_obj & (~1));
24926 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24928 UpdateFee_free(this_obj_conv);
24931 int8_tArray __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
24932 LDKUpdateFee this_ptr_conv;
24933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24934 this_ptr_conv.is_owned = false;
24935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24936 int8_tArray ret_arr = init_int8_tArray(32);
24937 memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
24941 void __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24942 LDKUpdateFee this_ptr_conv;
24943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24944 this_ptr_conv.is_owned = false;
24945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24946 LDKThirtyTwoBytes val_ref;
24947 CHECK(val->arr_len == 32);
24948 memcpy(val_ref.data, val->elems, 32);
24949 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
24952 int32_t __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
24953 LDKUpdateFee this_ptr_conv;
24954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24955 this_ptr_conv.is_owned = false;
24956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24957 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
24961 void __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
24962 LDKUpdateFee this_ptr_conv;
24963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24964 this_ptr_conv.is_owned = false;
24965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24966 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
24969 uint32_t __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
24970 LDKThirtyTwoBytes channel_id_arg_ref;
24971 CHECK(channel_id_arg->arr_len == 32);
24972 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24973 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
24974 uint64_t ret_ref = 0;
24975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24978 ret_ref = (uint64_t)ret_var.inner;
24979 if (ret_var.is_owned) {
24985 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
24986 LDKUpdateFee ret_var = UpdateFee_clone(arg);
24987 uint64_t ret_ref = 0;
24988 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24989 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24990 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24991 ret_ref = (uint64_t)ret_var.inner;
24992 if (ret_var.is_owned) {
24997 int64_t __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
24998 LDKUpdateFee arg_conv;
24999 arg_conv.inner = (void*)(arg & (~1));
25000 arg_conv.is_owned = false;
25001 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25002 int64_t ret_val = UpdateFee_clone_ptr(&arg_conv);
25006 uint32_t __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint32_t orig) {
25007 LDKUpdateFee orig_conv;
25008 orig_conv.inner = (void*)(orig & (~1));
25009 orig_conv.is_owned = false;
25010 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25011 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
25012 uint64_t ret_ref = 0;
25013 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25014 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25016 ret_ref = (uint64_t)ret_var.inner;
25017 if (ret_var.is_owned) {
25023 void __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint32_t this_obj) {
25024 LDKDataLossProtect this_obj_conv;
25025 this_obj_conv.inner = (void*)(this_obj & (~1));
25026 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25028 DataLossProtect_free(this_obj_conv);
25031 int8_tArray __attribute__((export_name("TS_DataLossProtect_get_your_last_per_commitment_secret"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
25032 LDKDataLossProtect this_ptr_conv;
25033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25034 this_ptr_conv.is_owned = false;
25035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25036 int8_tArray ret_arr = init_int8_tArray(32);
25037 memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
25041 void __attribute__((export_name("TS_DataLossProtect_set_your_last_per_commitment_secret"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
25042 LDKDataLossProtect this_ptr_conv;
25043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25044 this_ptr_conv.is_owned = false;
25045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25046 LDKThirtyTwoBytes val_ref;
25047 CHECK(val->arr_len == 32);
25048 memcpy(val_ref.data, val->elems, 32);
25049 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
25052 int8_tArray __attribute__((export_name("TS_DataLossProtect_get_my_current_per_commitment_point"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
25053 LDKDataLossProtect this_ptr_conv;
25054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25055 this_ptr_conv.is_owned = false;
25056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25057 int8_tArray ret_arr = init_int8_tArray(33);
25058 memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
25062 void __attribute__((export_name("TS_DataLossProtect_set_my_current_per_commitment_point"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
25063 LDKDataLossProtect this_ptr_conv;
25064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25065 this_ptr_conv.is_owned = false;
25066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25067 LDKPublicKey val_ref;
25068 CHECK(val->arr_len == 33);
25069 memcpy(val_ref.compressed_form, val->elems, 33);
25070 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
25073 uint32_t __attribute__((export_name("TS_DataLossProtect_new"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
25074 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
25075 CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
25076 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32);
25077 LDKPublicKey my_current_per_commitment_point_arg_ref;
25078 CHECK(my_current_per_commitment_point_arg->arr_len == 33);
25079 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg->elems, 33);
25080 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
25081 uint64_t ret_ref = 0;
25082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25085 ret_ref = (uint64_t)ret_var.inner;
25086 if (ret_var.is_owned) {
25092 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
25093 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
25094 uint64_t ret_ref = 0;
25095 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25096 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25097 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25098 ret_ref = (uint64_t)ret_var.inner;
25099 if (ret_var.is_owned) {
25104 int64_t __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
25105 LDKDataLossProtect arg_conv;
25106 arg_conv.inner = (void*)(arg & (~1));
25107 arg_conv.is_owned = false;
25108 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25109 int64_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
25113 uint32_t __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint32_t orig) {
25114 LDKDataLossProtect orig_conv;
25115 orig_conv.inner = (void*)(orig & (~1));
25116 orig_conv.is_owned = false;
25117 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25118 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
25119 uint64_t ret_ref = 0;
25120 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25121 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25123 ret_ref = (uint64_t)ret_var.inner;
25124 if (ret_var.is_owned) {
25130 void __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint32_t this_obj) {
25131 LDKChannelReestablish this_obj_conv;
25132 this_obj_conv.inner = (void*)(this_obj & (~1));
25133 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25135 ChannelReestablish_free(this_obj_conv);
25138 int8_tArray __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
25139 LDKChannelReestablish this_ptr_conv;
25140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25141 this_ptr_conv.is_owned = false;
25142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25143 int8_tArray ret_arr = init_int8_tArray(32);
25144 memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
25148 void __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25149 LDKChannelReestablish this_ptr_conv;
25150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25151 this_ptr_conv.is_owned = false;
25152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25153 LDKThirtyTwoBytes val_ref;
25154 CHECK(val->arr_len == 32);
25155 memcpy(val_ref.data, val->elems, 32);
25156 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
25159 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
25160 LDKChannelReestablish this_ptr_conv;
25161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25162 this_ptr_conv.is_owned = false;
25163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25164 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
25168 void __attribute__((export_name("TS_ChannelReestablish_set_next_local_commitment_number"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
25169 LDKChannelReestablish this_ptr_conv;
25170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25171 this_ptr_conv.is_owned = false;
25172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25173 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
25176 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
25177 LDKChannelReestablish this_ptr_conv;
25178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25179 this_ptr_conv.is_owned = false;
25180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25181 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
25185 void __attribute__((export_name("TS_ChannelReestablish_set_next_remote_commitment_number"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
25186 LDKChannelReestablish this_ptr_conv;
25187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25188 this_ptr_conv.is_owned = false;
25189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25190 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
25193 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
25194 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
25195 uint64_t ret_ref = 0;
25196 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25197 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25199 ret_ref = (uint64_t)ret_var.inner;
25200 if (ret_var.is_owned) {
25205 int64_t __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
25206 LDKChannelReestablish arg_conv;
25207 arg_conv.inner = (void*)(arg & (~1));
25208 arg_conv.is_owned = false;
25209 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25210 int64_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
25214 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint32_t orig) {
25215 LDKChannelReestablish orig_conv;
25216 orig_conv.inner = (void*)(orig & (~1));
25217 orig_conv.is_owned = false;
25218 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25219 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
25220 uint64_t ret_ref = 0;
25221 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25222 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25223 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25224 ret_ref = (uint64_t)ret_var.inner;
25225 if (ret_var.is_owned) {
25231 void __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
25232 LDKAnnouncementSignatures this_obj_conv;
25233 this_obj_conv.inner = (void*)(this_obj & (~1));
25234 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25236 AnnouncementSignatures_free(this_obj_conv);
25239 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
25240 LDKAnnouncementSignatures this_ptr_conv;
25241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25242 this_ptr_conv.is_owned = false;
25243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25244 int8_tArray ret_arr = init_int8_tArray(32);
25245 memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
25249 void __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25250 LDKAnnouncementSignatures this_ptr_conv;
25251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25252 this_ptr_conv.is_owned = false;
25253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25254 LDKThirtyTwoBytes val_ref;
25255 CHECK(val->arr_len == 32);
25256 memcpy(val_ref.data, val->elems, 32);
25257 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
25260 int64_t __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
25261 LDKAnnouncementSignatures this_ptr_conv;
25262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25263 this_ptr_conv.is_owned = false;
25264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25265 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
25269 void __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25270 LDKAnnouncementSignatures this_ptr_conv;
25271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25272 this_ptr_conv.is_owned = false;
25273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25274 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
25277 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
25278 LDKAnnouncementSignatures this_ptr_conv;
25279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25280 this_ptr_conv.is_owned = false;
25281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25282 int8_tArray ret_arr = init_int8_tArray(64);
25283 memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
25287 void __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
25288 LDKAnnouncementSignatures this_ptr_conv;
25289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25290 this_ptr_conv.is_owned = false;
25291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25292 LDKSignature val_ref;
25293 CHECK(val->arr_len == 64);
25294 memcpy(val_ref.compact_form, val->elems, 64);
25295 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
25298 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
25299 LDKAnnouncementSignatures this_ptr_conv;
25300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25301 this_ptr_conv.is_owned = false;
25302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25303 int8_tArray ret_arr = init_int8_tArray(64);
25304 memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
25308 void __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
25309 LDKAnnouncementSignatures this_ptr_conv;
25310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25311 this_ptr_conv.is_owned = false;
25312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25313 LDKSignature val_ref;
25314 CHECK(val->arr_len == 64);
25315 memcpy(val_ref.compact_form, val->elems, 64);
25316 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
25319 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_new"))) TS_AnnouncementSignatures_new(int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
25320 LDKThirtyTwoBytes channel_id_arg_ref;
25321 CHECK(channel_id_arg->arr_len == 32);
25322 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
25323 LDKSignature node_signature_arg_ref;
25324 CHECK(node_signature_arg->arr_len == 64);
25325 memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64);
25326 LDKSignature bitcoin_signature_arg_ref;
25327 CHECK(bitcoin_signature_arg->arr_len == 64);
25328 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64);
25329 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
25330 uint64_t ret_ref = 0;
25331 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25332 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25333 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25334 ret_ref = (uint64_t)ret_var.inner;
25335 if (ret_var.is_owned) {
25341 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
25342 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
25343 uint64_t ret_ref = 0;
25344 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25345 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25346 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25347 ret_ref = (uint64_t)ret_var.inner;
25348 if (ret_var.is_owned) {
25353 int64_t __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
25354 LDKAnnouncementSignatures arg_conv;
25355 arg_conv.inner = (void*)(arg & (~1));
25356 arg_conv.is_owned = false;
25357 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25358 int64_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
25362 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
25363 LDKAnnouncementSignatures orig_conv;
25364 orig_conv.inner = (void*)(orig & (~1));
25365 orig_conv.is_owned = false;
25366 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25367 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
25368 uint64_t ret_ref = 0;
25369 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25370 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25371 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25372 ret_ref = (uint64_t)ret_var.inner;
25373 if (ret_var.is_owned) {
25379 void __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint32_t this_ptr) {
25380 if ((this_ptr & 1) != 0) return;
25381 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
25382 CHECK_ACCESS(this_ptr_ptr);
25383 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
25384 FREE((void*)this_ptr);
25385 NetAddress_free(this_ptr_conv);
25388 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
25389 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25390 *ret_copy = NetAddress_clone(arg);
25391 uint64_t ret_ref = (uint64_t)ret_copy;
25394 int64_t __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint32_t arg) {
25395 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
25396 int64_t ret_val = NetAddress_clone_ptr(arg_conv);
25400 uint32_t __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint32_t orig) {
25401 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
25402 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25403 *ret_copy = NetAddress_clone(orig_conv);
25404 uint64_t ret_ref = (uint64_t)ret_copy;
25408 uint32_t __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
25409 LDKFourBytes addr_ref;
25410 CHECK(addr->arr_len == 4);
25411 memcpy(addr_ref.data, addr->elems, 4);
25412 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25413 *ret_copy = NetAddress_ipv4(addr_ref, port);
25414 uint64_t ret_ref = (uint64_t)ret_copy;
25418 uint32_t __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
25419 LDKSixteenBytes addr_ref;
25420 CHECK(addr->arr_len == 16);
25421 memcpy(addr_ref.data, addr->elems, 16);
25422 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25423 *ret_copy = NetAddress_ipv6(addr_ref, port);
25424 uint64_t ret_ref = (uint64_t)ret_copy;
25428 uint32_t __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
25429 LDKTwelveBytes a_ref;
25430 CHECK(a->arr_len == 12);
25431 memcpy(a_ref.data, a->elems, 12);
25432 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25433 *ret_copy = NetAddress_onion_v2(a_ref);
25434 uint64_t ret_ref = (uint64_t)ret_copy;
25438 uint32_t __attribute__((export_name("TS_NetAddress_onion_v3"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
25439 LDKThirtyTwoBytes ed25519_pubkey_ref;
25440 CHECK(ed25519_pubkey->arr_len == 32);
25441 memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32);
25442 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25443 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
25444 uint64_t ret_ref = (uint64_t)ret_copy;
25448 int8_tArray __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint32_t obj) {
25449 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
25450 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
25451 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
25452 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25453 CVec_u8Z_free(ret_var);
25457 uint32_t __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
25458 LDKu8slice ser_ref;
25459 ser_ref.datalen = ser->arr_len;
25460 ser_ref.data = ser->elems;
25461 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
25462 *ret_conv = NetAddress_read(ser_ref);
25463 return (uint64_t)ret_conv;
25466 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
25467 LDKUnsignedNodeAnnouncement this_obj_conv;
25468 this_obj_conv.inner = (void*)(this_obj & (~1));
25469 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25471 UnsignedNodeAnnouncement_free(this_obj_conv);
25474 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
25475 LDKUnsignedNodeAnnouncement this_ptr_conv;
25476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25477 this_ptr_conv.is_owned = false;
25478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25479 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
25480 uint64_t ret_ref = 0;
25481 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25482 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25484 ret_ref = (uint64_t)ret_var.inner;
25485 if (ret_var.is_owned) {
25491 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25492 LDKUnsignedNodeAnnouncement this_ptr_conv;
25493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25494 this_ptr_conv.is_owned = false;
25495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25496 LDKNodeFeatures val_conv;
25497 val_conv.inner = (void*)(val & (~1));
25498 val_conv.is_owned = (val & 1) || (val == 0);
25499 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25500 val_conv = NodeFeatures_clone(&val_conv);
25501 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
25504 int32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
25505 LDKUnsignedNodeAnnouncement this_ptr_conv;
25506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25507 this_ptr_conv.is_owned = false;
25508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25509 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
25513 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
25514 LDKUnsignedNodeAnnouncement this_ptr_conv;
25515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25516 this_ptr_conv.is_owned = false;
25517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25518 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
25521 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
25522 LDKUnsignedNodeAnnouncement this_ptr_conv;
25523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25524 this_ptr_conv.is_owned = false;
25525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25526 int8_tArray ret_arr = init_int8_tArray(33);
25527 memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
25531 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
25532 LDKUnsignedNodeAnnouncement this_ptr_conv;
25533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25534 this_ptr_conv.is_owned = false;
25535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25536 LDKPublicKey val_ref;
25537 CHECK(val->arr_len == 33);
25538 memcpy(val_ref.compressed_form, val->elems, 33);
25539 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
25542 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
25543 LDKUnsignedNodeAnnouncement this_ptr_conv;
25544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25545 this_ptr_conv.is_owned = false;
25546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25547 int8_tArray ret_arr = init_int8_tArray(3);
25548 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
25552 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
25553 LDKUnsignedNodeAnnouncement this_ptr_conv;
25554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25555 this_ptr_conv.is_owned = false;
25556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25557 LDKThreeBytes val_ref;
25558 CHECK(val->arr_len == 3);
25559 memcpy(val_ref.data, val->elems, 3);
25560 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
25563 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
25564 LDKUnsignedNodeAnnouncement this_ptr_conv;
25565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25566 this_ptr_conv.is_owned = false;
25567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25568 int8_tArray ret_arr = init_int8_tArray(32);
25569 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
25573 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
25574 LDKUnsignedNodeAnnouncement this_ptr_conv;
25575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25576 this_ptr_conv.is_owned = false;
25577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25578 LDKThirtyTwoBytes val_ref;
25579 CHECK(val->arr_len == 32);
25580 memcpy(val_ref.data, val->elems, 32);
25581 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
25584 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
25585 LDKUnsignedNodeAnnouncement this_ptr_conv;
25586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25587 this_ptr_conv.is_owned = false;
25588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25589 LDKCVec_NetAddressZ val_constr;
25590 val_constr.datalen = val->arr_len;
25591 if (val_constr.datalen > 0)
25592 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25594 val_constr.data = NULL;
25595 uint32_t* val_vals = val->elems;
25596 for (size_t m = 0; m < val_constr.datalen; m++) {
25597 uint32_t val_conv_12 = val_vals[m];
25598 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
25599 CHECK_ACCESS(val_conv_12_ptr);
25600 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
25601 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
25602 val_constr.data[m] = val_conv_12_conv;
25604 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
25607 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
25608 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
25609 uint64_t ret_ref = 0;
25610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25613 ret_ref = (uint64_t)ret_var.inner;
25614 if (ret_var.is_owned) {
25619 int64_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
25620 LDKUnsignedNodeAnnouncement arg_conv;
25621 arg_conv.inner = (void*)(arg & (~1));
25622 arg_conv.is_owned = false;
25623 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25624 int64_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
25628 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
25629 LDKUnsignedNodeAnnouncement orig_conv;
25630 orig_conv.inner = (void*)(orig & (~1));
25631 orig_conv.is_owned = false;
25632 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25633 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
25634 uint64_t ret_ref = 0;
25635 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25636 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25638 ret_ref = (uint64_t)ret_var.inner;
25639 if (ret_var.is_owned) {
25645 void __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
25646 LDKNodeAnnouncement this_obj_conv;
25647 this_obj_conv.inner = (void*)(this_obj & (~1));
25648 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25650 NodeAnnouncement_free(this_obj_conv);
25653 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
25654 LDKNodeAnnouncement this_ptr_conv;
25655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25656 this_ptr_conv.is_owned = false;
25657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25658 int8_tArray ret_arr = init_int8_tArray(64);
25659 memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
25663 void __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
25664 LDKNodeAnnouncement this_ptr_conv;
25665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25666 this_ptr_conv.is_owned = false;
25667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25668 LDKSignature val_ref;
25669 CHECK(val->arr_len == 64);
25670 memcpy(val_ref.compact_form, val->elems, 64);
25671 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
25674 uint32_t __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
25675 LDKNodeAnnouncement this_ptr_conv;
25676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25677 this_ptr_conv.is_owned = false;
25678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25679 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
25680 uint64_t ret_ref = 0;
25681 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25682 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25684 ret_ref = (uint64_t)ret_var.inner;
25685 if (ret_var.is_owned) {
25691 void __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
25692 LDKNodeAnnouncement this_ptr_conv;
25693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25694 this_ptr_conv.is_owned = false;
25695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25696 LDKUnsignedNodeAnnouncement val_conv;
25697 val_conv.inner = (void*)(val & (~1));
25698 val_conv.is_owned = (val & 1) || (val == 0);
25699 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25700 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
25701 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
25704 uint32_t __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
25705 LDKSignature signature_arg_ref;
25706 CHECK(signature_arg->arr_len == 64);
25707 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
25708 LDKUnsignedNodeAnnouncement contents_arg_conv;
25709 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25710 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25711 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25712 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
25713 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
25714 uint64_t ret_ref = 0;
25715 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25716 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25718 ret_ref = (uint64_t)ret_var.inner;
25719 if (ret_var.is_owned) {
25725 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
25726 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
25727 uint64_t ret_ref = 0;
25728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25731 ret_ref = (uint64_t)ret_var.inner;
25732 if (ret_var.is_owned) {
25737 int64_t __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
25738 LDKNodeAnnouncement arg_conv;
25739 arg_conv.inner = (void*)(arg & (~1));
25740 arg_conv.is_owned = false;
25741 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25742 int64_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
25746 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint32_t orig) {
25747 LDKNodeAnnouncement orig_conv;
25748 orig_conv.inner = (void*)(orig & (~1));
25749 orig_conv.is_owned = false;
25750 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25751 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
25752 uint64_t ret_ref = 0;
25753 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25754 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25756 ret_ref = (uint64_t)ret_var.inner;
25757 if (ret_var.is_owned) {
25763 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
25764 LDKUnsignedChannelAnnouncement this_obj_conv;
25765 this_obj_conv.inner = (void*)(this_obj & (~1));
25766 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25768 UnsignedChannelAnnouncement_free(this_obj_conv);
25771 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
25772 LDKUnsignedChannelAnnouncement this_ptr_conv;
25773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25774 this_ptr_conv.is_owned = false;
25775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25776 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
25777 uint64_t ret_ref = 0;
25778 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25779 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25781 ret_ref = (uint64_t)ret_var.inner;
25782 if (ret_var.is_owned) {
25788 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25789 LDKUnsignedChannelAnnouncement this_ptr_conv;
25790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25791 this_ptr_conv.is_owned = false;
25792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25793 LDKChannelFeatures val_conv;
25794 val_conv.inner = (void*)(val & (~1));
25795 val_conv.is_owned = (val & 1) || (val == 0);
25796 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25797 val_conv = ChannelFeatures_clone(&val_conv);
25798 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
25801 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
25802 LDKUnsignedChannelAnnouncement this_ptr_conv;
25803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25804 this_ptr_conv.is_owned = false;
25805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25806 int8_tArray ret_arr = init_int8_tArray(32);
25807 memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
25811 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
25812 LDKUnsignedChannelAnnouncement this_ptr_conv;
25813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25814 this_ptr_conv.is_owned = false;
25815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25816 LDKThirtyTwoBytes val_ref;
25817 CHECK(val->arr_len == 32);
25818 memcpy(val_ref.data, val->elems, 32);
25819 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
25822 int64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
25823 LDKUnsignedChannelAnnouncement this_ptr_conv;
25824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25825 this_ptr_conv.is_owned = false;
25826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25827 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
25831 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25832 LDKUnsignedChannelAnnouncement this_ptr_conv;
25833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25834 this_ptr_conv.is_owned = false;
25835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25836 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
25839 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
25840 LDKUnsignedChannelAnnouncement this_ptr_conv;
25841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25842 this_ptr_conv.is_owned = false;
25843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25844 int8_tArray ret_arr = init_int8_tArray(33);
25845 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
25849 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
25850 LDKUnsignedChannelAnnouncement this_ptr_conv;
25851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25852 this_ptr_conv.is_owned = false;
25853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25854 LDKPublicKey val_ref;
25855 CHECK(val->arr_len == 33);
25856 memcpy(val_ref.compressed_form, val->elems, 33);
25857 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
25860 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
25861 LDKUnsignedChannelAnnouncement this_ptr_conv;
25862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25863 this_ptr_conv.is_owned = false;
25864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25865 int8_tArray ret_arr = init_int8_tArray(33);
25866 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
25870 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
25871 LDKUnsignedChannelAnnouncement this_ptr_conv;
25872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25873 this_ptr_conv.is_owned = false;
25874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25875 LDKPublicKey val_ref;
25876 CHECK(val->arr_len == 33);
25877 memcpy(val_ref.compressed_form, val->elems, 33);
25878 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
25881 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
25882 LDKUnsignedChannelAnnouncement this_ptr_conv;
25883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25884 this_ptr_conv.is_owned = false;
25885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25886 int8_tArray ret_arr = init_int8_tArray(33);
25887 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
25891 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
25892 LDKUnsignedChannelAnnouncement this_ptr_conv;
25893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25894 this_ptr_conv.is_owned = false;
25895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25896 LDKPublicKey val_ref;
25897 CHECK(val->arr_len == 33);
25898 memcpy(val_ref.compressed_form, val->elems, 33);
25899 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
25902 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
25903 LDKUnsignedChannelAnnouncement this_ptr_conv;
25904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25905 this_ptr_conv.is_owned = false;
25906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25907 int8_tArray ret_arr = init_int8_tArray(33);
25908 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
25912 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
25913 LDKUnsignedChannelAnnouncement this_ptr_conv;
25914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25915 this_ptr_conv.is_owned = false;
25916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25917 LDKPublicKey val_ref;
25918 CHECK(val->arr_len == 33);
25919 memcpy(val_ref.compressed_form, val->elems, 33);
25920 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
25923 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
25924 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
25925 uint64_t ret_ref = 0;
25926 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25927 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25929 ret_ref = (uint64_t)ret_var.inner;
25930 if (ret_var.is_owned) {
25935 int64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
25936 LDKUnsignedChannelAnnouncement arg_conv;
25937 arg_conv.inner = (void*)(arg & (~1));
25938 arg_conv.is_owned = false;
25939 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25940 int64_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
25944 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
25945 LDKUnsignedChannelAnnouncement orig_conv;
25946 orig_conv.inner = (void*)(orig & (~1));
25947 orig_conv.is_owned = false;
25948 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25949 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
25950 uint64_t ret_ref = 0;
25951 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25952 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25954 ret_ref = (uint64_t)ret_var.inner;
25955 if (ret_var.is_owned) {
25961 void __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
25962 LDKChannelAnnouncement this_obj_conv;
25963 this_obj_conv.inner = (void*)(this_obj & (~1));
25964 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25966 ChannelAnnouncement_free(this_obj_conv);
25969 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
25970 LDKChannelAnnouncement this_ptr_conv;
25971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25972 this_ptr_conv.is_owned = false;
25973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25974 int8_tArray ret_arr = init_int8_tArray(64);
25975 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
25979 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
25980 LDKChannelAnnouncement this_ptr_conv;
25981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25982 this_ptr_conv.is_owned = false;
25983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25984 LDKSignature val_ref;
25985 CHECK(val->arr_len == 64);
25986 memcpy(val_ref.compact_form, val->elems, 64);
25987 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
25990 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
25991 LDKChannelAnnouncement this_ptr_conv;
25992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25993 this_ptr_conv.is_owned = false;
25994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25995 int8_tArray ret_arr = init_int8_tArray(64);
25996 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
26000 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
26001 LDKChannelAnnouncement this_ptr_conv;
26002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26003 this_ptr_conv.is_owned = false;
26004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26005 LDKSignature val_ref;
26006 CHECK(val->arr_len == 64);
26007 memcpy(val_ref.compact_form, val->elems, 64);
26008 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
26011 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
26012 LDKChannelAnnouncement this_ptr_conv;
26013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26014 this_ptr_conv.is_owned = false;
26015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26016 int8_tArray ret_arr = init_int8_tArray(64);
26017 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
26021 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
26022 LDKChannelAnnouncement this_ptr_conv;
26023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26024 this_ptr_conv.is_owned = false;
26025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26026 LDKSignature val_ref;
26027 CHECK(val->arr_len == 64);
26028 memcpy(val_ref.compact_form, val->elems, 64);
26029 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
26032 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
26033 LDKChannelAnnouncement this_ptr_conv;
26034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26035 this_ptr_conv.is_owned = false;
26036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26037 int8_tArray ret_arr = init_int8_tArray(64);
26038 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
26042 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
26043 LDKChannelAnnouncement this_ptr_conv;
26044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26045 this_ptr_conv.is_owned = false;
26046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26047 LDKSignature val_ref;
26048 CHECK(val->arr_len == 64);
26049 memcpy(val_ref.compact_form, val->elems, 64);
26050 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
26053 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
26054 LDKChannelAnnouncement this_ptr_conv;
26055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26056 this_ptr_conv.is_owned = false;
26057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26058 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
26059 uint64_t ret_ref = 0;
26060 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26061 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26062 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26063 ret_ref = (uint64_t)ret_var.inner;
26064 if (ret_var.is_owned) {
26070 void __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
26071 LDKChannelAnnouncement this_ptr_conv;
26072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26073 this_ptr_conv.is_owned = false;
26074 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26075 LDKUnsignedChannelAnnouncement val_conv;
26076 val_conv.inner = (void*)(val & (~1));
26077 val_conv.is_owned = (val & 1) || (val == 0);
26078 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26079 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
26080 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
26083 uint32_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, uint32_t contents_arg) {
26084 LDKSignature node_signature_1_arg_ref;
26085 CHECK(node_signature_1_arg->arr_len == 64);
26086 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64);
26087 LDKSignature node_signature_2_arg_ref;
26088 CHECK(node_signature_2_arg->arr_len == 64);
26089 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64);
26090 LDKSignature bitcoin_signature_1_arg_ref;
26091 CHECK(bitcoin_signature_1_arg->arr_len == 64);
26092 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64);
26093 LDKSignature bitcoin_signature_2_arg_ref;
26094 CHECK(bitcoin_signature_2_arg->arr_len == 64);
26095 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64);
26096 LDKUnsignedChannelAnnouncement contents_arg_conv;
26097 contents_arg_conv.inner = (void*)(contents_arg & (~1));
26098 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
26099 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
26100 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
26101 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);
26102 uint64_t ret_ref = 0;
26103 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26104 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26105 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26106 ret_ref = (uint64_t)ret_var.inner;
26107 if (ret_var.is_owned) {
26113 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
26114 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
26115 uint64_t ret_ref = 0;
26116 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26117 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26119 ret_ref = (uint64_t)ret_var.inner;
26120 if (ret_var.is_owned) {
26125 int64_t __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
26126 LDKChannelAnnouncement arg_conv;
26127 arg_conv.inner = (void*)(arg & (~1));
26128 arg_conv.is_owned = false;
26129 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26130 int64_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
26134 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
26135 LDKChannelAnnouncement orig_conv;
26136 orig_conv.inner = (void*)(orig & (~1));
26137 orig_conv.is_owned = false;
26138 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26139 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
26140 uint64_t ret_ref = 0;
26141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26144 ret_ref = (uint64_t)ret_var.inner;
26145 if (ret_var.is_owned) {
26151 void __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
26152 LDKUnsignedChannelUpdate this_obj_conv;
26153 this_obj_conv.inner = (void*)(this_obj & (~1));
26154 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26156 UnsignedChannelUpdate_free(this_obj_conv);
26159 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
26160 LDKUnsignedChannelUpdate this_ptr_conv;
26161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26162 this_ptr_conv.is_owned = false;
26163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26164 int8_tArray ret_arr = init_int8_tArray(32);
26165 memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
26169 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26170 LDKUnsignedChannelUpdate this_ptr_conv;
26171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26172 this_ptr_conv.is_owned = false;
26173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26174 LDKThirtyTwoBytes val_ref;
26175 CHECK(val->arr_len == 32);
26176 memcpy(val_ref.data, val->elems, 32);
26177 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
26180 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
26181 LDKUnsignedChannelUpdate this_ptr_conv;
26182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26183 this_ptr_conv.is_owned = false;
26184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26185 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
26189 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
26190 LDKUnsignedChannelUpdate this_ptr_conv;
26191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26192 this_ptr_conv.is_owned = false;
26193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26194 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
26197 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
26198 LDKUnsignedChannelUpdate this_ptr_conv;
26199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26200 this_ptr_conv.is_owned = false;
26201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26202 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
26206 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
26207 LDKUnsignedChannelUpdate this_ptr_conv;
26208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26209 this_ptr_conv.is_owned = false;
26210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26211 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
26214 int8_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
26215 LDKUnsignedChannelUpdate this_ptr_conv;
26216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26217 this_ptr_conv.is_owned = false;
26218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26219 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
26223 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
26224 LDKUnsignedChannelUpdate this_ptr_conv;
26225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26226 this_ptr_conv.is_owned = false;
26227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26228 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
26231 int16_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
26232 LDKUnsignedChannelUpdate this_ptr_conv;
26233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26234 this_ptr_conv.is_owned = false;
26235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26236 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
26240 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
26241 LDKUnsignedChannelUpdate this_ptr_conv;
26242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26243 this_ptr_conv.is_owned = false;
26244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26245 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
26248 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
26249 LDKUnsignedChannelUpdate this_ptr_conv;
26250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26251 this_ptr_conv.is_owned = false;
26252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26253 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
26257 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
26258 LDKUnsignedChannelUpdate this_ptr_conv;
26259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26260 this_ptr_conv.is_owned = false;
26261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26262 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
26265 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
26266 LDKUnsignedChannelUpdate this_ptr_conv;
26267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26268 this_ptr_conv.is_owned = false;
26269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26270 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
26274 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
26275 LDKUnsignedChannelUpdate this_ptr_conv;
26276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26277 this_ptr_conv.is_owned = false;
26278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26279 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
26282 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
26283 LDKUnsignedChannelUpdate this_ptr_conv;
26284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26285 this_ptr_conv.is_owned = false;
26286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26287 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
26291 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
26292 LDKUnsignedChannelUpdate this_ptr_conv;
26293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26294 this_ptr_conv.is_owned = false;
26295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26296 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
26299 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
26300 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
26301 uint64_t ret_ref = 0;
26302 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26303 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26304 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26305 ret_ref = (uint64_t)ret_var.inner;
26306 if (ret_var.is_owned) {
26311 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
26312 LDKUnsignedChannelUpdate arg_conv;
26313 arg_conv.inner = (void*)(arg & (~1));
26314 arg_conv.is_owned = false;
26315 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26316 int64_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
26320 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
26321 LDKUnsignedChannelUpdate orig_conv;
26322 orig_conv.inner = (void*)(orig & (~1));
26323 orig_conv.is_owned = false;
26324 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26325 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
26326 uint64_t ret_ref = 0;
26327 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26328 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26330 ret_ref = (uint64_t)ret_var.inner;
26331 if (ret_var.is_owned) {
26337 void __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint32_t this_obj) {
26338 LDKChannelUpdate this_obj_conv;
26339 this_obj_conv.inner = (void*)(this_obj & (~1));
26340 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26342 ChannelUpdate_free(this_obj_conv);
26345 int8_tArray __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
26346 LDKChannelUpdate this_ptr_conv;
26347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26348 this_ptr_conv.is_owned = false;
26349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26350 int8_tArray ret_arr = init_int8_tArray(64);
26351 memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
26355 void __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
26356 LDKChannelUpdate this_ptr_conv;
26357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26358 this_ptr_conv.is_owned = false;
26359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26360 LDKSignature val_ref;
26361 CHECK(val->arr_len == 64);
26362 memcpy(val_ref.compact_form, val->elems, 64);
26363 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
26366 uint32_t __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
26367 LDKChannelUpdate this_ptr_conv;
26368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26369 this_ptr_conv.is_owned = false;
26370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26371 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
26372 uint64_t ret_ref = 0;
26373 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26374 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26376 ret_ref = (uint64_t)ret_var.inner;
26377 if (ret_var.is_owned) {
26383 void __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
26384 LDKChannelUpdate this_ptr_conv;
26385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26386 this_ptr_conv.is_owned = false;
26387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26388 LDKUnsignedChannelUpdate val_conv;
26389 val_conv.inner = (void*)(val & (~1));
26390 val_conv.is_owned = (val & 1) || (val == 0);
26391 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26392 val_conv = UnsignedChannelUpdate_clone(&val_conv);
26393 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
26396 uint32_t __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
26397 LDKSignature signature_arg_ref;
26398 CHECK(signature_arg->arr_len == 64);
26399 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
26400 LDKUnsignedChannelUpdate contents_arg_conv;
26401 contents_arg_conv.inner = (void*)(contents_arg & (~1));
26402 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
26403 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
26404 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
26405 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
26406 uint64_t ret_ref = 0;
26407 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26408 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26409 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26410 ret_ref = (uint64_t)ret_var.inner;
26411 if (ret_var.is_owned) {
26417 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
26418 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
26419 uint64_t ret_ref = 0;
26420 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26421 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26423 ret_ref = (uint64_t)ret_var.inner;
26424 if (ret_var.is_owned) {
26429 int64_t __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
26430 LDKChannelUpdate arg_conv;
26431 arg_conv.inner = (void*)(arg & (~1));
26432 arg_conv.is_owned = false;
26433 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26434 int64_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
26438 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint32_t orig) {
26439 LDKChannelUpdate orig_conv;
26440 orig_conv.inner = (void*)(orig & (~1));
26441 orig_conv.is_owned = false;
26442 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26443 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
26444 uint64_t ret_ref = 0;
26445 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26446 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26448 ret_ref = (uint64_t)ret_var.inner;
26449 if (ret_var.is_owned) {
26455 void __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint32_t this_obj) {
26456 LDKQueryChannelRange this_obj_conv;
26457 this_obj_conv.inner = (void*)(this_obj & (~1));
26458 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26460 QueryChannelRange_free(this_obj_conv);
26463 int8_tArray __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
26464 LDKQueryChannelRange this_ptr_conv;
26465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26466 this_ptr_conv.is_owned = false;
26467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26468 int8_tArray ret_arr = init_int8_tArray(32);
26469 memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
26473 void __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26474 LDKQueryChannelRange this_ptr_conv;
26475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26476 this_ptr_conv.is_owned = false;
26477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26478 LDKThirtyTwoBytes val_ref;
26479 CHECK(val->arr_len == 32);
26480 memcpy(val_ref.data, val->elems, 32);
26481 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26484 int32_t __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
26485 LDKQueryChannelRange this_ptr_conv;
26486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26487 this_ptr_conv.is_owned = false;
26488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26489 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
26493 void __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26494 LDKQueryChannelRange this_ptr_conv;
26495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26496 this_ptr_conv.is_owned = false;
26497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26498 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
26501 int32_t __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26502 LDKQueryChannelRange this_ptr_conv;
26503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26504 this_ptr_conv.is_owned = false;
26505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26506 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
26510 void __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26511 LDKQueryChannelRange this_ptr_conv;
26512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26513 this_ptr_conv.is_owned = false;
26514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26515 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26518 uint32_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) {
26519 LDKThirtyTwoBytes chain_hash_arg_ref;
26520 CHECK(chain_hash_arg->arr_len == 32);
26521 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26522 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
26523 uint64_t ret_ref = 0;
26524 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26525 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26527 ret_ref = (uint64_t)ret_var.inner;
26528 if (ret_var.is_owned) {
26534 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
26535 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
26536 uint64_t ret_ref = 0;
26537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26540 ret_ref = (uint64_t)ret_var.inner;
26541 if (ret_var.is_owned) {
26546 int64_t __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint32_t arg) {
26547 LDKQueryChannelRange arg_conv;
26548 arg_conv.inner = (void*)(arg & (~1));
26549 arg_conv.is_owned = false;
26550 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26551 int64_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
26555 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint32_t orig) {
26556 LDKQueryChannelRange orig_conv;
26557 orig_conv.inner = (void*)(orig & (~1));
26558 orig_conv.is_owned = false;
26559 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26560 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
26561 uint64_t ret_ref = 0;
26562 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26563 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26565 ret_ref = (uint64_t)ret_var.inner;
26566 if (ret_var.is_owned) {
26572 void __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
26573 LDKReplyChannelRange this_obj_conv;
26574 this_obj_conv.inner = (void*)(this_obj & (~1));
26575 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26577 ReplyChannelRange_free(this_obj_conv);
26580 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
26581 LDKReplyChannelRange this_ptr_conv;
26582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26583 this_ptr_conv.is_owned = false;
26584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26585 int8_tArray ret_arr = init_int8_tArray(32);
26586 memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
26590 void __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26591 LDKReplyChannelRange this_ptr_conv;
26592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26593 this_ptr_conv.is_owned = false;
26594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26595 LDKThirtyTwoBytes val_ref;
26596 CHECK(val->arr_len == 32);
26597 memcpy(val_ref.data, val->elems, 32);
26598 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26601 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
26602 LDKReplyChannelRange this_ptr_conv;
26603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26604 this_ptr_conv.is_owned = false;
26605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26606 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
26610 void __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26611 LDKReplyChannelRange this_ptr_conv;
26612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26613 this_ptr_conv.is_owned = false;
26614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26615 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
26618 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26619 LDKReplyChannelRange this_ptr_conv;
26620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26621 this_ptr_conv.is_owned = false;
26622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26623 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
26627 void __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26628 LDKReplyChannelRange this_ptr_conv;
26629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26630 this_ptr_conv.is_owned = false;
26631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26632 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26635 jboolean __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
26636 LDKReplyChannelRange this_ptr_conv;
26637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26638 this_ptr_conv.is_owned = false;
26639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26640 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
26644 void __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
26645 LDKReplyChannelRange this_ptr_conv;
26646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26647 this_ptr_conv.is_owned = false;
26648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26649 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
26652 void __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26653 LDKReplyChannelRange this_ptr_conv;
26654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26655 this_ptr_conv.is_owned = false;
26656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26657 LDKCVec_u64Z val_constr;
26658 val_constr.datalen = val->arr_len;
26659 if (val_constr.datalen > 0)
26660 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26662 val_constr.data = NULL;
26663 int64_t* val_vals = val->elems;
26664 for (size_t i = 0; i < val_constr.datalen; i++) {
26665 int64_t val_conv_8 = val_vals[i];
26666 val_constr.data[i] = val_conv_8;
26668 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
26671 uint32_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) {
26672 LDKThirtyTwoBytes chain_hash_arg_ref;
26673 CHECK(chain_hash_arg->arr_len == 32);
26674 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26675 LDKCVec_u64Z short_channel_ids_arg_constr;
26676 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
26677 if (short_channel_ids_arg_constr.datalen > 0)
26678 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26680 short_channel_ids_arg_constr.data = NULL;
26681 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
26682 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26683 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26684 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26686 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
26687 uint64_t ret_ref = 0;
26688 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26689 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26691 ret_ref = (uint64_t)ret_var.inner;
26692 if (ret_var.is_owned) {
26698 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
26699 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
26700 uint64_t ret_ref = 0;
26701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26704 ret_ref = (uint64_t)ret_var.inner;
26705 if (ret_var.is_owned) {
26710 int64_t __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
26711 LDKReplyChannelRange arg_conv;
26712 arg_conv.inner = (void*)(arg & (~1));
26713 arg_conv.is_owned = false;
26714 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26715 int64_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
26719 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint32_t orig) {
26720 LDKReplyChannelRange orig_conv;
26721 orig_conv.inner = (void*)(orig & (~1));
26722 orig_conv.is_owned = false;
26723 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26724 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
26725 uint64_t ret_ref = 0;
26726 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26727 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26729 ret_ref = (uint64_t)ret_var.inner;
26730 if (ret_var.is_owned) {
26736 void __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
26737 LDKQueryShortChannelIds this_obj_conv;
26738 this_obj_conv.inner = (void*)(this_obj & (~1));
26739 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26741 QueryShortChannelIds_free(this_obj_conv);
26744 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
26745 LDKQueryShortChannelIds this_ptr_conv;
26746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26747 this_ptr_conv.is_owned = false;
26748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26749 int8_tArray ret_arr = init_int8_tArray(32);
26750 memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
26754 void __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26755 LDKQueryShortChannelIds this_ptr_conv;
26756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26757 this_ptr_conv.is_owned = false;
26758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26759 LDKThirtyTwoBytes val_ref;
26760 CHECK(val->arr_len == 32);
26761 memcpy(val_ref.data, val->elems, 32);
26762 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
26765 void __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26766 LDKQueryShortChannelIds this_ptr_conv;
26767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26768 this_ptr_conv.is_owned = false;
26769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26770 LDKCVec_u64Z val_constr;
26771 val_constr.datalen = val->arr_len;
26772 if (val_constr.datalen > 0)
26773 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26775 val_constr.data = NULL;
26776 int64_t* val_vals = val->elems;
26777 for (size_t i = 0; i < val_constr.datalen; i++) {
26778 int64_t val_conv_8 = val_vals[i];
26779 val_constr.data[i] = val_conv_8;
26781 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
26784 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
26785 LDKThirtyTwoBytes chain_hash_arg_ref;
26786 CHECK(chain_hash_arg->arr_len == 32);
26787 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26788 LDKCVec_u64Z short_channel_ids_arg_constr;
26789 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
26790 if (short_channel_ids_arg_constr.datalen > 0)
26791 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26793 short_channel_ids_arg_constr.data = NULL;
26794 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
26795 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26796 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26797 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26799 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
26800 uint64_t ret_ref = 0;
26801 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26802 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26803 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26804 ret_ref = (uint64_t)ret_var.inner;
26805 if (ret_var.is_owned) {
26811 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
26812 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
26813 uint64_t ret_ref = 0;
26814 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26815 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26816 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26817 ret_ref = (uint64_t)ret_var.inner;
26818 if (ret_var.is_owned) {
26823 int64_t __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
26824 LDKQueryShortChannelIds arg_conv;
26825 arg_conv.inner = (void*)(arg & (~1));
26826 arg_conv.is_owned = false;
26827 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26828 int64_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
26832 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
26833 LDKQueryShortChannelIds orig_conv;
26834 orig_conv.inner = (void*)(orig & (~1));
26835 orig_conv.is_owned = false;
26836 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26837 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
26838 uint64_t ret_ref = 0;
26839 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26840 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26841 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26842 ret_ref = (uint64_t)ret_var.inner;
26843 if (ret_var.is_owned) {
26849 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
26850 LDKReplyShortChannelIdsEnd this_obj_conv;
26851 this_obj_conv.inner = (void*)(this_obj & (~1));
26852 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26854 ReplyShortChannelIdsEnd_free(this_obj_conv);
26857 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
26858 LDKReplyShortChannelIdsEnd this_ptr_conv;
26859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26860 this_ptr_conv.is_owned = false;
26861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26862 int8_tArray ret_arr = init_int8_tArray(32);
26863 memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
26867 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26868 LDKReplyShortChannelIdsEnd this_ptr_conv;
26869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26870 this_ptr_conv.is_owned = false;
26871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26872 LDKThirtyTwoBytes val_ref;
26873 CHECK(val->arr_len == 32);
26874 memcpy(val_ref.data, val->elems, 32);
26875 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
26878 jboolean __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
26879 LDKReplyShortChannelIdsEnd this_ptr_conv;
26880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26881 this_ptr_conv.is_owned = false;
26882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26883 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
26887 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
26888 LDKReplyShortChannelIdsEnd this_ptr_conv;
26889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26890 this_ptr_conv.is_owned = false;
26891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26892 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
26895 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
26896 LDKThirtyTwoBytes chain_hash_arg_ref;
26897 CHECK(chain_hash_arg->arr_len == 32);
26898 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26899 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
26900 uint64_t ret_ref = 0;
26901 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26902 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26904 ret_ref = (uint64_t)ret_var.inner;
26905 if (ret_var.is_owned) {
26911 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
26912 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
26913 uint64_t ret_ref = 0;
26914 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26915 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26916 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26917 ret_ref = (uint64_t)ret_var.inner;
26918 if (ret_var.is_owned) {
26923 int64_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
26924 LDKReplyShortChannelIdsEnd arg_conv;
26925 arg_conv.inner = (void*)(arg & (~1));
26926 arg_conv.is_owned = false;
26927 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26928 int64_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
26932 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
26933 LDKReplyShortChannelIdsEnd orig_conv;
26934 orig_conv.inner = (void*)(orig & (~1));
26935 orig_conv.is_owned = false;
26936 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26937 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
26938 uint64_t ret_ref = 0;
26939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26941 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26942 ret_ref = (uint64_t)ret_var.inner;
26943 if (ret_var.is_owned) {
26949 void __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
26950 LDKGossipTimestampFilter this_obj_conv;
26951 this_obj_conv.inner = (void*)(this_obj & (~1));
26952 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26954 GossipTimestampFilter_free(this_obj_conv);
26957 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
26958 LDKGossipTimestampFilter this_ptr_conv;
26959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26960 this_ptr_conv.is_owned = false;
26961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26962 int8_tArray ret_arr = init_int8_tArray(32);
26963 memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
26967 void __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26968 LDKGossipTimestampFilter this_ptr_conv;
26969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26970 this_ptr_conv.is_owned = false;
26971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26972 LDKThirtyTwoBytes val_ref;
26973 CHECK(val->arr_len == 32);
26974 memcpy(val_ref.data, val->elems, 32);
26975 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
26978 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
26979 LDKGossipTimestampFilter this_ptr_conv;
26980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26981 this_ptr_conv.is_owned = false;
26982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26983 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
26987 void __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
26988 LDKGossipTimestampFilter this_ptr_conv;
26989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26990 this_ptr_conv.is_owned = false;
26991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26992 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
26995 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
26996 LDKGossipTimestampFilter this_ptr_conv;
26997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26998 this_ptr_conv.is_owned = false;
26999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27000 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
27004 void __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
27005 LDKGossipTimestampFilter this_ptr_conv;
27006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27007 this_ptr_conv.is_owned = false;
27008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27009 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
27012 uint32_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) {
27013 LDKThirtyTwoBytes chain_hash_arg_ref;
27014 CHECK(chain_hash_arg->arr_len == 32);
27015 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
27016 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
27017 uint64_t ret_ref = 0;
27018 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27019 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27021 ret_ref = (uint64_t)ret_var.inner;
27022 if (ret_var.is_owned) {
27028 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
27029 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
27030 uint64_t ret_ref = 0;
27031 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27032 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27034 ret_ref = (uint64_t)ret_var.inner;
27035 if (ret_var.is_owned) {
27040 int64_t __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint32_t arg) {
27041 LDKGossipTimestampFilter arg_conv;
27042 arg_conv.inner = (void*)(arg & (~1));
27043 arg_conv.is_owned = false;
27044 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27045 int64_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
27049 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
27050 LDKGossipTimestampFilter orig_conv;
27051 orig_conv.inner = (void*)(orig & (~1));
27052 orig_conv.is_owned = false;
27053 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27054 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
27055 uint64_t ret_ref = 0;
27056 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27057 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27059 ret_ref = (uint64_t)ret_var.inner;
27060 if (ret_var.is_owned) {
27066 void __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint32_t this_ptr) {
27067 if ((this_ptr & 1) != 0) return;
27068 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27069 CHECK_ACCESS(this_ptr_ptr);
27070 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
27071 FREE((void*)this_ptr);
27072 ErrorAction_free(this_ptr_conv);
27075 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
27076 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27077 *ret_copy = ErrorAction_clone(arg);
27078 uint64_t ret_ref = (uint64_t)ret_copy;
27081 int64_t __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
27082 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
27083 int64_t ret_val = ErrorAction_clone_ptr(arg_conv);
27087 uint32_t __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint32_t orig) {
27088 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
27089 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27090 *ret_copy = ErrorAction_clone(orig_conv);
27091 uint64_t ret_ref = (uint64_t)ret_copy;
27095 uint32_t __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
27096 LDKErrorMessage msg_conv;
27097 msg_conv.inner = (void*)(msg & (~1));
27098 msg_conv.is_owned = (msg & 1) || (msg == 0);
27099 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27100 msg_conv = ErrorMessage_clone(&msg_conv);
27101 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27102 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
27103 uint64_t ret_ref = (uint64_t)ret_copy;
27107 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
27108 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27109 *ret_copy = ErrorAction_ignore_error();
27110 uint64_t ret_ref = (uint64_t)ret_copy;
27114 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
27115 LDKLevel a_conv = LDKLevel_from_js(a);
27116 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27117 *ret_copy = ErrorAction_ignore_and_log(a_conv);
27118 uint64_t ret_ref = (uint64_t)ret_copy;
27122 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
27123 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27124 *ret_copy = ErrorAction_ignore_duplicate_gossip();
27125 uint64_t ret_ref = (uint64_t)ret_copy;
27129 uint32_t __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint32_t msg) {
27130 LDKErrorMessage msg_conv;
27131 msg_conv.inner = (void*)(msg & (~1));
27132 msg_conv.is_owned = (msg & 1) || (msg == 0);
27133 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27134 msg_conv = ErrorMessage_clone(&msg_conv);
27135 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27136 *ret_copy = ErrorAction_send_error_message(msg_conv);
27137 uint64_t ret_ref = (uint64_t)ret_copy;
27141 void __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint32_t this_obj) {
27142 LDKLightningError this_obj_conv;
27143 this_obj_conv.inner = (void*)(this_obj & (~1));
27144 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27146 LightningError_free(this_obj_conv);
27149 jstring __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint32_t this_ptr) {
27150 LDKLightningError this_ptr_conv;
27151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27152 this_ptr_conv.is_owned = false;
27153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27154 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
27155 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27160 void __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
27161 LDKLightningError this_ptr_conv;
27162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27163 this_ptr_conv.is_owned = false;
27164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27165 LDKStr val_conv = str_ref_to_owned_c(val);
27166 LightningError_set_err(&this_ptr_conv, val_conv);
27169 uint32_t __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint32_t this_ptr) {
27170 LDKLightningError this_ptr_conv;
27171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27172 this_ptr_conv.is_owned = false;
27173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27174 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27175 *ret_copy = LightningError_get_action(&this_ptr_conv);
27176 uint64_t ret_ref = (uint64_t)ret_copy;
27180 void __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
27181 LDKLightningError this_ptr_conv;
27182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27183 this_ptr_conv.is_owned = false;
27184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27185 void* val_ptr = (void*)(((uint64_t)val) & ~1);
27186 CHECK_ACCESS(val_ptr);
27187 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
27188 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
27189 LightningError_set_action(&this_ptr_conv, val_conv);
27192 uint32_t __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
27193 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
27194 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
27195 CHECK_ACCESS(action_arg_ptr);
27196 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
27197 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
27198 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
27199 uint64_t ret_ref = 0;
27200 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27201 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27203 ret_ref = (uint64_t)ret_var.inner;
27204 if (ret_var.is_owned) {
27210 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
27211 LDKLightningError ret_var = LightningError_clone(arg);
27212 uint64_t ret_ref = 0;
27213 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27214 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27215 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27216 ret_ref = (uint64_t)ret_var.inner;
27217 if (ret_var.is_owned) {
27222 int64_t __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint32_t arg) {
27223 LDKLightningError arg_conv;
27224 arg_conv.inner = (void*)(arg & (~1));
27225 arg_conv.is_owned = false;
27226 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27227 int64_t ret_val = LightningError_clone_ptr(&arg_conv);
27231 uint32_t __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint32_t orig) {
27232 LDKLightningError orig_conv;
27233 orig_conv.inner = (void*)(orig & (~1));
27234 orig_conv.is_owned = false;
27235 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27236 LDKLightningError ret_var = LightningError_clone(&orig_conv);
27237 uint64_t ret_ref = 0;
27238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27241 ret_ref = (uint64_t)ret_var.inner;
27242 if (ret_var.is_owned) {
27248 void __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
27249 LDKCommitmentUpdate this_obj_conv;
27250 this_obj_conv.inner = (void*)(this_obj & (~1));
27251 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27253 CommitmentUpdate_free(this_obj_conv);
27256 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
27257 LDKCommitmentUpdate this_ptr_conv;
27258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27259 this_ptr_conv.is_owned = false;
27260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27261 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
27262 uint32_tArray ret_arr = NULL;
27263 ret_arr = init_uint32_tArray(ret_var.datalen);
27264 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
27265 for (size_t p = 0; p < ret_var.datalen; p++) {
27266 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
27267 uint64_t ret_conv_15_ref = 0;
27268 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27269 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
27271 ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
27272 if (ret_conv_15_var.is_owned) {
27273 ret_conv_15_ref |= 1;
27275 ret_arr_ptr[p] = ret_conv_15_ref;
27278 FREE(ret_var.data);
27282 void __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
27283 LDKCommitmentUpdate this_ptr_conv;
27284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27285 this_ptr_conv.is_owned = false;
27286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27287 LDKCVec_UpdateAddHTLCZ val_constr;
27288 val_constr.datalen = val->arr_len;
27289 if (val_constr.datalen > 0)
27290 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27292 val_constr.data = NULL;
27293 uint32_t* val_vals = val->elems;
27294 for (size_t p = 0; p < val_constr.datalen; p++) {
27295 uint32_t val_conv_15 = val_vals[p];
27296 LDKUpdateAddHTLC val_conv_15_conv;
27297 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
27298 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
27299 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
27300 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
27301 val_constr.data[p] = val_conv_15_conv;
27303 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
27306 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
27307 LDKCommitmentUpdate this_ptr_conv;
27308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27309 this_ptr_conv.is_owned = false;
27310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27311 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
27312 uint32_tArray ret_arr = NULL;
27313 ret_arr = init_uint32_tArray(ret_var.datalen);
27314 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
27315 for (size_t t = 0; t < ret_var.datalen; t++) {
27316 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
27317 uint64_t ret_conv_19_ref = 0;
27318 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27319 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
27321 ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
27322 if (ret_conv_19_var.is_owned) {
27323 ret_conv_19_ref |= 1;
27325 ret_arr_ptr[t] = ret_conv_19_ref;
27328 FREE(ret_var.data);
27332 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
27333 LDKCommitmentUpdate this_ptr_conv;
27334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27335 this_ptr_conv.is_owned = false;
27336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27337 LDKCVec_UpdateFulfillHTLCZ val_constr;
27338 val_constr.datalen = val->arr_len;
27339 if (val_constr.datalen > 0)
27340 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27342 val_constr.data = NULL;
27343 uint32_t* val_vals = val->elems;
27344 for (size_t t = 0; t < val_constr.datalen; t++) {
27345 uint32_t val_conv_19 = val_vals[t];
27346 LDKUpdateFulfillHTLC val_conv_19_conv;
27347 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
27348 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
27349 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
27350 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
27351 val_constr.data[t] = val_conv_19_conv;
27353 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
27356 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
27357 LDKCommitmentUpdate this_ptr_conv;
27358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27359 this_ptr_conv.is_owned = false;
27360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27361 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
27362 uint32_tArray ret_arr = NULL;
27363 ret_arr = init_uint32_tArray(ret_var.datalen);
27364 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
27365 for (size_t q = 0; q < ret_var.datalen; q++) {
27366 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
27367 uint64_t ret_conv_16_ref = 0;
27368 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27369 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27371 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
27372 if (ret_conv_16_var.is_owned) {
27373 ret_conv_16_ref |= 1;
27375 ret_arr_ptr[q] = ret_conv_16_ref;
27378 FREE(ret_var.data);
27382 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
27383 LDKCommitmentUpdate this_ptr_conv;
27384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27385 this_ptr_conv.is_owned = false;
27386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27387 LDKCVec_UpdateFailHTLCZ val_constr;
27388 val_constr.datalen = val->arr_len;
27389 if (val_constr.datalen > 0)
27390 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27392 val_constr.data = NULL;
27393 uint32_t* val_vals = val->elems;
27394 for (size_t q = 0; q < val_constr.datalen; q++) {
27395 uint32_t val_conv_16 = val_vals[q];
27396 LDKUpdateFailHTLC val_conv_16_conv;
27397 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
27398 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
27399 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
27400 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
27401 val_constr.data[q] = val_conv_16_conv;
27403 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
27406 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
27407 LDKCommitmentUpdate this_ptr_conv;
27408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27409 this_ptr_conv.is_owned = false;
27410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27411 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
27412 uint32_tArray ret_arr = NULL;
27413 ret_arr = init_uint32_tArray(ret_var.datalen);
27414 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
27415 for (size_t z = 0; z < ret_var.datalen; z++) {
27416 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
27417 uint64_t ret_conv_25_ref = 0;
27418 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27419 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
27421 ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
27422 if (ret_conv_25_var.is_owned) {
27423 ret_conv_25_ref |= 1;
27425 ret_arr_ptr[z] = ret_conv_25_ref;
27428 FREE(ret_var.data);
27432 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
27433 LDKCommitmentUpdate this_ptr_conv;
27434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27435 this_ptr_conv.is_owned = false;
27436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27437 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
27438 val_constr.datalen = val->arr_len;
27439 if (val_constr.datalen > 0)
27440 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27442 val_constr.data = NULL;
27443 uint32_t* val_vals = val->elems;
27444 for (size_t z = 0; z < val_constr.datalen; z++) {
27445 uint32_t val_conv_25 = val_vals[z];
27446 LDKUpdateFailMalformedHTLC val_conv_25_conv;
27447 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
27448 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
27449 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
27450 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
27451 val_constr.data[z] = val_conv_25_conv;
27453 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
27456 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
27457 LDKCommitmentUpdate this_ptr_conv;
27458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27459 this_ptr_conv.is_owned = false;
27460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27461 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
27462 uint64_t ret_ref = 0;
27463 if ((uint64_t)ret_var.inner > 4096) {
27464 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27465 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27467 ret_ref = (uint64_t)ret_var.inner;
27468 if (ret_var.is_owned) {
27475 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
27476 LDKCommitmentUpdate this_ptr_conv;
27477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27478 this_ptr_conv.is_owned = false;
27479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27480 LDKUpdateFee val_conv;
27481 val_conv.inner = (void*)(val & (~1));
27482 val_conv.is_owned = (val & 1) || (val == 0);
27483 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27484 val_conv = UpdateFee_clone(&val_conv);
27485 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
27488 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
27489 LDKCommitmentUpdate this_ptr_conv;
27490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27491 this_ptr_conv.is_owned = false;
27492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27493 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
27494 uint64_t ret_ref = 0;
27495 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27496 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27497 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27498 ret_ref = (uint64_t)ret_var.inner;
27499 if (ret_var.is_owned) {
27505 void __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
27506 LDKCommitmentUpdate this_ptr_conv;
27507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27508 this_ptr_conv.is_owned = false;
27509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27510 LDKCommitmentSigned val_conv;
27511 val_conv.inner = (void*)(val & (~1));
27512 val_conv.is_owned = (val & 1) || (val == 0);
27513 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27514 val_conv = CommitmentSigned_clone(&val_conv);
27515 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
27518 uint32_t __attribute__((export_name("TS_CommitmentUpdate_new"))) TS_CommitmentUpdate_new(uint32_tArray update_add_htlcs_arg, uint32_tArray update_fulfill_htlcs_arg, uint32_tArray update_fail_htlcs_arg, uint32_tArray update_fail_malformed_htlcs_arg, uint32_t update_fee_arg, uint32_t commitment_signed_arg) {
27519 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
27520 update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
27521 if (update_add_htlcs_arg_constr.datalen > 0)
27522 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27524 update_add_htlcs_arg_constr.data = NULL;
27525 uint32_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
27526 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
27527 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
27528 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
27529 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
27530 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
27531 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
27532 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
27533 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
27535 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
27536 update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
27537 if (update_fulfill_htlcs_arg_constr.datalen > 0)
27538 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27540 update_fulfill_htlcs_arg_constr.data = NULL;
27541 uint32_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
27542 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
27543 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
27544 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
27545 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
27546 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
27547 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
27548 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
27549 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
27551 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
27552 update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
27553 if (update_fail_htlcs_arg_constr.datalen > 0)
27554 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27556 update_fail_htlcs_arg_constr.data = NULL;
27557 uint32_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
27558 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
27559 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
27560 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
27561 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
27562 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
27563 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
27564 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
27565 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
27567 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
27568 update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
27569 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
27570 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27572 update_fail_malformed_htlcs_arg_constr.data = NULL;
27573 uint32_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
27574 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
27575 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
27576 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
27577 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
27578 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = (update_fail_malformed_htlcs_arg_conv_25 & 1) || (update_fail_malformed_htlcs_arg_conv_25 == 0);
27579 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
27580 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
27581 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
27583 LDKUpdateFee update_fee_arg_conv;
27584 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
27585 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
27586 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
27587 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
27588 LDKCommitmentSigned commitment_signed_arg_conv;
27589 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
27590 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
27591 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
27592 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
27593 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);
27594 uint64_t ret_ref = 0;
27595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27598 ret_ref = (uint64_t)ret_var.inner;
27599 if (ret_var.is_owned) {
27605 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
27606 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
27607 uint64_t ret_ref = 0;
27608 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27609 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27611 ret_ref = (uint64_t)ret_var.inner;
27612 if (ret_var.is_owned) {
27617 int64_t __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
27618 LDKCommitmentUpdate arg_conv;
27619 arg_conv.inner = (void*)(arg & (~1));
27620 arg_conv.is_owned = false;
27621 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27622 int64_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
27626 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint32_t orig) {
27627 LDKCommitmentUpdate orig_conv;
27628 orig_conv.inner = (void*)(orig & (~1));
27629 orig_conv.is_owned = false;
27630 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27631 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
27632 uint64_t ret_ref = 0;
27633 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27634 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27635 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27636 ret_ref = (uint64_t)ret_var.inner;
27637 if (ret_var.is_owned) {
27643 void __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
27644 if ((this_ptr & 1) != 0) return;
27645 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27646 CHECK_ACCESS(this_ptr_ptr);
27647 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
27648 FREE((void*)this_ptr);
27649 ChannelMessageHandler_free(this_ptr_conv);
27652 void __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
27653 if ((this_ptr & 1) != 0) return;
27654 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27655 CHECK_ACCESS(this_ptr_ptr);
27656 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
27657 FREE((void*)this_ptr);
27658 RoutingMessageHandler_free(this_ptr_conv);
27661 int8_tArray __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint32_t obj) {
27662 LDKAcceptChannel obj_conv;
27663 obj_conv.inner = (void*)(obj & (~1));
27664 obj_conv.is_owned = false;
27665 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27666 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
27667 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27668 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27669 CVec_u8Z_free(ret_var);
27673 uint32_t __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
27674 LDKu8slice ser_ref;
27675 ser_ref.datalen = ser->arr_len;
27676 ser_ref.data = ser->elems;
27677 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27678 *ret_conv = AcceptChannel_read(ser_ref);
27679 return (uint64_t)ret_conv;
27682 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint32_t obj) {
27683 LDKAnnouncementSignatures obj_conv;
27684 obj_conv.inner = (void*)(obj & (~1));
27685 obj_conv.is_owned = false;
27686 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27687 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
27688 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27689 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27690 CVec_u8Z_free(ret_var);
27694 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
27695 LDKu8slice ser_ref;
27696 ser_ref.datalen = ser->arr_len;
27697 ser_ref.data = ser->elems;
27698 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27699 *ret_conv = AnnouncementSignatures_read(ser_ref);
27700 return (uint64_t)ret_conv;
27703 int8_tArray __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint32_t obj) {
27704 LDKChannelReestablish obj_conv;
27705 obj_conv.inner = (void*)(obj & (~1));
27706 obj_conv.is_owned = false;
27707 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27708 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
27709 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27710 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27711 CVec_u8Z_free(ret_var);
27715 uint32_t __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
27716 LDKu8slice ser_ref;
27717 ser_ref.datalen = ser->arr_len;
27718 ser_ref.data = ser->elems;
27719 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27720 *ret_conv = ChannelReestablish_read(ser_ref);
27721 return (uint64_t)ret_conv;
27724 int8_tArray __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint32_t obj) {
27725 LDKClosingSigned obj_conv;
27726 obj_conv.inner = (void*)(obj & (~1));
27727 obj_conv.is_owned = false;
27728 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27729 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
27730 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27731 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27732 CVec_u8Z_free(ret_var);
27736 uint32_t __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
27737 LDKu8slice ser_ref;
27738 ser_ref.datalen = ser->arr_len;
27739 ser_ref.data = ser->elems;
27740 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27741 *ret_conv = ClosingSigned_read(ser_ref);
27742 return (uint64_t)ret_conv;
27745 int8_tArray __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
27746 LDKClosingSignedFeeRange obj_conv;
27747 obj_conv.inner = (void*)(obj & (~1));
27748 obj_conv.is_owned = false;
27749 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27750 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
27751 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27752 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27753 CVec_u8Z_free(ret_var);
27757 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
27758 LDKu8slice ser_ref;
27759 ser_ref.datalen = ser->arr_len;
27760 ser_ref.data = ser->elems;
27761 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27762 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
27763 return (uint64_t)ret_conv;
27766 int8_tArray __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint32_t obj) {
27767 LDKCommitmentSigned obj_conv;
27768 obj_conv.inner = (void*)(obj & (~1));
27769 obj_conv.is_owned = false;
27770 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27771 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
27772 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27773 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27774 CVec_u8Z_free(ret_var);
27778 uint32_t __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
27779 LDKu8slice ser_ref;
27780 ser_ref.datalen = ser->arr_len;
27781 ser_ref.data = ser->elems;
27782 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27783 *ret_conv = CommitmentSigned_read(ser_ref);
27784 return (uint64_t)ret_conv;
27787 int8_tArray __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint32_t obj) {
27788 LDKFundingCreated obj_conv;
27789 obj_conv.inner = (void*)(obj & (~1));
27790 obj_conv.is_owned = false;
27791 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27792 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
27793 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27794 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27795 CVec_u8Z_free(ret_var);
27799 uint32_t __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
27800 LDKu8slice ser_ref;
27801 ser_ref.datalen = ser->arr_len;
27802 ser_ref.data = ser->elems;
27803 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27804 *ret_conv = FundingCreated_read(ser_ref);
27805 return (uint64_t)ret_conv;
27808 int8_tArray __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint32_t obj) {
27809 LDKFundingSigned obj_conv;
27810 obj_conv.inner = (void*)(obj & (~1));
27811 obj_conv.is_owned = false;
27812 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27813 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
27814 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27815 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27816 CVec_u8Z_free(ret_var);
27820 uint32_t __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
27821 LDKu8slice ser_ref;
27822 ser_ref.datalen = ser->arr_len;
27823 ser_ref.data = ser->elems;
27824 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27825 *ret_conv = FundingSigned_read(ser_ref);
27826 return (uint64_t)ret_conv;
27829 int8_tArray __attribute__((export_name("TS_FundingLocked_write"))) TS_FundingLocked_write(uint32_t obj) {
27830 LDKFundingLocked obj_conv;
27831 obj_conv.inner = (void*)(obj & (~1));
27832 obj_conv.is_owned = false;
27833 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27834 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
27835 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27836 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27837 CVec_u8Z_free(ret_var);
27841 uint32_t __attribute__((export_name("TS_FundingLocked_read"))) TS_FundingLocked_read(int8_tArray ser) {
27842 LDKu8slice ser_ref;
27843 ser_ref.datalen = ser->arr_len;
27844 ser_ref.data = ser->elems;
27845 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
27846 *ret_conv = FundingLocked_read(ser_ref);
27847 return (uint64_t)ret_conv;
27850 int8_tArray __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint32_t obj) {
27852 obj_conv.inner = (void*)(obj & (~1));
27853 obj_conv.is_owned = false;
27854 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27855 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
27856 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27857 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27858 CVec_u8Z_free(ret_var);
27862 uint32_t __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
27863 LDKu8slice ser_ref;
27864 ser_ref.datalen = ser->arr_len;
27865 ser_ref.data = ser->elems;
27866 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
27867 *ret_conv = Init_read(ser_ref);
27868 return (uint64_t)ret_conv;
27871 int8_tArray __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint32_t obj) {
27872 LDKOpenChannel obj_conv;
27873 obj_conv.inner = (void*)(obj & (~1));
27874 obj_conv.is_owned = false;
27875 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27876 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
27877 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27878 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27879 CVec_u8Z_free(ret_var);
27883 uint32_t __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
27884 LDKu8slice ser_ref;
27885 ser_ref.datalen = ser->arr_len;
27886 ser_ref.data = ser->elems;
27887 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
27888 *ret_conv = OpenChannel_read(ser_ref);
27889 return (uint64_t)ret_conv;
27892 int8_tArray __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint32_t obj) {
27893 LDKRevokeAndACK obj_conv;
27894 obj_conv.inner = (void*)(obj & (~1));
27895 obj_conv.is_owned = false;
27896 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27897 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
27898 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27899 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27900 CVec_u8Z_free(ret_var);
27904 uint32_t __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
27905 LDKu8slice ser_ref;
27906 ser_ref.datalen = ser->arr_len;
27907 ser_ref.data = ser->elems;
27908 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
27909 *ret_conv = RevokeAndACK_read(ser_ref);
27910 return (uint64_t)ret_conv;
27913 int8_tArray __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint32_t obj) {
27914 LDKShutdown obj_conv;
27915 obj_conv.inner = (void*)(obj & (~1));
27916 obj_conv.is_owned = false;
27917 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27918 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
27919 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27920 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27921 CVec_u8Z_free(ret_var);
27925 uint32_t __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
27926 LDKu8slice ser_ref;
27927 ser_ref.datalen = ser->arr_len;
27928 ser_ref.data = ser->elems;
27929 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27930 *ret_conv = Shutdown_read(ser_ref);
27931 return (uint64_t)ret_conv;
27934 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint32_t obj) {
27935 LDKUpdateFailHTLC obj_conv;
27936 obj_conv.inner = (void*)(obj & (~1));
27937 obj_conv.is_owned = false;
27938 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27939 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
27940 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27941 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27942 CVec_u8Z_free(ret_var);
27946 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
27947 LDKu8slice ser_ref;
27948 ser_ref.datalen = ser->arr_len;
27949 ser_ref.data = ser->elems;
27950 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27951 *ret_conv = UpdateFailHTLC_read(ser_ref);
27952 return (uint64_t)ret_conv;
27955 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
27956 LDKUpdateFailMalformedHTLC obj_conv;
27957 obj_conv.inner = (void*)(obj & (~1));
27958 obj_conv.is_owned = false;
27959 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27960 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
27961 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27962 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27963 CVec_u8Z_free(ret_var);
27967 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
27968 LDKu8slice ser_ref;
27969 ser_ref.datalen = ser->arr_len;
27970 ser_ref.data = ser->elems;
27971 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27972 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
27973 return (uint64_t)ret_conv;
27976 int8_tArray __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint32_t obj) {
27977 LDKUpdateFee obj_conv;
27978 obj_conv.inner = (void*)(obj & (~1));
27979 obj_conv.is_owned = false;
27980 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27981 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
27982 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27983 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27984 CVec_u8Z_free(ret_var);
27988 uint32_t __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
27989 LDKu8slice ser_ref;
27990 ser_ref.datalen = ser->arr_len;
27991 ser_ref.data = ser->elems;
27992 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27993 *ret_conv = UpdateFee_read(ser_ref);
27994 return (uint64_t)ret_conv;
27997 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
27998 LDKUpdateFulfillHTLC obj_conv;
27999 obj_conv.inner = (void*)(obj & (~1));
28000 obj_conv.is_owned = false;
28001 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28002 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
28003 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28004 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28005 CVec_u8Z_free(ret_var);
28009 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
28010 LDKu8slice ser_ref;
28011 ser_ref.datalen = ser->arr_len;
28012 ser_ref.data = ser->elems;
28013 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
28014 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
28015 return (uint64_t)ret_conv;
28018 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint32_t obj) {
28019 LDKUpdateAddHTLC obj_conv;
28020 obj_conv.inner = (void*)(obj & (~1));
28021 obj_conv.is_owned = false;
28022 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28023 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
28024 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28025 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28026 CVec_u8Z_free(ret_var);
28030 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
28031 LDKu8slice ser_ref;
28032 ser_ref.datalen = ser->arr_len;
28033 ser_ref.data = ser->elems;
28034 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
28035 *ret_conv = UpdateAddHTLC_read(ser_ref);
28036 return (uint64_t)ret_conv;
28039 int8_tArray __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint32_t obj) {
28041 obj_conv.inner = (void*)(obj & (~1));
28042 obj_conv.is_owned = false;
28043 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28044 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
28045 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28046 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28047 CVec_u8Z_free(ret_var);
28051 uint32_t __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
28052 LDKu8slice ser_ref;
28053 ser_ref.datalen = ser->arr_len;
28054 ser_ref.data = ser->elems;
28055 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
28056 *ret_conv = Ping_read(ser_ref);
28057 return (uint64_t)ret_conv;
28060 int8_tArray __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint32_t obj) {
28062 obj_conv.inner = (void*)(obj & (~1));
28063 obj_conv.is_owned = false;
28064 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28065 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
28066 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28067 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28068 CVec_u8Z_free(ret_var);
28072 uint32_t __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
28073 LDKu8slice ser_ref;
28074 ser_ref.datalen = ser->arr_len;
28075 ser_ref.data = ser->elems;
28076 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
28077 *ret_conv = Pong_read(ser_ref);
28078 return (uint64_t)ret_conv;
28081 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
28082 LDKUnsignedChannelAnnouncement obj_conv;
28083 obj_conv.inner = (void*)(obj & (~1));
28084 obj_conv.is_owned = false;
28085 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28086 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
28087 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28088 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28089 CVec_u8Z_free(ret_var);
28093 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
28094 LDKu8slice ser_ref;
28095 ser_ref.datalen = ser->arr_len;
28096 ser_ref.data = ser->elems;
28097 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
28098 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
28099 return (uint64_t)ret_conv;
28102 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint32_t obj) {
28103 LDKChannelAnnouncement obj_conv;
28104 obj_conv.inner = (void*)(obj & (~1));
28105 obj_conv.is_owned = false;
28106 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28107 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
28108 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28109 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28110 CVec_u8Z_free(ret_var);
28114 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
28115 LDKu8slice ser_ref;
28116 ser_ref.datalen = ser->arr_len;
28117 ser_ref.data = ser->elems;
28118 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
28119 *ret_conv = ChannelAnnouncement_read(ser_ref);
28120 return (uint64_t)ret_conv;
28123 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
28124 LDKUnsignedChannelUpdate obj_conv;
28125 obj_conv.inner = (void*)(obj & (~1));
28126 obj_conv.is_owned = false;
28127 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28128 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
28129 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28130 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28131 CVec_u8Z_free(ret_var);
28135 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
28136 LDKu8slice ser_ref;
28137 ser_ref.datalen = ser->arr_len;
28138 ser_ref.data = ser->elems;
28139 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
28140 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
28141 return (uint64_t)ret_conv;
28144 int8_tArray __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint32_t obj) {
28145 LDKChannelUpdate obj_conv;
28146 obj_conv.inner = (void*)(obj & (~1));
28147 obj_conv.is_owned = false;
28148 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28149 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
28150 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28151 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28152 CVec_u8Z_free(ret_var);
28156 uint32_t __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
28157 LDKu8slice ser_ref;
28158 ser_ref.datalen = ser->arr_len;
28159 ser_ref.data = ser->elems;
28160 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
28161 *ret_conv = ChannelUpdate_read(ser_ref);
28162 return (uint64_t)ret_conv;
28165 int8_tArray __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint32_t obj) {
28166 LDKErrorMessage obj_conv;
28167 obj_conv.inner = (void*)(obj & (~1));
28168 obj_conv.is_owned = false;
28169 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28170 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
28171 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28172 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28173 CVec_u8Z_free(ret_var);
28177 uint32_t __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
28178 LDKu8slice ser_ref;
28179 ser_ref.datalen = ser->arr_len;
28180 ser_ref.data = ser->elems;
28181 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
28182 *ret_conv = ErrorMessage_read(ser_ref);
28183 return (uint64_t)ret_conv;
28186 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
28187 LDKUnsignedNodeAnnouncement obj_conv;
28188 obj_conv.inner = (void*)(obj & (~1));
28189 obj_conv.is_owned = false;
28190 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28191 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
28192 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28193 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28194 CVec_u8Z_free(ret_var);
28198 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
28199 LDKu8slice ser_ref;
28200 ser_ref.datalen = ser->arr_len;
28201 ser_ref.data = ser->elems;
28202 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
28203 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
28204 return (uint64_t)ret_conv;
28207 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint32_t obj) {
28208 LDKNodeAnnouncement obj_conv;
28209 obj_conv.inner = (void*)(obj & (~1));
28210 obj_conv.is_owned = false;
28211 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28212 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
28213 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28214 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28215 CVec_u8Z_free(ret_var);
28219 uint32_t __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
28220 LDKu8slice ser_ref;
28221 ser_ref.datalen = ser->arr_len;
28222 ser_ref.data = ser->elems;
28223 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
28224 *ret_conv = NodeAnnouncement_read(ser_ref);
28225 return (uint64_t)ret_conv;
28228 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
28229 LDKu8slice ser_ref;
28230 ser_ref.datalen = ser->arr_len;
28231 ser_ref.data = ser->elems;
28232 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
28233 *ret_conv = QueryShortChannelIds_read(ser_ref);
28234 return (uint64_t)ret_conv;
28237 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint32_t obj) {
28238 LDKQueryShortChannelIds obj_conv;
28239 obj_conv.inner = (void*)(obj & (~1));
28240 obj_conv.is_owned = false;
28241 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28242 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
28243 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28244 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28245 CVec_u8Z_free(ret_var);
28249 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
28250 LDKReplyShortChannelIdsEnd obj_conv;
28251 obj_conv.inner = (void*)(obj & (~1));
28252 obj_conv.is_owned = false;
28253 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28254 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
28255 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28256 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28257 CVec_u8Z_free(ret_var);
28261 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
28262 LDKu8slice ser_ref;
28263 ser_ref.datalen = ser->arr_len;
28264 ser_ref.data = ser->elems;
28265 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
28266 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
28267 return (uint64_t)ret_conv;
28270 int32_t __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
28271 LDKQueryChannelRange this_arg_conv;
28272 this_arg_conv.inner = (void*)(this_arg & (~1));
28273 this_arg_conv.is_owned = false;
28274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28275 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
28279 int8_tArray __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint32_t obj) {
28280 LDKQueryChannelRange obj_conv;
28281 obj_conv.inner = (void*)(obj & (~1));
28282 obj_conv.is_owned = false;
28283 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28284 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
28285 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28286 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28287 CVec_u8Z_free(ret_var);
28291 uint32_t __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
28292 LDKu8slice ser_ref;
28293 ser_ref.datalen = ser->arr_len;
28294 ser_ref.data = ser->elems;
28295 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
28296 *ret_conv = QueryChannelRange_read(ser_ref);
28297 return (uint64_t)ret_conv;
28300 uint32_t __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
28301 LDKu8slice ser_ref;
28302 ser_ref.datalen = ser->arr_len;
28303 ser_ref.data = ser->elems;
28304 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
28305 *ret_conv = ReplyChannelRange_read(ser_ref);
28306 return (uint64_t)ret_conv;
28309 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint32_t obj) {
28310 LDKReplyChannelRange obj_conv;
28311 obj_conv.inner = (void*)(obj & (~1));
28312 obj_conv.is_owned = false;
28313 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28314 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
28315 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28316 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28317 CVec_u8Z_free(ret_var);
28321 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint32_t obj) {
28322 LDKGossipTimestampFilter obj_conv;
28323 obj_conv.inner = (void*)(obj & (~1));
28324 obj_conv.is_owned = false;
28325 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28326 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
28327 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28328 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28329 CVec_u8Z_free(ret_var);
28333 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
28334 LDKu8slice ser_ref;
28335 ser_ref.datalen = ser->arr_len;
28336 ser_ref.data = ser->elems;
28337 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28338 *ret_conv = GossipTimestampFilter_read(ser_ref);
28339 return (uint64_t)ret_conv;
28342 void __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
28343 if ((this_ptr & 1) != 0) return;
28344 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28345 CHECK_ACCESS(this_ptr_ptr);
28346 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
28347 FREE((void*)this_ptr);
28348 CustomMessageHandler_free(this_ptr_conv);
28351 void __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
28352 LDKIgnoringMessageHandler this_obj_conv;
28353 this_obj_conv.inner = (void*)(this_obj & (~1));
28354 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28356 IgnoringMessageHandler_free(this_obj_conv);
28359 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
28360 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
28361 uint64_t ret_ref = 0;
28362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28363 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28365 ret_ref = (uint64_t)ret_var.inner;
28366 if (ret_var.is_owned) {
28372 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
28373 LDKIgnoringMessageHandler this_arg_conv;
28374 this_arg_conv.inner = (void*)(this_arg & (~1));
28375 this_arg_conv.is_owned = false;
28376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28377 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28378 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
28379 return (uint64_t)ret_ret;
28382 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
28383 LDKIgnoringMessageHandler this_arg_conv;
28384 this_arg_conv.inner = (void*)(this_arg & (~1));
28385 this_arg_conv.is_owned = false;
28386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28387 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
28388 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
28389 return (uint64_t)ret_ret;
28392 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
28393 LDKIgnoringMessageHandler this_arg_conv;
28394 this_arg_conv.inner = (void*)(this_arg & (~1));
28395 this_arg_conv.is_owned = false;
28396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28397 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
28398 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
28399 return (uint64_t)ret_ret;
28402 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
28403 LDKIgnoringMessageHandler this_arg_conv;
28404 this_arg_conv.inner = (void*)(this_arg & (~1));
28405 this_arg_conv.is_owned = false;
28406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28407 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
28408 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
28409 return (uint64_t)ret_ret;
28412 void __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
28413 LDKErroringMessageHandler this_obj_conv;
28414 this_obj_conv.inner = (void*)(this_obj & (~1));
28415 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28417 ErroringMessageHandler_free(this_obj_conv);
28420 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
28421 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
28422 uint64_t ret_ref = 0;
28423 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28424 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28426 ret_ref = (uint64_t)ret_var.inner;
28427 if (ret_var.is_owned) {
28433 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
28434 LDKErroringMessageHandler this_arg_conv;
28435 this_arg_conv.inner = (void*)(this_arg & (~1));
28436 this_arg_conv.is_owned = false;
28437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28438 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28439 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
28440 return (uint64_t)ret_ret;
28443 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
28444 LDKErroringMessageHandler this_arg_conv;
28445 this_arg_conv.inner = (void*)(this_arg & (~1));
28446 this_arg_conv.is_owned = false;
28447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28448 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
28449 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
28450 return (uint64_t)ret_ret;
28453 void __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint32_t this_obj) {
28454 LDKMessageHandler this_obj_conv;
28455 this_obj_conv.inner = (void*)(this_obj & (~1));
28456 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28458 MessageHandler_free(this_obj_conv);
28461 uint32_t __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
28462 LDKMessageHandler this_ptr_conv;
28463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28464 this_ptr_conv.is_owned = false;
28465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28466 // WARNING: This object doesn't live past this scope, needs clone!
28467 uint64_t ret_ret = ((uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
28471 void __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
28472 LDKMessageHandler this_ptr_conv;
28473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28474 this_ptr_conv.is_owned = false;
28475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28476 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28477 CHECK_ACCESS(val_ptr);
28478 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
28479 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
28482 uint32_t __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
28483 LDKMessageHandler this_ptr_conv;
28484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28485 this_ptr_conv.is_owned = false;
28486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28487 // WARNING: This object doesn't live past this scope, needs clone!
28488 uint64_t ret_ret = ((uint64_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
28492 void __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
28493 LDKMessageHandler this_ptr_conv;
28494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28495 this_ptr_conv.is_owned = false;
28496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28497 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28498 CHECK_ACCESS(val_ptr);
28499 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
28500 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
28503 uint32_t __attribute__((export_name("TS_MessageHandler_new"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
28504 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
28505 CHECK_ACCESS(chan_handler_arg_ptr);
28506 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
28507 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
28508 CHECK_ACCESS(route_handler_arg_ptr);
28509 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
28510 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
28511 uint64_t ret_ref = 0;
28512 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28513 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28515 ret_ref = (uint64_t)ret_var.inner;
28516 if (ret_var.is_owned) {
28522 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
28523 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28524 *ret_ret = SocketDescriptor_clone(arg);
28525 return (uint64_t)ret_ret;
28527 int64_t __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
28528 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
28529 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
28530 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
28531 int64_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
28535 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint32_t orig) {
28536 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
28537 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
28538 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
28539 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28540 *ret_ret = SocketDescriptor_clone(orig_conv);
28541 return (uint64_t)ret_ret;
28544 void __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
28545 if ((this_ptr & 1) != 0) return;
28546 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28547 CHECK_ACCESS(this_ptr_ptr);
28548 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
28549 FREE((void*)this_ptr);
28550 SocketDescriptor_free(this_ptr_conv);
28553 void __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint32_t this_obj) {
28554 LDKPeerHandleError this_obj_conv;
28555 this_obj_conv.inner = (void*)(this_obj & (~1));
28556 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28558 PeerHandleError_free(this_obj_conv);
28561 jboolean __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
28562 LDKPeerHandleError this_ptr_conv;
28563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28564 this_ptr_conv.is_owned = false;
28565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28566 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
28570 void __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
28571 LDKPeerHandleError this_ptr_conv;
28572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28573 this_ptr_conv.is_owned = false;
28574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28575 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
28578 uint32_t __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
28579 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
28580 uint64_t ret_ref = 0;
28581 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28582 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28583 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28584 ret_ref = (uint64_t)ret_var.inner;
28585 if (ret_var.is_owned) {
28591 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
28592 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
28593 uint64_t ret_ref = 0;
28594 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28595 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28597 ret_ref = (uint64_t)ret_var.inner;
28598 if (ret_var.is_owned) {
28603 int64_t __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
28604 LDKPeerHandleError arg_conv;
28605 arg_conv.inner = (void*)(arg & (~1));
28606 arg_conv.is_owned = false;
28607 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28608 int64_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
28612 uint32_t __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint32_t orig) {
28613 LDKPeerHandleError orig_conv;
28614 orig_conv.inner = (void*)(orig & (~1));
28615 orig_conv.is_owned = false;
28616 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28617 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
28618 uint64_t ret_ref = 0;
28619 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28620 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28621 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28622 ret_ref = (uint64_t)ret_var.inner;
28623 if (ret_var.is_owned) {
28629 void __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint32_t this_obj) {
28630 LDKPeerManager this_obj_conv;
28631 this_obj_conv.inner = (void*)(this_obj & (~1));
28632 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28634 PeerManager_free(this_obj_conv);
28637 uint32_t __attribute__((export_name("TS_PeerManager_new"))) TS_PeerManager_new(uint32_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint32_t logger, uint32_t custom_message_handler) {
28638 LDKMessageHandler message_handler_conv;
28639 message_handler_conv.inner = (void*)(message_handler & (~1));
28640 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
28641 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
28642 // Warning: we need a move here but no clone is available for LDKMessageHandler
28643 LDKSecretKey our_node_secret_ref;
28644 CHECK(our_node_secret->arr_len == 32);
28645 memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32);
28646 unsigned char ephemeral_random_data_arr[32];
28647 CHECK(ephemeral_random_data->arr_len == 32);
28648 memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32);
28649 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
28650 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
28651 CHECK_ACCESS(logger_ptr);
28652 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28653 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
28654 CHECK_ACCESS(custom_message_handler_ptr);
28655 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
28656 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
28657 uint64_t ret_ref = 0;
28658 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28659 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28661 ret_ref = (uint64_t)ret_var.inner;
28662 if (ret_var.is_owned) {
28668 ptrArray __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
28669 LDKPeerManager this_arg_conv;
28670 this_arg_conv.inner = (void*)(this_arg & (~1));
28671 this_arg_conv.is_owned = false;
28672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28673 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
28674 ptrArray ret_arr = NULL;
28675 ret_arr = init_ptrArray(ret_var.datalen);
28676 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
28677 for (size_t m = 0; m < ret_var.datalen; m++) {
28678 int8_tArray ret_conv_12_arr = init_int8_tArray(33);
28679 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
28680 ret_arr_ptr[m] = ret_conv_12_arr;
28683 FREE(ret_var.data);
28687 uint32_t __attribute__((export_name("TS_PeerManager_new_outbound_connection"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
28688 LDKPeerManager this_arg_conv;
28689 this_arg_conv.inner = (void*)(this_arg & (~1));
28690 this_arg_conv.is_owned = false;
28691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28692 LDKPublicKey their_node_id_ref;
28693 CHECK(their_node_id->arr_len == 33);
28694 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
28695 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28696 CHECK_ACCESS(descriptor_ptr);
28697 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28698 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28699 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
28700 return (uint64_t)ret_conv;
28703 uint32_t __attribute__((export_name("TS_PeerManager_new_inbound_connection"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
28704 LDKPeerManager this_arg_conv;
28705 this_arg_conv.inner = (void*)(this_arg & (~1));
28706 this_arg_conv.is_owned = false;
28707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28708 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28709 CHECK_ACCESS(descriptor_ptr);
28710 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28711 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28712 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
28713 return (uint64_t)ret_conv;
28716 uint32_t __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
28717 LDKPeerManager this_arg_conv;
28718 this_arg_conv.inner = (void*)(this_arg & (~1));
28719 this_arg_conv.is_owned = false;
28720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28721 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28722 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28723 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28724 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28725 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
28726 return (uint64_t)ret_conv;
28729 uint32_t __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
28730 LDKPeerManager this_arg_conv;
28731 this_arg_conv.inner = (void*)(this_arg & (~1));
28732 this_arg_conv.is_owned = false;
28733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28734 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
28735 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
28736 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
28737 LDKu8slice data_ref;
28738 data_ref.datalen = data->arr_len;
28739 data_ref.data = data->elems;
28740 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28741 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
28742 return (uint64_t)ret_conv;
28745 void __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint32_t this_arg) {
28746 LDKPeerManager this_arg_conv;
28747 this_arg_conv.inner = (void*)(this_arg & (~1));
28748 this_arg_conv.is_owned = false;
28749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28750 PeerManager_process_events(&this_arg_conv);
28753 void __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
28754 LDKPeerManager this_arg_conv;
28755 this_arg_conv.inner = (void*)(this_arg & (~1));
28756 this_arg_conv.is_owned = false;
28757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28758 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28759 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28760 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28761 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
28764 void __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
28765 LDKPeerManager this_arg_conv;
28766 this_arg_conv.inner = (void*)(this_arg & (~1));
28767 this_arg_conv.is_owned = false;
28768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28769 LDKPublicKey node_id_ref;
28770 CHECK(node_id->arr_len == 33);
28771 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
28772 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
28775 void __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
28776 LDKPeerManager this_arg_conv;
28777 this_arg_conv.inner = (void*)(this_arg & (~1));
28778 this_arg_conv.is_owned = false;
28779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28780 PeerManager_disconnect_all_peers(&this_arg_conv);
28783 void __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
28784 LDKPeerManager this_arg_conv;
28785 this_arg_conv.inner = (void*)(this_arg & (~1));
28786 this_arg_conv.is_owned = false;
28787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28788 PeerManager_timer_tick_occurred(&this_arg_conv);
28791 int64_t __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
28792 int64_t ret_val = htlc_success_tx_weight(opt_anchors);
28796 int64_t __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
28797 int64_t ret_val = htlc_timeout_tx_weight(opt_anchors);
28801 int8_tArray __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
28802 unsigned char commitment_seed_arr[32];
28803 CHECK(commitment_seed->arr_len == 32);
28804 memcpy(commitment_seed_arr, commitment_seed->elems, 32);
28805 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
28806 int8_tArray ret_arr = init_int8_tArray(32);
28807 memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
28811 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, uint32_t funding_outpoint) {
28812 LDKCVec_u8Z to_holder_script_ref;
28813 to_holder_script_ref.datalen = to_holder_script->arr_len;
28814 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
28815 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen);
28816 LDKCVec_u8Z to_counterparty_script_ref;
28817 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
28818 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
28819 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen);
28820 LDKOutPoint funding_outpoint_conv;
28821 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
28822 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
28823 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
28824 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
28825 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);
28826 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28827 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28828 Transaction_free(ret_var);
28832 uint32_t __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
28833 LDKPublicKey per_commitment_point_ref;
28834 CHECK(per_commitment_point->arr_len == 33);
28835 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28836 unsigned char base_secret_arr[32];
28837 CHECK(base_secret->arr_len == 32);
28838 memcpy(base_secret_arr, base_secret->elems, 32);
28839 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
28840 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28841 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
28842 return (uint64_t)ret_conv;
28845 uint32_t __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
28846 LDKPublicKey per_commitment_point_ref;
28847 CHECK(per_commitment_point->arr_len == 33);
28848 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28849 LDKPublicKey base_point_ref;
28850 CHECK(base_point->arr_len == 33);
28851 memcpy(base_point_ref.compressed_form, base_point->elems, 33);
28852 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28853 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
28854 return (uint64_t)ret_conv;
28857 uint32_t __attribute__((export_name("TS_derive_private_revocation_key"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
28858 unsigned char per_commitment_secret_arr[32];
28859 CHECK(per_commitment_secret->arr_len == 32);
28860 memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32);
28861 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
28862 unsigned char countersignatory_revocation_base_secret_arr[32];
28863 CHECK(countersignatory_revocation_base_secret->arr_len == 32);
28864 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32);
28865 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
28866 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28867 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
28868 return (uint64_t)ret_conv;
28871 uint32_t __attribute__((export_name("TS_derive_public_revocation_key"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
28872 LDKPublicKey per_commitment_point_ref;
28873 CHECK(per_commitment_point->arr_len == 33);
28874 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28875 LDKPublicKey countersignatory_revocation_base_point_ref;
28876 CHECK(countersignatory_revocation_base_point->arr_len == 33);
28877 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33);
28878 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28879 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
28880 return (uint64_t)ret_conv;
28883 void __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint32_t this_obj) {
28884 LDKTxCreationKeys this_obj_conv;
28885 this_obj_conv.inner = (void*)(this_obj & (~1));
28886 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28888 TxCreationKeys_free(this_obj_conv);
28891 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
28892 LDKTxCreationKeys this_ptr_conv;
28893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28894 this_ptr_conv.is_owned = false;
28895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28896 int8_tArray ret_arr = init_int8_tArray(33);
28897 memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28901 void __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
28902 LDKTxCreationKeys this_ptr_conv;
28903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28904 this_ptr_conv.is_owned = false;
28905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28906 LDKPublicKey val_ref;
28907 CHECK(val->arr_len == 33);
28908 memcpy(val_ref.compressed_form, val->elems, 33);
28909 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
28912 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
28913 LDKTxCreationKeys this_ptr_conv;
28914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28915 this_ptr_conv.is_owned = false;
28916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28917 int8_tArray ret_arr = init_int8_tArray(33);
28918 memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
28922 void __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
28923 LDKTxCreationKeys this_ptr_conv;
28924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28925 this_ptr_conv.is_owned = false;
28926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28927 LDKPublicKey val_ref;
28928 CHECK(val->arr_len == 33);
28929 memcpy(val_ref.compressed_form, val->elems, 33);
28930 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
28933 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
28934 LDKTxCreationKeys this_ptr_conv;
28935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28936 this_ptr_conv.is_owned = false;
28937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28938 int8_tArray ret_arr = init_int8_tArray(33);
28939 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
28943 void __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
28944 LDKTxCreationKeys this_ptr_conv;
28945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28946 this_ptr_conv.is_owned = false;
28947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28948 LDKPublicKey val_ref;
28949 CHECK(val->arr_len == 33);
28950 memcpy(val_ref.compressed_form, val->elems, 33);
28951 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
28954 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
28955 LDKTxCreationKeys this_ptr_conv;
28956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28957 this_ptr_conv.is_owned = false;
28958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28959 int8_tArray ret_arr = init_int8_tArray(33);
28960 memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
28964 void __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
28965 LDKTxCreationKeys this_ptr_conv;
28966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28967 this_ptr_conv.is_owned = false;
28968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28969 LDKPublicKey val_ref;
28970 CHECK(val->arr_len == 33);
28971 memcpy(val_ref.compressed_form, val->elems, 33);
28972 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
28975 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
28976 LDKTxCreationKeys this_ptr_conv;
28977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28978 this_ptr_conv.is_owned = false;
28979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28980 int8_tArray ret_arr = init_int8_tArray(33);
28981 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
28985 void __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
28986 LDKTxCreationKeys this_ptr_conv;
28987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28988 this_ptr_conv.is_owned = false;
28989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28990 LDKPublicKey val_ref;
28991 CHECK(val->arr_len == 33);
28992 memcpy(val_ref.compressed_form, val->elems, 33);
28993 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
28996 uint32_t __attribute__((export_name("TS_TxCreationKeys_new"))) TS_TxCreationKeys_new(int8_tArray per_commitment_point_arg, int8_tArray revocation_key_arg, int8_tArray broadcaster_htlc_key_arg, int8_tArray countersignatory_htlc_key_arg, int8_tArray broadcaster_delayed_payment_key_arg) {
28997 LDKPublicKey per_commitment_point_arg_ref;
28998 CHECK(per_commitment_point_arg->arr_len == 33);
28999 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33);
29000 LDKPublicKey revocation_key_arg_ref;
29001 CHECK(revocation_key_arg->arr_len == 33);
29002 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33);
29003 LDKPublicKey broadcaster_htlc_key_arg_ref;
29004 CHECK(broadcaster_htlc_key_arg->arr_len == 33);
29005 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33);
29006 LDKPublicKey countersignatory_htlc_key_arg_ref;
29007 CHECK(countersignatory_htlc_key_arg->arr_len == 33);
29008 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33);
29009 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
29010 CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
29011 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33);
29012 LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_ref, broadcaster_htlc_key_arg_ref, countersignatory_htlc_key_arg_ref, broadcaster_delayed_payment_key_arg_ref);
29013 uint64_t ret_ref = 0;
29014 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29015 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29016 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29017 ret_ref = (uint64_t)ret_var.inner;
29018 if (ret_var.is_owned) {
29024 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
29025 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
29026 uint64_t ret_ref = 0;
29027 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29028 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29029 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29030 ret_ref = (uint64_t)ret_var.inner;
29031 if (ret_var.is_owned) {
29036 int64_t __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
29037 LDKTxCreationKeys arg_conv;
29038 arg_conv.inner = (void*)(arg & (~1));
29039 arg_conv.is_owned = false;
29040 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29041 int64_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
29045 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint32_t orig) {
29046 LDKTxCreationKeys orig_conv;
29047 orig_conv.inner = (void*)(orig & (~1));
29048 orig_conv.is_owned = false;
29049 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29050 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
29051 uint64_t ret_ref = 0;
29052 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29053 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29055 ret_ref = (uint64_t)ret_var.inner;
29056 if (ret_var.is_owned) {
29062 int8_tArray __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint32_t obj) {
29063 LDKTxCreationKeys obj_conv;
29064 obj_conv.inner = (void*)(obj & (~1));
29065 obj_conv.is_owned = false;
29066 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29067 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
29068 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29069 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29070 CVec_u8Z_free(ret_var);
29074 uint32_t __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
29075 LDKu8slice ser_ref;
29076 ser_ref.datalen = ser->arr_len;
29077 ser_ref.data = ser->elems;
29078 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
29079 *ret_conv = TxCreationKeys_read(ser_ref);
29080 return (uint64_t)ret_conv;
29083 void __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
29084 LDKChannelPublicKeys this_obj_conv;
29085 this_obj_conv.inner = (void*)(this_obj & (~1));
29086 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29088 ChannelPublicKeys_free(this_obj_conv);
29091 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
29092 LDKChannelPublicKeys this_ptr_conv;
29093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29094 this_ptr_conv.is_owned = false;
29095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29096 int8_tArray ret_arr = init_int8_tArray(33);
29097 memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
29101 void __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
29102 LDKChannelPublicKeys this_ptr_conv;
29103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29104 this_ptr_conv.is_owned = false;
29105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29106 LDKPublicKey val_ref;
29107 CHECK(val->arr_len == 33);
29108 memcpy(val_ref.compressed_form, val->elems, 33);
29109 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
29112 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
29113 LDKChannelPublicKeys this_ptr_conv;
29114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29115 this_ptr_conv.is_owned = false;
29116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29117 int8_tArray ret_arr = init_int8_tArray(33);
29118 memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
29122 void __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
29123 LDKChannelPublicKeys this_ptr_conv;
29124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29125 this_ptr_conv.is_owned = false;
29126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29127 LDKPublicKey val_ref;
29128 CHECK(val->arr_len == 33);
29129 memcpy(val_ref.compressed_form, val->elems, 33);
29130 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
29133 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
29134 LDKChannelPublicKeys this_ptr_conv;
29135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29136 this_ptr_conv.is_owned = false;
29137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29138 int8_tArray ret_arr = init_int8_tArray(33);
29139 memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
29143 void __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
29144 LDKChannelPublicKeys this_ptr_conv;
29145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29146 this_ptr_conv.is_owned = false;
29147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29148 LDKPublicKey val_ref;
29149 CHECK(val->arr_len == 33);
29150 memcpy(val_ref.compressed_form, val->elems, 33);
29151 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
29154 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
29155 LDKChannelPublicKeys this_ptr_conv;
29156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29157 this_ptr_conv.is_owned = false;
29158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29159 int8_tArray ret_arr = init_int8_tArray(33);
29160 memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
29164 void __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
29165 LDKChannelPublicKeys this_ptr_conv;
29166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29167 this_ptr_conv.is_owned = false;
29168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29169 LDKPublicKey val_ref;
29170 CHECK(val->arr_len == 33);
29171 memcpy(val_ref.compressed_form, val->elems, 33);
29172 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
29175 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
29176 LDKChannelPublicKeys this_ptr_conv;
29177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29178 this_ptr_conv.is_owned = false;
29179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29180 int8_tArray ret_arr = init_int8_tArray(33);
29181 memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
29185 void __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
29186 LDKChannelPublicKeys this_ptr_conv;
29187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29188 this_ptr_conv.is_owned = false;
29189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29190 LDKPublicKey val_ref;
29191 CHECK(val->arr_len == 33);
29192 memcpy(val_ref.compressed_form, val->elems, 33);
29193 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
29196 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_new"))) TS_ChannelPublicKeys_new(int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg) {
29197 LDKPublicKey funding_pubkey_arg_ref;
29198 CHECK(funding_pubkey_arg->arr_len == 33);
29199 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33);
29200 LDKPublicKey revocation_basepoint_arg_ref;
29201 CHECK(revocation_basepoint_arg->arr_len == 33);
29202 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33);
29203 LDKPublicKey payment_point_arg_ref;
29204 CHECK(payment_point_arg->arr_len == 33);
29205 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33);
29206 LDKPublicKey delayed_payment_basepoint_arg_ref;
29207 CHECK(delayed_payment_basepoint_arg->arr_len == 33);
29208 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33);
29209 LDKPublicKey htlc_basepoint_arg_ref;
29210 CHECK(htlc_basepoint_arg->arr_len == 33);
29211 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33);
29212 LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref);
29213 uint64_t ret_ref = 0;
29214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29217 ret_ref = (uint64_t)ret_var.inner;
29218 if (ret_var.is_owned) {
29224 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
29225 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
29226 uint64_t ret_ref = 0;
29227 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29228 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29229 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29230 ret_ref = (uint64_t)ret_var.inner;
29231 if (ret_var.is_owned) {
29236 int64_t __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
29237 LDKChannelPublicKeys arg_conv;
29238 arg_conv.inner = (void*)(arg & (~1));
29239 arg_conv.is_owned = false;
29240 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29241 int64_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
29245 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
29246 LDKChannelPublicKeys orig_conv;
29247 orig_conv.inner = (void*)(orig & (~1));
29248 orig_conv.is_owned = false;
29249 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29250 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
29251 uint64_t ret_ref = 0;
29252 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29253 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29255 ret_ref = (uint64_t)ret_var.inner;
29256 if (ret_var.is_owned) {
29262 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint32_t obj) {
29263 LDKChannelPublicKeys obj_conv;
29264 obj_conv.inner = (void*)(obj & (~1));
29265 obj_conv.is_owned = false;
29266 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29267 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
29268 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29269 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29270 CVec_u8Z_free(ret_var);
29274 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
29275 LDKu8slice ser_ref;
29276 ser_ref.datalen = ser->arr_len;
29277 ser_ref.data = ser->elems;
29278 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
29279 *ret_conv = ChannelPublicKeys_read(ser_ref);
29280 return (uint64_t)ret_conv;
29283 uint32_t __attribute__((export_name("TS_TxCreationKeys_derive_new"))) TS_TxCreationKeys_derive_new(int8_tArray per_commitment_point, int8_tArray broadcaster_delayed_payment_base, int8_tArray broadcaster_htlc_base, int8_tArray countersignatory_revocation_base, int8_tArray countersignatory_htlc_base) {
29284 LDKPublicKey per_commitment_point_ref;
29285 CHECK(per_commitment_point->arr_len == 33);
29286 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
29287 LDKPublicKey broadcaster_delayed_payment_base_ref;
29288 CHECK(broadcaster_delayed_payment_base->arr_len == 33);
29289 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33);
29290 LDKPublicKey broadcaster_htlc_base_ref;
29291 CHECK(broadcaster_htlc_base->arr_len == 33);
29292 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33);
29293 LDKPublicKey countersignatory_revocation_base_ref;
29294 CHECK(countersignatory_revocation_base->arr_len == 33);
29295 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33);
29296 LDKPublicKey countersignatory_htlc_base_ref;
29297 CHECK(countersignatory_htlc_base->arr_len == 33);
29298 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33);
29299 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
29300 *ret_conv = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
29301 return (uint64_t)ret_conv;
29304 uint32_t __attribute__((export_name("TS_TxCreationKeys_from_channel_static_keys"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
29305 LDKPublicKey per_commitment_point_ref;
29306 CHECK(per_commitment_point->arr_len == 33);
29307 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
29308 LDKChannelPublicKeys broadcaster_keys_conv;
29309 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
29310 broadcaster_keys_conv.is_owned = false;
29311 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
29312 LDKChannelPublicKeys countersignatory_keys_conv;
29313 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
29314 countersignatory_keys_conv.is_owned = false;
29315 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
29316 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
29317 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
29318 return (uint64_t)ret_conv;
29321 int8_tArray __attribute__((export_name("TS_get_revokeable_redeemscript"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
29322 LDKPublicKey revocation_key_ref;
29323 CHECK(revocation_key->arr_len == 33);
29324 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33);
29325 LDKPublicKey broadcaster_delayed_payment_key_ref;
29326 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
29327 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33);
29328 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
29329 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29330 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29331 CVec_u8Z_free(ret_var);
29335 void __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
29336 LDKHTLCOutputInCommitment this_obj_conv;
29337 this_obj_conv.inner = (void*)(this_obj & (~1));
29338 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29340 HTLCOutputInCommitment_free(this_obj_conv);
29343 jboolean __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
29344 LDKHTLCOutputInCommitment this_ptr_conv;
29345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29346 this_ptr_conv.is_owned = false;
29347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29348 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
29352 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
29353 LDKHTLCOutputInCommitment this_ptr_conv;
29354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29355 this_ptr_conv.is_owned = false;
29356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29357 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
29360 int64_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
29361 LDKHTLCOutputInCommitment this_ptr_conv;
29362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29363 this_ptr_conv.is_owned = false;
29364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29365 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
29369 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
29370 LDKHTLCOutputInCommitment this_ptr_conv;
29371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29372 this_ptr_conv.is_owned = false;
29373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29374 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
29377 int32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
29378 LDKHTLCOutputInCommitment this_ptr_conv;
29379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29380 this_ptr_conv.is_owned = false;
29381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29382 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
29386 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
29387 LDKHTLCOutputInCommitment this_ptr_conv;
29388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29389 this_ptr_conv.is_owned = false;
29390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29391 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
29394 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
29395 LDKHTLCOutputInCommitment this_ptr_conv;
29396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29397 this_ptr_conv.is_owned = false;
29398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29399 int8_tArray ret_arr = init_int8_tArray(32);
29400 memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
29404 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
29405 LDKHTLCOutputInCommitment this_ptr_conv;
29406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29407 this_ptr_conv.is_owned = false;
29408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29409 LDKThirtyTwoBytes val_ref;
29410 CHECK(val->arr_len == 32);
29411 memcpy(val_ref.data, val->elems, 32);
29412 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
29415 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
29416 LDKHTLCOutputInCommitment this_ptr_conv;
29417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29418 this_ptr_conv.is_owned = false;
29419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29420 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
29421 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
29422 uint64_t ret_ref = (uint64_t)ret_copy;
29426 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
29427 LDKHTLCOutputInCommitment this_ptr_conv;
29428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29429 this_ptr_conv.is_owned = false;
29430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29431 void* val_ptr = (void*)(((uint64_t)val) & ~1);
29432 CHECK_ACCESS(val_ptr);
29433 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
29434 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
29435 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
29438 uint32_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, uint32_t transaction_output_index_arg) {
29439 LDKThirtyTwoBytes payment_hash_arg_ref;
29440 CHECK(payment_hash_arg->arr_len == 32);
29441 memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32);
29442 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
29443 CHECK_ACCESS(transaction_output_index_arg_ptr);
29444 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
29445 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
29446 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
29447 uint64_t ret_ref = 0;
29448 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29449 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29450 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29451 ret_ref = (uint64_t)ret_var.inner;
29452 if (ret_var.is_owned) {
29458 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
29459 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
29460 uint64_t ret_ref = 0;
29461 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29462 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29464 ret_ref = (uint64_t)ret_var.inner;
29465 if (ret_var.is_owned) {
29470 int64_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
29471 LDKHTLCOutputInCommitment arg_conv;
29472 arg_conv.inner = (void*)(arg & (~1));
29473 arg_conv.is_owned = false;
29474 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29475 int64_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
29479 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
29480 LDKHTLCOutputInCommitment orig_conv;
29481 orig_conv.inner = (void*)(orig & (~1));
29482 orig_conv.is_owned = false;
29483 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29484 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
29485 uint64_t ret_ref = 0;
29486 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29487 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29489 ret_ref = (uint64_t)ret_var.inner;
29490 if (ret_var.is_owned) {
29496 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
29497 LDKHTLCOutputInCommitment obj_conv;
29498 obj_conv.inner = (void*)(obj & (~1));
29499 obj_conv.is_owned = false;
29500 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29501 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
29502 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29503 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29504 CVec_u8Z_free(ret_var);
29508 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
29509 LDKu8slice ser_ref;
29510 ser_ref.datalen = ser->arr_len;
29511 ser_ref.data = ser->elems;
29512 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29513 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
29514 return (uint64_t)ret_conv;
29517 int8_tArray __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) {
29518 LDKHTLCOutputInCommitment htlc_conv;
29519 htlc_conv.inner = (void*)(htlc & (~1));
29520 htlc_conv.is_owned = false;
29521 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29522 LDKTxCreationKeys keys_conv;
29523 keys_conv.inner = (void*)(keys & (~1));
29524 keys_conv.is_owned = false;
29525 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
29526 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
29527 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29528 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29529 CVec_u8Z_free(ret_var);
29533 int8_tArray __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
29534 LDKPublicKey broadcaster_ref;
29535 CHECK(broadcaster->arr_len == 33);
29536 memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33);
29537 LDKPublicKey countersignatory_ref;
29538 CHECK(countersignatory->arr_len == 33);
29539 memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33);
29540 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
29541 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29542 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29543 CVec_u8Z_free(ret_var);
29547 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, uint32_t htlc, jboolean opt_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
29548 unsigned char commitment_txid_arr[32];
29549 CHECK(commitment_txid->arr_len == 32);
29550 memcpy(commitment_txid_arr, commitment_txid->elems, 32);
29551 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
29552 LDKHTLCOutputInCommitment htlc_conv;
29553 htlc_conv.inner = (void*)(htlc & (~1));
29554 htlc_conv.is_owned = false;
29555 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29556 LDKPublicKey broadcaster_delayed_payment_key_ref;
29557 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
29558 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33);
29559 LDKPublicKey revocation_key_ref;
29560 CHECK(revocation_key->arr_len == 33);
29561 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33);
29562 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref);
29563 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29564 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29565 Transaction_free(ret_var);
29569 int8_tArray __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
29570 LDKPublicKey funding_pubkey_ref;
29571 CHECK(funding_pubkey->arr_len == 33);
29572 memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33);
29573 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
29574 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29575 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29576 CVec_u8Z_free(ret_var);
29580 void __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
29581 LDKChannelTransactionParameters this_obj_conv;
29582 this_obj_conv.inner = (void*)(this_obj & (~1));
29583 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29585 ChannelTransactionParameters_free(this_obj_conv);
29588 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
29589 LDKChannelTransactionParameters this_ptr_conv;
29590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29591 this_ptr_conv.is_owned = false;
29592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29593 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
29594 uint64_t ret_ref = 0;
29595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29598 ret_ref = (uint64_t)ret_var.inner;
29599 if (ret_var.is_owned) {
29605 void __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
29606 LDKChannelTransactionParameters this_ptr_conv;
29607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29608 this_ptr_conv.is_owned = false;
29609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29610 LDKChannelPublicKeys val_conv;
29611 val_conv.inner = (void*)(val & (~1));
29612 val_conv.is_owned = (val & 1) || (val == 0);
29613 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29614 val_conv = ChannelPublicKeys_clone(&val_conv);
29615 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
29618 int16_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
29619 LDKChannelTransactionParameters this_ptr_conv;
29620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29621 this_ptr_conv.is_owned = false;
29622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29623 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
29627 void __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29628 LDKChannelTransactionParameters this_ptr_conv;
29629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29630 this_ptr_conv.is_owned = false;
29631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29632 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
29635 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
29636 LDKChannelTransactionParameters this_ptr_conv;
29637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29638 this_ptr_conv.is_owned = false;
29639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29640 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
29644 void __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
29645 LDKChannelTransactionParameters this_ptr_conv;
29646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29647 this_ptr_conv.is_owned = false;
29648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29649 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
29652 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
29653 LDKChannelTransactionParameters this_ptr_conv;
29654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29655 this_ptr_conv.is_owned = false;
29656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29657 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
29658 uint64_t ret_ref = 0;
29659 if ((uint64_t)ret_var.inner > 4096) {
29660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29662 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29663 ret_ref = (uint64_t)ret_var.inner;
29664 if (ret_var.is_owned) {
29671 void __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
29672 LDKChannelTransactionParameters this_ptr_conv;
29673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29674 this_ptr_conv.is_owned = false;
29675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29676 LDKCounterpartyChannelTransactionParameters val_conv;
29677 val_conv.inner = (void*)(val & (~1));
29678 val_conv.is_owned = (val & 1) || (val == 0);
29679 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29680 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
29681 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
29684 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
29685 LDKChannelTransactionParameters this_ptr_conv;
29686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29687 this_ptr_conv.is_owned = false;
29688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29689 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
29690 uint64_t ret_ref = 0;
29691 if ((uint64_t)ret_var.inner > 4096) {
29692 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29693 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29695 ret_ref = (uint64_t)ret_var.inner;
29696 if (ret_var.is_owned) {
29703 void __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
29704 LDKChannelTransactionParameters this_ptr_conv;
29705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29706 this_ptr_conv.is_owned = false;
29707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29708 LDKOutPoint val_conv;
29709 val_conv.inner = (void*)(val & (~1));
29710 val_conv.is_owned = (val & 1) || (val == 0);
29711 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29712 val_conv = OutPoint_clone(&val_conv);
29713 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
29716 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) {
29717 LDKChannelTransactionParameters this_ptr_conv;
29718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29719 this_ptr_conv.is_owned = false;
29720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29721 uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
29725 void __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) {
29726 LDKChannelTransactionParameters this_ptr_conv;
29727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29728 this_ptr_conv.is_owned = false;
29729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29730 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
29731 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
29734 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_new"))) TS_ChannelTransactionParameters_new(uint32_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint32_t counterparty_parameters_arg, uint32_t funding_outpoint_arg, uint32_t opt_anchors_arg) {
29735 LDKChannelPublicKeys holder_pubkeys_arg_conv;
29736 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
29737 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
29738 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
29739 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
29740 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
29741 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
29742 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
29743 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
29744 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
29745 LDKOutPoint funding_outpoint_arg_conv;
29746 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
29747 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
29748 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
29749 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
29750 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
29751 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, opt_anchors_arg_conv);
29752 uint64_t ret_ref = 0;
29753 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29754 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29756 ret_ref = (uint64_t)ret_var.inner;
29757 if (ret_var.is_owned) {
29763 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
29764 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
29765 uint64_t ret_ref = 0;
29766 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29767 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29769 ret_ref = (uint64_t)ret_var.inner;
29770 if (ret_var.is_owned) {
29775 int64_t __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
29776 LDKChannelTransactionParameters arg_conv;
29777 arg_conv.inner = (void*)(arg & (~1));
29778 arg_conv.is_owned = false;
29779 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29780 int64_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
29784 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
29785 LDKChannelTransactionParameters orig_conv;
29786 orig_conv.inner = (void*)(orig & (~1));
29787 orig_conv.is_owned = false;
29788 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29789 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
29790 uint64_t ret_ref = 0;
29791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29794 ret_ref = (uint64_t)ret_var.inner;
29795 if (ret_var.is_owned) {
29801 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
29802 LDKCounterpartyChannelTransactionParameters this_obj_conv;
29803 this_obj_conv.inner = (void*)(this_obj & (~1));
29804 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29806 CounterpartyChannelTransactionParameters_free(this_obj_conv);
29809 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
29810 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29812 this_ptr_conv.is_owned = false;
29813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29814 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
29815 uint64_t ret_ref = 0;
29816 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29817 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29819 ret_ref = (uint64_t)ret_var.inner;
29820 if (ret_var.is_owned) {
29826 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
29827 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29829 this_ptr_conv.is_owned = false;
29830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29831 LDKChannelPublicKeys val_conv;
29832 val_conv.inner = (void*)(val & (~1));
29833 val_conv.is_owned = (val & 1) || (val == 0);
29834 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29835 val_conv = ChannelPublicKeys_clone(&val_conv);
29836 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
29839 int16_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
29840 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29842 this_ptr_conv.is_owned = false;
29843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29844 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
29848 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29849 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29851 this_ptr_conv.is_owned = false;
29852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29853 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
29856 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
29857 LDKChannelPublicKeys pubkeys_arg_conv;
29858 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
29859 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
29860 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
29861 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
29862 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
29863 uint64_t ret_ref = 0;
29864 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29865 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29866 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29867 ret_ref = (uint64_t)ret_var.inner;
29868 if (ret_var.is_owned) {
29874 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
29875 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
29876 uint64_t ret_ref = 0;
29877 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29878 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29880 ret_ref = (uint64_t)ret_var.inner;
29881 if (ret_var.is_owned) {
29886 int64_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
29887 LDKCounterpartyChannelTransactionParameters arg_conv;
29888 arg_conv.inner = (void*)(arg & (~1));
29889 arg_conv.is_owned = false;
29890 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29891 int64_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
29895 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
29896 LDKCounterpartyChannelTransactionParameters orig_conv;
29897 orig_conv.inner = (void*)(orig & (~1));
29898 orig_conv.is_owned = false;
29899 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29900 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
29901 uint64_t ret_ref = 0;
29902 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29903 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29905 ret_ref = (uint64_t)ret_var.inner;
29906 if (ret_var.is_owned) {
29912 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
29913 LDKChannelTransactionParameters this_arg_conv;
29914 this_arg_conv.inner = (void*)(this_arg & (~1));
29915 this_arg_conv.is_owned = false;
29916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29917 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
29921 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
29922 LDKChannelTransactionParameters this_arg_conv;
29923 this_arg_conv.inner = (void*)(this_arg & (~1));
29924 this_arg_conv.is_owned = false;
29925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29926 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
29927 uint64_t ret_ref = 0;
29928 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29929 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29930 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29931 ret_ref = (uint64_t)ret_var.inner;
29932 if (ret_var.is_owned) {
29938 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
29939 LDKChannelTransactionParameters this_arg_conv;
29940 this_arg_conv.inner = (void*)(this_arg & (~1));
29941 this_arg_conv.is_owned = false;
29942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29943 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
29944 uint64_t ret_ref = 0;
29945 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29946 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29947 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29948 ret_ref = (uint64_t)ret_var.inner;
29949 if (ret_var.is_owned) {
29955 int8_tArray __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
29956 LDKCounterpartyChannelTransactionParameters obj_conv;
29957 obj_conv.inner = (void*)(obj & (~1));
29958 obj_conv.is_owned = false;
29959 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29960 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
29961 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29962 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29963 CVec_u8Z_free(ret_var);
29967 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
29968 LDKu8slice ser_ref;
29969 ser_ref.datalen = ser->arr_len;
29970 ser_ref.data = ser->elems;
29971 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29972 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
29973 return (uint64_t)ret_conv;
29976 int8_tArray __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
29977 LDKChannelTransactionParameters obj_conv;
29978 obj_conv.inner = (void*)(obj & (~1));
29979 obj_conv.is_owned = false;
29980 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29981 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
29982 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29983 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29984 CVec_u8Z_free(ret_var);
29988 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
29989 LDKu8slice ser_ref;
29990 ser_ref.datalen = ser->arr_len;
29991 ser_ref.data = ser->elems;
29992 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29993 *ret_conv = ChannelTransactionParameters_read(ser_ref);
29994 return (uint64_t)ret_conv;
29997 void __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
29998 LDKDirectedChannelTransactionParameters this_obj_conv;
29999 this_obj_conv.inner = (void*)(this_obj & (~1));
30000 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30002 DirectedChannelTransactionParameters_free(this_obj_conv);
30005 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
30006 LDKDirectedChannelTransactionParameters this_arg_conv;
30007 this_arg_conv.inner = (void*)(this_arg & (~1));
30008 this_arg_conv.is_owned = false;
30009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30010 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
30011 uint64_t ret_ref = 0;
30012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30015 ret_ref = (uint64_t)ret_var.inner;
30016 if (ret_var.is_owned) {
30022 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
30023 LDKDirectedChannelTransactionParameters this_arg_conv;
30024 this_arg_conv.inner = (void*)(this_arg & (~1));
30025 this_arg_conv.is_owned = false;
30026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30027 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
30028 uint64_t ret_ref = 0;
30029 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30030 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30031 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30032 ret_ref = (uint64_t)ret_var.inner;
30033 if (ret_var.is_owned) {
30039 int16_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
30040 LDKDirectedChannelTransactionParameters this_arg_conv;
30041 this_arg_conv.inner = (void*)(this_arg & (~1));
30042 this_arg_conv.is_owned = false;
30043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30044 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
30048 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
30049 LDKDirectedChannelTransactionParameters this_arg_conv;
30050 this_arg_conv.inner = (void*)(this_arg & (~1));
30051 this_arg_conv.is_owned = false;
30052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30053 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
30057 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
30058 LDKDirectedChannelTransactionParameters this_arg_conv;
30059 this_arg_conv.inner = (void*)(this_arg & (~1));
30060 this_arg_conv.is_owned = false;
30061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30062 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
30063 uint64_t ret_ref = 0;
30064 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30065 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30066 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30067 ret_ref = (uint64_t)ret_var.inner;
30068 if (ret_var.is_owned) {
30074 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) {
30075 LDKDirectedChannelTransactionParameters this_arg_conv;
30076 this_arg_conv.inner = (void*)(this_arg & (~1));
30077 this_arg_conv.is_owned = false;
30078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30079 jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
30083 void __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
30084 LDKHolderCommitmentTransaction this_obj_conv;
30085 this_obj_conv.inner = (void*)(this_obj & (~1));
30086 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30088 HolderCommitmentTransaction_free(this_obj_conv);
30091 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
30092 LDKHolderCommitmentTransaction this_ptr_conv;
30093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30094 this_ptr_conv.is_owned = false;
30095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30096 int8_tArray ret_arr = init_int8_tArray(64);
30097 memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
30101 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
30102 LDKHolderCommitmentTransaction this_ptr_conv;
30103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30104 this_ptr_conv.is_owned = false;
30105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30106 LDKSignature val_ref;
30107 CHECK(val->arr_len == 64);
30108 memcpy(val_ref.compact_form, val->elems, 64);
30109 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
30112 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
30113 LDKHolderCommitmentTransaction this_ptr_conv;
30114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30115 this_ptr_conv.is_owned = false;
30116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30117 LDKCVec_SignatureZ val_constr;
30118 val_constr.datalen = val->arr_len;
30119 if (val_constr.datalen > 0)
30120 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30122 val_constr.data = NULL;
30123 int8_tArray* val_vals = (void*) val->elems;
30124 for (size_t m = 0; m < val_constr.datalen; m++) {
30125 int8_tArray val_conv_12 = val_vals[m];
30126 LDKSignature val_conv_12_ref;
30127 CHECK(val_conv_12->arr_len == 64);
30128 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64);
30129 val_constr.data[m] = val_conv_12_ref;
30131 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
30134 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
30135 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
30136 uint64_t ret_ref = 0;
30137 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30138 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30139 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30140 ret_ref = (uint64_t)ret_var.inner;
30141 if (ret_var.is_owned) {
30146 int64_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
30147 LDKHolderCommitmentTransaction arg_conv;
30148 arg_conv.inner = (void*)(arg & (~1));
30149 arg_conv.is_owned = false;
30150 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30151 int64_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
30155 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
30156 LDKHolderCommitmentTransaction orig_conv;
30157 orig_conv.inner = (void*)(orig & (~1));
30158 orig_conv.is_owned = false;
30159 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30160 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
30161 uint64_t ret_ref = 0;
30162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30165 ret_ref = (uint64_t)ret_var.inner;
30166 if (ret_var.is_owned) {
30172 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
30173 LDKHolderCommitmentTransaction obj_conv;
30174 obj_conv.inner = (void*)(obj & (~1));
30175 obj_conv.is_owned = false;
30176 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30177 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
30178 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30179 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30180 CVec_u8Z_free(ret_var);
30184 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
30185 LDKu8slice ser_ref;
30186 ser_ref.datalen = ser->arr_len;
30187 ser_ref.data = ser->elems;
30188 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
30189 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
30190 return (uint64_t)ret_conv;
30193 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_new"))) TS_HolderCommitmentTransaction_new(uint32_t commitment_tx, int8_tArray counterparty_sig, ptrArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
30194 LDKCommitmentTransaction commitment_tx_conv;
30195 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
30196 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
30197 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
30198 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
30199 LDKSignature counterparty_sig_ref;
30200 CHECK(counterparty_sig->arr_len == 64);
30201 memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64);
30202 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
30203 counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
30204 if (counterparty_htlc_sigs_constr.datalen > 0)
30205 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30207 counterparty_htlc_sigs_constr.data = NULL;
30208 int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
30209 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
30210 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
30211 LDKSignature counterparty_htlc_sigs_conv_12_ref;
30212 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
30213 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64);
30214 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
30216 LDKPublicKey holder_funding_key_ref;
30217 CHECK(holder_funding_key->arr_len == 33);
30218 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33);
30219 LDKPublicKey counterparty_funding_key_ref;
30220 CHECK(counterparty_funding_key->arr_len == 33);
30221 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33);
30222 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
30223 uint64_t ret_ref = 0;
30224 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30225 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30227 ret_ref = (uint64_t)ret_var.inner;
30228 if (ret_var.is_owned) {
30234 void __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
30235 LDKBuiltCommitmentTransaction this_obj_conv;
30236 this_obj_conv.inner = (void*)(this_obj & (~1));
30237 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30239 BuiltCommitmentTransaction_free(this_obj_conv);
30242 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
30243 LDKBuiltCommitmentTransaction this_ptr_conv;
30244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30245 this_ptr_conv.is_owned = false;
30246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30247 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
30248 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30249 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30250 Transaction_free(ret_var);
30254 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
30255 LDKBuiltCommitmentTransaction this_ptr_conv;
30256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30257 this_ptr_conv.is_owned = false;
30258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30259 LDKTransaction val_ref;
30260 val_ref.datalen = val->arr_len;
30261 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
30262 memcpy(val_ref.data, val->elems, val_ref.datalen);
30263 val_ref.data_is_owned = true;
30264 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
30267 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
30268 LDKBuiltCommitmentTransaction this_ptr_conv;
30269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30270 this_ptr_conv.is_owned = false;
30271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30272 int8_tArray ret_arr = init_int8_tArray(32);
30273 memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
30277 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
30278 LDKBuiltCommitmentTransaction this_ptr_conv;
30279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30280 this_ptr_conv.is_owned = false;
30281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30282 LDKThirtyTwoBytes val_ref;
30283 CHECK(val->arr_len == 32);
30284 memcpy(val_ref.data, val->elems, 32);
30285 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
30288 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
30289 LDKTransaction transaction_arg_ref;
30290 transaction_arg_ref.datalen = transaction_arg->arr_len;
30291 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
30292 memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen);
30293 transaction_arg_ref.data_is_owned = true;
30294 LDKThirtyTwoBytes txid_arg_ref;
30295 CHECK(txid_arg->arr_len == 32);
30296 memcpy(txid_arg_ref.data, txid_arg->elems, 32);
30297 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
30298 uint64_t ret_ref = 0;
30299 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30300 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30302 ret_ref = (uint64_t)ret_var.inner;
30303 if (ret_var.is_owned) {
30309 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
30310 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
30311 uint64_t ret_ref = 0;
30312 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30313 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30314 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30315 ret_ref = (uint64_t)ret_var.inner;
30316 if (ret_var.is_owned) {
30321 int64_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
30322 LDKBuiltCommitmentTransaction arg_conv;
30323 arg_conv.inner = (void*)(arg & (~1));
30324 arg_conv.is_owned = false;
30325 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30326 int64_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
30330 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
30331 LDKBuiltCommitmentTransaction orig_conv;
30332 orig_conv.inner = (void*)(orig & (~1));
30333 orig_conv.is_owned = false;
30334 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30335 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
30336 uint64_t ret_ref = 0;
30337 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30338 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30339 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30340 ret_ref = (uint64_t)ret_var.inner;
30341 if (ret_var.is_owned) {
30347 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
30348 LDKBuiltCommitmentTransaction obj_conv;
30349 obj_conv.inner = (void*)(obj & (~1));
30350 obj_conv.is_owned = false;
30351 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30352 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
30353 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30354 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30355 CVec_u8Z_free(ret_var);
30359 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
30360 LDKu8slice ser_ref;
30361 ser_ref.datalen = ser->arr_len;
30362 ser_ref.data = ser->elems;
30363 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
30364 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
30365 return (uint64_t)ret_conv;
30368 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_sighash_all"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30369 LDKBuiltCommitmentTransaction this_arg_conv;
30370 this_arg_conv.inner = (void*)(this_arg & (~1));
30371 this_arg_conv.is_owned = false;
30372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30373 LDKu8slice funding_redeemscript_ref;
30374 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30375 funding_redeemscript_ref.data = funding_redeemscript->elems;
30376 int8_tArray ret_arr = init_int8_tArray(32);
30377 memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
30381 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_sign"))) TS_BuiltCommitmentTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30382 LDKBuiltCommitmentTransaction this_arg_conv;
30383 this_arg_conv.inner = (void*)(this_arg & (~1));
30384 this_arg_conv.is_owned = false;
30385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30386 unsigned char funding_key_arr[32];
30387 CHECK(funding_key->arr_len == 32);
30388 memcpy(funding_key_arr, funding_key->elems, 32);
30389 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
30390 LDKu8slice funding_redeemscript_ref;
30391 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30392 funding_redeemscript_ref.data = funding_redeemscript->elems;
30393 int8_tArray ret_arr = init_int8_tArray(64);
30394 memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
30398 void __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint32_t this_obj) {
30399 LDKClosingTransaction this_obj_conv;
30400 this_obj_conv.inner = (void*)(this_obj & (~1));
30401 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30403 ClosingTransaction_free(this_obj_conv);
30406 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
30407 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
30408 uint64_t ret_ref = 0;
30409 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30410 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30412 ret_ref = (uint64_t)ret_var.inner;
30413 if (ret_var.is_owned) {
30418 int64_t __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
30419 LDKClosingTransaction arg_conv;
30420 arg_conv.inner = (void*)(arg & (~1));
30421 arg_conv.is_owned = false;
30422 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30423 int64_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
30427 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint32_t orig) {
30428 LDKClosingTransaction orig_conv;
30429 orig_conv.inner = (void*)(orig & (~1));
30430 orig_conv.is_owned = false;
30431 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30432 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
30433 uint64_t ret_ref = 0;
30434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30437 ret_ref = (uint64_t)ret_var.inner;
30438 if (ret_var.is_owned) {
30444 int64_t __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint32_t o) {
30445 LDKClosingTransaction o_conv;
30446 o_conv.inner = (void*)(o & (~1));
30447 o_conv.is_owned = false;
30448 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30449 int64_t ret_val = ClosingTransaction_hash(&o_conv);
30453 uint32_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, uint32_t funding_outpoint) {
30454 LDKCVec_u8Z to_holder_script_ref;
30455 to_holder_script_ref.datalen = to_holder_script->arr_len;
30456 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
30457 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen);
30458 LDKCVec_u8Z to_counterparty_script_ref;
30459 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
30460 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
30461 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen);
30462 LDKOutPoint funding_outpoint_conv;
30463 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
30464 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
30465 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
30466 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
30467 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
30468 uint64_t ret_ref = 0;
30469 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30470 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30471 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30472 ret_ref = (uint64_t)ret_var.inner;
30473 if (ret_var.is_owned) {
30479 uint32_t __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
30480 LDKClosingTransaction this_arg_conv;
30481 this_arg_conv.inner = (void*)(this_arg & (~1));
30482 this_arg_conv.is_owned = false;
30483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30484 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
30485 uint64_t ret_ref = 0;
30486 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30487 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30489 ret_ref = (uint64_t)ret_var.inner;
30490 if (ret_var.is_owned) {
30496 uint32_t __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
30497 LDKClosingTransaction this_arg_conv;
30498 this_arg_conv.inner = (void*)(this_arg & (~1));
30499 this_arg_conv.is_owned = false;
30500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30501 LDKOutPoint funding_outpoint_conv;
30502 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
30503 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
30504 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
30505 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
30506 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
30507 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
30508 return (uint64_t)ret_conv;
30511 int64_t __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
30512 LDKClosingTransaction this_arg_conv;
30513 this_arg_conv.inner = (void*)(this_arg & (~1));
30514 this_arg_conv.is_owned = false;
30515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30516 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
30520 int64_t __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
30521 LDKClosingTransaction this_arg_conv;
30522 this_arg_conv.inner = (void*)(this_arg & (~1));
30523 this_arg_conv.is_owned = false;
30524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30525 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
30529 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
30530 LDKClosingTransaction this_arg_conv;
30531 this_arg_conv.inner = (void*)(this_arg & (~1));
30532 this_arg_conv.is_owned = false;
30533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30534 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
30535 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30536 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30540 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
30541 LDKClosingTransaction this_arg_conv;
30542 this_arg_conv.inner = (void*)(this_arg & (~1));
30543 this_arg_conv.is_owned = false;
30544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30545 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
30546 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30547 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30551 void __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
30552 LDKTrustedClosingTransaction this_obj_conv;
30553 this_obj_conv.inner = (void*)(this_obj & (~1));
30554 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30556 TrustedClosingTransaction_free(this_obj_conv);
30559 int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
30560 LDKTrustedClosingTransaction this_arg_conv;
30561 this_arg_conv.inner = (void*)(this_arg & (~1));
30562 this_arg_conv.is_owned = false;
30563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30564 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
30565 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30566 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30567 Transaction_free(ret_var);
30571 int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_get_sighash_all"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30572 LDKTrustedClosingTransaction this_arg_conv;
30573 this_arg_conv.inner = (void*)(this_arg & (~1));
30574 this_arg_conv.is_owned = false;
30575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30576 LDKu8slice funding_redeemscript_ref;
30577 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30578 funding_redeemscript_ref.data = funding_redeemscript->elems;
30579 int8_tArray ret_arr = init_int8_tArray(32);
30580 memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
30584 int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_sign"))) TS_TrustedClosingTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30585 LDKTrustedClosingTransaction this_arg_conv;
30586 this_arg_conv.inner = (void*)(this_arg & (~1));
30587 this_arg_conv.is_owned = false;
30588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30589 unsigned char funding_key_arr[32];
30590 CHECK(funding_key->arr_len == 32);
30591 memcpy(funding_key_arr, funding_key->elems, 32);
30592 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
30593 LDKu8slice funding_redeemscript_ref;
30594 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30595 funding_redeemscript_ref.data = funding_redeemscript->elems;
30596 int8_tArray ret_arr = init_int8_tArray(64);
30597 memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
30601 void __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
30602 LDKCommitmentTransaction this_obj_conv;
30603 this_obj_conv.inner = (void*)(this_obj & (~1));
30604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30606 CommitmentTransaction_free(this_obj_conv);
30609 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
30610 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
30611 uint64_t ret_ref = 0;
30612 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30613 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30615 ret_ref = (uint64_t)ret_var.inner;
30616 if (ret_var.is_owned) {
30621 int64_t __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
30622 LDKCommitmentTransaction arg_conv;
30623 arg_conv.inner = (void*)(arg & (~1));
30624 arg_conv.is_owned = false;
30625 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30626 int64_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
30630 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint32_t orig) {
30631 LDKCommitmentTransaction orig_conv;
30632 orig_conv.inner = (void*)(orig & (~1));
30633 orig_conv.is_owned = false;
30634 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30635 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
30636 uint64_t ret_ref = 0;
30637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30640 ret_ref = (uint64_t)ret_var.inner;
30641 if (ret_var.is_owned) {
30647 int8_tArray __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint32_t obj) {
30648 LDKCommitmentTransaction obj_conv;
30649 obj_conv.inner = (void*)(obj & (~1));
30650 obj_conv.is_owned = false;
30651 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30652 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
30653 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30654 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30655 CVec_u8Z_free(ret_var);
30659 uint32_t __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
30660 LDKu8slice ser_ref;
30661 ser_ref.datalen = ser->arr_len;
30662 ser_ref.data = ser->elems;
30663 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30664 *ret_conv = CommitmentTransaction_read(ser_ref);
30665 return (uint64_t)ret_conv;
30668 int64_t __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
30669 LDKCommitmentTransaction this_arg_conv;
30670 this_arg_conv.inner = (void*)(this_arg & (~1));
30671 this_arg_conv.is_owned = false;
30672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30673 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
30677 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
30678 LDKCommitmentTransaction this_arg_conv;
30679 this_arg_conv.inner = (void*)(this_arg & (~1));
30680 this_arg_conv.is_owned = false;
30681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30682 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
30686 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
30687 LDKCommitmentTransaction this_arg_conv;
30688 this_arg_conv.inner = (void*)(this_arg & (~1));
30689 this_arg_conv.is_owned = false;
30690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30691 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
30695 int32_t __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
30696 LDKCommitmentTransaction this_arg_conv;
30697 this_arg_conv.inner = (void*)(this_arg & (~1));
30698 this_arg_conv.is_owned = false;
30699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30700 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
30704 uint32_t __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
30705 LDKCommitmentTransaction this_arg_conv;
30706 this_arg_conv.inner = (void*)(this_arg & (~1));
30707 this_arg_conv.is_owned = false;
30708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30709 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
30710 uint64_t ret_ref = 0;
30711 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30712 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30713 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30714 ret_ref = (uint64_t)ret_var.inner;
30715 if (ret_var.is_owned) {
30721 uint32_t __attribute__((export_name("TS_CommitmentTransaction_verify"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
30722 LDKCommitmentTransaction this_arg_conv;
30723 this_arg_conv.inner = (void*)(this_arg & (~1));
30724 this_arg_conv.is_owned = false;
30725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30726 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30727 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30728 channel_parameters_conv.is_owned = false;
30729 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30730 LDKChannelPublicKeys broadcaster_keys_conv;
30731 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
30732 broadcaster_keys_conv.is_owned = false;
30733 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
30734 LDKChannelPublicKeys countersignatory_keys_conv;
30735 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
30736 countersignatory_keys_conv.is_owned = false;
30737 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
30738 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
30739 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
30740 return (uint64_t)ret_conv;
30743 void __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
30744 LDKTrustedCommitmentTransaction this_obj_conv;
30745 this_obj_conv.inner = (void*)(this_obj & (~1));
30746 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30748 TrustedCommitmentTransaction_free(this_obj_conv);
30751 int8_tArray __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
30752 LDKTrustedCommitmentTransaction this_arg_conv;
30753 this_arg_conv.inner = (void*)(this_arg & (~1));
30754 this_arg_conv.is_owned = false;
30755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30756 int8_tArray ret_arr = init_int8_tArray(32);
30757 memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
30761 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
30762 LDKTrustedCommitmentTransaction this_arg_conv;
30763 this_arg_conv.inner = (void*)(this_arg & (~1));
30764 this_arg_conv.is_owned = false;
30765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30766 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
30767 uint64_t ret_ref = 0;
30768 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30769 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30771 ret_ref = (uint64_t)ret_var.inner;
30772 if (ret_var.is_owned) {
30778 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
30779 LDKTrustedCommitmentTransaction this_arg_conv;
30780 this_arg_conv.inner = (void*)(this_arg & (~1));
30781 this_arg_conv.is_owned = false;
30782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30783 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
30784 uint64_t ret_ref = 0;
30785 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30786 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30787 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30788 ret_ref = (uint64_t)ret_var.inner;
30789 if (ret_var.is_owned) {
30795 jboolean __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) {
30796 LDKTrustedCommitmentTransaction this_arg_conv;
30797 this_arg_conv.inner = (void*)(this_arg & (~1));
30798 this_arg_conv.is_owned = false;
30799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30800 jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
30804 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_get_htlc_sigs"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
30805 LDKTrustedCommitmentTransaction this_arg_conv;
30806 this_arg_conv.inner = (void*)(this_arg & (~1));
30807 this_arg_conv.is_owned = false;
30808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30809 unsigned char htlc_base_key_arr[32];
30810 CHECK(htlc_base_key->arr_len == 32);
30811 memcpy(htlc_base_key_arr, htlc_base_key->elems, 32);
30812 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
30813 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30814 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30815 channel_parameters_conv.is_owned = false;
30816 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30817 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30818 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
30819 return (uint64_t)ret_conv;
30822 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) {
30823 LDKPublicKey broadcaster_payment_basepoint_ref;
30824 CHECK(broadcaster_payment_basepoint->arr_len == 33);
30825 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33);
30826 LDKPublicKey countersignatory_payment_basepoint_ref;
30827 CHECK(countersignatory_payment_basepoint->arr_len == 33);
30828 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33);
30829 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
30833 jboolean __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
30834 LDKInitFeatures a_conv;
30835 a_conv.inner = (void*)(a & (~1));
30836 a_conv.is_owned = false;
30837 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30838 LDKInitFeatures b_conv;
30839 b_conv.inner = (void*)(b & (~1));
30840 b_conv.is_owned = false;
30841 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30842 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
30846 jboolean __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
30847 LDKNodeFeatures a_conv;
30848 a_conv.inner = (void*)(a & (~1));
30849 a_conv.is_owned = false;
30850 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30851 LDKNodeFeatures b_conv;
30852 b_conv.inner = (void*)(b & (~1));
30853 b_conv.is_owned = false;
30854 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30855 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
30859 jboolean __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
30860 LDKChannelFeatures a_conv;
30861 a_conv.inner = (void*)(a & (~1));
30862 a_conv.is_owned = false;
30863 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30864 LDKChannelFeatures b_conv;
30865 b_conv.inner = (void*)(b & (~1));
30866 b_conv.is_owned = false;
30867 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30868 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
30872 jboolean __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
30873 LDKInvoiceFeatures a_conv;
30874 a_conv.inner = (void*)(a & (~1));
30875 a_conv.is_owned = false;
30876 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30877 LDKInvoiceFeatures b_conv;
30878 b_conv.inner = (void*)(b & (~1));
30879 b_conv.is_owned = false;
30880 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30881 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
30885 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) {
30886 LDKChannelTypeFeatures a_conv;
30887 a_conv.inner = (void*)(a & (~1));
30888 a_conv.is_owned = false;
30889 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30890 LDKChannelTypeFeatures b_conv;
30891 b_conv.inner = (void*)(b & (~1));
30892 b_conv.is_owned = false;
30893 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30894 jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv);
30898 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
30899 LDKInitFeatures ret_var = InitFeatures_clone(arg);
30900 uint64_t ret_ref = 0;
30901 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30902 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30904 ret_ref = (uint64_t)ret_var.inner;
30905 if (ret_var.is_owned) {
30910 int64_t __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
30911 LDKInitFeatures arg_conv;
30912 arg_conv.inner = (void*)(arg & (~1));
30913 arg_conv.is_owned = false;
30914 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30915 int64_t ret_val = InitFeatures_clone_ptr(&arg_conv);
30919 uint32_t __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint32_t orig) {
30920 LDKInitFeatures orig_conv;
30921 orig_conv.inner = (void*)(orig & (~1));
30922 orig_conv.is_owned = false;
30923 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30924 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
30925 uint64_t ret_ref = 0;
30926 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30927 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30929 ret_ref = (uint64_t)ret_var.inner;
30930 if (ret_var.is_owned) {
30936 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
30937 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
30938 uint64_t ret_ref = 0;
30939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30941 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30942 ret_ref = (uint64_t)ret_var.inner;
30943 if (ret_var.is_owned) {
30948 int64_t __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
30949 LDKNodeFeatures arg_conv;
30950 arg_conv.inner = (void*)(arg & (~1));
30951 arg_conv.is_owned = false;
30952 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30953 int64_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
30957 uint32_t __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint32_t orig) {
30958 LDKNodeFeatures orig_conv;
30959 orig_conv.inner = (void*)(orig & (~1));
30960 orig_conv.is_owned = false;
30961 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30962 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
30963 uint64_t ret_ref = 0;
30964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30967 ret_ref = (uint64_t)ret_var.inner;
30968 if (ret_var.is_owned) {
30974 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
30975 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
30976 uint64_t ret_ref = 0;
30977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30980 ret_ref = (uint64_t)ret_var.inner;
30981 if (ret_var.is_owned) {
30986 int64_t __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
30987 LDKChannelFeatures arg_conv;
30988 arg_conv.inner = (void*)(arg & (~1));
30989 arg_conv.is_owned = false;
30990 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30991 int64_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
30995 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint32_t orig) {
30996 LDKChannelFeatures orig_conv;
30997 orig_conv.inner = (void*)(orig & (~1));
30998 orig_conv.is_owned = false;
30999 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31000 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
31001 uint64_t ret_ref = 0;
31002 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31003 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31004 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31005 ret_ref = (uint64_t)ret_var.inner;
31006 if (ret_var.is_owned) {
31012 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
31013 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
31014 uint64_t ret_ref = 0;
31015 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31016 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31017 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31018 ret_ref = (uint64_t)ret_var.inner;
31019 if (ret_var.is_owned) {
31024 int64_t __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
31025 LDKInvoiceFeatures arg_conv;
31026 arg_conv.inner = (void*)(arg & (~1));
31027 arg_conv.is_owned = false;
31028 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31029 int64_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
31033 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint32_t orig) {
31034 LDKInvoiceFeatures orig_conv;
31035 orig_conv.inner = (void*)(orig & (~1));
31036 orig_conv.is_owned = false;
31037 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31038 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
31039 uint64_t ret_ref = 0;
31040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31043 ret_ref = (uint64_t)ret_var.inner;
31044 if (ret_var.is_owned) {
31050 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
31051 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
31052 uint64_t ret_ref = 0;
31053 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31054 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31056 ret_ref = (uint64_t)ret_var.inner;
31057 if (ret_var.is_owned) {
31062 int64_t __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) {
31063 LDKChannelTypeFeatures arg_conv;
31064 arg_conv.inner = (void*)(arg & (~1));
31065 arg_conv.is_owned = false;
31066 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31067 int64_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv);
31071 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint32_t orig) {
31072 LDKChannelTypeFeatures orig_conv;
31073 orig_conv.inner = (void*)(orig & (~1));
31074 orig_conv.is_owned = false;
31075 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31076 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
31077 uint64_t ret_ref = 0;
31078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31081 ret_ref = (uint64_t)ret_var.inner;
31082 if (ret_var.is_owned) {
31088 void __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint32_t this_obj) {
31089 LDKInitFeatures this_obj_conv;
31090 this_obj_conv.inner = (void*)(this_obj & (~1));
31091 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31093 InitFeatures_free(this_obj_conv);
31096 void __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint32_t this_obj) {
31097 LDKNodeFeatures this_obj_conv;
31098 this_obj_conv.inner = (void*)(this_obj & (~1));
31099 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31101 NodeFeatures_free(this_obj_conv);
31104 void __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint32_t this_obj) {
31105 LDKChannelFeatures this_obj_conv;
31106 this_obj_conv.inner = (void*)(this_obj & (~1));
31107 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31109 ChannelFeatures_free(this_obj_conv);
31112 void __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
31113 LDKInvoiceFeatures this_obj_conv;
31114 this_obj_conv.inner = (void*)(this_obj & (~1));
31115 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31117 InvoiceFeatures_free(this_obj_conv);
31120 void __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) {
31121 LDKChannelTypeFeatures this_obj_conv;
31122 this_obj_conv.inner = (void*)(this_obj & (~1));
31123 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31125 ChannelTypeFeatures_free(this_obj_conv);
31128 uint32_t __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
31129 LDKInitFeatures ret_var = InitFeatures_empty();
31130 uint64_t ret_ref = 0;
31131 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31132 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31133 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31134 ret_ref = (uint64_t)ret_var.inner;
31135 if (ret_var.is_owned) {
31141 uint32_t __attribute__((export_name("TS_InitFeatures_known"))) TS_InitFeatures_known() {
31142 LDKInitFeatures ret_var = InitFeatures_known();
31143 uint64_t ret_ref = 0;
31144 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31145 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31147 ret_ref = (uint64_t)ret_var.inner;
31148 if (ret_var.is_owned) {
31154 jboolean __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
31155 LDKInitFeatures this_arg_conv;
31156 this_arg_conv.inner = (void*)(this_arg & (~1));
31157 this_arg_conv.is_owned = false;
31158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31159 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
31163 uint32_t __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
31164 LDKNodeFeatures ret_var = NodeFeatures_empty();
31165 uint64_t ret_ref = 0;
31166 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31167 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31168 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31169 ret_ref = (uint64_t)ret_var.inner;
31170 if (ret_var.is_owned) {
31176 uint32_t __attribute__((export_name("TS_NodeFeatures_known"))) TS_NodeFeatures_known() {
31177 LDKNodeFeatures ret_var = NodeFeatures_known();
31178 uint64_t ret_ref = 0;
31179 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31180 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31181 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31182 ret_ref = (uint64_t)ret_var.inner;
31183 if (ret_var.is_owned) {
31189 jboolean __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
31190 LDKNodeFeatures this_arg_conv;
31191 this_arg_conv.inner = (void*)(this_arg & (~1));
31192 this_arg_conv.is_owned = false;
31193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31194 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
31198 uint32_t __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
31199 LDKChannelFeatures ret_var = ChannelFeatures_empty();
31200 uint64_t ret_ref = 0;
31201 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31202 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31204 ret_ref = (uint64_t)ret_var.inner;
31205 if (ret_var.is_owned) {
31211 uint32_t __attribute__((export_name("TS_ChannelFeatures_known"))) TS_ChannelFeatures_known() {
31212 LDKChannelFeatures ret_var = ChannelFeatures_known();
31213 uint64_t ret_ref = 0;
31214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31217 ret_ref = (uint64_t)ret_var.inner;
31218 if (ret_var.is_owned) {
31224 jboolean __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
31225 LDKChannelFeatures this_arg_conv;
31226 this_arg_conv.inner = (void*)(this_arg & (~1));
31227 this_arg_conv.is_owned = false;
31228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31229 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
31233 uint32_t __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
31234 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
31235 uint64_t ret_ref = 0;
31236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31239 ret_ref = (uint64_t)ret_var.inner;
31240 if (ret_var.is_owned) {
31246 uint32_t __attribute__((export_name("TS_InvoiceFeatures_known"))) TS_InvoiceFeatures_known() {
31247 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
31248 uint64_t ret_ref = 0;
31249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31252 ret_ref = (uint64_t)ret_var.inner;
31253 if (ret_var.is_owned) {
31259 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
31260 LDKInvoiceFeatures this_arg_conv;
31261 this_arg_conv.inner = (void*)(this_arg & (~1));
31262 this_arg_conv.is_owned = false;
31263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31264 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
31268 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
31269 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
31270 uint64_t ret_ref = 0;
31271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31273 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31274 ret_ref = (uint64_t)ret_var.inner;
31275 if (ret_var.is_owned) {
31281 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_known"))) TS_ChannelTypeFeatures_known() {
31282 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
31283 uint64_t ret_ref = 0;
31284 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31285 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31286 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31287 ret_ref = (uint64_t)ret_var.inner;
31288 if (ret_var.is_owned) {
31294 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) {
31295 LDKChannelTypeFeatures this_arg_conv;
31296 this_arg_conv.inner = (void*)(this_arg & (~1));
31297 this_arg_conv.is_owned = false;
31298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31299 jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
31303 int8_tArray __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint32_t obj) {
31304 LDKInitFeatures obj_conv;
31305 obj_conv.inner = (void*)(obj & (~1));
31306 obj_conv.is_owned = false;
31307 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31308 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
31309 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31310 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31311 CVec_u8Z_free(ret_var);
31315 uint32_t __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
31316 LDKu8slice ser_ref;
31317 ser_ref.datalen = ser->arr_len;
31318 ser_ref.data = ser->elems;
31319 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
31320 *ret_conv = InitFeatures_read(ser_ref);
31321 return (uint64_t)ret_conv;
31324 int8_tArray __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint32_t obj) {
31325 LDKChannelFeatures obj_conv;
31326 obj_conv.inner = (void*)(obj & (~1));
31327 obj_conv.is_owned = false;
31328 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31329 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
31330 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31331 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31332 CVec_u8Z_free(ret_var);
31336 uint32_t __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
31337 LDKu8slice ser_ref;
31338 ser_ref.datalen = ser->arr_len;
31339 ser_ref.data = ser->elems;
31340 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
31341 *ret_conv = ChannelFeatures_read(ser_ref);
31342 return (uint64_t)ret_conv;
31345 int8_tArray __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint32_t obj) {
31346 LDKNodeFeatures obj_conv;
31347 obj_conv.inner = (void*)(obj & (~1));
31348 obj_conv.is_owned = false;
31349 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31350 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
31351 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31352 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31353 CVec_u8Z_free(ret_var);
31357 uint32_t __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
31358 LDKu8slice ser_ref;
31359 ser_ref.datalen = ser->arr_len;
31360 ser_ref.data = ser->elems;
31361 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
31362 *ret_conv = NodeFeatures_read(ser_ref);
31363 return (uint64_t)ret_conv;
31366 int8_tArray __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint32_t obj) {
31367 LDKInvoiceFeatures obj_conv;
31368 obj_conv.inner = (void*)(obj & (~1));
31369 obj_conv.is_owned = false;
31370 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31371 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
31372 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31373 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31374 CVec_u8Z_free(ret_var);
31378 uint32_t __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
31379 LDKu8slice ser_ref;
31380 ser_ref.datalen = ser->arr_len;
31381 ser_ref.data = ser->elems;
31382 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
31383 *ret_conv = InvoiceFeatures_read(ser_ref);
31384 return (uint64_t)ret_conv;
31387 int8_tArray __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint32_t obj) {
31388 LDKChannelTypeFeatures obj_conv;
31389 obj_conv.inner = (void*)(obj & (~1));
31390 obj_conv.is_owned = false;
31391 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31392 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
31393 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31394 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31395 CVec_u8Z_free(ret_var);
31399 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
31400 LDKu8slice ser_ref;
31401 ser_ref.datalen = ser->arr_len;
31402 ser_ref.data = ser->elems;
31403 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
31404 *ret_conv = ChannelTypeFeatures_read(ser_ref);
31405 return (uint64_t)ret_conv;
31408 void __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint32_t this_obj) {
31409 LDKShutdownScript this_obj_conv;
31410 this_obj_conv.inner = (void*)(this_obj & (~1));
31411 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31413 ShutdownScript_free(this_obj_conv);
31416 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
31417 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
31418 uint64_t ret_ref = 0;
31419 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31420 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31422 ret_ref = (uint64_t)ret_var.inner;
31423 if (ret_var.is_owned) {
31428 int64_t __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
31429 LDKShutdownScript arg_conv;
31430 arg_conv.inner = (void*)(arg & (~1));
31431 arg_conv.is_owned = false;
31432 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31433 int64_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
31437 uint32_t __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint32_t orig) {
31438 LDKShutdownScript orig_conv;
31439 orig_conv.inner = (void*)(orig & (~1));
31440 orig_conv.is_owned = false;
31441 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31442 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
31443 uint64_t ret_ref = 0;
31444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31447 ret_ref = (uint64_t)ret_var.inner;
31448 if (ret_var.is_owned) {
31454 void __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
31455 LDKInvalidShutdownScript this_obj_conv;
31456 this_obj_conv.inner = (void*)(this_obj & (~1));
31457 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31459 InvalidShutdownScript_free(this_obj_conv);
31462 int8_tArray __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
31463 LDKInvalidShutdownScript this_ptr_conv;
31464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31465 this_ptr_conv.is_owned = false;
31466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31467 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
31468 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31469 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31473 void __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
31474 LDKInvalidShutdownScript this_ptr_conv;
31475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31476 this_ptr_conv.is_owned = false;
31477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31478 LDKCVec_u8Z val_ref;
31479 val_ref.datalen = val->arr_len;
31480 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31481 memcpy(val_ref.data, val->elems, val_ref.datalen);
31482 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
31485 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
31486 LDKCVec_u8Z script_arg_ref;
31487 script_arg_ref.datalen = script_arg->arr_len;
31488 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31489 memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen);
31490 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
31491 uint64_t ret_ref = 0;
31492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31495 ret_ref = (uint64_t)ret_var.inner;
31496 if (ret_var.is_owned) {
31502 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
31503 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
31504 uint64_t ret_ref = 0;
31505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31508 ret_ref = (uint64_t)ret_var.inner;
31509 if (ret_var.is_owned) {
31514 int64_t __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
31515 LDKInvalidShutdownScript arg_conv;
31516 arg_conv.inner = (void*)(arg & (~1));
31517 arg_conv.is_owned = false;
31518 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31519 int64_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
31523 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
31524 LDKInvalidShutdownScript orig_conv;
31525 orig_conv.inner = (void*)(orig & (~1));
31526 orig_conv.is_owned = false;
31527 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31528 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
31529 uint64_t ret_ref = 0;
31530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31533 ret_ref = (uint64_t)ret_var.inner;
31534 if (ret_var.is_owned) {
31540 int8_tArray __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint32_t obj) {
31541 LDKShutdownScript obj_conv;
31542 obj_conv.inner = (void*)(obj & (~1));
31543 obj_conv.is_owned = false;
31544 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31545 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
31546 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31547 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31548 CVec_u8Z_free(ret_var);
31552 uint32_t __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
31553 LDKu8slice ser_ref;
31554 ser_ref.datalen = ser->arr_len;
31555 ser_ref.data = ser->elems;
31556 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31557 *ret_conv = ShutdownScript_read(ser_ref);
31558 return (uint64_t)ret_conv;
31561 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
31562 unsigned char pubkey_hash_arr[20];
31563 CHECK(pubkey_hash->arr_len == 20);
31564 memcpy(pubkey_hash_arr, pubkey_hash->elems, 20);
31565 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
31566 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
31567 uint64_t ret_ref = 0;
31568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31571 ret_ref = (uint64_t)ret_var.inner;
31572 if (ret_var.is_owned) {
31578 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
31579 unsigned char script_hash_arr[32];
31580 CHECK(script_hash->arr_len == 32);
31581 memcpy(script_hash_arr, script_hash->elems, 32);
31582 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
31583 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
31584 uint64_t ret_ref = 0;
31585 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31586 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31588 ret_ref = (uint64_t)ret_var.inner;
31589 if (ret_var.is_owned) {
31595 uint32_t __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
31596 LDKu8slice program_ref;
31597 program_ref.datalen = program->arr_len;
31598 program_ref.data = program->elems;
31599 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31600 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
31601 return (uint64_t)ret_conv;
31604 int8_tArray __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
31605 LDKShutdownScript this_arg_conv;
31606 this_arg_conv.inner = (void*)(this_arg & (~1));
31607 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
31608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31609 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
31610 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
31611 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31612 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31613 CVec_u8Z_free(ret_var);
31617 int8_tArray __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
31618 LDKShutdownScript this_arg_conv;
31619 this_arg_conv.inner = (void*)(this_arg & (~1));
31620 this_arg_conv.is_owned = false;
31621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31622 int8_tArray ret_arr = init_int8_tArray(33);
31623 memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
31627 jboolean __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
31628 LDKShutdownScript this_arg_conv;
31629 this_arg_conv.inner = (void*)(this_arg & (~1));
31630 this_arg_conv.is_owned = false;
31631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31632 LDKInitFeatures features_conv;
31633 features_conv.inner = (void*)(features & (~1));
31634 features_conv.is_owned = false;
31635 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
31636 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
31640 void __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
31641 if ((this_ptr & 1) != 0) return;
31642 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31643 CHECK_ACCESS(this_ptr_ptr);
31644 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
31645 FREE((void*)this_ptr);
31646 CustomMessageReader_free(this_ptr_conv);
31649 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
31650 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31651 *ret_ret = Type_clone(arg);
31652 return (uint64_t)ret_ret;
31654 int64_t __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint32_t arg) {
31655 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
31656 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
31657 LDKType* arg_conv = (LDKType*)arg_ptr;
31658 int64_t ret_val = Type_clone_ptr(arg_conv);
31662 uint32_t __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint32_t orig) {
31663 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
31664 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
31665 LDKType* orig_conv = (LDKType*)orig_ptr;
31666 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31667 *ret_ret = Type_clone(orig_conv);
31668 return (uint64_t)ret_ret;
31671 void __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint32_t this_ptr) {
31672 if ((this_ptr & 1) != 0) return;
31673 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31674 CHECK_ACCESS(this_ptr_ptr);
31675 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
31676 FREE((void*)this_ptr);
31677 Type_free(this_ptr_conv);
31680 void __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint32_t this_obj) {
31681 LDKNodeId this_obj_conv;
31682 this_obj_conv.inner = (void*)(this_obj & (~1));
31683 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31685 NodeId_free(this_obj_conv);
31688 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
31689 LDKNodeId ret_var = NodeId_clone(arg);
31690 uint64_t ret_ref = 0;
31691 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31692 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31694 ret_ref = (uint64_t)ret_var.inner;
31695 if (ret_var.is_owned) {
31700 int64_t __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint32_t arg) {
31701 LDKNodeId arg_conv;
31702 arg_conv.inner = (void*)(arg & (~1));
31703 arg_conv.is_owned = false;
31704 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31705 int64_t ret_val = NodeId_clone_ptr(&arg_conv);
31709 uint32_t __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint32_t orig) {
31710 LDKNodeId orig_conv;
31711 orig_conv.inner = (void*)(orig & (~1));
31712 orig_conv.is_owned = false;
31713 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31714 LDKNodeId ret_var = NodeId_clone(&orig_conv);
31715 uint64_t ret_ref = 0;
31716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31719 ret_ref = (uint64_t)ret_var.inner;
31720 if (ret_var.is_owned) {
31726 uint32_t __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
31727 LDKPublicKey pubkey_ref;
31728 CHECK(pubkey->arr_len == 33);
31729 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
31730 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
31731 uint64_t ret_ref = 0;
31732 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31733 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31735 ret_ref = (uint64_t)ret_var.inner;
31736 if (ret_var.is_owned) {
31742 int8_tArray __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint32_t this_arg) {
31743 LDKNodeId this_arg_conv;
31744 this_arg_conv.inner = (void*)(this_arg & (~1));
31745 this_arg_conv.is_owned = false;
31746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31747 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
31748 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31749 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31753 int64_t __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint32_t o) {
31755 o_conv.inner = (void*)(o & (~1));
31756 o_conv.is_owned = false;
31757 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31758 int64_t ret_val = NodeId_hash(&o_conv);
31762 int8_tArray __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint32_t obj) {
31763 LDKNodeId obj_conv;
31764 obj_conv.inner = (void*)(obj & (~1));
31765 obj_conv.is_owned = false;
31766 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31767 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
31768 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31769 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31770 CVec_u8Z_free(ret_var);
31774 uint32_t __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
31775 LDKu8slice ser_ref;
31776 ser_ref.datalen = ser->arr_len;
31777 ser_ref.data = ser->elems;
31778 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
31779 *ret_conv = NodeId_read(ser_ref);
31780 return (uint64_t)ret_conv;
31783 void __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint32_t this_obj) {
31784 LDKNetworkGraph this_obj_conv;
31785 this_obj_conv.inner = (void*)(this_obj & (~1));
31786 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31788 NetworkGraph_free(this_obj_conv);
31791 static inline uintptr_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
31792 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
31793 uint64_t ret_ref = 0;
31794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31797 ret_ref = (uint64_t)ret_var.inner;
31798 if (ret_var.is_owned) {
31803 int64_t __attribute__((export_name("TS_NetworkGraph_clone_ptr"))) TS_NetworkGraph_clone_ptr(uint32_t arg) {
31804 LDKNetworkGraph arg_conv;
31805 arg_conv.inner = (void*)(arg & (~1));
31806 arg_conv.is_owned = false;
31807 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31808 int64_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
31812 uint32_t __attribute__((export_name("TS_NetworkGraph_clone"))) TS_NetworkGraph_clone(uint32_t orig) {
31813 LDKNetworkGraph orig_conv;
31814 orig_conv.inner = (void*)(orig & (~1));
31815 orig_conv.is_owned = false;
31816 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31817 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
31818 uint64_t ret_ref = 0;
31819 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31820 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31821 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31822 ret_ref = (uint64_t)ret_var.inner;
31823 if (ret_var.is_owned) {
31829 void __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
31830 LDKReadOnlyNetworkGraph this_obj_conv;
31831 this_obj_conv.inner = (void*)(this_obj & (~1));
31832 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31834 ReadOnlyNetworkGraph_free(this_obj_conv);
31837 void __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
31838 if ((this_ptr & 1) != 0) return;
31839 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31840 CHECK_ACCESS(this_ptr_ptr);
31841 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
31842 FREE((void*)this_ptr);
31843 NetworkUpdate_free(this_ptr_conv);
31846 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
31847 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31848 *ret_copy = NetworkUpdate_clone(arg);
31849 uint64_t ret_ref = (uint64_t)ret_copy;
31852 int64_t __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
31853 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
31854 int64_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
31858 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint32_t orig) {
31859 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
31860 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31861 *ret_copy = NetworkUpdate_clone(orig_conv);
31862 uint64_t ret_ref = (uint64_t)ret_copy;
31866 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
31867 LDKChannelUpdate msg_conv;
31868 msg_conv.inner = (void*)(msg & (~1));
31869 msg_conv.is_owned = (msg & 1) || (msg == 0);
31870 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31871 msg_conv = ChannelUpdate_clone(&msg_conv);
31872 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31873 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
31874 uint64_t ret_ref = (uint64_t)ret_copy;
31878 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_closed"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
31879 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31880 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
31881 uint64_t ret_ref = (uint64_t)ret_copy;
31885 uint32_t __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
31886 LDKPublicKey node_id_ref;
31887 CHECK(node_id->arr_len == 33);
31888 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
31889 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31890 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
31891 uint64_t ret_ref = (uint64_t)ret_copy;
31895 int8_tArray __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint32_t obj) {
31896 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
31897 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
31898 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31899 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31900 CVec_u8Z_free(ret_var);
31904 uint32_t __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
31905 LDKu8slice ser_ref;
31906 ser_ref.datalen = ser->arr_len;
31907 ser_ref.data = ser->elems;
31908 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
31909 *ret_conv = NetworkUpdate_read(ser_ref);
31910 return (uint64_t)ret_conv;
31913 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_as_EventHandler"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
31914 LDKNetGraphMsgHandler this_arg_conv;
31915 this_arg_conv.inner = (void*)(this_arg & (~1));
31916 this_arg_conv.is_owned = false;
31917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31918 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
31919 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
31920 return (uint64_t)ret_ret;
31923 void __attribute__((export_name("TS_NetGraphMsgHandler_free"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
31924 LDKNetGraphMsgHandler this_obj_conv;
31925 this_obj_conv.inner = (void*)(this_obj & (~1));
31926 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31928 NetGraphMsgHandler_free(this_obj_conv);
31931 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_new"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
31932 LDKNetworkGraph network_graph_conv;
31933 network_graph_conv.inner = (void*)(network_graph & (~1));
31934 network_graph_conv.is_owned = false;
31935 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
31936 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
31937 CHECK_ACCESS(chain_access_ptr);
31938 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
31939 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
31940 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
31941 // Manually implement clone for Java trait instances
31943 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
31944 CHECK_ACCESS(logger_ptr);
31945 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31946 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
31947 uint64_t ret_ref = 0;
31948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31951 ret_ref = (uint64_t)ret_var.inner;
31952 if (ret_var.is_owned) {
31958 void __attribute__((export_name("TS_NetGraphMsgHandler_add_chain_access"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
31959 LDKNetGraphMsgHandler this_arg_conv;
31960 this_arg_conv.inner = (void*)(this_arg & (~1));
31961 this_arg_conv.is_owned = false;
31962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31963 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
31964 CHECK_ACCESS(chain_access_ptr);
31965 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
31966 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
31967 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
31968 // Manually implement clone for Java trait instances
31970 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
31973 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_as_RoutingMessageHandler"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
31974 LDKNetGraphMsgHandler this_arg_conv;
31975 this_arg_conv.inner = (void*)(this_arg & (~1));
31976 this_arg_conv.is_owned = false;
31977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31978 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
31979 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
31980 return (uint64_t)ret_ret;
31983 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_as_MessageSendEventsProvider"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
31984 LDKNetGraphMsgHandler this_arg_conv;
31985 this_arg_conv.inner = (void*)(this_arg & (~1));
31986 this_arg_conv.is_owned = false;
31987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31988 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
31989 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
31990 return (uint64_t)ret_ret;
31993 void __attribute__((export_name("TS_DirectionalChannelInfo_free"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
31994 LDKDirectionalChannelInfo this_obj_conv;
31995 this_obj_conv.inner = (void*)(this_obj & (~1));
31996 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31998 DirectionalChannelInfo_free(this_obj_conv);
32001 int32_t __attribute__((export_name("TS_DirectionalChannelInfo_get_last_update"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
32002 LDKDirectionalChannelInfo this_ptr_conv;
32003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32004 this_ptr_conv.is_owned = false;
32005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32006 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
32010 void __attribute__((export_name("TS_DirectionalChannelInfo_set_last_update"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
32011 LDKDirectionalChannelInfo this_ptr_conv;
32012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32013 this_ptr_conv.is_owned = false;
32014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32015 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
32018 jboolean __attribute__((export_name("TS_DirectionalChannelInfo_get_enabled"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
32019 LDKDirectionalChannelInfo this_ptr_conv;
32020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32021 this_ptr_conv.is_owned = false;
32022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32023 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
32027 void __attribute__((export_name("TS_DirectionalChannelInfo_set_enabled"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
32028 LDKDirectionalChannelInfo this_ptr_conv;
32029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32030 this_ptr_conv.is_owned = false;
32031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32032 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
32035 int16_t __attribute__((export_name("TS_DirectionalChannelInfo_get_cltv_expiry_delta"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
32036 LDKDirectionalChannelInfo this_ptr_conv;
32037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32038 this_ptr_conv.is_owned = false;
32039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32040 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
32044 void __attribute__((export_name("TS_DirectionalChannelInfo_set_cltv_expiry_delta"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
32045 LDKDirectionalChannelInfo this_ptr_conv;
32046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32047 this_ptr_conv.is_owned = false;
32048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32049 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
32052 int64_t __attribute__((export_name("TS_DirectionalChannelInfo_get_htlc_minimum_msat"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
32053 LDKDirectionalChannelInfo this_ptr_conv;
32054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32055 this_ptr_conv.is_owned = false;
32056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32057 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
32061 void __attribute__((export_name("TS_DirectionalChannelInfo_set_htlc_minimum_msat"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
32062 LDKDirectionalChannelInfo this_ptr_conv;
32063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32064 this_ptr_conv.is_owned = false;
32065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32066 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
32069 uint32_t __attribute__((export_name("TS_DirectionalChannelInfo_get_htlc_maximum_msat"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
32070 LDKDirectionalChannelInfo this_ptr_conv;
32071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32072 this_ptr_conv.is_owned = false;
32073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32074 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32075 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
32076 uint64_t ret_ref = (uint64_t)ret_copy;
32080 void __attribute__((export_name("TS_DirectionalChannelInfo_set_htlc_maximum_msat"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
32081 LDKDirectionalChannelInfo this_ptr_conv;
32082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32083 this_ptr_conv.is_owned = false;
32084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32085 void* val_ptr = (void*)(((uint64_t)val) & ~1);
32086 CHECK_ACCESS(val_ptr);
32087 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32088 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
32089 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
32092 uint32_t __attribute__((export_name("TS_DirectionalChannelInfo_get_fees"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
32093 LDKDirectionalChannelInfo this_ptr_conv;
32094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32095 this_ptr_conv.is_owned = false;
32096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32097 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
32098 uint64_t ret_ref = 0;
32099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32101 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32102 ret_ref = (uint64_t)ret_var.inner;
32103 if (ret_var.is_owned) {
32109 void __attribute__((export_name("TS_DirectionalChannelInfo_set_fees"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
32110 LDKDirectionalChannelInfo this_ptr_conv;
32111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32112 this_ptr_conv.is_owned = false;
32113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32114 LDKRoutingFees val_conv;
32115 val_conv.inner = (void*)(val & (~1));
32116 val_conv.is_owned = (val & 1) || (val == 0);
32117 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32118 val_conv = RoutingFees_clone(&val_conv);
32119 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
32122 uint32_t __attribute__((export_name("TS_DirectionalChannelInfo_get_last_update_message"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
32123 LDKDirectionalChannelInfo this_ptr_conv;
32124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32125 this_ptr_conv.is_owned = false;
32126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32127 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
32128 uint64_t ret_ref = 0;
32129 if ((uint64_t)ret_var.inner > 4096) {
32130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32133 ret_ref = (uint64_t)ret_var.inner;
32134 if (ret_var.is_owned) {
32141 void __attribute__((export_name("TS_DirectionalChannelInfo_set_last_update_message"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
32142 LDKDirectionalChannelInfo this_ptr_conv;
32143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32144 this_ptr_conv.is_owned = false;
32145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32146 LDKChannelUpdate val_conv;
32147 val_conv.inner = (void*)(val & (~1));
32148 val_conv.is_owned = (val & 1) || (val == 0);
32149 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32150 val_conv = ChannelUpdate_clone(&val_conv);
32151 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
32154 uint32_t __attribute__((export_name("TS_DirectionalChannelInfo_new"))) TS_DirectionalChannelInfo_new(int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg, uint32_t fees_arg, uint32_t last_update_message_arg) {
32155 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
32156 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
32157 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
32158 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
32159 LDKRoutingFees fees_arg_conv;
32160 fees_arg_conv.inner = (void*)(fees_arg & (~1));
32161 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
32162 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
32163 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
32164 LDKChannelUpdate last_update_message_arg_conv;
32165 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
32166 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
32167 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
32168 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
32169 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv);
32170 uint64_t ret_ref = 0;
32171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32174 ret_ref = (uint64_t)ret_var.inner;
32175 if (ret_var.is_owned) {
32181 static inline uintptr_t DirectionalChannelInfo_clone_ptr(LDKDirectionalChannelInfo *NONNULL_PTR arg) {
32182 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(arg);
32183 uint64_t ret_ref = 0;
32184 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32185 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32186 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32187 ret_ref = (uint64_t)ret_var.inner;
32188 if (ret_var.is_owned) {
32193 int64_t __attribute__((export_name("TS_DirectionalChannelInfo_clone_ptr"))) TS_DirectionalChannelInfo_clone_ptr(uint32_t arg) {
32194 LDKDirectionalChannelInfo arg_conv;
32195 arg_conv.inner = (void*)(arg & (~1));
32196 arg_conv.is_owned = false;
32197 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32198 int64_t ret_val = DirectionalChannelInfo_clone_ptr(&arg_conv);
32202 uint32_t __attribute__((export_name("TS_DirectionalChannelInfo_clone"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
32203 LDKDirectionalChannelInfo orig_conv;
32204 orig_conv.inner = (void*)(orig & (~1));
32205 orig_conv.is_owned = false;
32206 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32207 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
32208 uint64_t ret_ref = 0;
32209 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32210 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32211 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32212 ret_ref = (uint64_t)ret_var.inner;
32213 if (ret_var.is_owned) {
32219 int8_tArray __attribute__((export_name("TS_DirectionalChannelInfo_write"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
32220 LDKDirectionalChannelInfo obj_conv;
32221 obj_conv.inner = (void*)(obj & (~1));
32222 obj_conv.is_owned = false;
32223 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32224 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
32225 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32226 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32227 CVec_u8Z_free(ret_var);
32231 uint32_t __attribute__((export_name("TS_DirectionalChannelInfo_read"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
32232 LDKu8slice ser_ref;
32233 ser_ref.datalen = ser->arr_len;
32234 ser_ref.data = ser->elems;
32235 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
32236 *ret_conv = DirectionalChannelInfo_read(ser_ref);
32237 return (uint64_t)ret_conv;
32240 void __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint32_t this_obj) {
32241 LDKChannelInfo this_obj_conv;
32242 this_obj_conv.inner = (void*)(this_obj & (~1));
32243 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32245 ChannelInfo_free(this_obj_conv);
32248 uint32_t __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
32249 LDKChannelInfo this_ptr_conv;
32250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32251 this_ptr_conv.is_owned = false;
32252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32253 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
32254 uint64_t ret_ref = 0;
32255 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32256 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32258 ret_ref = (uint64_t)ret_var.inner;
32259 if (ret_var.is_owned) {
32265 void __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
32266 LDKChannelInfo this_ptr_conv;
32267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32268 this_ptr_conv.is_owned = false;
32269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32270 LDKChannelFeatures val_conv;
32271 val_conv.inner = (void*)(val & (~1));
32272 val_conv.is_owned = (val & 1) || (val == 0);
32273 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32274 val_conv = ChannelFeatures_clone(&val_conv);
32275 ChannelInfo_set_features(&this_ptr_conv, val_conv);
32278 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
32279 LDKChannelInfo this_ptr_conv;
32280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32281 this_ptr_conv.is_owned = false;
32282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32283 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
32284 uint64_t ret_ref = 0;
32285 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32286 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32288 ret_ref = (uint64_t)ret_var.inner;
32289 if (ret_var.is_owned) {
32295 void __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
32296 LDKChannelInfo this_ptr_conv;
32297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32298 this_ptr_conv.is_owned = false;
32299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32300 LDKNodeId val_conv;
32301 val_conv.inner = (void*)(val & (~1));
32302 val_conv.is_owned = (val & 1) || (val == 0);
32303 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32304 val_conv = NodeId_clone(&val_conv);
32305 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
32308 uint32_t __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
32309 LDKChannelInfo this_ptr_conv;
32310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32311 this_ptr_conv.is_owned = false;
32312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32313 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
32314 uint64_t ret_ref = 0;
32315 if ((uint64_t)ret_var.inner > 4096) {
32316 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32317 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32318 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32319 ret_ref = (uint64_t)ret_var.inner;
32320 if (ret_var.is_owned) {
32327 void __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
32328 LDKChannelInfo this_ptr_conv;
32329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32330 this_ptr_conv.is_owned = false;
32331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32332 LDKDirectionalChannelInfo val_conv;
32333 val_conv.inner = (void*)(val & (~1));
32334 val_conv.is_owned = (val & 1) || (val == 0);
32335 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32336 val_conv = DirectionalChannelInfo_clone(&val_conv);
32337 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
32340 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
32341 LDKChannelInfo this_ptr_conv;
32342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32343 this_ptr_conv.is_owned = false;
32344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32345 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
32346 uint64_t ret_ref = 0;
32347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32350 ret_ref = (uint64_t)ret_var.inner;
32351 if (ret_var.is_owned) {
32357 void __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
32358 LDKChannelInfo this_ptr_conv;
32359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32360 this_ptr_conv.is_owned = false;
32361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32362 LDKNodeId val_conv;
32363 val_conv.inner = (void*)(val & (~1));
32364 val_conv.is_owned = (val & 1) || (val == 0);
32365 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32366 val_conv = NodeId_clone(&val_conv);
32367 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
32370 uint32_t __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
32371 LDKChannelInfo this_ptr_conv;
32372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32373 this_ptr_conv.is_owned = false;
32374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32375 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
32376 uint64_t ret_ref = 0;
32377 if ((uint64_t)ret_var.inner > 4096) {
32378 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32379 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32381 ret_ref = (uint64_t)ret_var.inner;
32382 if (ret_var.is_owned) {
32389 void __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
32390 LDKChannelInfo this_ptr_conv;
32391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32392 this_ptr_conv.is_owned = false;
32393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32394 LDKDirectionalChannelInfo val_conv;
32395 val_conv.inner = (void*)(val & (~1));
32396 val_conv.is_owned = (val & 1) || (val == 0);
32397 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32398 val_conv = DirectionalChannelInfo_clone(&val_conv);
32399 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
32402 uint32_t __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
32403 LDKChannelInfo this_ptr_conv;
32404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32405 this_ptr_conv.is_owned = false;
32406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32407 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32408 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
32409 uint64_t ret_ref = (uint64_t)ret_copy;
32413 void __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
32414 LDKChannelInfo this_ptr_conv;
32415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32416 this_ptr_conv.is_owned = false;
32417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32418 void* val_ptr = (void*)(((uint64_t)val) & ~1);
32419 CHECK_ACCESS(val_ptr);
32420 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32421 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
32422 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
32425 uint32_t __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
32426 LDKChannelInfo this_ptr_conv;
32427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32428 this_ptr_conv.is_owned = false;
32429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32430 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
32431 uint64_t ret_ref = 0;
32432 if ((uint64_t)ret_var.inner > 4096) {
32433 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32434 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32435 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32436 ret_ref = (uint64_t)ret_var.inner;
32437 if (ret_var.is_owned) {
32444 void __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
32445 LDKChannelInfo this_ptr_conv;
32446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32447 this_ptr_conv.is_owned = false;
32448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32449 LDKChannelAnnouncement val_conv;
32450 val_conv.inner = (void*)(val & (~1));
32451 val_conv.is_owned = (val & 1) || (val == 0);
32452 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32453 val_conv = ChannelAnnouncement_clone(&val_conv);
32454 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
32457 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
32458 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
32459 uint64_t ret_ref = 0;
32460 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32461 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32463 ret_ref = (uint64_t)ret_var.inner;
32464 if (ret_var.is_owned) {
32469 int64_t __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
32470 LDKChannelInfo arg_conv;
32471 arg_conv.inner = (void*)(arg & (~1));
32472 arg_conv.is_owned = false;
32473 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32474 int64_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
32478 uint32_t __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint32_t orig) {
32479 LDKChannelInfo orig_conv;
32480 orig_conv.inner = (void*)(orig & (~1));
32481 orig_conv.is_owned = false;
32482 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32483 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
32484 uint64_t ret_ref = 0;
32485 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32486 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32488 ret_ref = (uint64_t)ret_var.inner;
32489 if (ret_var.is_owned) {
32495 int8_tArray __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint32_t obj) {
32496 LDKChannelInfo obj_conv;
32497 obj_conv.inner = (void*)(obj & (~1));
32498 obj_conv.is_owned = false;
32499 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32500 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
32501 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32502 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32503 CVec_u8Z_free(ret_var);
32507 uint32_t __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
32508 LDKu8slice ser_ref;
32509 ser_ref.datalen = ser->arr_len;
32510 ser_ref.data = ser->elems;
32511 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
32512 *ret_conv = ChannelInfo_read(ser_ref);
32513 return (uint64_t)ret_conv;
32516 void __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint32_t this_obj) {
32517 LDKRoutingFees this_obj_conv;
32518 this_obj_conv.inner = (void*)(this_obj & (~1));
32519 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32521 RoutingFees_free(this_obj_conv);
32524 int32_t __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
32525 LDKRoutingFees this_ptr_conv;
32526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32527 this_ptr_conv.is_owned = false;
32528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32529 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
32533 void __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
32534 LDKRoutingFees this_ptr_conv;
32535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32536 this_ptr_conv.is_owned = false;
32537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32538 RoutingFees_set_base_msat(&this_ptr_conv, val);
32541 int32_t __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
32542 LDKRoutingFees this_ptr_conv;
32543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32544 this_ptr_conv.is_owned = false;
32545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32546 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
32550 void __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
32551 LDKRoutingFees this_ptr_conv;
32552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32553 this_ptr_conv.is_owned = false;
32554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32555 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
32558 uint32_t __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
32559 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
32560 uint64_t ret_ref = 0;
32561 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32562 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32564 ret_ref = (uint64_t)ret_var.inner;
32565 if (ret_var.is_owned) {
32571 jboolean __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
32572 LDKRoutingFees a_conv;
32573 a_conv.inner = (void*)(a & (~1));
32574 a_conv.is_owned = false;
32575 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32576 LDKRoutingFees b_conv;
32577 b_conv.inner = (void*)(b & (~1));
32578 b_conv.is_owned = false;
32579 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32580 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
32584 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
32585 LDKRoutingFees ret_var = RoutingFees_clone(arg);
32586 uint64_t ret_ref = 0;
32587 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32588 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32590 ret_ref = (uint64_t)ret_var.inner;
32591 if (ret_var.is_owned) {
32596 int64_t __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
32597 LDKRoutingFees arg_conv;
32598 arg_conv.inner = (void*)(arg & (~1));
32599 arg_conv.is_owned = false;
32600 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32601 int64_t ret_val = RoutingFees_clone_ptr(&arg_conv);
32605 uint32_t __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint32_t orig) {
32606 LDKRoutingFees orig_conv;
32607 orig_conv.inner = (void*)(orig & (~1));
32608 orig_conv.is_owned = false;
32609 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32610 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
32611 uint64_t ret_ref = 0;
32612 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32613 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32615 ret_ref = (uint64_t)ret_var.inner;
32616 if (ret_var.is_owned) {
32622 int64_t __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint32_t o) {
32623 LDKRoutingFees o_conv;
32624 o_conv.inner = (void*)(o & (~1));
32625 o_conv.is_owned = false;
32626 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32627 int64_t ret_val = RoutingFees_hash(&o_conv);
32631 int8_tArray __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint32_t obj) {
32632 LDKRoutingFees obj_conv;
32633 obj_conv.inner = (void*)(obj & (~1));
32634 obj_conv.is_owned = false;
32635 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32636 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
32637 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32638 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32639 CVec_u8Z_free(ret_var);
32643 uint32_t __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
32644 LDKu8slice ser_ref;
32645 ser_ref.datalen = ser->arr_len;
32646 ser_ref.data = ser->elems;
32647 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
32648 *ret_conv = RoutingFees_read(ser_ref);
32649 return (uint64_t)ret_conv;
32652 void __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
32653 LDKNodeAnnouncementInfo this_obj_conv;
32654 this_obj_conv.inner = (void*)(this_obj & (~1));
32655 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32657 NodeAnnouncementInfo_free(this_obj_conv);
32660 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
32661 LDKNodeAnnouncementInfo this_ptr_conv;
32662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32663 this_ptr_conv.is_owned = false;
32664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32665 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
32666 uint64_t ret_ref = 0;
32667 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32668 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32670 ret_ref = (uint64_t)ret_var.inner;
32671 if (ret_var.is_owned) {
32677 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
32678 LDKNodeAnnouncementInfo this_ptr_conv;
32679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32680 this_ptr_conv.is_owned = false;
32681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32682 LDKNodeFeatures val_conv;
32683 val_conv.inner = (void*)(val & (~1));
32684 val_conv.is_owned = (val & 1) || (val == 0);
32685 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32686 val_conv = NodeFeatures_clone(&val_conv);
32687 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
32690 int32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
32691 LDKNodeAnnouncementInfo this_ptr_conv;
32692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32693 this_ptr_conv.is_owned = false;
32694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32695 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
32699 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
32700 LDKNodeAnnouncementInfo this_ptr_conv;
32701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32702 this_ptr_conv.is_owned = false;
32703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32704 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
32707 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
32708 LDKNodeAnnouncementInfo this_ptr_conv;
32709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32710 this_ptr_conv.is_owned = false;
32711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32712 int8_tArray ret_arr = init_int8_tArray(3);
32713 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
32717 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
32718 LDKNodeAnnouncementInfo this_ptr_conv;
32719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32720 this_ptr_conv.is_owned = false;
32721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32722 LDKThreeBytes val_ref;
32723 CHECK(val->arr_len == 3);
32724 memcpy(val_ref.data, val->elems, 3);
32725 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
32728 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
32729 LDKNodeAnnouncementInfo this_ptr_conv;
32730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32731 this_ptr_conv.is_owned = false;
32732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32733 int8_tArray ret_arr = init_int8_tArray(32);
32734 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
32738 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
32739 LDKNodeAnnouncementInfo this_ptr_conv;
32740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32741 this_ptr_conv.is_owned = false;
32742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32743 LDKThirtyTwoBytes val_ref;
32744 CHECK(val->arr_len == 32);
32745 memcpy(val_ref.data, val->elems, 32);
32746 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
32749 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
32750 LDKNodeAnnouncementInfo this_ptr_conv;
32751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32752 this_ptr_conv.is_owned = false;
32753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32754 LDKCVec_NetAddressZ val_constr;
32755 val_constr.datalen = val->arr_len;
32756 if (val_constr.datalen > 0)
32757 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32759 val_constr.data = NULL;
32760 uint32_t* val_vals = val->elems;
32761 for (size_t m = 0; m < val_constr.datalen; m++) {
32762 uint32_t val_conv_12 = val_vals[m];
32763 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
32764 CHECK_ACCESS(val_conv_12_ptr);
32765 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
32766 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
32767 val_constr.data[m] = val_conv_12_conv;
32769 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
32772 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
32773 LDKNodeAnnouncementInfo this_ptr_conv;
32774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32775 this_ptr_conv.is_owned = false;
32776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32777 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
32778 uint64_t ret_ref = 0;
32779 if ((uint64_t)ret_var.inner > 4096) {
32780 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32781 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32783 ret_ref = (uint64_t)ret_var.inner;
32784 if (ret_var.is_owned) {
32791 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
32792 LDKNodeAnnouncementInfo this_ptr_conv;
32793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32794 this_ptr_conv.is_owned = false;
32795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32796 LDKNodeAnnouncement val_conv;
32797 val_conv.inner = (void*)(val & (~1));
32798 val_conv.is_owned = (val & 1) || (val == 0);
32799 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32800 val_conv = NodeAnnouncement_clone(&val_conv);
32801 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
32804 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_new"))) TS_NodeAnnouncementInfo_new(uint32_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, uint32_tArray addresses_arg, uint32_t announcement_message_arg) {
32805 LDKNodeFeatures features_arg_conv;
32806 features_arg_conv.inner = (void*)(features_arg & (~1));
32807 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
32808 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
32809 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
32810 LDKThreeBytes rgb_arg_ref;
32811 CHECK(rgb_arg->arr_len == 3);
32812 memcpy(rgb_arg_ref.data, rgb_arg->elems, 3);
32813 LDKThirtyTwoBytes alias_arg_ref;
32814 CHECK(alias_arg->arr_len == 32);
32815 memcpy(alias_arg_ref.data, alias_arg->elems, 32);
32816 LDKCVec_NetAddressZ addresses_arg_constr;
32817 addresses_arg_constr.datalen = addresses_arg->arr_len;
32818 if (addresses_arg_constr.datalen > 0)
32819 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32821 addresses_arg_constr.data = NULL;
32822 uint32_t* addresses_arg_vals = addresses_arg->elems;
32823 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
32824 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
32825 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
32826 CHECK_ACCESS(addresses_arg_conv_12_ptr);
32827 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
32828 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
32830 LDKNodeAnnouncement announcement_message_arg_conv;
32831 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
32832 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
32833 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
32834 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
32835 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
32836 uint64_t ret_ref = 0;
32837 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32838 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32840 ret_ref = (uint64_t)ret_var.inner;
32841 if (ret_var.is_owned) {
32847 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
32848 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
32849 uint64_t ret_ref = 0;
32850 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32851 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32853 ret_ref = (uint64_t)ret_var.inner;
32854 if (ret_var.is_owned) {
32859 int64_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
32860 LDKNodeAnnouncementInfo arg_conv;
32861 arg_conv.inner = (void*)(arg & (~1));
32862 arg_conv.is_owned = false;
32863 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32864 int64_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
32868 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
32869 LDKNodeAnnouncementInfo orig_conv;
32870 orig_conv.inner = (void*)(orig & (~1));
32871 orig_conv.is_owned = false;
32872 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32873 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
32874 uint64_t ret_ref = 0;
32875 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32876 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32877 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32878 ret_ref = (uint64_t)ret_var.inner;
32879 if (ret_var.is_owned) {
32885 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
32886 LDKNodeAnnouncementInfo obj_conv;
32887 obj_conv.inner = (void*)(obj & (~1));
32888 obj_conv.is_owned = false;
32889 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32890 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
32891 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32892 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32893 CVec_u8Z_free(ret_var);
32897 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
32898 LDKu8slice ser_ref;
32899 ser_ref.datalen = ser->arr_len;
32900 ser_ref.data = ser->elems;
32901 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
32902 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
32903 return (uint64_t)ret_conv;
32906 void __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint32_t this_obj) {
32907 LDKNodeInfo this_obj_conv;
32908 this_obj_conv.inner = (void*)(this_obj & (~1));
32909 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32911 NodeInfo_free(this_obj_conv);
32914 void __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
32915 LDKNodeInfo this_ptr_conv;
32916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32917 this_ptr_conv.is_owned = false;
32918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32919 LDKCVec_u64Z val_constr;
32920 val_constr.datalen = val->arr_len;
32921 if (val_constr.datalen > 0)
32922 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32924 val_constr.data = NULL;
32925 int64_t* val_vals = val->elems;
32926 for (size_t i = 0; i < val_constr.datalen; i++) {
32927 int64_t val_conv_8 = val_vals[i];
32928 val_constr.data[i] = val_conv_8;
32930 NodeInfo_set_channels(&this_ptr_conv, val_constr);
32933 uint32_t __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
32934 LDKNodeInfo this_ptr_conv;
32935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32936 this_ptr_conv.is_owned = false;
32937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32938 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
32939 uint64_t ret_ref = 0;
32940 if ((uint64_t)ret_var.inner > 4096) {
32941 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32942 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32943 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32944 ret_ref = (uint64_t)ret_var.inner;
32945 if (ret_var.is_owned) {
32952 void __attribute__((export_name("TS_NodeInfo_set_lowest_inbound_channel_fees"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
32953 LDKNodeInfo this_ptr_conv;
32954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32955 this_ptr_conv.is_owned = false;
32956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32957 LDKRoutingFees val_conv;
32958 val_conv.inner = (void*)(val & (~1));
32959 val_conv.is_owned = (val & 1) || (val == 0);
32960 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32961 val_conv = RoutingFees_clone(&val_conv);
32962 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
32965 uint32_t __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
32966 LDKNodeInfo this_ptr_conv;
32967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32968 this_ptr_conv.is_owned = false;
32969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32970 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
32971 uint64_t ret_ref = 0;
32972 if ((uint64_t)ret_var.inner > 4096) {
32973 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32974 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32975 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32976 ret_ref = (uint64_t)ret_var.inner;
32977 if (ret_var.is_owned) {
32984 void __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
32985 LDKNodeInfo this_ptr_conv;
32986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32987 this_ptr_conv.is_owned = false;
32988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32989 LDKNodeAnnouncementInfo val_conv;
32990 val_conv.inner = (void*)(val & (~1));
32991 val_conv.is_owned = (val & 1) || (val == 0);
32992 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32993 val_conv = NodeAnnouncementInfo_clone(&val_conv);
32994 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
32997 uint32_t __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
32998 LDKCVec_u64Z channels_arg_constr;
32999 channels_arg_constr.datalen = channels_arg->arr_len;
33000 if (channels_arg_constr.datalen > 0)
33001 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33003 channels_arg_constr.data = NULL;
33004 int64_t* channels_arg_vals = channels_arg->elems;
33005 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
33006 int64_t channels_arg_conv_8 = channels_arg_vals[i];
33007 channels_arg_constr.data[i] = channels_arg_conv_8;
33009 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
33010 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
33011 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
33012 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
33013 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
33014 LDKNodeAnnouncementInfo announcement_info_arg_conv;
33015 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
33016 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
33017 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
33018 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
33019 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
33020 uint64_t ret_ref = 0;
33021 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33022 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33023 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33024 ret_ref = (uint64_t)ret_var.inner;
33025 if (ret_var.is_owned) {
33031 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
33032 LDKNodeInfo ret_var = NodeInfo_clone(arg);
33033 uint64_t ret_ref = 0;
33034 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33035 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33037 ret_ref = (uint64_t)ret_var.inner;
33038 if (ret_var.is_owned) {
33043 int64_t __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
33044 LDKNodeInfo arg_conv;
33045 arg_conv.inner = (void*)(arg & (~1));
33046 arg_conv.is_owned = false;
33047 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33048 int64_t ret_val = NodeInfo_clone_ptr(&arg_conv);
33052 uint32_t __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint32_t orig) {
33053 LDKNodeInfo orig_conv;
33054 orig_conv.inner = (void*)(orig & (~1));
33055 orig_conv.is_owned = false;
33056 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33057 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
33058 uint64_t ret_ref = 0;
33059 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33060 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33061 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33062 ret_ref = (uint64_t)ret_var.inner;
33063 if (ret_var.is_owned) {
33069 int8_tArray __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint32_t obj) {
33070 LDKNodeInfo obj_conv;
33071 obj_conv.inner = (void*)(obj & (~1));
33072 obj_conv.is_owned = false;
33073 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33074 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
33075 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33076 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33077 CVec_u8Z_free(ret_var);
33081 uint32_t __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
33082 LDKu8slice ser_ref;
33083 ser_ref.datalen = ser->arr_len;
33084 ser_ref.data = ser->elems;
33085 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
33086 *ret_conv = NodeInfo_read(ser_ref);
33087 return (uint64_t)ret_conv;
33090 int8_tArray __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint32_t obj) {
33091 LDKNetworkGraph obj_conv;
33092 obj_conv.inner = (void*)(obj & (~1));
33093 obj_conv.is_owned = false;
33094 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33095 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
33096 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33097 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33098 CVec_u8Z_free(ret_var);
33102 uint32_t __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser) {
33103 LDKu8slice ser_ref;
33104 ser_ref.datalen = ser->arr_len;
33105 ser_ref.data = ser->elems;
33106 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
33107 *ret_conv = NetworkGraph_read(ser_ref);
33108 return (uint64_t)ret_conv;
33111 uint32_t __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
33112 LDKThirtyTwoBytes genesis_hash_ref;
33113 CHECK(genesis_hash->arr_len == 32);
33114 memcpy(genesis_hash_ref.data, genesis_hash->elems, 32);
33115 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
33116 uint64_t ret_ref = 0;
33117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33120 ret_ref = (uint64_t)ret_var.inner;
33121 if (ret_var.is_owned) {
33127 uint32_t __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
33128 LDKNetworkGraph this_arg_conv;
33129 this_arg_conv.inner = (void*)(this_arg & (~1));
33130 this_arg_conv.is_owned = false;
33131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33132 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
33133 uint64_t ret_ref = 0;
33134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33137 ret_ref = (uint64_t)ret_var.inner;
33138 if (ret_var.is_owned) {
33144 uint32_t __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
33145 LDKNetworkGraph this_arg_conv;
33146 this_arg_conv.inner = (void*)(this_arg & (~1));
33147 this_arg_conv.is_owned = false;
33148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33149 LDKNodeAnnouncement msg_conv;
33150 msg_conv.inner = (void*)(msg & (~1));
33151 msg_conv.is_owned = false;
33152 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33153 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33154 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
33155 return (uint64_t)ret_conv;
33158 uint32_t __attribute__((export_name("TS_NetworkGraph_update_node_from_unsigned_announcement"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
33159 LDKNetworkGraph this_arg_conv;
33160 this_arg_conv.inner = (void*)(this_arg & (~1));
33161 this_arg_conv.is_owned = false;
33162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33163 LDKUnsignedNodeAnnouncement msg_conv;
33164 msg_conv.inner = (void*)(msg & (~1));
33165 msg_conv.is_owned = false;
33166 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33167 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33168 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
33169 return (uint64_t)ret_conv;
33172 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel_from_announcement"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
33173 LDKNetworkGraph this_arg_conv;
33174 this_arg_conv.inner = (void*)(this_arg & (~1));
33175 this_arg_conv.is_owned = false;
33176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33177 LDKChannelAnnouncement msg_conv;
33178 msg_conv.inner = (void*)(msg & (~1));
33179 msg_conv.is_owned = false;
33180 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33181 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
33182 CHECK_ACCESS(chain_access_ptr);
33183 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
33184 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
33185 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
33186 // Manually implement clone for Java trait instances
33188 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33189 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
33190 return (uint64_t)ret_conv;
33193 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel_from_unsigned_announcement"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
33194 LDKNetworkGraph this_arg_conv;
33195 this_arg_conv.inner = (void*)(this_arg & (~1));
33196 this_arg_conv.is_owned = false;
33197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33198 LDKUnsignedChannelAnnouncement msg_conv;
33199 msg_conv.inner = (void*)(msg & (~1));
33200 msg_conv.is_owned = false;
33201 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33202 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
33203 CHECK_ACCESS(chain_access_ptr);
33204 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
33205 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
33206 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
33207 // Manually implement clone for Java trait instances
33209 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33210 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
33211 return (uint64_t)ret_conv;
33214 void __attribute__((export_name("TS_NetworkGraph_close_channel_from_update"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
33215 LDKNetworkGraph this_arg_conv;
33216 this_arg_conv.inner = (void*)(this_arg & (~1));
33217 this_arg_conv.is_owned = false;
33218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33219 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
33222 void __attribute__((export_name("TS_NetworkGraph_fail_node"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
33223 LDKNetworkGraph this_arg_conv;
33224 this_arg_conv.inner = (void*)(this_arg & (~1));
33225 this_arg_conv.is_owned = false;
33226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33227 LDKPublicKey _node_id_ref;
33228 CHECK(_node_id->arr_len == 33);
33229 memcpy(_node_id_ref.compressed_form, _node_id->elems, 33);
33230 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
33233 void __attribute__((export_name("TS_NetworkGraph_remove_stale_channels_with_time"))) TS_NetworkGraph_remove_stale_channels_with_time(uint32_t this_arg, int64_t current_time_unix) {
33234 LDKNetworkGraph this_arg_conv;
33235 this_arg_conv.inner = (void*)(this_arg & (~1));
33236 this_arg_conv.is_owned = false;
33237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33238 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
33241 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
33242 LDKNetworkGraph this_arg_conv;
33243 this_arg_conv.inner = (void*)(this_arg & (~1));
33244 this_arg_conv.is_owned = false;
33245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33246 LDKChannelUpdate msg_conv;
33247 msg_conv.inner = (void*)(msg & (~1));
33248 msg_conv.is_owned = false;
33249 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33250 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33251 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
33252 return (uint64_t)ret_conv;
33255 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
33256 LDKNetworkGraph this_arg_conv;
33257 this_arg_conv.inner = (void*)(this_arg & (~1));
33258 this_arg_conv.is_owned = false;
33259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33260 LDKUnsignedChannelUpdate msg_conv;
33261 msg_conv.inner = (void*)(msg & (~1));
33262 msg_conv.is_owned = false;
33263 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33264 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33265 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
33266 return (uint64_t)ret_conv;
33269 uint32_t __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
33270 LDKReadOnlyNetworkGraph this_arg_conv;
33271 this_arg_conv.inner = (void*)(this_arg & (~1));
33272 this_arg_conv.is_owned = false;
33273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33274 LDKPublicKey pubkey_ref;
33275 CHECK(pubkey->arr_len == 33);
33276 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
33277 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
33278 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
33279 uint64_t ret_ref = (uint64_t)ret_copy;
33283 void __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint32_t this_obj) {
33284 LDKRouteHop this_obj_conv;
33285 this_obj_conv.inner = (void*)(this_obj & (~1));
33286 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33288 RouteHop_free(this_obj_conv);
33291 int8_tArray __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
33292 LDKRouteHop this_ptr_conv;
33293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33294 this_ptr_conv.is_owned = false;
33295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33296 int8_tArray ret_arr = init_int8_tArray(33);
33297 memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
33301 void __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
33302 LDKRouteHop this_ptr_conv;
33303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33304 this_ptr_conv.is_owned = false;
33305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33306 LDKPublicKey val_ref;
33307 CHECK(val->arr_len == 33);
33308 memcpy(val_ref.compressed_form, val->elems, 33);
33309 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
33312 uint32_t __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
33313 LDKRouteHop this_ptr_conv;
33314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33315 this_ptr_conv.is_owned = false;
33316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33317 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
33318 uint64_t ret_ref = 0;
33319 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33320 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33321 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33322 ret_ref = (uint64_t)ret_var.inner;
33323 if (ret_var.is_owned) {
33329 void __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
33330 LDKRouteHop this_ptr_conv;
33331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33332 this_ptr_conv.is_owned = false;
33333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33334 LDKNodeFeatures val_conv;
33335 val_conv.inner = (void*)(val & (~1));
33336 val_conv.is_owned = (val & 1) || (val == 0);
33337 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33338 val_conv = NodeFeatures_clone(&val_conv);
33339 RouteHop_set_node_features(&this_ptr_conv, val_conv);
33342 int64_t __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
33343 LDKRouteHop this_ptr_conv;
33344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33345 this_ptr_conv.is_owned = false;
33346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33347 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
33351 void __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
33352 LDKRouteHop this_ptr_conv;
33353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33354 this_ptr_conv.is_owned = false;
33355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33356 RouteHop_set_short_channel_id(&this_ptr_conv, val);
33359 uint32_t __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
33360 LDKRouteHop this_ptr_conv;
33361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33362 this_ptr_conv.is_owned = false;
33363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33364 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
33365 uint64_t ret_ref = 0;
33366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33368 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33369 ret_ref = (uint64_t)ret_var.inner;
33370 if (ret_var.is_owned) {
33376 void __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
33377 LDKRouteHop this_ptr_conv;
33378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33379 this_ptr_conv.is_owned = false;
33380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33381 LDKChannelFeatures val_conv;
33382 val_conv.inner = (void*)(val & (~1));
33383 val_conv.is_owned = (val & 1) || (val == 0);
33384 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33385 val_conv = ChannelFeatures_clone(&val_conv);
33386 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
33389 int64_t __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
33390 LDKRouteHop this_ptr_conv;
33391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33392 this_ptr_conv.is_owned = false;
33393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33394 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
33398 void __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
33399 LDKRouteHop this_ptr_conv;
33400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33401 this_ptr_conv.is_owned = false;
33402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33403 RouteHop_set_fee_msat(&this_ptr_conv, val);
33406 int32_t __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
33407 LDKRouteHop this_ptr_conv;
33408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33409 this_ptr_conv.is_owned = false;
33410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33411 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
33415 void __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
33416 LDKRouteHop this_ptr_conv;
33417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33418 this_ptr_conv.is_owned = false;
33419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33420 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
33423 uint32_t __attribute__((export_name("TS_RouteHop_new"))) TS_RouteHop_new(int8_tArray pubkey_arg, uint32_t node_features_arg, int64_t short_channel_id_arg, uint32_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) {
33424 LDKPublicKey pubkey_arg_ref;
33425 CHECK(pubkey_arg->arr_len == 33);
33426 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33);
33427 LDKNodeFeatures node_features_arg_conv;
33428 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
33429 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
33430 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
33431 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
33432 LDKChannelFeatures channel_features_arg_conv;
33433 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
33434 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
33435 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
33436 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
33437 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);
33438 uint64_t ret_ref = 0;
33439 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33440 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33442 ret_ref = (uint64_t)ret_var.inner;
33443 if (ret_var.is_owned) {
33449 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
33450 LDKRouteHop ret_var = RouteHop_clone(arg);
33451 uint64_t ret_ref = 0;
33452 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33453 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33454 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33455 ret_ref = (uint64_t)ret_var.inner;
33456 if (ret_var.is_owned) {
33461 int64_t __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint32_t arg) {
33462 LDKRouteHop arg_conv;
33463 arg_conv.inner = (void*)(arg & (~1));
33464 arg_conv.is_owned = false;
33465 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33466 int64_t ret_val = RouteHop_clone_ptr(&arg_conv);
33470 uint32_t __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint32_t orig) {
33471 LDKRouteHop orig_conv;
33472 orig_conv.inner = (void*)(orig & (~1));
33473 orig_conv.is_owned = false;
33474 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33475 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
33476 uint64_t ret_ref = 0;
33477 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33478 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33479 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33480 ret_ref = (uint64_t)ret_var.inner;
33481 if (ret_var.is_owned) {
33487 int64_t __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint32_t o) {
33488 LDKRouteHop o_conv;
33489 o_conv.inner = (void*)(o & (~1));
33490 o_conv.is_owned = false;
33491 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33492 int64_t ret_val = RouteHop_hash(&o_conv);
33496 jboolean __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
33497 LDKRouteHop a_conv;
33498 a_conv.inner = (void*)(a & (~1));
33499 a_conv.is_owned = false;
33500 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33501 LDKRouteHop b_conv;
33502 b_conv.inner = (void*)(b & (~1));
33503 b_conv.is_owned = false;
33504 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33505 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
33509 int8_tArray __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint32_t obj) {
33510 LDKRouteHop obj_conv;
33511 obj_conv.inner = (void*)(obj & (~1));
33512 obj_conv.is_owned = false;
33513 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33514 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
33515 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33516 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33517 CVec_u8Z_free(ret_var);
33521 uint32_t __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
33522 LDKu8slice ser_ref;
33523 ser_ref.datalen = ser->arr_len;
33524 ser_ref.data = ser->elems;
33525 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
33526 *ret_conv = RouteHop_read(ser_ref);
33527 return (uint64_t)ret_conv;
33530 void __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint32_t this_obj) {
33531 LDKRoute this_obj_conv;
33532 this_obj_conv.inner = (void*)(this_obj & (~1));
33533 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33535 Route_free(this_obj_conv);
33538 ptrArray __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint32_t this_ptr) {
33539 LDKRoute this_ptr_conv;
33540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33541 this_ptr_conv.is_owned = false;
33542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33543 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
33544 ptrArray ret_arr = NULL;
33545 ret_arr = init_ptrArray(ret_var.datalen);
33546 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(((uint8_t*)ret_arr) + 4);
33547 for (size_t m = 0; m < ret_var.datalen; m++) {
33548 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
33549 uint32_tArray ret_conv_12_arr = NULL;
33550 ret_conv_12_arr = init_uint32_tArray(ret_conv_12_var.datalen);
33551 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(((uint8_t*)ret_conv_12_arr) + 4);
33552 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
33553 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
33554 uint64_t ret_conv_12_conv_10_ref = 0;
33555 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33556 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33557 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
33558 ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
33559 if (ret_conv_12_conv_10_var.is_owned) {
33560 ret_conv_12_conv_10_ref |= 1;
33562 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
33565 FREE(ret_conv_12_var.data);
33566 ret_arr_ptr[m] = ret_conv_12_arr;
33569 FREE(ret_var.data);
33573 void __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
33574 LDKRoute this_ptr_conv;
33575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33576 this_ptr_conv.is_owned = false;
33577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33578 LDKCVec_CVec_RouteHopZZ val_constr;
33579 val_constr.datalen = val->arr_len;
33580 if (val_constr.datalen > 0)
33581 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33583 val_constr.data = NULL;
33584 uint32_tArray* val_vals = (void*) val->elems;
33585 for (size_t m = 0; m < val_constr.datalen; m++) {
33586 uint32_tArray val_conv_12 = val_vals[m];
33587 LDKCVec_RouteHopZ val_conv_12_constr;
33588 val_conv_12_constr.datalen = val_conv_12->arr_len;
33589 if (val_conv_12_constr.datalen > 0)
33590 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33592 val_conv_12_constr.data = NULL;
33593 uint32_t* val_conv_12_vals = val_conv_12->elems;
33594 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
33595 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
33596 LDKRouteHop val_conv_12_conv_10_conv;
33597 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
33598 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
33599 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
33600 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
33601 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
33603 val_constr.data[m] = val_conv_12_constr;
33605 Route_set_paths(&this_ptr_conv, val_constr);
33608 uint32_t __attribute__((export_name("TS_Route_get_payee"))) TS_Route_get_payee(uint32_t this_ptr) {
33609 LDKRoute this_ptr_conv;
33610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33611 this_ptr_conv.is_owned = false;
33612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33613 LDKPayee ret_var = Route_get_payee(&this_ptr_conv);
33614 uint64_t ret_ref = 0;
33615 if ((uint64_t)ret_var.inner > 4096) {
33616 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33617 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33618 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33619 ret_ref = (uint64_t)ret_var.inner;
33620 if (ret_var.is_owned) {
33627 void __attribute__((export_name("TS_Route_set_payee"))) TS_Route_set_payee(uint32_t this_ptr, uint32_t val) {
33628 LDKRoute this_ptr_conv;
33629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33630 this_ptr_conv.is_owned = false;
33631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33633 val_conv.inner = (void*)(val & (~1));
33634 val_conv.is_owned = (val & 1) || (val == 0);
33635 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33636 val_conv = Payee_clone(&val_conv);
33637 Route_set_payee(&this_ptr_conv, val_conv);
33640 uint32_t __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint32_t payee_arg) {
33641 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
33642 paths_arg_constr.datalen = paths_arg->arr_len;
33643 if (paths_arg_constr.datalen > 0)
33644 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33646 paths_arg_constr.data = NULL;
33647 uint32_tArray* paths_arg_vals = (void*) paths_arg->elems;
33648 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
33649 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
33650 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
33651 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
33652 if (paths_arg_conv_12_constr.datalen > 0)
33653 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33655 paths_arg_conv_12_constr.data = NULL;
33656 uint32_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
33657 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
33658 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
33659 LDKRouteHop paths_arg_conv_12_conv_10_conv;
33660 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
33661 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
33662 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
33663 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
33664 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
33666 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
33668 LDKPayee payee_arg_conv;
33669 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33670 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33671 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33672 payee_arg_conv = Payee_clone(&payee_arg_conv);
33673 LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv);
33674 uint64_t ret_ref = 0;
33675 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33676 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33677 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33678 ret_ref = (uint64_t)ret_var.inner;
33679 if (ret_var.is_owned) {
33685 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
33686 LDKRoute ret_var = Route_clone(arg);
33687 uint64_t ret_ref = 0;
33688 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33689 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33691 ret_ref = (uint64_t)ret_var.inner;
33692 if (ret_var.is_owned) {
33697 int64_t __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint32_t arg) {
33699 arg_conv.inner = (void*)(arg & (~1));
33700 arg_conv.is_owned = false;
33701 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33702 int64_t ret_val = Route_clone_ptr(&arg_conv);
33706 uint32_t __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint32_t orig) {
33707 LDKRoute orig_conv;
33708 orig_conv.inner = (void*)(orig & (~1));
33709 orig_conv.is_owned = false;
33710 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33711 LDKRoute ret_var = Route_clone(&orig_conv);
33712 uint64_t ret_ref = 0;
33713 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33714 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33715 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33716 ret_ref = (uint64_t)ret_var.inner;
33717 if (ret_var.is_owned) {
33723 int64_t __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint32_t o) {
33725 o_conv.inner = (void*)(o & (~1));
33726 o_conv.is_owned = false;
33727 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33728 int64_t ret_val = Route_hash(&o_conv);
33732 jboolean __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint32_t a, uint32_t b) {
33734 a_conv.inner = (void*)(a & (~1));
33735 a_conv.is_owned = false;
33736 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33738 b_conv.inner = (void*)(b & (~1));
33739 b_conv.is_owned = false;
33740 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33741 jboolean ret_val = Route_eq(&a_conv, &b_conv);
33745 int64_t __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint32_t this_arg) {
33746 LDKRoute this_arg_conv;
33747 this_arg_conv.inner = (void*)(this_arg & (~1));
33748 this_arg_conv.is_owned = false;
33749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33750 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
33754 int64_t __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint32_t this_arg) {
33755 LDKRoute this_arg_conv;
33756 this_arg_conv.inner = (void*)(this_arg & (~1));
33757 this_arg_conv.is_owned = false;
33758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33759 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
33763 int8_tArray __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint32_t obj) {
33765 obj_conv.inner = (void*)(obj & (~1));
33766 obj_conv.is_owned = false;
33767 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33768 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
33769 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33770 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33771 CVec_u8Z_free(ret_var);
33775 uint32_t __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
33776 LDKu8slice ser_ref;
33777 ser_ref.datalen = ser->arr_len;
33778 ser_ref.data = ser->elems;
33779 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
33780 *ret_conv = Route_read(ser_ref);
33781 return (uint64_t)ret_conv;
33784 void __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint32_t this_obj) {
33785 LDKRouteParameters this_obj_conv;
33786 this_obj_conv.inner = (void*)(this_obj & (~1));
33787 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33789 RouteParameters_free(this_obj_conv);
33792 uint32_t __attribute__((export_name("TS_RouteParameters_get_payee"))) TS_RouteParameters_get_payee(uint32_t this_ptr) {
33793 LDKRouteParameters this_ptr_conv;
33794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33795 this_ptr_conv.is_owned = false;
33796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33797 LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv);
33798 uint64_t ret_ref = 0;
33799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33801 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33802 ret_ref = (uint64_t)ret_var.inner;
33803 if (ret_var.is_owned) {
33809 void __attribute__((export_name("TS_RouteParameters_set_payee"))) TS_RouteParameters_set_payee(uint32_t this_ptr, uint32_t val) {
33810 LDKRouteParameters this_ptr_conv;
33811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33812 this_ptr_conv.is_owned = false;
33813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33815 val_conv.inner = (void*)(val & (~1));
33816 val_conv.is_owned = (val & 1) || (val == 0);
33817 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33818 val_conv = Payee_clone(&val_conv);
33819 RouteParameters_set_payee(&this_ptr_conv, val_conv);
33822 int64_t __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
33823 LDKRouteParameters this_ptr_conv;
33824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33825 this_ptr_conv.is_owned = false;
33826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33827 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
33831 void __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
33832 LDKRouteParameters this_ptr_conv;
33833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33834 this_ptr_conv.is_owned = false;
33835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33836 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
33839 int32_t __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
33840 LDKRouteParameters this_ptr_conv;
33841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33842 this_ptr_conv.is_owned = false;
33843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33844 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
33848 void __attribute__((export_name("TS_RouteParameters_set_final_cltv_expiry_delta"))) TS_RouteParameters_set_final_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
33849 LDKRouteParameters this_ptr_conv;
33850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33851 this_ptr_conv.is_owned = false;
33852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33853 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
33856 uint32_t __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint32_t payee_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) {
33857 LDKPayee payee_arg_conv;
33858 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33859 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33860 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33861 payee_arg_conv = Payee_clone(&payee_arg_conv);
33862 LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
33863 uint64_t ret_ref = 0;
33864 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33865 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33866 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33867 ret_ref = (uint64_t)ret_var.inner;
33868 if (ret_var.is_owned) {
33874 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
33875 LDKRouteParameters ret_var = RouteParameters_clone(arg);
33876 uint64_t ret_ref = 0;
33877 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33878 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33880 ret_ref = (uint64_t)ret_var.inner;
33881 if (ret_var.is_owned) {
33886 int64_t __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
33887 LDKRouteParameters arg_conv;
33888 arg_conv.inner = (void*)(arg & (~1));
33889 arg_conv.is_owned = false;
33890 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33891 int64_t ret_val = RouteParameters_clone_ptr(&arg_conv);
33895 uint32_t __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint32_t orig) {
33896 LDKRouteParameters orig_conv;
33897 orig_conv.inner = (void*)(orig & (~1));
33898 orig_conv.is_owned = false;
33899 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33900 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
33901 uint64_t ret_ref = 0;
33902 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33903 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33905 ret_ref = (uint64_t)ret_var.inner;
33906 if (ret_var.is_owned) {
33912 int8_tArray __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint32_t obj) {
33913 LDKRouteParameters obj_conv;
33914 obj_conv.inner = (void*)(obj & (~1));
33915 obj_conv.is_owned = false;
33916 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33917 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
33918 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33919 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33920 CVec_u8Z_free(ret_var);
33924 uint32_t __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
33925 LDKu8slice ser_ref;
33926 ser_ref.datalen = ser->arr_len;
33927 ser_ref.data = ser->elems;
33928 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
33929 *ret_conv = RouteParameters_read(ser_ref);
33930 return (uint64_t)ret_conv;
33933 void __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint32_t this_obj) {
33934 LDKPayee this_obj_conv;
33935 this_obj_conv.inner = (void*)(this_obj & (~1));
33936 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33938 Payee_free(this_obj_conv);
33941 int8_tArray __attribute__((export_name("TS_Payee_get_pubkey"))) TS_Payee_get_pubkey(uint32_t this_ptr) {
33942 LDKPayee this_ptr_conv;
33943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33944 this_ptr_conv.is_owned = false;
33945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33946 int8_tArray ret_arr = init_int8_tArray(33);
33947 memcpy(ret_arr->elems, Payee_get_pubkey(&this_ptr_conv).compressed_form, 33);
33951 void __attribute__((export_name("TS_Payee_set_pubkey"))) TS_Payee_set_pubkey(uint32_t this_ptr, int8_tArray val) {
33952 LDKPayee this_ptr_conv;
33953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33954 this_ptr_conv.is_owned = false;
33955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33956 LDKPublicKey val_ref;
33957 CHECK(val->arr_len == 33);
33958 memcpy(val_ref.compressed_form, val->elems, 33);
33959 Payee_set_pubkey(&this_ptr_conv, val_ref);
33962 uint32_t __attribute__((export_name("TS_Payee_get_features"))) TS_Payee_get_features(uint32_t this_ptr) {
33963 LDKPayee this_ptr_conv;
33964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33965 this_ptr_conv.is_owned = false;
33966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33967 LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv);
33968 uint64_t ret_ref = 0;
33969 if ((uint64_t)ret_var.inner > 4096) {
33970 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33971 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33972 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33973 ret_ref = (uint64_t)ret_var.inner;
33974 if (ret_var.is_owned) {
33981 void __attribute__((export_name("TS_Payee_set_features"))) TS_Payee_set_features(uint32_t this_ptr, uint32_t val) {
33982 LDKPayee this_ptr_conv;
33983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33984 this_ptr_conv.is_owned = false;
33985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33986 LDKInvoiceFeatures val_conv;
33987 val_conv.inner = (void*)(val & (~1));
33988 val_conv.is_owned = (val & 1) || (val == 0);
33989 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33990 val_conv = InvoiceFeatures_clone(&val_conv);
33991 Payee_set_features(&this_ptr_conv, val_conv);
33994 uint32_tArray __attribute__((export_name("TS_Payee_get_route_hints"))) TS_Payee_get_route_hints(uint32_t this_ptr) {
33995 LDKPayee this_ptr_conv;
33996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33997 this_ptr_conv.is_owned = false;
33998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33999 LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv);
34000 uint32_tArray ret_arr = NULL;
34001 ret_arr = init_uint32_tArray(ret_var.datalen);
34002 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
34003 for (size_t l = 0; l < ret_var.datalen; l++) {
34004 LDKRouteHint ret_conv_11_var = ret_var.data[l];
34005 uint64_t ret_conv_11_ref = 0;
34006 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34007 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34008 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
34009 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
34010 if (ret_conv_11_var.is_owned) {
34011 ret_conv_11_ref |= 1;
34013 ret_arr_ptr[l] = ret_conv_11_ref;
34016 FREE(ret_var.data);
34020 void __attribute__((export_name("TS_Payee_set_route_hints"))) TS_Payee_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
34021 LDKPayee this_ptr_conv;
34022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34023 this_ptr_conv.is_owned = false;
34024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34025 LDKCVec_RouteHintZ val_constr;
34026 val_constr.datalen = val->arr_len;
34027 if (val_constr.datalen > 0)
34028 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
34030 val_constr.data = NULL;
34031 uint32_t* val_vals = val->elems;
34032 for (size_t l = 0; l < val_constr.datalen; l++) {
34033 uint32_t val_conv_11 = val_vals[l];
34034 LDKRouteHint val_conv_11_conv;
34035 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
34036 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
34037 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
34038 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
34039 val_constr.data[l] = val_conv_11_conv;
34041 Payee_set_route_hints(&this_ptr_conv, val_constr);
34044 uint32_t __attribute__((export_name("TS_Payee_get_expiry_time"))) TS_Payee_get_expiry_time(uint32_t this_ptr) {
34045 LDKPayee this_ptr_conv;
34046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34047 this_ptr_conv.is_owned = false;
34048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34049 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34050 *ret_copy = Payee_get_expiry_time(&this_ptr_conv);
34051 uint64_t ret_ref = (uint64_t)ret_copy;
34055 void __attribute__((export_name("TS_Payee_set_expiry_time"))) TS_Payee_set_expiry_time(uint32_t this_ptr, uint32_t val) {
34056 LDKPayee this_ptr_conv;
34057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34058 this_ptr_conv.is_owned = false;
34059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34060 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34061 CHECK_ACCESS(val_ptr);
34062 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34063 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34064 Payee_set_expiry_time(&this_ptr_conv, val_conv);
34067 uint32_t __attribute__((export_name("TS_Payee_new"))) TS_Payee_new(int8_tArray pubkey_arg, uint32_t features_arg, uint32_tArray route_hints_arg, uint32_t expiry_time_arg) {
34068 LDKPublicKey pubkey_arg_ref;
34069 CHECK(pubkey_arg->arr_len == 33);
34070 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33);
34071 LDKInvoiceFeatures features_arg_conv;
34072 features_arg_conv.inner = (void*)(features_arg & (~1));
34073 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
34074 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
34075 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
34076 LDKCVec_RouteHintZ route_hints_arg_constr;
34077 route_hints_arg_constr.datalen = route_hints_arg->arr_len;
34078 if (route_hints_arg_constr.datalen > 0)
34079 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
34081 route_hints_arg_constr.data = NULL;
34082 uint32_t* route_hints_arg_vals = route_hints_arg->elems;
34083 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
34084 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
34085 LDKRouteHint route_hints_arg_conv_11_conv;
34086 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
34087 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
34088 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
34089 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
34090 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
34092 void* expiry_time_arg_ptr = (void*)(((uint64_t)expiry_time_arg) & ~1);
34093 CHECK_ACCESS(expiry_time_arg_ptr);
34094 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
34095 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)expiry_time_arg) & ~1));
34096 LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv);
34097 uint64_t ret_ref = 0;
34098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34101 ret_ref = (uint64_t)ret_var.inner;
34102 if (ret_var.is_owned) {
34108 static inline uintptr_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
34109 LDKPayee ret_var = Payee_clone(arg);
34110 uint64_t ret_ref = 0;
34111 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34112 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34114 ret_ref = (uint64_t)ret_var.inner;
34115 if (ret_var.is_owned) {
34120 int64_t __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint32_t arg) {
34122 arg_conv.inner = (void*)(arg & (~1));
34123 arg_conv.is_owned = false;
34124 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34125 int64_t ret_val = Payee_clone_ptr(&arg_conv);
34129 uint32_t __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint32_t orig) {
34130 LDKPayee orig_conv;
34131 orig_conv.inner = (void*)(orig & (~1));
34132 orig_conv.is_owned = false;
34133 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34134 LDKPayee ret_var = Payee_clone(&orig_conv);
34135 uint64_t ret_ref = 0;
34136 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34137 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34139 ret_ref = (uint64_t)ret_var.inner;
34140 if (ret_var.is_owned) {
34146 int64_t __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint32_t o) {
34148 o_conv.inner = (void*)(o & (~1));
34149 o_conv.is_owned = false;
34150 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34151 int64_t ret_val = Payee_hash(&o_conv);
34155 jboolean __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint32_t a, uint32_t b) {
34157 a_conv.inner = (void*)(a & (~1));
34158 a_conv.is_owned = false;
34159 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34161 b_conv.inner = (void*)(b & (~1));
34162 b_conv.is_owned = false;
34163 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34164 jboolean ret_val = Payee_eq(&a_conv, &b_conv);
34168 int8_tArray __attribute__((export_name("TS_Payee_write"))) TS_Payee_write(uint32_t obj) {
34170 obj_conv.inner = (void*)(obj & (~1));
34171 obj_conv.is_owned = false;
34172 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34173 LDKCVec_u8Z ret_var = Payee_write(&obj_conv);
34174 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34175 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34176 CVec_u8Z_free(ret_var);
34180 uint32_t __attribute__((export_name("TS_Payee_read"))) TS_Payee_read(int8_tArray ser) {
34181 LDKu8slice ser_ref;
34182 ser_ref.datalen = ser->arr_len;
34183 ser_ref.data = ser->elems;
34184 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
34185 *ret_conv = Payee_read(ser_ref);
34186 return (uint64_t)ret_conv;
34189 uint32_t __attribute__((export_name("TS_Payee_from_node_id"))) TS_Payee_from_node_id(int8_tArray pubkey) {
34190 LDKPublicKey pubkey_ref;
34191 CHECK(pubkey->arr_len == 33);
34192 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
34193 LDKPayee ret_var = Payee_from_node_id(pubkey_ref);
34194 uint64_t ret_ref = 0;
34195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34197 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34198 ret_ref = (uint64_t)ret_var.inner;
34199 if (ret_var.is_owned) {
34205 uint32_t __attribute__((export_name("TS_Payee_for_keysend"))) TS_Payee_for_keysend(int8_tArray pubkey) {
34206 LDKPublicKey pubkey_ref;
34207 CHECK(pubkey->arr_len == 33);
34208 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
34209 LDKPayee ret_var = Payee_for_keysend(pubkey_ref);
34210 uint64_t ret_ref = 0;
34211 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34212 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34214 ret_ref = (uint64_t)ret_var.inner;
34215 if (ret_var.is_owned) {
34221 void __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint32_t this_obj) {
34222 LDKRouteHint this_obj_conv;
34223 this_obj_conv.inner = (void*)(this_obj & (~1));
34224 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34226 RouteHint_free(this_obj_conv);
34229 uint32_tArray __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint32_t this_ptr) {
34230 LDKRouteHint this_ptr_conv;
34231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34232 this_ptr_conv.is_owned = false;
34233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34234 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
34235 uint32_tArray ret_arr = NULL;
34236 ret_arr = init_uint32_tArray(ret_var.datalen);
34237 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
34238 for (size_t o = 0; o < ret_var.datalen; o++) {
34239 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
34240 uint64_t ret_conv_14_ref = 0;
34241 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34242 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34243 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
34244 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
34245 if (ret_conv_14_var.is_owned) {
34246 ret_conv_14_ref |= 1;
34248 ret_arr_ptr[o] = ret_conv_14_ref;
34251 FREE(ret_var.data);
34255 void __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
34256 LDKRouteHint this_ptr_conv;
34257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34258 this_ptr_conv.is_owned = false;
34259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34260 LDKCVec_RouteHintHopZ val_constr;
34261 val_constr.datalen = val->arr_len;
34262 if (val_constr.datalen > 0)
34263 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
34265 val_constr.data = NULL;
34266 uint32_t* val_vals = val->elems;
34267 for (size_t o = 0; o < val_constr.datalen; o++) {
34268 uint32_t val_conv_14 = val_vals[o];
34269 LDKRouteHintHop val_conv_14_conv;
34270 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
34271 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
34272 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
34273 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
34274 val_constr.data[o] = val_conv_14_conv;
34276 RouteHint_set_a(&this_ptr_conv, val_constr);
34279 uint32_t __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint32_tArray a_arg) {
34280 LDKCVec_RouteHintHopZ a_arg_constr;
34281 a_arg_constr.datalen = a_arg->arr_len;
34282 if (a_arg_constr.datalen > 0)
34283 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
34285 a_arg_constr.data = NULL;
34286 uint32_t* a_arg_vals = a_arg->elems;
34287 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
34288 uint32_t a_arg_conv_14 = a_arg_vals[o];
34289 LDKRouteHintHop a_arg_conv_14_conv;
34290 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
34291 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
34292 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
34293 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
34294 a_arg_constr.data[o] = a_arg_conv_14_conv;
34296 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
34297 uint64_t ret_ref = 0;
34298 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34299 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34300 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34301 ret_ref = (uint64_t)ret_var.inner;
34302 if (ret_var.is_owned) {
34308 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
34309 LDKRouteHint ret_var = RouteHint_clone(arg);
34310 uint64_t ret_ref = 0;
34311 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34312 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34314 ret_ref = (uint64_t)ret_var.inner;
34315 if (ret_var.is_owned) {
34320 int64_t __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint32_t arg) {
34321 LDKRouteHint arg_conv;
34322 arg_conv.inner = (void*)(arg & (~1));
34323 arg_conv.is_owned = false;
34324 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34325 int64_t ret_val = RouteHint_clone_ptr(&arg_conv);
34329 uint32_t __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint32_t orig) {
34330 LDKRouteHint orig_conv;
34331 orig_conv.inner = (void*)(orig & (~1));
34332 orig_conv.is_owned = false;
34333 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34334 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
34335 uint64_t ret_ref = 0;
34336 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34337 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34338 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34339 ret_ref = (uint64_t)ret_var.inner;
34340 if (ret_var.is_owned) {
34346 int64_t __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint32_t o) {
34347 LDKRouteHint o_conv;
34348 o_conv.inner = (void*)(o & (~1));
34349 o_conv.is_owned = false;
34350 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34351 int64_t ret_val = RouteHint_hash(&o_conv);
34355 jboolean __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
34356 LDKRouteHint a_conv;
34357 a_conv.inner = (void*)(a & (~1));
34358 a_conv.is_owned = false;
34359 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34360 LDKRouteHint b_conv;
34361 b_conv.inner = (void*)(b & (~1));
34362 b_conv.is_owned = false;
34363 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34364 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
34368 int8_tArray __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint32_t obj) {
34369 LDKRouteHint obj_conv;
34370 obj_conv.inner = (void*)(obj & (~1));
34371 obj_conv.is_owned = false;
34372 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34373 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
34374 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34375 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34376 CVec_u8Z_free(ret_var);
34380 uint32_t __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
34381 LDKu8slice ser_ref;
34382 ser_ref.datalen = ser->arr_len;
34383 ser_ref.data = ser->elems;
34384 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
34385 *ret_conv = RouteHint_read(ser_ref);
34386 return (uint64_t)ret_conv;
34389 void __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint32_t this_obj) {
34390 LDKRouteHintHop this_obj_conv;
34391 this_obj_conv.inner = (void*)(this_obj & (~1));
34392 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34394 RouteHintHop_free(this_obj_conv);
34397 int8_tArray __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
34398 LDKRouteHintHop this_ptr_conv;
34399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34400 this_ptr_conv.is_owned = false;
34401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34402 int8_tArray ret_arr = init_int8_tArray(33);
34403 memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
34407 void __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
34408 LDKRouteHintHop this_ptr_conv;
34409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34410 this_ptr_conv.is_owned = false;
34411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34412 LDKPublicKey val_ref;
34413 CHECK(val->arr_len == 33);
34414 memcpy(val_ref.compressed_form, val->elems, 33);
34415 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
34418 int64_t __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
34419 LDKRouteHintHop this_ptr_conv;
34420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34421 this_ptr_conv.is_owned = false;
34422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34423 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
34427 void __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
34428 LDKRouteHintHop this_ptr_conv;
34429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34430 this_ptr_conv.is_owned = false;
34431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34432 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
34435 uint32_t __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
34436 LDKRouteHintHop this_ptr_conv;
34437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34438 this_ptr_conv.is_owned = false;
34439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34440 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
34441 uint64_t ret_ref = 0;
34442 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34443 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34444 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34445 ret_ref = (uint64_t)ret_var.inner;
34446 if (ret_var.is_owned) {
34452 void __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
34453 LDKRouteHintHop this_ptr_conv;
34454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34455 this_ptr_conv.is_owned = false;
34456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34457 LDKRoutingFees val_conv;
34458 val_conv.inner = (void*)(val & (~1));
34459 val_conv.is_owned = (val & 1) || (val == 0);
34460 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34461 val_conv = RoutingFees_clone(&val_conv);
34462 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
34465 int16_t __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
34466 LDKRouteHintHop this_ptr_conv;
34467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34468 this_ptr_conv.is_owned = false;
34469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34470 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
34474 void __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
34475 LDKRouteHintHop this_ptr_conv;
34476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34477 this_ptr_conv.is_owned = false;
34478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34479 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
34482 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
34483 LDKRouteHintHop this_ptr_conv;
34484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34485 this_ptr_conv.is_owned = false;
34486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34487 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34488 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
34489 uint64_t ret_ref = (uint64_t)ret_copy;
34493 void __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
34494 LDKRouteHintHop this_ptr_conv;
34495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34496 this_ptr_conv.is_owned = false;
34497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34498 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34499 CHECK_ACCESS(val_ptr);
34500 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34501 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34502 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
34505 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
34506 LDKRouteHintHop this_ptr_conv;
34507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34508 this_ptr_conv.is_owned = false;
34509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34510 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34511 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
34512 uint64_t ret_ref = (uint64_t)ret_copy;
34516 void __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
34517 LDKRouteHintHop this_ptr_conv;
34518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34519 this_ptr_conv.is_owned = false;
34520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34521 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34522 CHECK_ACCESS(val_ptr);
34523 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34524 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34525 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
34528 uint32_t __attribute__((export_name("TS_RouteHintHop_new"))) TS_RouteHintHop_new(int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint32_t fees_arg, int16_t cltv_expiry_delta_arg, uint32_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg) {
34529 LDKPublicKey src_node_id_arg_ref;
34530 CHECK(src_node_id_arg->arr_len == 33);
34531 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33);
34532 LDKRoutingFees fees_arg_conv;
34533 fees_arg_conv.inner = (void*)(fees_arg & (~1));
34534 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
34535 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
34536 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
34537 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
34538 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
34539 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
34540 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
34541 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
34542 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
34543 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
34544 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
34545 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);
34546 uint64_t ret_ref = 0;
34547 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34548 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34550 ret_ref = (uint64_t)ret_var.inner;
34551 if (ret_var.is_owned) {
34557 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
34558 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
34559 uint64_t ret_ref = 0;
34560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34563 ret_ref = (uint64_t)ret_var.inner;
34564 if (ret_var.is_owned) {
34569 int64_t __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
34570 LDKRouteHintHop arg_conv;
34571 arg_conv.inner = (void*)(arg & (~1));
34572 arg_conv.is_owned = false;
34573 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34574 int64_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
34578 uint32_t __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint32_t orig) {
34579 LDKRouteHintHop orig_conv;
34580 orig_conv.inner = (void*)(orig & (~1));
34581 orig_conv.is_owned = false;
34582 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34583 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
34584 uint64_t ret_ref = 0;
34585 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34586 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34588 ret_ref = (uint64_t)ret_var.inner;
34589 if (ret_var.is_owned) {
34595 int64_t __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint32_t o) {
34596 LDKRouteHintHop o_conv;
34597 o_conv.inner = (void*)(o & (~1));
34598 o_conv.is_owned = false;
34599 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34600 int64_t ret_val = RouteHintHop_hash(&o_conv);
34604 jboolean __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
34605 LDKRouteHintHop a_conv;
34606 a_conv.inner = (void*)(a & (~1));
34607 a_conv.is_owned = false;
34608 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34609 LDKRouteHintHop b_conv;
34610 b_conv.inner = (void*)(b & (~1));
34611 b_conv.is_owned = false;
34612 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34613 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
34617 int8_tArray __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint32_t obj) {
34618 LDKRouteHintHop obj_conv;
34619 obj_conv.inner = (void*)(obj & (~1));
34620 obj_conv.is_owned = false;
34621 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34622 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
34623 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34624 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34625 CVec_u8Z_free(ret_var);
34629 uint32_t __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
34630 LDKu8slice ser_ref;
34631 ser_ref.datalen = ser->arr_len;
34632 ser_ref.data = ser->elems;
34633 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
34634 *ret_conv = RouteHintHop_read(ser_ref);
34635 return (uint64_t)ret_conv;
34638 uint32_t __attribute__((export_name("TS_find_route"))) TS_find_route(int8_tArray our_node_pubkey, uint32_t params, uint32_t network, uint32_tArray first_hops, uint32_t logger, uint32_t scorer) {
34639 LDKPublicKey our_node_pubkey_ref;
34640 CHECK(our_node_pubkey->arr_len == 33);
34641 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33);
34642 LDKRouteParameters params_conv;
34643 params_conv.inner = (void*)(params & (~1));
34644 params_conv.is_owned = false;
34645 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
34646 LDKNetworkGraph network_conv;
34647 network_conv.inner = (void*)(network & (~1));
34648 network_conv.is_owned = false;
34649 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
34650 LDKCVec_ChannelDetailsZ first_hops_constr;
34651 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
34652 if (first_hops != 0) {
34653 first_hops_constr.datalen = first_hops->arr_len;
34654 if (first_hops_constr.datalen > 0)
34655 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34657 first_hops_constr.data = NULL;
34658 uint32_t* first_hops_vals = first_hops->elems;
34659 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
34660 uint32_t first_hops_conv_16 = first_hops_vals[q];
34661 LDKChannelDetails first_hops_conv_16_conv;
34662 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
34663 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
34664 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
34665 first_hops_constr.data[q] = first_hops_conv_16_conv;
34667 first_hops_ptr = &first_hops_constr;
34669 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
34670 CHECK_ACCESS(logger_ptr);
34671 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34672 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
34673 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
34674 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
34675 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
34676 *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
34677 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
34678 return (uint64_t)ret_conv;
34681 void __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint32_t this_ptr) {
34682 if ((this_ptr & 1) != 0) return;
34683 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
34684 CHECK_ACCESS(this_ptr_ptr);
34685 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
34686 FREE((void*)this_ptr);
34687 Score_free(this_ptr_conv);
34690 void __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint32_t this_ptr) {
34691 if ((this_ptr & 1) != 0) return;
34692 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
34693 CHECK_ACCESS(this_ptr_ptr);
34694 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
34695 FREE((void*)this_ptr);
34696 LockableScore_free(this_ptr_conv);
34699 void __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) {
34700 LDKMultiThreadedLockableScore this_obj_conv;
34701 this_obj_conv.inner = (void*)(this_obj & (~1));
34702 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34704 MultiThreadedLockableScore_free(this_obj_conv);
34707 uint32_t __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint32_t score) {
34708 void* score_ptr = (void*)(((uint64_t)score) & ~1);
34709 CHECK_ACCESS(score_ptr);
34710 LDKScore score_conv = *(LDKScore*)(score_ptr);
34711 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
34712 uint64_t ret_ref = 0;
34713 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34714 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34715 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34716 ret_ref = (uint64_t)ret_var.inner;
34717 if (ret_var.is_owned) {
34723 void __attribute__((export_name("TS_ScoringParameters_free"))) TS_ScoringParameters_free(uint32_t this_obj) {
34724 LDKScoringParameters this_obj_conv;
34725 this_obj_conv.inner = (void*)(this_obj & (~1));
34726 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34728 ScoringParameters_free(this_obj_conv);
34731 int64_t __attribute__((export_name("TS_ScoringParameters_get_base_penalty_msat"))) TS_ScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
34732 LDKScoringParameters this_ptr_conv;
34733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34734 this_ptr_conv.is_owned = false;
34735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34736 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
34740 void __attribute__((export_name("TS_ScoringParameters_set_base_penalty_msat"))) TS_ScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
34741 LDKScoringParameters this_ptr_conv;
34742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34743 this_ptr_conv.is_owned = false;
34744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34745 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
34748 int64_t __attribute__((export_name("TS_ScoringParameters_get_failure_penalty_msat"))) TS_ScoringParameters_get_failure_penalty_msat(uint32_t this_ptr) {
34749 LDKScoringParameters this_ptr_conv;
34750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34751 this_ptr_conv.is_owned = false;
34752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34753 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
34757 void __attribute__((export_name("TS_ScoringParameters_set_failure_penalty_msat"))) TS_ScoringParameters_set_failure_penalty_msat(uint32_t this_ptr, int64_t val) {
34758 LDKScoringParameters this_ptr_conv;
34759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34760 this_ptr_conv.is_owned = false;
34761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34762 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
34765 int16_t __attribute__((export_name("TS_ScoringParameters_get_overuse_penalty_start_1024th"))) TS_ScoringParameters_get_overuse_penalty_start_1024th(uint32_t this_ptr) {
34766 LDKScoringParameters this_ptr_conv;
34767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34768 this_ptr_conv.is_owned = false;
34769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34770 int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
34774 void __attribute__((export_name("TS_ScoringParameters_set_overuse_penalty_start_1024th"))) TS_ScoringParameters_set_overuse_penalty_start_1024th(uint32_t this_ptr, int16_t val) {
34775 LDKScoringParameters this_ptr_conv;
34776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34777 this_ptr_conv.is_owned = false;
34778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34779 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
34782 int64_t __attribute__((export_name("TS_ScoringParameters_get_overuse_penalty_msat_per_1024th"))) TS_ScoringParameters_get_overuse_penalty_msat_per_1024th(uint32_t this_ptr) {
34783 LDKScoringParameters this_ptr_conv;
34784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34785 this_ptr_conv.is_owned = false;
34786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34787 int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
34791 void __attribute__((export_name("TS_ScoringParameters_set_overuse_penalty_msat_per_1024th"))) TS_ScoringParameters_set_overuse_penalty_msat_per_1024th(uint32_t this_ptr, int64_t val) {
34792 LDKScoringParameters this_ptr_conv;
34793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34794 this_ptr_conv.is_owned = false;
34795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34796 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
34799 int64_t __attribute__((export_name("TS_ScoringParameters_get_failure_penalty_half_life"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) {
34800 LDKScoringParameters this_ptr_conv;
34801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34802 this_ptr_conv.is_owned = false;
34803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34804 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
34808 void __attribute__((export_name("TS_ScoringParameters_set_failure_penalty_half_life"))) TS_ScoringParameters_set_failure_penalty_half_life(uint32_t this_ptr, int64_t val) {
34809 LDKScoringParameters this_ptr_conv;
34810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34811 this_ptr_conv.is_owned = false;
34812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34813 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
34816 uint32_t __attribute__((export_name("TS_ScoringParameters_new"))) TS_ScoringParameters_new(int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int16_t overuse_penalty_start_1024th_arg, int64_t overuse_penalty_msat_per_1024th_arg, int64_t failure_penalty_half_life_arg) {
34817 LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, overuse_penalty_start_1024th_arg, overuse_penalty_msat_per_1024th_arg, failure_penalty_half_life_arg);
34818 uint64_t ret_ref = 0;
34819 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34820 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34821 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34822 ret_ref = (uint64_t)ret_var.inner;
34823 if (ret_var.is_owned) {
34829 int8_tArray __attribute__((export_name("TS_ScoringParameters_write"))) TS_ScoringParameters_write(uint32_t obj) {
34830 LDKScoringParameters obj_conv;
34831 obj_conv.inner = (void*)(obj & (~1));
34832 obj_conv.is_owned = false;
34833 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34834 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
34835 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34836 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34837 CVec_u8Z_free(ret_var);
34841 uint32_t __attribute__((export_name("TS_ScoringParameters_read"))) TS_ScoringParameters_read(int8_tArray ser) {
34842 LDKu8slice ser_ref;
34843 ser_ref.datalen = ser->arr_len;
34844 ser_ref.data = ser->elems;
34845 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
34846 *ret_conv = ScoringParameters_read(ser_ref);
34847 return (uint64_t)ret_conv;
34850 uint32_t __attribute__((export_name("TS_ScoringParameters_default"))) TS_ScoringParameters_default() {
34851 LDKScoringParameters ret_var = ScoringParameters_default();
34852 uint64_t ret_ref = 0;
34853 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34854 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34855 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34856 ret_ref = (uint64_t)ret_var.inner;
34857 if (ret_var.is_owned) {