1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
7 // These should be provided...somehow...
8 void *memset(void *s, int c, size_t n);
9 void *memcpy(void *dest, const void *src, size_t n);
10 int memcmp(const void *s1, const void *s2, size_t n);
12 extern void __attribute__((noreturn)) abort(void);
13 static inline void assert(bool expression) {
14 if (!expression) { abort(); }
17 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
18 return val == 0xdeadbeef0badf00dULL;
22 void *malloc(size_t size);
25 #define MALLOC(a, _) malloc(a)
26 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
27 #define DO_ASSERT(a) (void)(a)
29 #define CHECK_ACCESS(p)
30 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
32 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
33 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
34 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
35 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
37 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
39 #define DECL_ARR_TYPE(ty, name) \
40 struct name##array { \
44 typedef struct name##array * name##Array; \
45 static inline name##Array init_##name##Array(size_t arr_len) { \
46 name##Array arr = (name##Array)MALLOC(arr_len * sizeof(ty) + sizeof(uint32_t), "##name array init"); \
47 arr->arr_len = arr_len; \
51 DECL_ARR_TYPE(int64_t, int64_t);
52 DECL_ARR_TYPE(int8_t, int8_t);
53 DECL_ARR_TYPE(uint32_t, uint32_t);
54 DECL_ARR_TYPE(void*, ptr);
55 DECL_ARR_TYPE(char, char);
56 typedef charArray jstring;
58 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
59 charArray arr = init_charArray(len);
60 memcpy(arr->elems, chars, len);
63 static inline LDKStr str_ref_to_owned_c(const jstring str) {
64 char* newchars = MALLOC(str->arr_len + 1, "String chars");
65 memcpy(newchars, str->elems, str->arr_len);
66 newchars[str->arr_len] = 0;
70 .chars_is_owned = true
75 typedef bool jboolean;
77 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
78 return (uint32_t)MALLOC(size, "JS-Called malloc");
80 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
83 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
84 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
86 case 0: return LDKAccessError_UnknownChain;
87 case 1: return LDKAccessError_UnknownTx;
91 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
93 case LDKAccessError_UnknownChain: return 0;
94 case LDKAccessError_UnknownTx: return 1;
98 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
100 case 0: return LDKCOption_NoneZ_Some;
101 case 1: return LDKCOption_NoneZ_None;
105 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
107 case LDKCOption_NoneZ_Some: return 0;
108 case LDKCOption_NoneZ_None: return 1;
112 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
114 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
115 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
119 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
121 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
122 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
126 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
128 case 0: return LDKConfirmationTarget_Background;
129 case 1: return LDKConfirmationTarget_Normal;
130 case 2: return LDKConfirmationTarget_HighPriority;
134 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
136 case LDKConfirmationTarget_Background: return 0;
137 case LDKConfirmationTarget_Normal: return 1;
138 case LDKConfirmationTarget_HighPriority: return 2;
142 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
144 case 0: return LDKLevel_Gossip;
145 case 1: return LDKLevel_Trace;
146 case 2: return LDKLevel_Debug;
147 case 3: return LDKLevel_Info;
148 case 4: return LDKLevel_Warn;
149 case 5: return LDKLevel_Error;
153 static inline int32_t LDKLevel_to_js(LDKLevel val) {
155 case LDKLevel_Gossip: return 0;
156 case LDKLevel_Trace: return 1;
157 case LDKLevel_Debug: return 2;
158 case LDKLevel_Info: return 3;
159 case LDKLevel_Warn: return 4;
160 case LDKLevel_Error: return 5;
164 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
166 case 0: return LDKNetwork_Bitcoin;
167 case 1: return LDKNetwork_Testnet;
168 case 2: return LDKNetwork_Regtest;
169 case 3: return LDKNetwork_Signet;
173 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
175 case LDKNetwork_Bitcoin: return 0;
176 case LDKNetwork_Testnet: return 1;
177 case LDKNetwork_Regtest: return 2;
178 case LDKNetwork_Signet: return 3;
182 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
184 case 0: return LDKSecp256k1Error_IncorrectSignature;
185 case 1: return LDKSecp256k1Error_InvalidMessage;
186 case 2: return LDKSecp256k1Error_InvalidPublicKey;
187 case 3: return LDKSecp256k1Error_InvalidSignature;
188 case 4: return LDKSecp256k1Error_InvalidSecretKey;
189 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
190 case 6: return LDKSecp256k1Error_InvalidTweak;
191 case 7: return LDKSecp256k1Error_TweakCheckFailed;
192 case 8: return LDKSecp256k1Error_NotEnoughMemory;
196 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
198 case LDKSecp256k1Error_IncorrectSignature: return 0;
199 case LDKSecp256k1Error_InvalidMessage: return 1;
200 case LDKSecp256k1Error_InvalidPublicKey: return 2;
201 case LDKSecp256k1Error_InvalidSignature: return 3;
202 case LDKSecp256k1Error_InvalidSecretKey: return 4;
203 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
204 case LDKSecp256k1Error_InvalidTweak: return 6;
205 case LDKSecp256k1Error_TweakCheckFailed: return 7;
206 case LDKSecp256k1Error_NotEnoughMemory: return 8;
210 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
211 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
212 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
215 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) {
216 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
217 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
218 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
219 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
220 CVec_u8Z_free(ret_var);
224 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) {
225 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
226 int64_t ret_val = TxOut_get_value(thing_conv);
230 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
231 CHECK(owner->result_ok);
232 return ChannelConfig_clone(&*owner->contents.result);
234 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t owner) {
235 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
236 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
237 uint64_t ret_ref = 0;
238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
241 ret_ref = (uint64_t)ret_var.inner;
242 if (ret_var.is_owned) {
248 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
249 CHECK(!owner->result_ok);
250 return DecodeError_clone(&*owner->contents.err);
252 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint32_t owner) {
253 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
254 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
255 uint64_t ret_ref = 0;
256 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
257 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
259 ret_ref = (uint64_t)ret_var.inner;
260 if (ret_var.is_owned) {
266 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
267 CHECK(owner->result_ok);
268 return OutPoint_clone(&*owner->contents.result);
270 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint32_t owner) {
271 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
272 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
273 uint64_t ret_ref = 0;
274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
277 ret_ref = (uint64_t)ret_var.inner;
278 if (ret_var.is_owned) {
284 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
285 CHECK(!owner->result_ok);
286 return DecodeError_clone(&*owner->contents.err);
288 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint32_t owner) {
289 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
290 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
291 uint64_t ret_ref = 0;
292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
295 ret_ref = (uint64_t)ret_var.inner;
296 if (ret_var.is_owned) {
302 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
303 CHECK(owner->result_ok);
304 return *owner->contents.result;
306 int8_tArray __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint32_t owner) {
307 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
308 int8_tArray ret_arr = init_int8_tArray(32);
309 memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
313 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
314 CHECK(!owner->result_ok);
315 return *owner->contents.err;
317 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint32_t owner) {
318 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
319 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
323 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
324 CHECK(owner->result_ok);
325 return *owner->contents.result;
327 int8_tArray __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint32_t owner) {
328 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
329 int8_tArray ret_arr = init_int8_tArray(33);
330 memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
334 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
335 CHECK(!owner->result_ok);
336 return *owner->contents.err;
338 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint32_t owner) {
339 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
340 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
344 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
345 CHECK(owner->result_ok);
346 return TxCreationKeys_clone(&*owner->contents.result);
348 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t owner) {
349 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
350 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
351 uint64_t ret_ref = 0;
352 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
353 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
354 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
355 ret_ref = (uint64_t)ret_var.inner;
356 if (ret_var.is_owned) {
362 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
363 CHECK(!owner->result_ok);
364 return DecodeError_clone(&*owner->contents.err);
366 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t owner) {
367 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
368 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
369 uint64_t ret_ref = 0;
370 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
371 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
373 ret_ref = (uint64_t)ret_var.inner;
374 if (ret_var.is_owned) {
380 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
381 CHECK(owner->result_ok);
382 return ChannelPublicKeys_clone(&*owner->contents.result);
384 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t owner) {
385 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
386 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
387 uint64_t ret_ref = 0;
388 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
389 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
390 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
391 ret_ref = (uint64_t)ret_var.inner;
392 if (ret_var.is_owned) {
398 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
399 CHECK(!owner->result_ok);
400 return DecodeError_clone(&*owner->contents.err);
402 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t owner) {
403 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
404 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
405 uint64_t ret_ref = 0;
406 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
407 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
408 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
409 ret_ref = (uint64_t)ret_var.inner;
410 if (ret_var.is_owned) {
416 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
417 CHECK(owner->result_ok);
418 return TxCreationKeys_clone(&*owner->contents.result);
420 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint32_t owner) {
421 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
422 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
423 uint64_t ret_ref = 0;
424 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
425 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
426 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
427 ret_ref = (uint64_t)ret_var.inner;
428 if (ret_var.is_owned) {
434 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
435 CHECK(!owner->result_ok);
436 return *owner->contents.err;
438 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint32_t owner) {
439 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
440 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
444 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint32_t ptr) {
445 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
447 case LDKCOption_u32Z_Some: return 0;
448 case LDKCOption_u32Z_None: return 1;
452 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint32_t ptr) {
453 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
454 assert(obj->tag == LDKCOption_u32Z_Some);
457 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
458 CHECK(owner->result_ok);
459 return HTLCOutputInCommitment_clone(&*owner->contents.result);
461 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t owner) {
462 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
463 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
464 uint64_t ret_ref = 0;
465 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
466 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
467 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
468 ret_ref = (uint64_t)ret_var.inner;
469 if (ret_var.is_owned) {
475 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
476 CHECK(!owner->result_ok);
477 return DecodeError_clone(&*owner->contents.err);
479 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t owner) {
480 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
481 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
482 uint64_t ret_ref = 0;
483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
486 ret_ref = (uint64_t)ret_var.inner;
487 if (ret_var.is_owned) {
493 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
494 CHECK(owner->result_ok);
495 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
497 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
498 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
499 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
500 uint64_t ret_ref = 0;
501 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
502 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
503 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
504 ret_ref = (uint64_t)ret_var.inner;
505 if (ret_var.is_owned) {
511 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
512 CHECK(!owner->result_ok);
513 return DecodeError_clone(&*owner->contents.err);
515 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
516 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
517 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
518 uint64_t ret_ref = 0;
519 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
520 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
521 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
522 ret_ref = (uint64_t)ret_var.inner;
523 if (ret_var.is_owned) {
529 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
530 CHECK(owner->result_ok);
531 return ChannelTransactionParameters_clone(&*owner->contents.result);
533 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
534 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
535 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
536 uint64_t ret_ref = 0;
537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
540 ret_ref = (uint64_t)ret_var.inner;
541 if (ret_var.is_owned) {
547 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
548 CHECK(!owner->result_ok);
549 return DecodeError_clone(&*owner->contents.err);
551 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
552 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
553 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
554 uint64_t ret_ref = 0;
555 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
556 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
557 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
558 ret_ref = (uint64_t)ret_var.inner;
559 if (ret_var.is_owned) {
565 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
566 CHECK(owner->result_ok);
567 return HolderCommitmentTransaction_clone(&*owner->contents.result);
569 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
570 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
571 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
572 uint64_t ret_ref = 0;
573 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
574 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
575 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
576 ret_ref = (uint64_t)ret_var.inner;
577 if (ret_var.is_owned) {
583 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
584 CHECK(!owner->result_ok);
585 return DecodeError_clone(&*owner->contents.err);
587 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
588 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
589 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
590 uint64_t ret_ref = 0;
591 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
592 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
594 ret_ref = (uint64_t)ret_var.inner;
595 if (ret_var.is_owned) {
601 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
602 CHECK(owner->result_ok);
603 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
605 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
606 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
607 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
608 uint64_t ret_ref = 0;
609 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
610 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
612 ret_ref = (uint64_t)ret_var.inner;
613 if (ret_var.is_owned) {
619 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
620 CHECK(!owner->result_ok);
621 return DecodeError_clone(&*owner->contents.err);
623 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
624 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
625 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
626 uint64_t ret_ref = 0;
627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
630 ret_ref = (uint64_t)ret_var.inner;
631 if (ret_var.is_owned) {
637 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
638 CHECK(owner->result_ok);
639 return &*owner->contents.result;
641 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t owner) {
642 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
643 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
644 uint64_t ret_ref = 0;
645 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
646 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
648 ret_ref = (uint64_t)ret_var.inner & ~1;
652 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
653 CHECK(!owner->result_ok);
654 return *owner->contents.err;
656 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint32_t owner) {
657 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
658 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
661 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
662 CHECK(owner->result_ok);
663 return CommitmentTransaction_clone(&*owner->contents.result);
665 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
666 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
667 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
668 uint64_t ret_ref = 0;
669 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
670 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
671 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
672 ret_ref = (uint64_t)ret_var.inner;
673 if (ret_var.is_owned) {
679 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
680 CHECK(!owner->result_ok);
681 return DecodeError_clone(&*owner->contents.err);
683 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
684 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
685 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
686 uint64_t ret_ref = 0;
687 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
688 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
689 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
690 ret_ref = (uint64_t)ret_var.inner;
691 if (ret_var.is_owned) {
697 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
698 CHECK(owner->result_ok);
699 return &*owner->contents.result;
701 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t owner) {
702 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
703 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
704 uint64_t ret_ref = 0;
705 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
706 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
708 ret_ref = (uint64_t)ret_var.inner & ~1;
712 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
713 CHECK(!owner->result_ok);
714 return *owner->contents.err;
716 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t owner) {
717 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
718 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
721 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
722 CHECK(owner->result_ok);
723 return *owner->contents.result;
725 ptrArray __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint32_t owner) {
726 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
727 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
728 ptrArray ret_arr = NULL;
729 ret_arr = init_ptrArray(ret_var.datalen);
730 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
731 for (size_t m = 0; m < ret_var.datalen; m++) {
732 int8_tArray ret_conv_12_arr = init_int8_tArray(64);
733 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
734 ret_arr_ptr[m] = ret_conv_12_arr;
740 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
741 CHECK(!owner->result_ok);
742 return *owner->contents.err;
744 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint32_t owner) {
745 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
746 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
749 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
750 CHECK(owner->result_ok);
751 return ShutdownScript_clone(&*owner->contents.result);
753 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t owner) {
754 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
755 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
756 uint64_t ret_ref = 0;
757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
760 ret_ref = (uint64_t)ret_var.inner;
761 if (ret_var.is_owned) {
767 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
768 CHECK(!owner->result_ok);
769 return DecodeError_clone(&*owner->contents.err);
771 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t owner) {
772 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
773 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
774 uint64_t ret_ref = 0;
775 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
776 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
778 ret_ref = (uint64_t)ret_var.inner;
779 if (ret_var.is_owned) {
785 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
786 CHECK(owner->result_ok);
787 return ShutdownScript_clone(&*owner->contents.result);
789 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t owner) {
790 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
791 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
792 uint64_t ret_ref = 0;
793 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
794 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
796 ret_ref = (uint64_t)ret_var.inner;
797 if (ret_var.is_owned) {
803 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
804 CHECK(!owner->result_ok);
805 return InvalidShutdownScript_clone(&*owner->contents.err);
807 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t owner) {
808 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
809 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
810 uint64_t ret_ref = 0;
811 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
812 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
814 ret_ref = (uint64_t)ret_var.inner;
815 if (ret_var.is_owned) {
821 typedef struct LDKType_JCalls {
822 atomic_size_t refcnt;
823 uint32_t instance_ptr;
825 static void LDKType_JCalls_free(void* this_arg) {
826 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
827 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
831 uint16_t type_id_LDKType_jcall(const void* this_arg) {
832 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
833 return js_invoke_function_0(j_calls->instance_ptr, 0);
835 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
836 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
837 jstring ret = (jstring)js_invoke_function_0(j_calls->instance_ptr, 1);
838 LDKStr ret_conv = str_ref_to_owned_c(ret);
841 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
842 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
843 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 2);
845 ret_ref.datalen = ret->arr_len;
846 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
847 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
850 static void LDKType_JCalls_cloned(LDKType* new_obj) {
851 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
852 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
854 static inline LDKType LDKType_init (JSValue o) {
855 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
856 atomic_init(&calls->refcnt, 1);
857 calls->instance_ptr = o;
860 .this_arg = (void*) calls,
861 .type_id = type_id_LDKType_jcall,
862 .debug_str = debug_str_LDKType_jcall,
863 .write = write_LDKType_jcall,
864 .cloned = LDKType_JCalls_cloned,
865 .free = LDKType_JCalls_free,
869 long __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
870 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
871 *res_ptr = LDKType_init(o);
872 return (long)res_ptr;
874 int16_t __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint32_t this_arg) {
875 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
876 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
877 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
878 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
882 jstring __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint32_t this_arg) {
883 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
884 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
885 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
886 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
887 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
892 int8_tArray __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint32_t this_arg) {
893 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
894 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
895 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
896 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
897 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
898 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
899 CVec_u8Z_free(ret_var);
903 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint32_t ptr) {
904 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
906 case LDKCOption_TypeZ_Some: return 0;
907 case LDKCOption_TypeZ_None: return 1;
911 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint32_t ptr) {
912 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
913 assert(obj->tag == LDKCOption_TypeZ_Some);
914 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
915 *some_ret = Type_clone(&obj->some);
916 return (uint64_t)some_ret;
918 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
919 CHECK(owner->result_ok);
920 return COption_TypeZ_clone(&*owner->contents.result);
922 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t owner) {
923 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
924 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
925 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
926 uint64_t ret_ref = (uint64_t)ret_copy;
930 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
931 CHECK(!owner->result_ok);
932 return DecodeError_clone(&*owner->contents.err);
934 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint32_t owner) {
935 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
936 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
937 uint64_t ret_ref = 0;
938 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
939 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
941 ret_ref = (uint64_t)ret_var.inner;
942 if (ret_var.is_owned) {
948 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
949 CHECK(owner->result_ok);
950 return *owner->contents.result;
952 jstring __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint32_t owner) {
953 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
954 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
955 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
959 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
960 CHECK(!owner->result_ok);
961 return *owner->contents.err;
963 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint32_t owner) {
964 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
965 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
969 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
970 CHECK(owner->result_ok);
971 return ChannelMonitorUpdate_clone(&*owner->contents.result);
973 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t owner) {
974 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
975 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
976 uint64_t ret_ref = 0;
977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
980 ret_ref = (uint64_t)ret_var.inner;
981 if (ret_var.is_owned) {
987 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
988 CHECK(!owner->result_ok);
989 return DecodeError_clone(&*owner->contents.err);
991 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t owner) {
992 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
993 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
994 uint64_t ret_ref = 0;
995 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
996 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
998 ret_ref = (uint64_t)ret_var.inner;
999 if (ret_var.is_owned) {
1005 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint32_t ptr) {
1006 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1008 case LDKMonitorEvent_HTLCEvent: return 0;
1009 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
1010 case LDKMonitorEvent_UpdateCompleted: return 2;
1011 case LDKMonitorEvent_UpdateFailed: return 3;
1015 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint32_t ptr) {
1016 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1017 assert(obj->tag == LDKMonitorEvent_HTLCEvent);
1018 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1019 uint64_t htlc_event_ref = 0;
1020 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1021 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1022 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
1023 htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1024 return htlc_event_ref;
1026 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint32_t ptr) {
1027 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1028 assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
1029 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1030 uint64_t commitment_tx_confirmed_ref = 0;
1031 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1032 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1033 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
1034 commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
1035 return commitment_tx_confirmed_ref;
1037 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo"))) TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo(uint32_t ptr) {
1038 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1039 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
1040 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
1041 uint64_t funding_txo_ref = 0;
1042 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1043 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1044 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
1045 funding_txo_ref = (uint64_t)funding_txo_var.inner & ~1;
1046 return funding_txo_ref;
1048 int64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id"))) TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id(uint32_t ptr) {
1049 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1050 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
1051 return obj->update_completed.monitor_update_id;
1053 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint32_t ptr) {
1054 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1055 assert(obj->tag == LDKMonitorEvent_UpdateFailed);
1056 LDKOutPoint update_failed_var = obj->update_failed;
1057 uint64_t update_failed_ref = 0;
1058 CHECK((((uint64_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1059 CHECK((((uint64_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1060 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
1061 update_failed_ref = (uint64_t)update_failed_var.inner & ~1;
1062 return update_failed_ref;
1064 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint32_t ptr) {
1065 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
1067 case LDKCOption_MonitorEventZ_Some: return 0;
1068 case LDKCOption_MonitorEventZ_None: return 1;
1072 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint32_t ptr) {
1073 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
1074 assert(obj->tag == LDKCOption_MonitorEventZ_Some);
1075 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1078 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
1079 CHECK(owner->result_ok);
1080 return COption_MonitorEventZ_clone(&*owner->contents.result);
1082 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t owner) {
1083 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
1084 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
1085 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
1086 uint64_t ret_ref = (uint64_t)ret_copy;
1090 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
1091 CHECK(!owner->result_ok);
1092 return DecodeError_clone(&*owner->contents.err);
1094 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t owner) {
1095 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
1096 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
1097 uint64_t ret_ref = 0;
1098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1101 ret_ref = (uint64_t)ret_var.inner;
1102 if (ret_var.is_owned) {
1108 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
1109 CHECK(owner->result_ok);
1110 return HTLCUpdate_clone(&*owner->contents.result);
1112 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t owner) {
1113 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
1114 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
1115 uint64_t ret_ref = 0;
1116 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1117 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1119 ret_ref = (uint64_t)ret_var.inner;
1120 if (ret_var.is_owned) {
1126 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
1127 CHECK(!owner->result_ok);
1128 return DecodeError_clone(&*owner->contents.err);
1130 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t owner) {
1131 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
1132 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
1133 uint64_t ret_ref = 0;
1134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1137 ret_ref = (uint64_t)ret_var.inner;
1138 if (ret_var.is_owned) {
1144 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1145 CHECK(owner->result_ok);
1146 return *owner->contents.result;
1148 void __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint32_t owner) {
1149 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
1150 CResult_NoneNoneZ_get_ok(owner_conv);
1153 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1154 CHECK(!owner->result_ok);
1155 return *owner->contents.err;
1157 void __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint32_t owner) {
1158 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
1159 CResult_NoneNoneZ_get_err(owner_conv);
1162 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
1163 return OutPoint_clone(&owner->a);
1165 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t owner) {
1166 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
1167 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
1168 uint64_t ret_ref = 0;
1169 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1170 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1171 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1172 ret_ref = (uint64_t)ret_var.inner;
1173 if (ret_var.is_owned) {
1179 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
1180 return CVec_u8Z_clone(&owner->b);
1182 int8_tArray __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t owner) {
1183 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
1184 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
1185 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
1186 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1187 CVec_u8Z_free(ret_var);
1191 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
1194 int32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t owner) {
1195 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
1196 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(owner_conv);
1200 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
1201 return CVec_u8Z_clone(&owner->b);
1203 int8_tArray __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t owner) {
1204 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
1205 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
1206 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
1207 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1208 CVec_u8Z_free(ret_var);
1212 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
1213 return ThirtyTwoBytes_clone(&owner->a);
1215 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t owner) {
1216 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
1217 int8_tArray ret_arr = init_int8_tArray(32);
1218 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
1222 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
1225 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t owner) {
1226 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
1227 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
1228 uint32_tArray ret_arr = NULL;
1229 ret_arr = init_uint32_tArray(ret_var.datalen);
1230 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
1231 for (size_t v = 0; v < ret_var.datalen; v++) {
1232 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = &ret_var.data[v];
1233 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_u32ScriptZ
1234 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv) | 1;
1240 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1241 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1242 for (size_t i = 0; i < ret.datalen; i++) {
1243 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1247 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint32_t ptr) {
1248 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1250 case LDKPaymentPurpose_InvoicePayment: return 0;
1251 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1255 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint32_t ptr) {
1256 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1257 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1258 int8_tArray payment_preimage_arr = init_int8_tArray(32);
1259 memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1260 return payment_preimage_arr;
1262 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint32_t ptr) {
1263 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1264 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1265 int8_tArray payment_secret_arr = init_int8_tArray(32);
1266 memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1267 return payment_secret_arr;
1269 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint32_t ptr) {
1270 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1271 assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1272 int8_tArray spontaneous_payment_arr = init_int8_tArray(32);
1273 memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1274 return spontaneous_payment_arr;
1276 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint32_t ptr) {
1277 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1279 case LDKCOption_u64Z_Some: return 0;
1280 case LDKCOption_u64Z_None: return 1;
1284 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint32_t ptr) {
1285 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1286 assert(obj->tag == LDKCOption_u64Z_Some);
1289 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint32_t ptr) {
1290 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1292 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1293 case LDKNetworkUpdate_ChannelClosed: return 1;
1294 case LDKNetworkUpdate_NodeFailure: return 2;
1298 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint32_t ptr) {
1299 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1300 assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1301 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1302 uint64_t msg_ref = 0;
1303 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1304 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1305 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1306 msg_ref = (uint64_t)msg_var.inner & ~1;
1309 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelClosed_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelClosed_get_short_channel_id(uint32_t ptr) {
1310 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1311 assert(obj->tag == LDKNetworkUpdate_ChannelClosed);
1312 return obj->channel_closed.short_channel_id;
1314 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelClosed_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelClosed_get_is_permanent(uint32_t ptr) {
1315 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1316 assert(obj->tag == LDKNetworkUpdate_ChannelClosed);
1317 return obj->channel_closed.is_permanent;
1319 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint32_t ptr) {
1320 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1321 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1322 int8_tArray node_id_arr = init_int8_tArray(33);
1323 memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1326 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint32_t ptr) {
1327 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1328 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1329 return obj->node_failure.is_permanent;
1331 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint32_t ptr) {
1332 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1334 case LDKCOption_NetworkUpdateZ_Some: return 0;
1335 case LDKCOption_NetworkUpdateZ_None: return 1;
1339 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint32_t ptr) {
1340 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1341 assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1342 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1345 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1346 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1347 for (size_t i = 0; i < ret.datalen; i++) {
1348 ret.data[i] = RouteHop_clone(&orig->data[i]);
1352 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint32_t ptr) {
1353 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1355 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1356 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1357 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1361 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint32_t ptr) {
1362 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1363 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1364 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1365 uint64_t outpoint_ref = 0;
1366 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1367 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1368 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1369 outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1370 return outpoint_ref;
1372 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint32_t ptr) {
1373 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1374 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1375 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1376 return (uint64_t)output_ref;
1378 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint32_t ptr) {
1379 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1380 assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1381 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1382 uint64_t delayed_payment_output_ref = 0;
1383 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1384 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1385 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1386 delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1387 return delayed_payment_output_ref;
1389 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint32_t ptr) {
1390 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1391 assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1392 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1393 uint64_t static_payment_output_ref = 0;
1394 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1395 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1396 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1397 static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1398 return static_payment_output_ref;
1400 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1401 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1402 for (size_t i = 0; i < ret.datalen; i++) {
1403 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1407 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint32_t ptr) {
1408 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1410 case LDKClosureReason_CounterpartyForceClosed: return 0;
1411 case LDKClosureReason_HolderForceClosed: return 1;
1412 case LDKClosureReason_CooperativeClosure: return 2;
1413 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1414 case LDKClosureReason_FundingTimedOut: return 4;
1415 case LDKClosureReason_ProcessingError: return 5;
1416 case LDKClosureReason_DisconnectedPeer: return 6;
1417 case LDKClosureReason_OutdatedChannelManager: return 7;
1421 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint32_t ptr) {
1422 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1423 assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1424 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1425 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1426 return peer_msg_conv;
1428 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint32_t ptr) {
1429 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1430 assert(obj->tag == LDKClosureReason_ProcessingError);
1431 LDKStr err_str = obj->processing_error.err;
1432 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1435 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint32_t ptr) {
1436 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1438 case LDKEvent_FundingGenerationReady: return 0;
1439 case LDKEvent_PaymentReceived: return 1;
1440 case LDKEvent_PaymentSent: return 2;
1441 case LDKEvent_PaymentPathFailed: return 3;
1442 case LDKEvent_PaymentFailed: return 4;
1443 case LDKEvent_PendingHTLCsForwardable: return 5;
1444 case LDKEvent_SpendableOutputs: return 6;
1445 case LDKEvent_PaymentForwarded: return 7;
1446 case LDKEvent_ChannelClosed: return 8;
1447 case LDKEvent_DiscardFunding: return 9;
1448 case LDKEvent_PaymentPathSuccessful: return 10;
1452 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint32_t ptr) {
1453 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1454 assert(obj->tag == LDKEvent_FundingGenerationReady);
1455 int8_tArray temporary_channel_id_arr = init_int8_tArray(32);
1456 memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1457 return temporary_channel_id_arr;
1459 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint32_t ptr) {
1460 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1461 assert(obj->tag == LDKEvent_FundingGenerationReady);
1462 return obj->funding_generation_ready.channel_value_satoshis;
1464 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint32_t ptr) {
1465 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1466 assert(obj->tag == LDKEvent_FundingGenerationReady);
1467 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1468 int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen);
1469 memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1470 return output_script_arr;
1472 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint32_t ptr) {
1473 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1474 assert(obj->tag == LDKEvent_FundingGenerationReady);
1475 return obj->funding_generation_ready.user_channel_id;
1477 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint32_t ptr) {
1478 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1479 assert(obj->tag == LDKEvent_PaymentReceived);
1480 int8_tArray payment_hash_arr = init_int8_tArray(32);
1481 memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1482 return payment_hash_arr;
1484 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amt"))) TS_LDKEvent_PaymentReceived_get_amt(uint32_t ptr) {
1485 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1486 assert(obj->tag == LDKEvent_PaymentReceived);
1487 return obj->payment_received.amt;
1489 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint32_t ptr) {
1490 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1491 assert(obj->tag == LDKEvent_PaymentReceived);
1492 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
1495 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint32_t ptr) {
1496 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1497 assert(obj->tag == LDKEvent_PaymentSent);
1498 int8_tArray payment_id_arr = init_int8_tArray(32);
1499 memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1500 return payment_id_arr;
1502 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint32_t ptr) {
1503 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1504 assert(obj->tag == LDKEvent_PaymentSent);
1505 int8_tArray payment_preimage_arr = init_int8_tArray(32);
1506 memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1507 return payment_preimage_arr;
1509 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint32_t ptr) {
1510 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1511 assert(obj->tag == LDKEvent_PaymentSent);
1512 int8_tArray payment_hash_arr = init_int8_tArray(32);
1513 memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1514 return payment_hash_arr;
1516 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint32_t ptr) {
1517 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1518 assert(obj->tag == LDKEvent_PaymentSent);
1519 uint64_t fee_paid_msat_ref = ((uint64_t)&obj->payment_sent.fee_paid_msat) | 1;
1520 return fee_paid_msat_ref;
1522 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint32_t ptr) {
1523 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1524 assert(obj->tag == LDKEvent_PaymentPathFailed);
1525 int8_tArray payment_id_arr = init_int8_tArray(32);
1526 memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1527 return payment_id_arr;
1529 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint32_t ptr) {
1530 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1531 assert(obj->tag == LDKEvent_PaymentPathFailed);
1532 int8_tArray payment_hash_arr = init_int8_tArray(32);
1533 memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1534 return payment_hash_arr;
1536 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest"))) TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest(uint32_t ptr) {
1537 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1538 assert(obj->tag == LDKEvent_PaymentPathFailed);
1539 return obj->payment_path_failed.rejected_by_dest;
1541 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint32_t ptr) {
1542 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1543 assert(obj->tag == LDKEvent_PaymentPathFailed);
1544 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
1545 return network_update_ref;
1547 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint32_t ptr) {
1548 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1549 assert(obj->tag == LDKEvent_PaymentPathFailed);
1550 return obj->payment_path_failed.all_paths_failed;
1552 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint32_t ptr) {
1553 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1554 assert(obj->tag == LDKEvent_PaymentPathFailed);
1555 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1556 uint32_tArray path_arr = NULL;
1557 path_arr = init_uint32_tArray(path_var.datalen);
1558 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1559 for (size_t k = 0; k < path_var.datalen; k++) {
1560 LDKRouteHop path_conv_10_var = path_var.data[k];
1561 uint64_t path_conv_10_ref = 0;
1562 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1563 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1564 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1565 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
1566 path_arr_ptr[k] = path_conv_10_ref;
1571 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint32_t ptr) {
1572 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1573 assert(obj->tag == LDKEvent_PaymentPathFailed);
1574 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
1575 return short_channel_id_ref;
1577 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint32_t ptr) {
1578 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1579 assert(obj->tag == LDKEvent_PaymentPathFailed);
1580 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1581 uint64_t retry_ref = 0;
1582 if ((uint64_t)retry_var.inner > 4096) {
1583 CHECK((((uint64_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1584 CHECK((((uint64_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1585 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1586 retry_ref = (uint64_t)retry_var.inner & ~1;
1590 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint32_t ptr) {
1591 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1592 assert(obj->tag == LDKEvent_PaymentFailed);
1593 int8_tArray payment_id_arr = init_int8_tArray(32);
1594 memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1595 return payment_id_arr;
1597 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint32_t ptr) {
1598 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1599 assert(obj->tag == LDKEvent_PaymentFailed);
1600 int8_tArray payment_hash_arr = init_int8_tArray(32);
1601 memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1602 return payment_hash_arr;
1604 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint32_t ptr) {
1605 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1606 assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1607 return obj->pending_htl_cs_forwardable.time_forwardable;
1609 uint32_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint32_t ptr) {
1610 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1611 assert(obj->tag == LDKEvent_SpendableOutputs);
1612 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1613 uint32_tArray outputs_arr = NULL;
1614 outputs_arr = init_uint32_tArray(outputs_var.datalen);
1615 uint32_t *outputs_arr_ptr = (uint32_t*)(((uint8_t*)outputs_arr) + 4);
1616 for (size_t b = 0; b < outputs_var.datalen; b++) {
1617 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
1618 outputs_arr_ptr[b] = outputs_conv_27_ref;
1623 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint32_t ptr) {
1624 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1625 assert(obj->tag == LDKEvent_PaymentForwarded);
1626 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
1627 return fee_earned_msat_ref;
1629 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint32_t ptr) {
1630 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1631 assert(obj->tag == LDKEvent_PaymentForwarded);
1632 return obj->payment_forwarded.claim_from_onchain_tx;
1634 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint32_t ptr) {
1635 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1636 assert(obj->tag == LDKEvent_ChannelClosed);
1637 int8_tArray channel_id_arr = init_int8_tArray(32);
1638 memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1639 return channel_id_arr;
1641 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint32_t ptr) {
1642 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1643 assert(obj->tag == LDKEvent_ChannelClosed);
1644 return obj->channel_closed.user_channel_id;
1646 uint32_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint32_t ptr) {
1647 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1648 assert(obj->tag == LDKEvent_ChannelClosed);
1649 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
1652 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint32_t ptr) {
1653 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1654 assert(obj->tag == LDKEvent_DiscardFunding);
1655 int8_tArray channel_id_arr = init_int8_tArray(32);
1656 memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1657 return channel_id_arr;
1659 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint32_t ptr) {
1660 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1661 assert(obj->tag == LDKEvent_DiscardFunding);
1662 LDKTransaction transaction_var = obj->discard_funding.transaction;
1663 int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen);
1664 memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1665 return transaction_arr;
1667 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint32_t ptr) {
1668 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1669 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1670 int8_tArray payment_id_arr = init_int8_tArray(32);
1671 memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1672 return payment_id_arr;
1674 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint32_t ptr) {
1675 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1676 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1677 int8_tArray payment_hash_arr = init_int8_tArray(32);
1678 memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1679 return payment_hash_arr;
1681 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint32_t ptr) {
1682 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1683 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1684 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1685 uint32_tArray path_arr = NULL;
1686 path_arr = init_uint32_tArray(path_var.datalen);
1687 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1688 for (size_t k = 0; k < path_var.datalen; k++) {
1689 LDKRouteHop path_conv_10_var = path_var.data[k];
1690 uint64_t path_conv_10_ref = 0;
1691 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1692 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1693 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1694 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
1695 path_arr_ptr[k] = path_conv_10_ref;
1700 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1701 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1702 for (size_t i = 0; i < ret.datalen; i++) {
1703 ret.data[i] = Event_clone(&orig->data[i]);
1707 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1710 int64_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t owner) {
1711 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1712 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(owner_conv);
1716 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1719 int8_tArray __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t owner) {
1720 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1721 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
1722 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
1723 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1727 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1728 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1729 for (size_t i = 0; i < ret.datalen; i++) {
1730 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1734 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
1737 int32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t owner) {
1738 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
1739 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(owner_conv);
1743 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
1744 return TxOut_clone(&owner->b);
1746 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t owner) {
1747 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
1748 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
1749 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
1750 return (uint64_t)ret_ref;
1753 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1754 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1755 for (size_t i = 0; i < ret.datalen; i++) {
1756 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
1760 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
1761 return ThirtyTwoBytes_clone(&owner->a);
1763 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t owner) {
1764 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
1765 int8_tArray ret_arr = init_int8_tArray(32);
1766 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
1770 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
1771 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
1773 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t owner) {
1774 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
1775 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
1776 uint32_tArray ret_arr = NULL;
1777 ret_arr = init_uint32_tArray(ret_var.datalen);
1778 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
1779 for (size_t u = 0; u < ret_var.datalen; u++) {
1780 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1781 *ret_conv_20_conv = ret_var.data[u];
1782 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
1789 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
1790 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 };
1791 for (size_t i = 0; i < ret.datalen; i++) {
1792 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
1796 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1797 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1798 for (size_t i = 0; i < ret.datalen; i++) {
1799 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1803 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint32_t ptr) {
1804 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1806 case LDKBalance_ClaimableOnChannelClose: return 0;
1807 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
1808 case LDKBalance_ContentiousClaimable: return 2;
1809 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: return 3;
1813 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint32_t ptr) {
1814 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1815 assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
1816 return obj->claimable_on_channel_close.claimable_amount_satoshis;
1818 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint32_t ptr) {
1819 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1820 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
1821 return obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
1823 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint32_t ptr) {
1824 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1825 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
1826 return obj->claimable_awaiting_confirmations.confirmation_height;
1828 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint32_t ptr) {
1829 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1830 assert(obj->tag == LDKBalance_ContentiousClaimable);
1831 return obj->contentious_claimable.claimable_amount_satoshis;
1833 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint32_t ptr) {
1834 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1835 assert(obj->tag == LDKBalance_ContentiousClaimable);
1836 return obj->contentious_claimable.timeout_height;
1838 int64_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis(uint32_t ptr) {
1839 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1840 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
1841 return obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
1843 int32_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height(uint32_t ptr) {
1844 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1845 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
1846 return obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
1848 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
1849 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
1850 for (size_t i = 0; i < ret.datalen; i++) {
1851 ret.data[i] = Balance_clone(&orig->data[i]);
1855 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
1858 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t owner) {
1859 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
1860 int8_tArray ret_arr = init_int8_tArray(64);
1861 memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
1865 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
1868 ptrArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t owner) {
1869 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
1870 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
1871 ptrArray ret_arr = NULL;
1872 ret_arr = init_ptrArray(ret_var.datalen);
1873 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
1874 for (size_t m = 0; m < ret_var.datalen; m++) {
1875 int8_tArray ret_conv_12_arr = init_int8_tArray(64);
1876 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1877 ret_arr_ptr[m] = ret_conv_12_arr;
1883 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
1884 CHECK(owner->result_ok);
1885 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
1887 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t owner) {
1888 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
1889 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1890 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
1891 return ((uint64_t)ret_conv);
1894 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
1895 CHECK(!owner->result_ok);
1896 return *owner->contents.err;
1898 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t owner) {
1899 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
1900 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
1903 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
1904 CHECK(owner->result_ok);
1905 return *owner->contents.result;
1907 int8_tArray __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint32_t owner) {
1908 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
1909 int8_tArray ret_arr = init_int8_tArray(64);
1910 memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1914 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
1915 CHECK(!owner->result_ok);
1916 return *owner->contents.err;
1918 void __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint32_t owner) {
1919 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
1920 CResult_SignatureNoneZ_get_err(owner_conv);
1923 typedef struct LDKBaseSign_JCalls {
1924 atomic_size_t refcnt;
1925 uint32_t instance_ptr;
1926 } LDKBaseSign_JCalls;
1927 static void LDKBaseSign_JCalls_free(void* this_arg) {
1928 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1929 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1933 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1934 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1935 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->instance_ptr, 3, (uint32_t)idx);
1936 LDKPublicKey ret_ref;
1937 CHECK(ret->arr_len == 33);
1938 memcpy(ret_ref.compressed_form, ret->elems, 33);
1941 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1942 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1943 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->instance_ptr, 4, (uint32_t)idx);
1944 LDKThirtyTwoBytes ret_ref;
1945 CHECK(ret->arr_len == 32);
1946 memcpy(ret_ref.data, ret->elems, 32);
1949 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1950 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1951 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1952 uint64_t holder_tx_ref = 0;
1953 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1954 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1955 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1956 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1957 holder_tx_ref = (uint64_t)holder_tx_var.inner;
1958 if (holder_tx_var.is_owned) {
1961 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 5, (uint32_t)holder_tx_ref);
1962 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1963 CHECK_ACCESS(ret_ptr);
1964 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1968 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1969 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1970 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 6);
1971 LDKThirtyTwoBytes ret_ref;
1972 CHECK(ret->arr_len == 32);
1973 memcpy(ret_ref.data, ret->elems, 32);
1976 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1977 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1978 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1979 uint64_t commitment_tx_ref = 0;
1980 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1981 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1982 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1983 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1984 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1985 if (commitment_tx_var.is_owned) {
1986 commitment_tx_ref |= 1;
1988 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 7, (uint32_t)commitment_tx_ref);
1989 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1990 CHECK_ACCESS(ret_ptr);
1991 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1995 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1996 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1997 int8_tArray secret_arr = init_int8_tArray(32);
1998 memcpy(secret_arr->elems, *secret, 32);
1999 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 8, (uint32_t)idx, (uint32_t)secret_arr);
2000 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2001 CHECK_ACCESS(ret_ptr);
2002 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2006 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2007 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2008 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2009 uint64_t commitment_tx_ref = 0;
2010 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2011 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2012 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2013 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2014 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2015 if (commitment_tx_var.is_owned) {
2016 commitment_tx_ref |= 1;
2018 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 9, (uint32_t)commitment_tx_ref);
2019 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2020 CHECK_ACCESS(ret_ptr);
2021 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2025 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]) {
2026 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2027 LDKTransaction justice_tx_var = justice_tx;
2028 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen);
2029 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2030 Transaction_free(justice_tx_var);
2031 int8_tArray per_commitment_key_arr = init_int8_tArray(32);
2032 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2033 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);
2034 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2035 CHECK_ACCESS(ret_ptr);
2036 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2040 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) {
2041 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2042 LDKTransaction justice_tx_var = justice_tx;
2043 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen);
2044 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2045 Transaction_free(justice_tx_var);
2046 int8_tArray per_commitment_key_arr = init_int8_tArray(32);
2047 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2048 LDKHTLCOutputInCommitment htlc_var = *htlc;
2049 uint64_t htlc_ref = 0;
2050 htlc_var = HTLCOutputInCommitment_clone(htlc);
2051 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2052 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2053 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2054 htlc_ref = (uint64_t)htlc_var.inner;
2055 if (htlc_var.is_owned) {
2058 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);
2059 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2060 CHECK_ACCESS(ret_ptr);
2061 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2065 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) {
2066 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2067 LDKTransaction htlc_tx_var = htlc_tx;
2068 int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen);
2069 memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2070 Transaction_free(htlc_tx_var);
2071 int8_tArray per_commitment_point_arr = init_int8_tArray(33);
2072 memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
2073 LDKHTLCOutputInCommitment htlc_var = *htlc;
2074 uint64_t htlc_ref = 0;
2075 htlc_var = HTLCOutputInCommitment_clone(htlc);
2076 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2077 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2078 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2079 htlc_ref = (uint64_t)htlc_var.inner;
2080 if (htlc_var.is_owned) {
2083 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);
2084 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2085 CHECK_ACCESS(ret_ptr);
2086 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2090 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2091 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2092 LDKClosingTransaction closing_tx_var = *closing_tx;
2093 uint64_t closing_tx_ref = 0;
2094 closing_tx_var = ClosingTransaction_clone(closing_tx);
2095 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2096 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2097 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2098 closing_tx_ref = (uint64_t)closing_tx_var.inner;
2099 if (closing_tx_var.is_owned) {
2100 closing_tx_ref |= 1;
2102 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 13, (uint32_t)closing_tx_ref);
2103 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2104 CHECK_ACCESS(ret_ptr);
2105 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2109 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2110 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2111 LDKUnsignedChannelAnnouncement msg_var = *msg;
2112 uint64_t msg_ref = 0;
2113 msg_var = UnsignedChannelAnnouncement_clone(msg);
2114 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2115 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2116 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2117 msg_ref = (uint64_t)msg_var.inner;
2118 if (msg_var.is_owned) {
2121 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 14, (uint32_t)msg_ref);
2122 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2123 CHECK_ACCESS(ret_ptr);
2124 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2128 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2129 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2130 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2131 uint64_t channel_parameters_ref = 0;
2132 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2133 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2134 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2135 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2136 channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2137 if (channel_parameters_var.is_owned) {
2138 channel_parameters_ref |= 1;
2140 js_invoke_function_1(j_calls->instance_ptr, 15, (uint32_t)channel_parameters_ref);
2142 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
2143 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
2144 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2146 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint32_t pubkeys) {
2147 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2148 atomic_init(&calls->refcnt, 1);
2149 calls->instance_ptr = o;
2151 LDKChannelPublicKeys pubkeys_conv;
2152 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2153 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2154 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2157 .this_arg = (void*) calls,
2158 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2159 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2160 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
2161 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2162 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2163 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
2164 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2165 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2166 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2167 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2168 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2169 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2170 .ready_channel = ready_channel_LDKBaseSign_jcall,
2171 .free = LDKBaseSign_JCalls_free,
2172 .pubkeys = pubkeys_conv,
2173 .set_pubkeys = NULL,
2177 long __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint32_t pubkeys) {
2178 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2179 *res_ptr = LDKBaseSign_init(o, pubkeys);
2180 return (long)res_ptr;
2182 int8_tArray __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
2183 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2184 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2185 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2186 int8_tArray ret_arr = init_int8_tArray(33);
2187 memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
2191 int8_tArray __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
2192 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2193 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2194 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2195 int8_tArray ret_arr = init_int8_tArray(32);
2196 memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
2200 uint32_t __attribute__((export_name("TS_BaseSign_validate_holder_commitment"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
2201 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2202 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2203 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2204 LDKHolderCommitmentTransaction holder_tx_conv;
2205 holder_tx_conv.inner = (void*)(holder_tx & (~1));
2206 holder_tx_conv.is_owned = false;
2207 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2208 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2209 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
2210 return (uint64_t)ret_conv;
2213 int8_tArray __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
2214 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2215 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2216 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2217 int8_tArray ret_arr = init_int8_tArray(32);
2218 memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
2222 uint32_t __attribute__((export_name("TS_BaseSign_sign_counterparty_commitment"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
2223 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2224 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2225 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2226 LDKCommitmentTransaction commitment_tx_conv;
2227 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2228 commitment_tx_conv.is_owned = false;
2229 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2230 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2231 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2232 return (uint64_t)ret_conv;
2235 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) {
2236 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2237 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2238 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2239 unsigned char secret_arr[32];
2240 CHECK(secret->arr_len == 32);
2241 memcpy(secret_arr, secret->elems, 32);
2242 unsigned char (*secret_ref)[32] = &secret_arr;
2243 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2244 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2245 return (uint64_t)ret_conv;
2248 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) {
2249 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2250 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2251 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2252 LDKHolderCommitmentTransaction commitment_tx_conv;
2253 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2254 commitment_tx_conv.is_owned = false;
2255 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2256 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2257 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2258 return (uint64_t)ret_conv;
2261 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) {
2262 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2263 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2264 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2265 LDKTransaction justice_tx_ref;
2266 justice_tx_ref.datalen = justice_tx->arr_len;
2267 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2268 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen);
2269 justice_tx_ref.data_is_owned = true;
2270 unsigned char per_commitment_key_arr[32];
2271 CHECK(per_commitment_key->arr_len == 32);
2272 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32);
2273 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2274 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2275 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2276 return (uint64_t)ret_conv;
2279 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) {
2280 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2281 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2282 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2283 LDKTransaction justice_tx_ref;
2284 justice_tx_ref.datalen = justice_tx->arr_len;
2285 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2286 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen);
2287 justice_tx_ref.data_is_owned = true;
2288 unsigned char per_commitment_key_arr[32];
2289 CHECK(per_commitment_key->arr_len == 32);
2290 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32);
2291 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2292 LDKHTLCOutputInCommitment htlc_conv;
2293 htlc_conv.inner = (void*)(htlc & (~1));
2294 htlc_conv.is_owned = false;
2295 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2296 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2297 *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);
2298 return (uint64_t)ret_conv;
2301 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) {
2302 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2303 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2304 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2305 LDKTransaction htlc_tx_ref;
2306 htlc_tx_ref.datalen = htlc_tx->arr_len;
2307 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2308 memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen);
2309 htlc_tx_ref.data_is_owned = true;
2310 LDKPublicKey per_commitment_point_ref;
2311 CHECK(per_commitment_point->arr_len == 33);
2312 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
2313 LDKHTLCOutputInCommitment htlc_conv;
2314 htlc_conv.inner = (void*)(htlc & (~1));
2315 htlc_conv.is_owned = false;
2316 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2317 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2318 *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);
2319 return (uint64_t)ret_conv;
2322 uint32_t __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
2323 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2324 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2325 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2326 LDKClosingTransaction closing_tx_conv;
2327 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2328 closing_tx_conv.is_owned = false;
2329 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2330 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2331 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2332 return (uint64_t)ret_conv;
2335 uint32_t __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
2336 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2337 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2338 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2339 LDKUnsignedChannelAnnouncement msg_conv;
2340 msg_conv.inner = (void*)(msg & (~1));
2341 msg_conv.is_owned = false;
2342 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2343 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2344 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2345 return (uint64_t)ret_conv;
2348 void __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
2349 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2350 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2351 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2352 LDKChannelTransactionParameters channel_parameters_conv;
2353 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2354 channel_parameters_conv.is_owned = false;
2355 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2356 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2359 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2360 if (this_arg->set_pubkeys != NULL)
2361 this_arg->set_pubkeys(this_arg);
2362 return this_arg->pubkeys;
2364 uint32_t __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
2365 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2366 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2367 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2368 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2369 uint64_t ret_ref = 0;
2370 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2371 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2373 ret_ref = (uint64_t)ret_var.inner;
2374 if (ret_var.is_owned) {
2380 typedef struct LDKSign_JCalls {
2381 atomic_size_t refcnt;
2382 uint32_t instance_ptr;
2383 LDKBaseSign_JCalls* BaseSign;
2385 static void LDKSign_JCalls_free(void* this_arg) {
2386 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2387 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2391 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2392 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2393 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 16);
2394 LDKCVec_u8Z ret_ref;
2395 ret_ref.datalen = ret->arr_len;
2396 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2397 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
2400 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2401 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2402 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2403 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2405 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint32_t pubkeys) {
2406 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2407 atomic_init(&calls->refcnt, 1);
2408 calls->instance_ptr = o;
2410 LDKChannelPublicKeys pubkeys_conv;
2411 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2412 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2413 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2416 .this_arg = (void*) calls,
2417 .write = write_LDKSign_jcall,
2418 .cloned = LDKSign_JCalls_cloned,
2419 .free = LDKSign_JCalls_free,
2420 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
2422 calls->BaseSign = ret.BaseSign.this_arg;
2425 long __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint32_t pubkeys) {
2426 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2427 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
2428 return (long)res_ptr;
2430 int8_tArray __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint32_t this_arg) {
2431 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2432 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2433 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
2434 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2435 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
2436 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2437 CVec_u8Z_free(ret_var);
2441 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
2442 return ThirtyTwoBytes_clone(&owner->a);
2444 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t owner) {
2445 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
2446 int8_tArray ret_arr = init_int8_tArray(32);
2447 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
2451 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
2452 return ChannelMonitor_clone(&owner->b);
2454 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t owner) {
2455 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
2456 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
2457 uint64_t ret_ref = 0;
2458 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2459 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2461 ret_ref = (uint64_t)ret_var.inner;
2462 if (ret_var.is_owned) {
2468 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
2469 CHECK(owner->result_ok);
2470 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
2472 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t owner) {
2473 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
2474 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2475 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
2476 return ((uint64_t)ret_conv);
2479 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
2480 CHECK(!owner->result_ok);
2481 return DecodeError_clone(&*owner->contents.err);
2483 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t owner) {
2484 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
2485 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
2486 uint64_t ret_ref = 0;
2487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2490 ret_ref = (uint64_t)ret_var.inner;
2491 if (ret_var.is_owned) {
2497 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2498 CHECK(owner->result_ok);
2499 return RouteHop_clone(&*owner->contents.result);
2501 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint32_t owner) {
2502 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
2503 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2504 uint64_t ret_ref = 0;
2505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2508 ret_ref = (uint64_t)ret_var.inner;
2509 if (ret_var.is_owned) {
2515 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2516 CHECK(!owner->result_ok);
2517 return DecodeError_clone(&*owner->contents.err);
2519 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint32_t owner) {
2520 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
2521 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2522 uint64_t ret_ref = 0;
2523 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2524 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2526 ret_ref = (uint64_t)ret_var.inner;
2527 if (ret_var.is_owned) {
2533 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2534 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2535 for (size_t i = 0; i < ret.datalen; i++) {
2536 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2540 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2541 CHECK(owner->result_ok);
2542 return Route_clone(&*owner->contents.result);
2544 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint32_t owner) {
2545 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
2546 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2547 uint64_t ret_ref = 0;
2548 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2549 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2551 ret_ref = (uint64_t)ret_var.inner;
2552 if (ret_var.is_owned) {
2558 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2559 CHECK(!owner->result_ok);
2560 return DecodeError_clone(&*owner->contents.err);
2562 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint32_t owner) {
2563 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
2564 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2565 uint64_t ret_ref = 0;
2566 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2567 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2569 ret_ref = (uint64_t)ret_var.inner;
2570 if (ret_var.is_owned) {
2576 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2577 CHECK(owner->result_ok);
2578 return RouteParameters_clone(&*owner->contents.result);
2580 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint32_t owner) {
2581 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
2582 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2583 uint64_t ret_ref = 0;
2584 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2585 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2586 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2587 ret_ref = (uint64_t)ret_var.inner;
2588 if (ret_var.is_owned) {
2594 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2595 CHECK(!owner->result_ok);
2596 return DecodeError_clone(&*owner->contents.err);
2598 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint32_t owner) {
2599 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
2600 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2601 uint64_t ret_ref = 0;
2602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2605 ret_ref = (uint64_t)ret_var.inner;
2606 if (ret_var.is_owned) {
2612 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2613 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2614 for (size_t i = 0; i < ret.datalen; i++) {
2615 ret.data[i] = RouteHint_clone(&orig->data[i]);
2619 static inline struct LDKPayee CResult_PayeeDecodeErrorZ_get_ok(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){
2620 CHECK(owner->result_ok);
2621 return Payee_clone(&*owner->contents.result);
2623 uint32_t __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_get_ok"))) TS_CResult_PayeeDecodeErrorZ_get_ok(uint32_t owner) {
2624 LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1);
2625 LDKPayee ret_var = CResult_PayeeDecodeErrorZ_get_ok(owner_conv);
2626 uint64_t ret_ref = 0;
2627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2630 ret_ref = (uint64_t)ret_var.inner;
2631 if (ret_var.is_owned) {
2637 static inline struct LDKDecodeError CResult_PayeeDecodeErrorZ_get_err(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){
2638 CHECK(!owner->result_ok);
2639 return DecodeError_clone(&*owner->contents.err);
2641 uint32_t __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_get_err"))) TS_CResult_PayeeDecodeErrorZ_get_err(uint32_t owner) {
2642 LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1);
2643 LDKDecodeError ret_var = CResult_PayeeDecodeErrorZ_get_err(owner_conv);
2644 uint64_t ret_ref = 0;
2645 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2646 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2648 ret_ref = (uint64_t)ret_var.inner;
2649 if (ret_var.is_owned) {
2655 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2656 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2657 for (size_t i = 0; i < ret.datalen; i++) {
2658 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2662 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2663 CHECK(owner->result_ok);
2664 return RouteHint_clone(&*owner->contents.result);
2666 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint32_t owner) {
2667 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
2668 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2669 uint64_t ret_ref = 0;
2670 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2671 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2673 ret_ref = (uint64_t)ret_var.inner;
2674 if (ret_var.is_owned) {
2680 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2681 CHECK(!owner->result_ok);
2682 return DecodeError_clone(&*owner->contents.err);
2684 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint32_t owner) {
2685 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
2686 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2687 uint64_t ret_ref = 0;
2688 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2689 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2691 ret_ref = (uint64_t)ret_var.inner;
2692 if (ret_var.is_owned) {
2698 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2699 CHECK(owner->result_ok);
2700 return RouteHintHop_clone(&*owner->contents.result);
2702 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t owner) {
2703 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
2704 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2705 uint64_t ret_ref = 0;
2706 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2707 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2709 ret_ref = (uint64_t)ret_var.inner;
2710 if (ret_var.is_owned) {
2716 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2717 CHECK(!owner->result_ok);
2718 return DecodeError_clone(&*owner->contents.err);
2720 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint32_t owner) {
2721 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
2722 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2723 uint64_t ret_ref = 0;
2724 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2725 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2726 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2727 ret_ref = (uint64_t)ret_var.inner;
2728 if (ret_var.is_owned) {
2734 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2735 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2736 for (size_t i = 0; i < ret.datalen; i++) {
2737 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2741 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2742 CHECK(owner->result_ok);
2743 return Route_clone(&*owner->contents.result);
2745 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint32_t owner) {
2746 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
2747 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2748 uint64_t ret_ref = 0;
2749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2751 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2752 ret_ref = (uint64_t)ret_var.inner;
2753 if (ret_var.is_owned) {
2759 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2760 CHECK(!owner->result_ok);
2761 return LightningError_clone(&*owner->contents.err);
2763 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint32_t owner) {
2764 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
2765 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2766 uint64_t ret_ref = 0;
2767 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2768 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2769 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2770 ret_ref = (uint64_t)ret_var.inner;
2771 if (ret_var.is_owned) {
2777 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
2778 CHECK(owner->result_ok);
2779 return *owner->contents.result;
2781 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint32_t owner) {
2782 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
2783 CResult_NoneLightningErrorZ_get_ok(owner_conv);
2786 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
2787 CHECK(!owner->result_ok);
2788 return LightningError_clone(&*owner->contents.err);
2790 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint32_t owner) {
2791 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
2792 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
2793 uint64_t ret_ref = 0;
2794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2797 ret_ref = (uint64_t)ret_var.inner;
2798 if (ret_var.is_owned) {
2804 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
2807 int8_tArray __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t owner) {
2808 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
2809 int8_tArray ret_arr = init_int8_tArray(33);
2810 memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
2814 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
2815 return Type_clone(&owner->b);
2817 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t owner) {
2818 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
2819 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
2820 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
2821 return (uint64_t)ret_ret;
2824 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
2825 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
2826 for (size_t i = 0; i < ret.datalen; i++) {
2827 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
2831 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint32_t ptr) {
2832 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2834 case LDKErrorAction_DisconnectPeer: return 0;
2835 case LDKErrorAction_IgnoreError: return 1;
2836 case LDKErrorAction_IgnoreAndLog: return 2;
2837 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
2838 case LDKErrorAction_SendErrorMessage: return 4;
2842 uint32_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint32_t ptr) {
2843 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2844 assert(obj->tag == LDKErrorAction_DisconnectPeer);
2845 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2846 uint64_t msg_ref = 0;
2847 if ((uint64_t)msg_var.inner > 4096) {
2848 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2849 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2850 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2851 msg_ref = (uint64_t)msg_var.inner & ~1;
2855 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint32_t ptr) {
2856 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2857 assert(obj->tag == LDKErrorAction_IgnoreAndLog);
2858 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2859 return ignore_and_log_conv;
2861 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint32_t ptr) {
2862 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2863 assert(obj->tag == LDKErrorAction_SendErrorMessage);
2864 LDKErrorMessage msg_var = obj->send_error_message.msg;
2865 uint64_t msg_ref = 0;
2866 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2867 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2868 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2869 msg_ref = (uint64_t)msg_var.inner & ~1;
2872 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint32_t ptr) {
2873 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2875 case LDKMessageSendEvent_SendAcceptChannel: return 0;
2876 case LDKMessageSendEvent_SendOpenChannel: return 1;
2877 case LDKMessageSendEvent_SendFundingCreated: return 2;
2878 case LDKMessageSendEvent_SendFundingSigned: return 3;
2879 case LDKMessageSendEvent_SendFundingLocked: return 4;
2880 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2881 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2882 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2883 case LDKMessageSendEvent_SendClosingSigned: return 8;
2884 case LDKMessageSendEvent_SendShutdown: return 9;
2885 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2886 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 11;
2887 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 12;
2888 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2889 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2890 case LDKMessageSendEvent_HandleError: return 15;
2891 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2892 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2893 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2897 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint32_t ptr) {
2898 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2899 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2900 int8_tArray node_id_arr = init_int8_tArray(33);
2901 memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2904 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint32_t ptr) {
2905 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2906 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2907 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2908 uint64_t msg_ref = 0;
2909 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2910 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2911 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2912 msg_ref = (uint64_t)msg_var.inner & ~1;
2915 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint32_t ptr) {
2916 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2917 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2918 int8_tArray node_id_arr = init_int8_tArray(33);
2919 memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2922 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint32_t ptr) {
2923 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2924 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2925 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2926 uint64_t msg_ref = 0;
2927 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2928 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2929 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2930 msg_ref = (uint64_t)msg_var.inner & ~1;
2933 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint32_t ptr) {
2934 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2935 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2936 int8_tArray node_id_arr = init_int8_tArray(33);
2937 memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2940 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint32_t ptr) {
2941 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2942 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2943 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2944 uint64_t msg_ref = 0;
2945 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2946 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2947 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2948 msg_ref = (uint64_t)msg_var.inner & ~1;
2951 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint32_t ptr) {
2952 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2953 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2954 int8_tArray node_id_arr = init_int8_tArray(33);
2955 memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2958 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint32_t ptr) {
2959 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2960 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2961 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2962 uint64_t msg_ref = 0;
2963 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2964 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2965 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2966 msg_ref = (uint64_t)msg_var.inner & ~1;
2969 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingLocked_get_node_id"))) TS_LDKMessageSendEvent_SendFundingLocked_get_node_id(uint32_t ptr) {
2970 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2971 assert(obj->tag == LDKMessageSendEvent_SendFundingLocked);
2972 int8_tArray node_id_arr = init_int8_tArray(33);
2973 memcpy(node_id_arr->elems, obj->send_funding_locked.node_id.compressed_form, 33);
2976 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingLocked_get_msg"))) TS_LDKMessageSendEvent_SendFundingLocked_get_msg(uint32_t ptr) {
2977 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2978 assert(obj->tag == LDKMessageSendEvent_SendFundingLocked);
2979 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
2980 uint64_t msg_ref = 0;
2981 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2982 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2983 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2984 msg_ref = (uint64_t)msg_var.inner & ~1;
2987 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint32_t ptr) {
2988 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2989 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2990 int8_tArray node_id_arr = init_int8_tArray(33);
2991 memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2994 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint32_t ptr) {
2995 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2996 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2997 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2998 uint64_t msg_ref = 0;
2999 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3000 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3001 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3002 msg_ref = (uint64_t)msg_var.inner & ~1;
3005 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint32_t ptr) {
3006 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3007 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3008 int8_tArray node_id_arr = init_int8_tArray(33);
3009 memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
3012 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint32_t ptr) {
3013 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3014 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3015 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
3016 uint64_t updates_ref = 0;
3017 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3018 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3019 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
3020 updates_ref = (uint64_t)updates_var.inner & ~1;
3023 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint32_t ptr) {
3024 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3025 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3026 int8_tArray node_id_arr = init_int8_tArray(33);
3027 memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
3030 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint32_t ptr) {
3031 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3032 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3033 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
3034 uint64_t msg_ref = 0;
3035 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3036 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3037 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3038 msg_ref = (uint64_t)msg_var.inner & ~1;
3041 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint32_t ptr) {
3042 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3043 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3044 int8_tArray node_id_arr = init_int8_tArray(33);
3045 memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
3048 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint32_t ptr) {
3049 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3050 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3051 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3052 uint64_t msg_ref = 0;
3053 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3054 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3055 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3056 msg_ref = (uint64_t)msg_var.inner & ~1;
3059 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint32_t ptr) {
3060 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3061 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3062 int8_tArray node_id_arr = init_int8_tArray(33);
3063 memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
3066 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint32_t ptr) {
3067 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3068 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3069 LDKShutdown msg_var = obj->send_shutdown.msg;
3070 uint64_t msg_ref = 0;
3071 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3072 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3073 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3074 msg_ref = (uint64_t)msg_var.inner & ~1;
3077 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint32_t ptr) {
3078 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3079 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
3080 int8_tArray node_id_arr = init_int8_tArray(33);
3081 memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
3084 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint32_t ptr) {
3085 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3086 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
3087 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
3088 uint64_t msg_ref = 0;
3089 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3090 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3091 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3092 msg_ref = (uint64_t)msg_var.inner & ~1;
3095 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint32_t ptr) {
3096 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3097 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
3098 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
3099 uint64_t msg_ref = 0;
3100 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3101 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3102 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3103 msg_ref = (uint64_t)msg_var.inner & ~1;
3106 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint32_t ptr) {
3107 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3108 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
3109 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
3110 uint64_t update_msg_ref = 0;
3111 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3112 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3113 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3114 update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
3115 return update_msg_ref;
3117 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint32_t ptr) {
3118 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3119 assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
3120 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
3121 uint64_t msg_ref = 0;
3122 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3123 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3124 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3125 msg_ref = (uint64_t)msg_var.inner & ~1;
3128 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint32_t ptr) {
3129 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3130 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
3131 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
3132 uint64_t msg_ref = 0;
3133 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3134 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3135 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3136 msg_ref = (uint64_t)msg_var.inner & ~1;
3139 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint32_t ptr) {
3140 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3141 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
3142 int8_tArray node_id_arr = init_int8_tArray(33);
3143 memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
3146 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint32_t ptr) {
3147 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3148 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
3149 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
3150 uint64_t msg_ref = 0;
3151 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3152 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3153 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3154 msg_ref = (uint64_t)msg_var.inner & ~1;
3157 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint32_t ptr) {
3158 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3159 assert(obj->tag == LDKMessageSendEvent_HandleError);
3160 int8_tArray node_id_arr = init_int8_tArray(33);
3161 memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
3164 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint32_t ptr) {
3165 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3166 assert(obj->tag == LDKMessageSendEvent_HandleError);
3167 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
3170 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint32_t ptr) {
3171 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3172 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
3173 int8_tArray node_id_arr = init_int8_tArray(33);
3174 memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
3177 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint32_t ptr) {
3178 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3179 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
3180 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
3181 uint64_t msg_ref = 0;
3182 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3183 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3184 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3185 msg_ref = (uint64_t)msg_var.inner & ~1;
3188 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint32_t ptr) {
3189 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3190 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
3191 int8_tArray node_id_arr = init_int8_tArray(33);
3192 memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
3195 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint32_t ptr) {
3196 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3197 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
3198 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3199 uint64_t msg_ref = 0;
3200 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3201 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3202 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3203 msg_ref = (uint64_t)msg_var.inner & ~1;
3206 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint32_t ptr) {
3207 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3208 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
3209 int8_tArray node_id_arr = init_int8_tArray(33);
3210 memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
3213 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint32_t ptr) {
3214 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
3215 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
3216 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3217 uint64_t msg_ref = 0;
3218 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3219 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3220 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3221 msg_ref = (uint64_t)msg_var.inner & ~1;
3224 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3225 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3226 for (size_t i = 0; i < ret.datalen; i++) {
3227 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3231 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3232 CHECK(owner->result_ok);
3233 return *owner->contents.result;
3235 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint32_t owner) {
3236 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3237 jboolean ret_val = CResult_boolLightningErrorZ_get_ok(owner_conv);
3241 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3242 CHECK(!owner->result_ok);
3243 return LightningError_clone(&*owner->contents.err);
3245 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint32_t owner) {
3246 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3247 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3248 uint64_t ret_ref = 0;
3249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3252 ret_ref = (uint64_t)ret_var.inner;
3253 if (ret_var.is_owned) {
3259 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3260 return ChannelAnnouncement_clone(&owner->a);
3262 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t owner) {
3263 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3264 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3265 uint64_t ret_ref = 0;
3266 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3267 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3269 ret_ref = (uint64_t)ret_var.inner;
3270 if (ret_var.is_owned) {
3276 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3277 return ChannelUpdate_clone(&owner->b);
3279 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t owner) {
3280 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3281 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3282 uint64_t ret_ref = 0;
3283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3285 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3286 ret_ref = (uint64_t)ret_var.inner;
3287 if (ret_var.is_owned) {
3293 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3294 return ChannelUpdate_clone(&owner->c);
3296 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t owner) {
3297 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3298 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3299 uint64_t ret_ref = 0;
3300 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3301 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3302 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3303 ret_ref = (uint64_t)ret_var.inner;
3304 if (ret_var.is_owned) {
3310 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3311 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3312 for (size_t i = 0; i < ret.datalen; i++) {
3313 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3317 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3318 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3319 for (size_t i = 0; i < ret.datalen; i++) {
3320 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3324 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
3325 CHECK(owner->result_ok);
3326 return CVec_u8Z_clone(&*owner->contents.result);
3328 int8_tArray __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t owner) {
3329 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
3330 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
3331 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
3332 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3333 CVec_u8Z_free(ret_var);
3337 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
3338 CHECK(!owner->result_ok);
3339 return PeerHandleError_clone(&*owner->contents.err);
3341 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t owner) {
3342 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
3343 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
3344 uint64_t ret_ref = 0;
3345 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3346 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3347 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3348 ret_ref = (uint64_t)ret_var.inner;
3349 if (ret_var.is_owned) {
3355 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
3356 CHECK(owner->result_ok);
3357 return *owner->contents.result;
3359 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint32_t owner) {
3360 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
3361 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
3364 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
3365 CHECK(!owner->result_ok);
3366 return PeerHandleError_clone(&*owner->contents.err);
3368 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint32_t owner) {
3369 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
3370 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
3371 uint64_t ret_ref = 0;
3372 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3373 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3374 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3375 ret_ref = (uint64_t)ret_var.inner;
3376 if (ret_var.is_owned) {
3382 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
3383 CHECK(owner->result_ok);
3384 return *owner->contents.result;
3386 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint32_t owner) {
3387 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
3388 jboolean ret_val = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
3392 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
3393 CHECK(!owner->result_ok);
3394 return PeerHandleError_clone(&*owner->contents.err);
3396 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint32_t owner) {
3397 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
3398 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
3399 uint64_t ret_ref = 0;
3400 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3401 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3402 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3403 ret_ref = (uint64_t)ret_var.inner;
3404 if (ret_var.is_owned) {
3410 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3411 CHECK(owner->result_ok);
3412 return TxOut_clone(&*owner->contents.result);
3414 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint32_t owner) {
3415 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3416 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3417 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
3418 return (uint64_t)ret_ref;
3421 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3422 CHECK(!owner->result_ok);
3423 return AccessError_clone(&*owner->contents.err);
3425 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint32_t owner) {
3426 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3427 uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
3431 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3432 CHECK(owner->result_ok);
3433 return *owner->contents.result;
3435 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t owner) {
3436 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3437 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
3440 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3441 CHECK(!owner->result_ok);
3442 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
3444 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t owner) {
3445 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3446 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
3450 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr(uint32_t ptr) {
3451 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
3453 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: return 0;
3454 case LDKCOption_C2Tuple_usizeTransactionZZ_None: return 1;
3458 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some(uint32_t ptr) {
3459 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
3460 assert(obj->tag == LDKCOption_C2Tuple_usizeTransactionZZ_Some);
3461 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
3462 *some_conv = obj->some;
3463 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
3464 return ((uint64_t)some_conv);
3466 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint32_t ptr) {
3467 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
3469 case LDKCOption_ClosureReasonZ_Some: return 0;
3470 case LDKCOption_ClosureReasonZ_None: return 1;
3474 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint32_t ptr) {
3475 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
3476 assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
3477 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
3480 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3481 CHECK(owner->result_ok);
3482 return COption_ClosureReasonZ_clone(&*owner->contents.result);
3484 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint32_t owner) {
3485 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
3486 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
3487 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
3488 uint64_t ret_ref = (uint64_t)ret_copy;
3492 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3493 CHECK(!owner->result_ok);
3494 return DecodeError_clone(&*owner->contents.err);
3496 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint32_t owner) {
3497 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
3498 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
3499 uint64_t ret_ref = 0;
3500 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3501 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3503 ret_ref = (uint64_t)ret_var.inner;
3504 if (ret_var.is_owned) {
3510 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint32_t ptr) {
3511 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
3513 case LDKCOption_EventZ_Some: return 0;
3514 case LDKCOption_EventZ_None: return 1;
3518 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint32_t ptr) {
3519 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
3520 assert(obj->tag == LDKCOption_EventZ_Some);
3521 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
3524 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3525 CHECK(owner->result_ok);
3526 return COption_EventZ_clone(&*owner->contents.result);
3528 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint32_t owner) {
3529 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
3530 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
3531 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
3532 uint64_t ret_ref = (uint64_t)ret_copy;
3536 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3537 CHECK(!owner->result_ok);
3538 return DecodeError_clone(&*owner->contents.err);
3540 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint32_t owner) {
3541 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
3542 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
3543 uint64_t ret_ref = 0;
3544 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3545 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3547 ret_ref = (uint64_t)ret_var.inner;
3548 if (ret_var.is_owned) {
3554 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3555 CHECK(owner->result_ok);
3556 return NodeId_clone(&*owner->contents.result);
3558 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint32_t owner) {
3559 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3560 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3561 uint64_t ret_ref = 0;
3562 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3563 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3565 ret_ref = (uint64_t)ret_var.inner;
3566 if (ret_var.is_owned) {
3572 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3573 CHECK(!owner->result_ok);
3574 return DecodeError_clone(&*owner->contents.err);
3576 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint32_t owner) {
3577 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3578 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3579 uint64_t ret_ref = 0;
3580 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3581 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3582 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3583 ret_ref = (uint64_t)ret_var.inner;
3584 if (ret_var.is_owned) {
3590 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3591 CHECK(owner->result_ok);
3592 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3594 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t owner) {
3595 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3596 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3597 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3598 uint64_t ret_ref = (uint64_t)ret_copy;
3602 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3603 CHECK(!owner->result_ok);
3604 return DecodeError_clone(&*owner->contents.err);
3606 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t owner) {
3607 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3608 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3609 uint64_t ret_ref = 0;
3610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3613 ret_ref = (uint64_t)ret_var.inner;
3614 if (ret_var.is_owned) {
3620 typedef struct LDKAccess_JCalls {
3621 atomic_size_t refcnt;
3622 uint32_t instance_ptr;
3624 static void LDKAccess_JCalls_free(void* this_arg) {
3625 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3626 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3630 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3631 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3632 int8_tArray genesis_hash_arr = init_int8_tArray(32);
3633 memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3634 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 17, (uint32_t)genesis_hash_arr, (uint32_t)short_channel_id);
3635 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3636 CHECK_ACCESS(ret_ptr);
3637 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3641 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3642 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3643 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3645 static inline LDKAccess LDKAccess_init (JSValue o) {
3646 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3647 atomic_init(&calls->refcnt, 1);
3648 calls->instance_ptr = o;
3651 .this_arg = (void*) calls,
3652 .get_utxo = get_utxo_LDKAccess_jcall,
3653 .free = LDKAccess_JCalls_free,
3657 long __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
3658 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3659 *res_ptr = LDKAccess_init(o);
3660 return (long)res_ptr;
3662 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) {
3663 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3664 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3665 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3666 unsigned char genesis_hash_arr[32];
3667 CHECK(genesis_hash->arr_len == 32);
3668 memcpy(genesis_hash_arr, genesis_hash->elems, 32);
3669 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3670 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3671 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3672 return (uint64_t)ret_conv;
3675 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint32_t ptr) {
3676 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
3678 case LDKCOption_AccessZ_Some: return 0;
3679 case LDKCOption_AccessZ_None: return 1;
3683 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint32_t ptr) {
3684 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
3685 assert(obj->tag == LDKCOption_AccessZ_Some);
3686 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3687 *some_ret = obj->some;
3688 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
3689 return (uint64_t)some_ret;
3691 static inline struct LDKDirectionalChannelInfo CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3692 CHECK(owner->result_ok);
3693 return DirectionalChannelInfo_clone(&*owner->contents.result);
3695 uint32_t __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
3696 LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1);
3697 LDKDirectionalChannelInfo ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(owner_conv);
3698 uint64_t ret_ref = 0;
3699 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3700 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3702 ret_ref = (uint64_t)ret_var.inner;
3703 if (ret_var.is_owned) {
3709 static inline struct LDKDecodeError CResult_DirectionalChannelInfoDecodeErrorZ_get_err(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3710 CHECK(!owner->result_ok);
3711 return DecodeError_clone(&*owner->contents.err);
3713 uint32_t __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_get_err"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
3714 LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1);
3715 LDKDecodeError ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_err(owner_conv);
3716 uint64_t ret_ref = 0;
3717 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3718 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3719 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3720 ret_ref = (uint64_t)ret_var.inner;
3721 if (ret_var.is_owned) {
3727 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3728 CHECK(owner->result_ok);
3729 return ChannelInfo_clone(&*owner->contents.result);
3731 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
3732 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3733 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3734 uint64_t ret_ref = 0;
3735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3738 ret_ref = (uint64_t)ret_var.inner;
3739 if (ret_var.is_owned) {
3745 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3746 CHECK(!owner->result_ok);
3747 return DecodeError_clone(&*owner->contents.err);
3749 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
3750 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3751 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3752 uint64_t ret_ref = 0;
3753 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3754 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3756 ret_ref = (uint64_t)ret_var.inner;
3757 if (ret_var.is_owned) {
3763 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3764 CHECK(owner->result_ok);
3765 return RoutingFees_clone(&*owner->contents.result);
3767 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t owner) {
3768 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3769 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3770 uint64_t ret_ref = 0;
3771 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3772 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3773 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3774 ret_ref = (uint64_t)ret_var.inner;
3775 if (ret_var.is_owned) {
3781 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3782 CHECK(!owner->result_ok);
3783 return DecodeError_clone(&*owner->contents.err);
3785 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint32_t owner) {
3786 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3787 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3788 uint64_t ret_ref = 0;
3789 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3790 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3791 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3792 ret_ref = (uint64_t)ret_var.inner;
3793 if (ret_var.is_owned) {
3799 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint32_t ptr) {
3800 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3802 case LDKNetAddress_IPv4: return 0;
3803 case LDKNetAddress_IPv6: return 1;
3804 case LDKNetAddress_OnionV2: return 2;
3805 case LDKNetAddress_OnionV3: return 3;
3809 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint32_t ptr) {
3810 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3811 assert(obj->tag == LDKNetAddress_IPv4);
3812 int8_tArray addr_arr = init_int8_tArray(4);
3813 memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3816 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint32_t ptr) {
3817 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3818 assert(obj->tag == LDKNetAddress_IPv4);
3819 return obj->i_pv4.port;
3821 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint32_t ptr) {
3822 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3823 assert(obj->tag == LDKNetAddress_IPv6);
3824 int8_tArray addr_arr = init_int8_tArray(16);
3825 memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3828 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint32_t ptr) {
3829 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3830 assert(obj->tag == LDKNetAddress_IPv6);
3831 return obj->i_pv6.port;
3833 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint32_t ptr) {
3834 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3835 assert(obj->tag == LDKNetAddress_OnionV2);
3836 int8_tArray onion_v2_arr = init_int8_tArray(12);
3837 memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3838 return onion_v2_arr;
3840 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint32_t ptr) {
3841 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3842 assert(obj->tag == LDKNetAddress_OnionV3);
3843 int8_tArray ed25519_pubkey_arr = init_int8_tArray(32);
3844 memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3845 return ed25519_pubkey_arr;
3847 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint32_t ptr) {
3848 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3849 assert(obj->tag == LDKNetAddress_OnionV3);
3850 return obj->onion_v3.checksum;
3852 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint32_t ptr) {
3853 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3854 assert(obj->tag == LDKNetAddress_OnionV3);
3855 return obj->onion_v3.version;
3857 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint32_t ptr) {
3858 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3859 assert(obj->tag == LDKNetAddress_OnionV3);
3860 return obj->onion_v3.port;
3862 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3863 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3864 for (size_t i = 0; i < ret.datalen; i++) {
3865 ret.data[i] = NetAddress_clone(&orig->data[i]);
3869 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3870 CHECK(owner->result_ok);
3871 return NodeAnnouncementInfo_clone(&*owner->contents.result);
3873 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t owner) {
3874 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3875 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3876 uint64_t ret_ref = 0;
3877 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3878 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3880 ret_ref = (uint64_t)ret_var.inner;
3881 if (ret_var.is_owned) {
3887 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3888 CHECK(!owner->result_ok);
3889 return DecodeError_clone(&*owner->contents.err);
3891 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t owner) {
3892 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3893 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3894 uint64_t ret_ref = 0;
3895 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3896 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3897 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3898 ret_ref = (uint64_t)ret_var.inner;
3899 if (ret_var.is_owned) {
3905 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3906 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3907 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3910 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3911 CHECK(owner->result_ok);
3912 return NodeInfo_clone(&*owner->contents.result);
3914 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint32_t owner) {
3915 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3916 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3917 uint64_t ret_ref = 0;
3918 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3919 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3921 ret_ref = (uint64_t)ret_var.inner;
3922 if (ret_var.is_owned) {
3928 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3929 CHECK(!owner->result_ok);
3930 return DecodeError_clone(&*owner->contents.err);
3932 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint32_t owner) {
3933 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3934 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3935 uint64_t ret_ref = 0;
3936 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3937 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3939 ret_ref = (uint64_t)ret_var.inner;
3940 if (ret_var.is_owned) {
3946 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3947 CHECK(owner->result_ok);
3948 return NetworkGraph_clone(&*owner->contents.result);
3950 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t owner) {
3951 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3952 LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3953 uint64_t ret_ref = 0;
3954 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3955 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3957 ret_ref = (uint64_t)ret_var.inner;
3958 if (ret_var.is_owned) {
3964 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3965 CHECK(!owner->result_ok);
3966 return DecodeError_clone(&*owner->contents.err);
3968 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint32_t owner) {
3969 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3970 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3971 uint64_t ret_ref = 0;
3972 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3973 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3974 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3975 ret_ref = (uint64_t)ret_var.inner;
3976 if (ret_var.is_owned) {
3982 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint32_t ptr) {
3983 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3985 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3986 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3990 uint32_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint32_t ptr) {
3991 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3992 assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3993 LDKCVec_NetAddressZ some_var = obj->some;
3994 uint32_tArray some_arr = NULL;
3995 some_arr = init_uint32_tArray(some_var.datalen);
3996 uint32_t *some_arr_ptr = (uint32_t*)(((uint8_t*)some_arr) + 4);
3997 for (size_t m = 0; m < some_var.datalen; m++) {
3998 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
3999 some_arr_ptr[m] = some_conv_12_ref;
4004 static inline struct LDKScoringParameters *CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
4005 CHECK(owner->result_ok);
4006 return &*owner->contents.result;
4008 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_get_ok"))) TS_CResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t owner) {
4009 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
4010 LDKScoringParameters ret_var = *CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv);
4011 uint64_t ret_ref = 0;
4012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4015 ret_ref = (uint64_t)ret_var.inner & ~1;
4019 static inline struct LDKDecodeError CResult_ScoringParametersDecodeErrorZ_get_err(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
4020 CHECK(!owner->result_ok);
4021 return DecodeError_clone(&*owner->contents.err);
4023 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_get_err"))) TS_CResult_ScoringParametersDecodeErrorZ_get_err(uint32_t owner) {
4024 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
4025 LDKDecodeError ret_var = CResult_ScoringParametersDecodeErrorZ_get_err(owner_conv);
4026 uint64_t ret_ref = 0;
4027 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4028 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4029 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4030 ret_ref = (uint64_t)ret_var.inner;
4031 if (ret_var.is_owned) {
4037 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4038 CHECK(owner->result_ok);
4039 return InitFeatures_clone(&*owner->contents.result);
4041 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
4042 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
4043 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
4044 uint64_t ret_ref = 0;
4045 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4046 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4048 ret_ref = (uint64_t)ret_var.inner;
4049 if (ret_var.is_owned) {
4055 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4056 CHECK(!owner->result_ok);
4057 return DecodeError_clone(&*owner->contents.err);
4059 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint32_t owner) {
4060 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
4061 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
4062 uint64_t ret_ref = 0;
4063 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4064 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4065 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4066 ret_ref = (uint64_t)ret_var.inner;
4067 if (ret_var.is_owned) {
4073 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4074 CHECK(owner->result_ok);
4075 return ChannelFeatures_clone(&*owner->contents.result);
4077 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
4078 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
4079 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
4080 uint64_t ret_ref = 0;
4081 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4082 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4083 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4084 ret_ref = (uint64_t)ret_var.inner;
4085 if (ret_var.is_owned) {
4091 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4092 CHECK(!owner->result_ok);
4093 return DecodeError_clone(&*owner->contents.err);
4095 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t owner) {
4096 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
4097 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
4098 uint64_t ret_ref = 0;
4099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4101 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4102 ret_ref = (uint64_t)ret_var.inner;
4103 if (ret_var.is_owned) {
4109 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4110 CHECK(owner->result_ok);
4111 return NodeFeatures_clone(&*owner->contents.result);
4113 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
4114 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
4115 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
4116 uint64_t ret_ref = 0;
4117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4120 ret_ref = (uint64_t)ret_var.inner;
4121 if (ret_var.is_owned) {
4127 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4128 CHECK(!owner->result_ok);
4129 return DecodeError_clone(&*owner->contents.err);
4131 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
4132 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
4133 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
4134 uint64_t ret_ref = 0;
4135 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4136 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4137 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4138 ret_ref = (uint64_t)ret_var.inner;
4139 if (ret_var.is_owned) {
4145 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4146 CHECK(owner->result_ok);
4147 return InvoiceFeatures_clone(&*owner->contents.result);
4149 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
4150 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
4151 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
4152 uint64_t ret_ref = 0;
4153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4156 ret_ref = (uint64_t)ret_var.inner;
4157 if (ret_var.is_owned) {
4163 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4164 CHECK(!owner->result_ok);
4165 return DecodeError_clone(&*owner->contents.err);
4167 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t owner) {
4168 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
4169 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
4170 uint64_t ret_ref = 0;
4171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4174 ret_ref = (uint64_t)ret_var.inner;
4175 if (ret_var.is_owned) {
4181 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4182 CHECK(owner->result_ok);
4183 return ChannelTypeFeatures_clone(&*owner->contents.result);
4185 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
4186 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
4187 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
4188 uint64_t ret_ref = 0;
4189 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4190 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4192 ret_ref = (uint64_t)ret_var.inner;
4193 if (ret_var.is_owned) {
4199 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4200 CHECK(!owner->result_ok);
4201 return DecodeError_clone(&*owner->contents.err);
4203 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
4204 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
4205 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
4206 uint64_t ret_ref = 0;
4207 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4208 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4209 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4210 ret_ref = (uint64_t)ret_var.inner;
4211 if (ret_var.is_owned) {
4217 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
4218 CHECK(owner->result_ok);
4219 return NetAddress_clone(&*owner->contents.result);
4221 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint32_t owner) {
4222 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
4223 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
4224 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
4225 uint64_t ret_ref = (uint64_t)ret_copy;
4229 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
4230 CHECK(!owner->result_ok);
4231 return DecodeError_clone(&*owner->contents.err);
4233 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint32_t owner) {
4234 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
4235 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
4236 uint64_t ret_ref = 0;
4237 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4238 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4239 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4240 ret_ref = (uint64_t)ret_var.inner;
4241 if (ret_var.is_owned) {
4247 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
4248 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
4249 for (size_t i = 0; i < ret.datalen; i++) {
4250 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
4254 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
4255 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
4256 for (size_t i = 0; i < ret.datalen; i++) {
4257 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
4261 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
4262 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
4263 for (size_t i = 0; i < ret.datalen; i++) {
4264 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
4268 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
4269 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
4270 for (size_t i = 0; i < ret.datalen; i++) {
4271 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
4275 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
4276 CHECK(owner->result_ok);
4277 return AcceptChannel_clone(&*owner->contents.result);
4279 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t owner) {
4280 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
4281 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
4282 uint64_t ret_ref = 0;
4283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4285 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4286 ret_ref = (uint64_t)ret_var.inner;
4287 if (ret_var.is_owned) {
4293 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
4294 CHECK(!owner->result_ok);
4295 return DecodeError_clone(&*owner->contents.err);
4297 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint32_t owner) {
4298 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
4299 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
4300 uint64_t ret_ref = 0;
4301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4304 ret_ref = (uint64_t)ret_var.inner;
4305 if (ret_var.is_owned) {
4311 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
4312 CHECK(owner->result_ok);
4313 return AnnouncementSignatures_clone(&*owner->contents.result);
4315 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t owner) {
4316 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
4317 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
4318 uint64_t ret_ref = 0;
4319 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4320 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4321 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4322 ret_ref = (uint64_t)ret_var.inner;
4323 if (ret_var.is_owned) {
4329 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
4330 CHECK(!owner->result_ok);
4331 return DecodeError_clone(&*owner->contents.err);
4333 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t owner) {
4334 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
4335 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
4336 uint64_t ret_ref = 0;
4337 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4338 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4339 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4340 ret_ref = (uint64_t)ret_var.inner;
4341 if (ret_var.is_owned) {
4347 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
4348 CHECK(owner->result_ok);
4349 return ChannelReestablish_clone(&*owner->contents.result);
4351 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t owner) {
4352 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
4353 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
4354 uint64_t ret_ref = 0;
4355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4357 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4358 ret_ref = (uint64_t)ret_var.inner;
4359 if (ret_var.is_owned) {
4365 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
4366 CHECK(!owner->result_ok);
4367 return DecodeError_clone(&*owner->contents.err);
4369 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t owner) {
4370 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
4371 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
4372 uint64_t ret_ref = 0;
4373 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4374 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4376 ret_ref = (uint64_t)ret_var.inner;
4377 if (ret_var.is_owned) {
4383 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
4384 CHECK(owner->result_ok);
4385 return ClosingSigned_clone(&*owner->contents.result);
4387 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t owner) {
4388 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
4389 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
4390 uint64_t ret_ref = 0;
4391 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4392 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4393 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4394 ret_ref = (uint64_t)ret_var.inner;
4395 if (ret_var.is_owned) {
4401 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
4402 CHECK(!owner->result_ok);
4403 return DecodeError_clone(&*owner->contents.err);
4405 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint32_t owner) {
4406 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
4407 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
4408 uint64_t ret_ref = 0;
4409 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4410 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4412 ret_ref = (uint64_t)ret_var.inner;
4413 if (ret_var.is_owned) {
4419 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
4420 CHECK(owner->result_ok);
4421 return ClosingSignedFeeRange_clone(&*owner->contents.result);
4423 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t owner) {
4424 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
4425 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
4426 uint64_t ret_ref = 0;
4427 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4428 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4430 ret_ref = (uint64_t)ret_var.inner;
4431 if (ret_var.is_owned) {
4437 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
4438 CHECK(!owner->result_ok);
4439 return DecodeError_clone(&*owner->contents.err);
4441 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t owner) {
4442 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
4443 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
4444 uint64_t ret_ref = 0;
4445 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4446 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4448 ret_ref = (uint64_t)ret_var.inner;
4449 if (ret_var.is_owned) {
4455 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
4456 CHECK(owner->result_ok);
4457 return CommitmentSigned_clone(&*owner->contents.result);
4459 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t owner) {
4460 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
4461 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
4462 uint64_t ret_ref = 0;
4463 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4464 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4466 ret_ref = (uint64_t)ret_var.inner;
4467 if (ret_var.is_owned) {
4473 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
4474 CHECK(!owner->result_ok);
4475 return DecodeError_clone(&*owner->contents.err);
4477 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t owner) {
4478 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
4479 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
4480 uint64_t ret_ref = 0;
4481 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4482 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4484 ret_ref = (uint64_t)ret_var.inner;
4485 if (ret_var.is_owned) {
4491 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
4492 CHECK(owner->result_ok);
4493 return FundingCreated_clone(&*owner->contents.result);
4495 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t owner) {
4496 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
4497 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
4498 uint64_t ret_ref = 0;
4499 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4500 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4502 ret_ref = (uint64_t)ret_var.inner;
4503 if (ret_var.is_owned) {
4509 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
4510 CHECK(!owner->result_ok);
4511 return DecodeError_clone(&*owner->contents.err);
4513 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint32_t owner) {
4514 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
4515 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
4516 uint64_t ret_ref = 0;
4517 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4518 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4520 ret_ref = (uint64_t)ret_var.inner;
4521 if (ret_var.is_owned) {
4527 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
4528 CHECK(owner->result_ok);
4529 return FundingSigned_clone(&*owner->contents.result);
4531 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint32_t owner) {
4532 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
4533 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
4534 uint64_t ret_ref = 0;
4535 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4536 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4538 ret_ref = (uint64_t)ret_var.inner;
4539 if (ret_var.is_owned) {
4545 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
4546 CHECK(!owner->result_ok);
4547 return DecodeError_clone(&*owner->contents.err);
4549 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint32_t owner) {
4550 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
4551 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
4552 uint64_t ret_ref = 0;
4553 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4554 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4556 ret_ref = (uint64_t)ret_var.inner;
4557 if (ret_var.is_owned) {
4563 static inline struct LDKFundingLocked CResult_FundingLockedDecodeErrorZ_get_ok(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
4564 CHECK(owner->result_ok);
4565 return FundingLocked_clone(&*owner->contents.result);
4567 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_get_ok"))) TS_CResult_FundingLockedDecodeErrorZ_get_ok(uint32_t owner) {
4568 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
4569 LDKFundingLocked ret_var = CResult_FundingLockedDecodeErrorZ_get_ok(owner_conv);
4570 uint64_t ret_ref = 0;
4571 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4572 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4573 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4574 ret_ref = (uint64_t)ret_var.inner;
4575 if (ret_var.is_owned) {
4581 static inline struct LDKDecodeError CResult_FundingLockedDecodeErrorZ_get_err(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
4582 CHECK(!owner->result_ok);
4583 return DecodeError_clone(&*owner->contents.err);
4585 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_get_err"))) TS_CResult_FundingLockedDecodeErrorZ_get_err(uint32_t owner) {
4586 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
4587 LDKDecodeError ret_var = CResult_FundingLockedDecodeErrorZ_get_err(owner_conv);
4588 uint64_t ret_ref = 0;
4589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4592 ret_ref = (uint64_t)ret_var.inner;
4593 if (ret_var.is_owned) {
4599 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
4600 CHECK(owner->result_ok);
4601 return Init_clone(&*owner->contents.result);
4603 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint32_t owner) {
4604 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
4605 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
4606 uint64_t ret_ref = 0;
4607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4610 ret_ref = (uint64_t)ret_var.inner;
4611 if (ret_var.is_owned) {
4617 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
4618 CHECK(!owner->result_ok);
4619 return DecodeError_clone(&*owner->contents.err);
4621 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint32_t owner) {
4622 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
4623 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
4624 uint64_t ret_ref = 0;
4625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4627 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4628 ret_ref = (uint64_t)ret_var.inner;
4629 if (ret_var.is_owned) {
4635 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
4636 CHECK(owner->result_ok);
4637 return OpenChannel_clone(&*owner->contents.result);
4639 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint32_t owner) {
4640 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
4641 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
4642 uint64_t ret_ref = 0;
4643 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4644 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4645 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4646 ret_ref = (uint64_t)ret_var.inner;
4647 if (ret_var.is_owned) {
4653 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
4654 CHECK(!owner->result_ok);
4655 return DecodeError_clone(&*owner->contents.err);
4657 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint32_t owner) {
4658 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
4659 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
4660 uint64_t ret_ref = 0;
4661 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4662 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4663 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4664 ret_ref = (uint64_t)ret_var.inner;
4665 if (ret_var.is_owned) {
4671 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
4672 CHECK(owner->result_ok);
4673 return RevokeAndACK_clone(&*owner->contents.result);
4675 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t owner) {
4676 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
4677 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
4678 uint64_t ret_ref = 0;
4679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4682 ret_ref = (uint64_t)ret_var.inner;
4683 if (ret_var.is_owned) {
4689 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
4690 CHECK(!owner->result_ok);
4691 return DecodeError_clone(&*owner->contents.err);
4693 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t owner) {
4694 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
4695 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
4696 uint64_t ret_ref = 0;
4697 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4698 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4700 ret_ref = (uint64_t)ret_var.inner;
4701 if (ret_var.is_owned) {
4707 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
4708 CHECK(owner->result_ok);
4709 return Shutdown_clone(&*owner->contents.result);
4711 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint32_t owner) {
4712 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
4713 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
4714 uint64_t ret_ref = 0;
4715 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4716 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4718 ret_ref = (uint64_t)ret_var.inner;
4719 if (ret_var.is_owned) {
4725 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
4726 CHECK(!owner->result_ok);
4727 return DecodeError_clone(&*owner->contents.err);
4729 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint32_t owner) {
4730 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
4731 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
4732 uint64_t ret_ref = 0;
4733 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4734 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4735 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4736 ret_ref = (uint64_t)ret_var.inner;
4737 if (ret_var.is_owned) {
4743 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
4744 CHECK(owner->result_ok);
4745 return UpdateFailHTLC_clone(&*owner->contents.result);
4747 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4748 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
4749 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
4750 uint64_t ret_ref = 0;
4751 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4752 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4754 ret_ref = (uint64_t)ret_var.inner;
4755 if (ret_var.is_owned) {
4761 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
4762 CHECK(!owner->result_ok);
4763 return DecodeError_clone(&*owner->contents.err);
4765 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t owner) {
4766 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
4767 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
4768 uint64_t ret_ref = 0;
4769 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4770 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4772 ret_ref = (uint64_t)ret_var.inner;
4773 if (ret_var.is_owned) {
4779 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
4780 CHECK(owner->result_ok);
4781 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
4783 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4784 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
4785 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
4786 uint64_t ret_ref = 0;
4787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4789 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4790 ret_ref = (uint64_t)ret_var.inner;
4791 if (ret_var.is_owned) {
4797 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
4798 CHECK(!owner->result_ok);
4799 return DecodeError_clone(&*owner->contents.err);
4801 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t owner) {
4802 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
4803 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
4804 uint64_t ret_ref = 0;
4805 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4806 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4807 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4808 ret_ref = (uint64_t)ret_var.inner;
4809 if (ret_var.is_owned) {
4815 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
4816 CHECK(owner->result_ok);
4817 return UpdateFee_clone(&*owner->contents.result);
4819 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t owner) {
4820 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
4821 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
4822 uint64_t ret_ref = 0;
4823 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4824 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4825 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4826 ret_ref = (uint64_t)ret_var.inner;
4827 if (ret_var.is_owned) {
4833 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
4834 CHECK(!owner->result_ok);
4835 return DecodeError_clone(&*owner->contents.err);
4837 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint32_t owner) {
4838 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
4839 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
4840 uint64_t ret_ref = 0;
4841 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4842 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4844 ret_ref = (uint64_t)ret_var.inner;
4845 if (ret_var.is_owned) {
4851 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
4852 CHECK(owner->result_ok);
4853 return UpdateFulfillHTLC_clone(&*owner->contents.result);
4855 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4856 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
4857 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
4858 uint64_t ret_ref = 0;
4859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4862 ret_ref = (uint64_t)ret_var.inner;
4863 if (ret_var.is_owned) {
4869 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
4870 CHECK(!owner->result_ok);
4871 return DecodeError_clone(&*owner->contents.err);
4873 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t owner) {
4874 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
4875 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
4876 uint64_t ret_ref = 0;
4877 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4878 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4880 ret_ref = (uint64_t)ret_var.inner;
4881 if (ret_var.is_owned) {
4887 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
4888 CHECK(owner->result_ok);
4889 return UpdateAddHTLC_clone(&*owner->contents.result);
4891 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4892 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
4893 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
4894 uint64_t ret_ref = 0;
4895 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4896 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4897 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4898 ret_ref = (uint64_t)ret_var.inner;
4899 if (ret_var.is_owned) {
4905 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
4906 CHECK(!owner->result_ok);
4907 return DecodeError_clone(&*owner->contents.err);
4909 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t owner) {
4910 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
4911 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
4912 uint64_t ret_ref = 0;
4913 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4914 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4915 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4916 ret_ref = (uint64_t)ret_var.inner;
4917 if (ret_var.is_owned) {
4923 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
4924 CHECK(owner->result_ok);
4925 return Ping_clone(&*owner->contents.result);
4927 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint32_t owner) {
4928 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
4929 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
4930 uint64_t ret_ref = 0;
4931 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4932 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4933 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4934 ret_ref = (uint64_t)ret_var.inner;
4935 if (ret_var.is_owned) {
4941 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
4942 CHECK(!owner->result_ok);
4943 return DecodeError_clone(&*owner->contents.err);
4945 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint32_t owner) {
4946 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
4947 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
4948 uint64_t ret_ref = 0;
4949 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4950 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4951 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4952 ret_ref = (uint64_t)ret_var.inner;
4953 if (ret_var.is_owned) {
4959 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
4960 CHECK(owner->result_ok);
4961 return Pong_clone(&*owner->contents.result);
4963 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint32_t owner) {
4964 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
4965 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
4966 uint64_t ret_ref = 0;
4967 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4968 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4969 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4970 ret_ref = (uint64_t)ret_var.inner;
4971 if (ret_var.is_owned) {
4977 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
4978 CHECK(!owner->result_ok);
4979 return DecodeError_clone(&*owner->contents.err);
4981 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint32_t owner) {
4982 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
4983 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
4984 uint64_t ret_ref = 0;
4985 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4986 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4987 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4988 ret_ref = (uint64_t)ret_var.inner;
4989 if (ret_var.is_owned) {
4995 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4996 CHECK(owner->result_ok);
4997 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
4999 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
5000 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
5001 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
5002 uint64_t ret_ref = 0;
5003 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5004 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5006 ret_ref = (uint64_t)ret_var.inner;
5007 if (ret_var.is_owned) {
5013 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5014 CHECK(!owner->result_ok);
5015 return DecodeError_clone(&*owner->contents.err);
5017 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
5018 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
5019 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
5020 uint64_t ret_ref = 0;
5021 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5022 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5023 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5024 ret_ref = (uint64_t)ret_var.inner;
5025 if (ret_var.is_owned) {
5031 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5032 CHECK(owner->result_ok);
5033 return ChannelAnnouncement_clone(&*owner->contents.result);
5035 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
5036 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
5037 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
5038 uint64_t ret_ref = 0;
5039 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5040 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5041 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5042 ret_ref = (uint64_t)ret_var.inner;
5043 if (ret_var.is_owned) {
5049 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5050 CHECK(!owner->result_ok);
5051 return DecodeError_clone(&*owner->contents.err);
5053 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
5054 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
5055 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
5056 uint64_t ret_ref = 0;
5057 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5058 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5060 ret_ref = (uint64_t)ret_var.inner;
5061 if (ret_var.is_owned) {
5067 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
5068 CHECK(owner->result_ok);
5069 return UnsignedChannelUpdate_clone(&*owner->contents.result);
5071 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
5072 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
5073 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
5074 uint64_t ret_ref = 0;
5075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5078 ret_ref = (uint64_t)ret_var.inner;
5079 if (ret_var.is_owned) {
5085 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
5086 CHECK(!owner->result_ok);
5087 return DecodeError_clone(&*owner->contents.err);
5089 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
5090 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
5091 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
5092 uint64_t ret_ref = 0;
5093 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5094 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5095 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5096 ret_ref = (uint64_t)ret_var.inner;
5097 if (ret_var.is_owned) {
5103 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
5104 CHECK(owner->result_ok);
5105 return ChannelUpdate_clone(&*owner->contents.result);
5107 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
5108 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
5109 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
5110 uint64_t ret_ref = 0;
5111 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5112 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5114 ret_ref = (uint64_t)ret_var.inner;
5115 if (ret_var.is_owned) {
5121 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
5122 CHECK(!owner->result_ok);
5123 return DecodeError_clone(&*owner->contents.err);
5125 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
5126 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
5127 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
5128 uint64_t ret_ref = 0;
5129 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5130 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5131 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5132 ret_ref = (uint64_t)ret_var.inner;
5133 if (ret_var.is_owned) {
5139 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
5140 CHECK(owner->result_ok);
5141 return ErrorMessage_clone(&*owner->contents.result);
5143 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t owner) {
5144 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
5145 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
5146 uint64_t ret_ref = 0;
5147 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5148 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5150 ret_ref = (uint64_t)ret_var.inner;
5151 if (ret_var.is_owned) {
5157 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
5158 CHECK(!owner->result_ok);
5159 return DecodeError_clone(&*owner->contents.err);
5161 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint32_t owner) {
5162 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
5163 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
5164 uint64_t ret_ref = 0;
5165 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5166 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5168 ret_ref = (uint64_t)ret_var.inner;
5169 if (ret_var.is_owned) {
5175 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5176 CHECK(owner->result_ok);
5177 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
5179 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
5180 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
5181 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
5182 uint64_t ret_ref = 0;
5183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5186 ret_ref = (uint64_t)ret_var.inner;
5187 if (ret_var.is_owned) {
5193 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5194 CHECK(!owner->result_ok);
5195 return DecodeError_clone(&*owner->contents.err);
5197 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
5198 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
5199 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
5200 uint64_t ret_ref = 0;
5201 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5202 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5204 ret_ref = (uint64_t)ret_var.inner;
5205 if (ret_var.is_owned) {
5211 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5212 CHECK(owner->result_ok);
5213 return NodeAnnouncement_clone(&*owner->contents.result);
5215 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
5216 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
5217 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
5218 uint64_t ret_ref = 0;
5219 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5220 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5222 ret_ref = (uint64_t)ret_var.inner;
5223 if (ret_var.is_owned) {
5229 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
5230 CHECK(!owner->result_ok);
5231 return DecodeError_clone(&*owner->contents.err);
5233 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
5234 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
5235 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
5236 uint64_t ret_ref = 0;
5237 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5238 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5239 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5240 ret_ref = (uint64_t)ret_var.inner;
5241 if (ret_var.is_owned) {
5247 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
5248 CHECK(owner->result_ok);
5249 return QueryShortChannelIds_clone(&*owner->contents.result);
5251 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t owner) {
5252 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
5253 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
5254 uint64_t ret_ref = 0;
5255 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5256 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5258 ret_ref = (uint64_t)ret_var.inner;
5259 if (ret_var.is_owned) {
5265 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
5266 CHECK(!owner->result_ok);
5267 return DecodeError_clone(&*owner->contents.err);
5269 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t owner) {
5270 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
5271 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
5272 uint64_t ret_ref = 0;
5273 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5274 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5275 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5276 ret_ref = (uint64_t)ret_var.inner;
5277 if (ret_var.is_owned) {
5283 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
5284 CHECK(owner->result_ok);
5285 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
5287 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t owner) {
5288 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
5289 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
5290 uint64_t ret_ref = 0;
5291 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5292 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5293 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5294 ret_ref = (uint64_t)ret_var.inner;
5295 if (ret_var.is_owned) {
5301 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
5302 CHECK(!owner->result_ok);
5303 return DecodeError_clone(&*owner->contents.err);
5305 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t owner) {
5306 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
5307 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
5308 uint64_t ret_ref = 0;
5309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5312 ret_ref = (uint64_t)ret_var.inner;
5313 if (ret_var.is_owned) {
5319 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
5320 CHECK(owner->result_ok);
5321 return QueryChannelRange_clone(&*owner->contents.result);
5323 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
5324 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
5325 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
5326 uint64_t ret_ref = 0;
5327 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5328 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5330 ret_ref = (uint64_t)ret_var.inner;
5331 if (ret_var.is_owned) {
5337 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
5338 CHECK(!owner->result_ok);
5339 return DecodeError_clone(&*owner->contents.err);
5341 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
5342 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
5343 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
5344 uint64_t ret_ref = 0;
5345 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5346 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5347 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5348 ret_ref = (uint64_t)ret_var.inner;
5349 if (ret_var.is_owned) {
5355 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
5356 CHECK(owner->result_ok);
5357 return ReplyChannelRange_clone(&*owner->contents.result);
5359 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
5360 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
5361 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
5362 uint64_t ret_ref = 0;
5363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5365 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5366 ret_ref = (uint64_t)ret_var.inner;
5367 if (ret_var.is_owned) {
5373 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
5374 CHECK(!owner->result_ok);
5375 return DecodeError_clone(&*owner->contents.err);
5377 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
5378 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
5379 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
5380 uint64_t ret_ref = 0;
5381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5384 ret_ref = (uint64_t)ret_var.inner;
5385 if (ret_var.is_owned) {
5391 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
5392 CHECK(owner->result_ok);
5393 return GossipTimestampFilter_clone(&*owner->contents.result);
5395 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t owner) {
5396 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
5397 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
5398 uint64_t ret_ref = 0;
5399 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5400 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5401 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5402 ret_ref = (uint64_t)ret_var.inner;
5403 if (ret_var.is_owned) {
5409 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
5410 CHECK(!owner->result_ok);
5411 return DecodeError_clone(&*owner->contents.err);
5413 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t owner) {
5414 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
5415 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
5416 uint64_t ret_ref = 0;
5417 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5418 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5419 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5420 ret_ref = (uint64_t)ret_var.inner;
5421 if (ret_var.is_owned) {
5427 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5428 CHECK(owner->result_ok);
5429 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
5431 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
5432 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5433 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5434 uint64_t ret_ref = 0;
5435 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5436 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5438 ret_ref = (uint64_t)ret_var.inner;
5439 if (ret_var.is_owned) {
5445 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5446 CHECK(!owner->result_ok);
5447 return DecodeError_clone(&*owner->contents.err);
5449 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
5450 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5451 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5452 uint64_t ret_ref = 0;
5453 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5454 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5455 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5456 ret_ref = (uint64_t)ret_var.inner;
5457 if (ret_var.is_owned) {
5463 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5464 CHECK(owner->result_ok);
5465 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
5467 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
5468 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5469 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5470 uint64_t ret_ref = 0;
5471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5474 ret_ref = (uint64_t)ret_var.inner;
5475 if (ret_var.is_owned) {
5481 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5482 CHECK(!owner->result_ok);
5483 return DecodeError_clone(&*owner->contents.err);
5485 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
5486 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5487 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5488 uint64_t ret_ref = 0;
5489 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5490 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5492 ret_ref = (uint64_t)ret_var.inner;
5493 if (ret_var.is_owned) {
5499 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5500 CHECK(owner->result_ok);
5501 return SpendableOutputDescriptor_clone(&*owner->contents.result);
5503 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
5504 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
5505 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
5506 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5507 uint64_t ret_ref = (uint64_t)ret_copy;
5511 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5512 CHECK(!owner->result_ok);
5513 return DecodeError_clone(&*owner->contents.err);
5515 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
5516 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
5517 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5518 uint64_t ret_ref = 0;
5519 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5520 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5521 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5522 ret_ref = (uint64_t)ret_var.inner;
5523 if (ret_var.is_owned) {
5529 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5530 CHECK(owner->result_ok);
5531 return Sign_clone(&*owner->contents.result);
5533 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint32_t owner) {
5534 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5535 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5536 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
5537 return (uint64_t)ret_ret;
5540 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5541 CHECK(!owner->result_ok);
5542 return DecodeError_clone(&*owner->contents.err);
5544 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint32_t owner) {
5545 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5546 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
5547 uint64_t ret_ref = 0;
5548 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5549 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5551 ret_ref = (uint64_t)ret_var.inner;
5552 if (ret_var.is_owned) {
5558 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5559 CHECK(owner->result_ok);
5560 return *owner->contents.result;
5562 int8_tArray __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint32_t owner) {
5563 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5564 int8_tArray ret_arr = init_int8_tArray(68);
5565 memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
5569 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5570 CHECK(!owner->result_ok);
5571 return *owner->contents.err;
5573 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint32_t owner) {
5574 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5575 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
5578 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
5579 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
5580 for (size_t i = 0; i < ret.datalen; i++) {
5581 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
5585 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5586 CHECK(owner->result_ok);
5587 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
5589 ptrArray __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t owner) {
5590 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5591 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
5592 ptrArray ret_arr = NULL;
5593 ret_arr = init_ptrArray(ret_var.datalen);
5594 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
5595 for (size_t m = 0; m < ret_var.datalen; m++) {
5596 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
5597 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen);
5598 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
5599 CVec_u8Z_free(ret_conv_12_var);
5600 ret_arr_ptr[m] = ret_conv_12_arr;
5607 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5608 CHECK(!owner->result_ok);
5609 return *owner->contents.err;
5611 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t owner) {
5612 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5613 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
5616 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5617 CHECK(owner->result_ok);
5618 return InMemorySigner_clone(&*owner->contents.result);
5620 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t owner) {
5621 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5622 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
5623 uint64_t ret_ref = 0;
5624 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5625 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5626 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5627 ret_ref = (uint64_t)ret_var.inner;
5628 if (ret_var.is_owned) {
5634 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5635 CHECK(!owner->result_ok);
5636 return DecodeError_clone(&*owner->contents.err);
5638 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint32_t owner) {
5639 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5640 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
5641 uint64_t ret_ref = 0;
5642 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5643 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5644 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5645 ret_ref = (uint64_t)ret_var.inner;
5646 if (ret_var.is_owned) {
5652 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
5653 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
5654 for (size_t i = 0; i < ret.datalen; i++) {
5655 ret.data[i] = TxOut_clone(&orig->data[i]);
5659 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5660 CHECK(owner->result_ok);
5661 return *owner->contents.result;
5663 int8_tArray __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint32_t owner) {
5664 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5665 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
5666 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
5667 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5671 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5672 CHECK(!owner->result_ok);
5673 return *owner->contents.err;
5675 void __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint32_t owner) {
5676 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5677 CResult_TransactionNoneZ_get_err(owner_conv);
5680 typedef struct LDKFilter_JCalls {
5681 atomic_size_t refcnt;
5682 uint32_t instance_ptr;
5684 static void LDKFilter_JCalls_free(void* this_arg) {
5685 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5686 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5690 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5691 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5692 int8_tArray txid_arr = init_int8_tArray(32);
5693 memcpy(txid_arr->elems, *txid, 32);
5694 LDKu8slice script_pubkey_var = script_pubkey;
5695 int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen);
5696 memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
5697 js_invoke_function_2(j_calls->instance_ptr, 18, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr);
5699 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5700 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5701 LDKWatchedOutput output_var = output;
5702 uint64_t output_ref = 0;
5703 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5704 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5705 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
5706 output_ref = (uint64_t)output_var.inner;
5707 if (output_var.is_owned) {
5710 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 19, (uint32_t)output_ref);
5711 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5712 CHECK_ACCESS(ret_ptr);
5713 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
5717 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5718 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5719 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5721 static inline LDKFilter LDKFilter_init (JSValue o) {
5722 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5723 atomic_init(&calls->refcnt, 1);
5724 calls->instance_ptr = o;
5727 .this_arg = (void*) calls,
5728 .register_tx = register_tx_LDKFilter_jcall,
5729 .register_output = register_output_LDKFilter_jcall,
5730 .free = LDKFilter_JCalls_free,
5734 long __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
5735 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5736 *res_ptr = LDKFilter_init(o);
5737 return (long)res_ptr;
5739 void __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5740 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5741 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5742 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5743 unsigned char txid_arr[32];
5744 CHECK(txid->arr_len == 32);
5745 memcpy(txid_arr, txid->elems, 32);
5746 unsigned char (*txid_ref)[32] = &txid_arr;
5747 LDKu8slice script_pubkey_ref;
5748 script_pubkey_ref.datalen = script_pubkey->arr_len;
5749 script_pubkey_ref.data = script_pubkey->elems;
5750 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5753 uint32_t __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5754 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5755 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5756 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5757 LDKWatchedOutput output_conv;
5758 output_conv.inner = (void*)(output & (~1));
5759 output_conv.is_owned = (output & 1) || (output == 0);
5760 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
5761 output_conv = WatchedOutput_clone(&output_conv);
5762 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5763 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5764 uint64_t ret_ref = (uint64_t)ret_copy;
5768 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint32_t ptr) {
5769 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5771 case LDKCOption_FilterZ_Some: return 0;
5772 case LDKCOption_FilterZ_None: return 1;
5776 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint32_t ptr) {
5777 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5778 assert(obj->tag == LDKCOption_FilterZ_Some);
5779 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
5780 *some_ret = obj->some;
5781 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5782 return (uint64_t)some_ret;
5784 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
5785 CHECK(owner->result_ok);
5786 return &*owner->contents.result;
5788 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint32_t owner) {
5789 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
5790 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
5791 uint64_t ret_ref = 0;
5792 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5793 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5794 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5795 ret_ref = (uint64_t)ret_var.inner & ~1;
5799 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
5800 CHECK(!owner->result_ok);
5801 return *owner->contents.err;
5803 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint32_t owner) {
5804 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
5805 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
5808 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
5809 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
5810 for (size_t i = 0; i < ret.datalen; i++) {
5811 ret.data[i] = OutPoint_clone(&orig->data[i]);
5815 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint32_t ptr) {
5816 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5818 case LDKAPIError_APIMisuseError: return 0;
5819 case LDKAPIError_FeeRateTooHigh: return 1;
5820 case LDKAPIError_RouteError: return 2;
5821 case LDKAPIError_ChannelUnavailable: return 3;
5822 case LDKAPIError_MonitorUpdateFailed: return 4;
5823 case LDKAPIError_IncompatibleShutdownScript: return 5;
5827 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint32_t ptr) {
5828 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5829 assert(obj->tag == LDKAPIError_APIMisuseError);
5830 LDKStr err_str = obj->api_misuse_error.err;
5831 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5834 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint32_t ptr) {
5835 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5836 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
5837 LDKStr err_str = obj->fee_rate_too_high.err;
5838 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5841 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint32_t ptr) {
5842 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5843 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
5844 return obj->fee_rate_too_high.feerate;
5846 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint32_t ptr) {
5847 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5848 assert(obj->tag == LDKAPIError_RouteError);
5849 LDKStr err_str = obj->route_error.err;
5850 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5853 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint32_t ptr) {
5854 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5855 assert(obj->tag == LDKAPIError_ChannelUnavailable);
5856 LDKStr err_str = obj->channel_unavailable.err;
5857 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5860 uint32_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint32_t ptr) {
5861 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5862 assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
5863 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
5864 uint64_t script_ref = 0;
5865 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5866 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5867 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
5868 script_ref = (uint64_t)script_var.inner & ~1;
5871 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5872 CHECK(owner->result_ok);
5873 return *owner->contents.result;
5875 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint32_t owner) {
5876 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5877 CResult_NoneAPIErrorZ_get_ok(owner_conv);
5880 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5881 CHECK(!owner->result_ok);
5882 return APIError_clone(&*owner->contents.err);
5884 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint32_t owner) {
5885 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5886 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5887 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
5888 uint64_t ret_ref = (uint64_t)ret_copy;
5892 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint32_t ptr) {
5893 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
5895 case LDKCOption_u16Z_Some: return 0;
5896 case LDKCOption_u16Z_None: return 1;
5900 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint32_t ptr) {
5901 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
5902 assert(obj->tag == LDKCOption_u16Z_Some);
5905 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
5906 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
5907 for (size_t i = 0; i < ret.datalen; i++) {
5908 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
5912 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
5913 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
5914 for (size_t i = 0; i < ret.datalen; i++) {
5915 ret.data[i] = APIError_clone(&orig->data[i]);
5919 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5920 CHECK(owner->result_ok);
5921 return ThirtyTwoBytes_clone(&*owner->contents.result);
5923 int8_tArray __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint32_t owner) {
5924 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5925 int8_tArray ret_arr = init_int8_tArray(32);
5926 memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
5930 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5931 CHECK(!owner->result_ok);
5932 return APIError_clone(&*owner->contents.err);
5934 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint32_t owner) {
5935 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5936 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5937 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5938 uint64_t ret_ref = (uint64_t)ret_copy;
5942 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint32_t ptr) {
5943 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5945 case LDKPaymentSendFailure_ParameterError: return 0;
5946 case LDKPaymentSendFailure_PathParameterError: return 1;
5947 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
5948 case LDKPaymentSendFailure_PartialFailure: return 3;
5952 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint32_t ptr) {
5953 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5954 assert(obj->tag == LDKPaymentSendFailure_ParameterError);
5955 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
5956 return parameter_error_ref;
5958 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint32_t ptr) {
5959 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5960 assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
5961 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5962 uint32_tArray path_parameter_error_arr = NULL;
5963 path_parameter_error_arr = init_uint32_tArray(path_parameter_error_var.datalen);
5964 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(((uint8_t*)path_parameter_error_arr) + 4);
5965 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5966 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5967 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5968 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5969 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
5972 return path_parameter_error_arr;
5974 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint32_t ptr) {
5975 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5976 assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
5977 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
5978 uint32_tArray all_failed_retry_safe_arr = NULL;
5979 all_failed_retry_safe_arr = init_uint32_tArray(all_failed_retry_safe_var.datalen);
5980 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(((uint8_t*)all_failed_retry_safe_arr) + 4);
5981 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
5982 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
5983 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
5986 return all_failed_retry_safe_arr;
5988 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint32_t ptr) {
5989 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5990 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5991 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5992 uint32_tArray results_arr = NULL;
5993 results_arr = init_uint32_tArray(results_var.datalen);
5994 uint32_t *results_arr_ptr = (uint32_t*)(((uint8_t*)results_arr) + 4);
5995 for (size_t w = 0; w < results_var.datalen; w++) {
5996 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5997 *results_conv_22_conv = results_var.data[w];
5998 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5999 results_arr_ptr[w] = (uint64_t)results_conv_22_conv;
6004 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint32_t ptr) {
6005 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
6006 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
6007 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
6008 uint64_t failed_paths_retry_ref = 0;
6009 if ((uint64_t)failed_paths_retry_var.inner > 4096) {
6010 CHECK((((uint64_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6011 CHECK((((uint64_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6012 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
6013 failed_paths_retry_ref = (uint64_t)failed_paths_retry_var.inner & ~1;
6015 return failed_paths_retry_ref;
6017 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint32_t ptr) {
6018 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
6019 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
6020 int8_tArray payment_id_arr = init_int8_tArray(32);
6021 memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
6022 return payment_id_arr;
6024 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
6025 CHECK(owner->result_ok);
6026 return ThirtyTwoBytes_clone(&*owner->contents.result);
6028 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t owner) {
6029 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
6030 int8_tArray ret_arr = init_int8_tArray(32);
6031 memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
6035 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
6036 CHECK(!owner->result_ok);
6037 return PaymentSendFailure_clone(&*owner->contents.err);
6039 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t owner) {
6040 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
6041 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6042 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
6043 uint64_t ret_ref = (uint64_t)ret_copy;
6047 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6048 CHECK(owner->result_ok);
6049 return *owner->contents.result;
6051 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint32_t owner) {
6052 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
6053 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
6056 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6057 CHECK(!owner->result_ok);
6058 return PaymentSendFailure_clone(&*owner->contents.err);
6060 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint32_t owner) {
6061 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
6062 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6063 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
6064 uint64_t ret_ref = (uint64_t)ret_copy;
6068 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6069 return ThirtyTwoBytes_clone(&owner->a);
6071 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t owner) {
6072 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
6073 int8_tArray ret_arr = init_int8_tArray(32);
6074 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
6078 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6079 return ThirtyTwoBytes_clone(&owner->b);
6081 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t owner) {
6082 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
6083 int8_tArray ret_arr = init_int8_tArray(32);
6084 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
6088 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6089 CHECK(owner->result_ok);
6090 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
6092 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t owner) {
6093 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
6094 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
6095 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
6096 return ((uint64_t)ret_conv);
6099 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6100 CHECK(!owner->result_ok);
6101 return PaymentSendFailure_clone(&*owner->contents.err);
6103 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t owner) {
6104 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
6105 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6106 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
6107 uint64_t ret_ref = (uint64_t)ret_copy;
6111 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6112 return ThirtyTwoBytes_clone(&owner->a);
6114 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t owner) {
6115 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
6116 int8_tArray ret_arr = init_int8_tArray(32);
6117 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
6121 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6122 return ThirtyTwoBytes_clone(&owner->b);
6124 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t owner) {
6125 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
6126 int8_tArray ret_arr = init_int8_tArray(32);
6127 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
6131 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6132 CHECK(owner->result_ok);
6133 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6135 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint32_t owner) {
6136 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
6137 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6138 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
6139 return ((uint64_t)ret_conv);
6142 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6143 CHECK(!owner->result_ok);
6144 return *owner->contents.err;
6146 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint32_t owner) {
6147 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
6148 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
6151 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
6152 CHECK(owner->result_ok);
6153 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6155 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint32_t owner) {
6156 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
6157 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6158 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
6159 return ((uint64_t)ret_conv);
6162 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
6163 CHECK(!owner->result_ok);
6164 return APIError_clone(&*owner->contents.err);
6166 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint32_t owner) {
6167 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
6168 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6169 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
6170 uint64_t ret_ref = (uint64_t)ret_copy;
6174 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6175 CHECK(owner->result_ok);
6176 return ThirtyTwoBytes_clone(&*owner->contents.result);
6178 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint32_t owner) {
6179 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
6180 int8_tArray ret_arr = init_int8_tArray(32);
6181 memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
6185 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6186 CHECK(!owner->result_ok);
6187 return *owner->contents.err;
6189 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint32_t owner) {
6190 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
6191 CResult_PaymentSecretNoneZ_get_err(owner_conv);
6194 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
6195 CHECK(owner->result_ok);
6196 return ThirtyTwoBytes_clone(&*owner->contents.result);
6198 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint32_t owner) {
6199 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
6200 int8_tArray ret_arr = init_int8_tArray(32);
6201 memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
6205 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
6206 CHECK(!owner->result_ok);
6207 return APIError_clone(&*owner->contents.err);
6209 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint32_t owner) {
6210 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
6211 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6212 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
6213 uint64_t ret_ref = (uint64_t)ret_copy;
6217 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6218 CHECK(owner->result_ok);
6219 return ThirtyTwoBytes_clone(&*owner->contents.result);
6221 int8_tArray __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint32_t owner) {
6222 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
6223 int8_tArray ret_arr = init_int8_tArray(32);
6224 memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
6228 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6229 CHECK(!owner->result_ok);
6230 return APIError_clone(&*owner->contents.err);
6232 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint32_t owner) {
6233 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
6234 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6235 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
6236 uint64_t ret_ref = (uint64_t)ret_copy;
6240 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6241 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6242 for (size_t i = 0; i < ret.datalen; i++) {
6243 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6247 typedef struct LDKWatch_JCalls {
6248 atomic_size_t refcnt;
6249 uint32_t instance_ptr;
6251 static void LDKWatch_JCalls_free(void* this_arg) {
6252 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6253 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6257 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6258 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6259 LDKOutPoint funding_txo_var = funding_txo;
6260 uint64_t funding_txo_ref = 0;
6261 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6262 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6263 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6264 funding_txo_ref = (uint64_t)funding_txo_var.inner;
6265 if (funding_txo_var.is_owned) {
6266 funding_txo_ref |= 1;
6268 LDKChannelMonitor monitor_var = monitor;
6269 uint64_t monitor_ref = 0;
6270 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6271 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6272 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6273 monitor_ref = (uint64_t)monitor_var.inner;
6274 if (monitor_var.is_owned) {
6277 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 20, (uint32_t)funding_txo_ref, (uint32_t)monitor_ref);
6278 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6279 CHECK_ACCESS(ret_ptr);
6280 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6284 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
6285 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6286 LDKOutPoint funding_txo_var = funding_txo;
6287 uint64_t funding_txo_ref = 0;
6288 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6289 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6290 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6291 funding_txo_ref = (uint64_t)funding_txo_var.inner;
6292 if (funding_txo_var.is_owned) {
6293 funding_txo_ref |= 1;
6295 LDKChannelMonitorUpdate update_var = update;
6296 uint64_t update_ref = 0;
6297 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6298 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6299 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6300 update_ref = (uint64_t)update_var.inner;
6301 if (update_var.is_owned) {
6304 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 21, (uint32_t)funding_txo_ref, (uint32_t)update_ref);
6305 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6306 CHECK_ACCESS(ret_ptr);
6307 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6311 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6312 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6313 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 22);
6314 LDKCVec_MonitorEventZ ret_constr;
6315 ret_constr.datalen = ret->arr_len;
6316 if (ret_constr.datalen > 0)
6317 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
6319 ret_constr.data = NULL;
6320 uint32_t* ret_vals = ret->elems;
6321 for (size_t o = 0; o < ret_constr.datalen; o++) {
6322 uint32_t ret_conv_14 = ret_vals[o];
6323 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
6324 CHECK_ACCESS(ret_conv_14_ptr);
6325 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
6326 FREE((void*)ret_conv_14);
6327 ret_constr.data[o] = ret_conv_14_conv;
6331 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6332 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6333 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6335 static inline LDKWatch LDKWatch_init (JSValue o) {
6336 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6337 atomic_init(&calls->refcnt, 1);
6338 calls->instance_ptr = o;
6341 .this_arg = (void*) calls,
6342 .watch_channel = watch_channel_LDKWatch_jcall,
6343 .update_channel = update_channel_LDKWatch_jcall,
6344 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6345 .free = LDKWatch_JCalls_free,
6349 long __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
6350 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6351 *res_ptr = LDKWatch_init(o);
6352 return (long)res_ptr;
6354 uint32_t __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
6355 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6356 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6357 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6358 LDKOutPoint funding_txo_conv;
6359 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6360 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6361 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6362 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6363 LDKChannelMonitor monitor_conv;
6364 monitor_conv.inner = (void*)(monitor & (~1));
6365 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
6366 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6367 monitor_conv = ChannelMonitor_clone(&monitor_conv);
6368 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6369 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6370 return (uint64_t)ret_conv;
6373 uint32_t __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
6374 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6375 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6376 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6377 LDKOutPoint funding_txo_conv;
6378 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6379 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6380 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6381 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6382 LDKChannelMonitorUpdate update_conv;
6383 update_conv.inner = (void*)(update & (~1));
6384 update_conv.is_owned = (update & 1) || (update == 0);
6385 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6386 update_conv = ChannelMonitorUpdate_clone(&update_conv);
6387 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6388 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
6389 return (uint64_t)ret_conv;
6392 uint32_tArray __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
6393 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6394 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6395 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6396 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6397 uint32_tArray ret_arr = NULL;
6398 ret_arr = init_uint32_tArray(ret_var.datalen);
6399 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
6400 for (size_t o = 0; o < ret_var.datalen; o++) {
6401 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
6402 *ret_conv_14_copy = ret_var.data[o];
6403 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
6404 ret_arr_ptr[o] = ret_conv_14_ref;
6411 typedef struct LDKBroadcasterInterface_JCalls {
6412 atomic_size_t refcnt;
6413 uint32_t instance_ptr;
6414 } LDKBroadcasterInterface_JCalls;
6415 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6416 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6417 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6421 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
6422 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6423 LDKTransaction tx_var = tx;
6424 int8_tArray tx_arr = init_int8_tArray(tx_var.datalen);
6425 memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
6426 Transaction_free(tx_var);
6427 js_invoke_function_1(j_calls->instance_ptr, 23, (uint32_t)tx_arr);
6429 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6430 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6431 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6433 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
6434 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6435 atomic_init(&calls->refcnt, 1);
6436 calls->instance_ptr = o;
6438 LDKBroadcasterInterface ret = {
6439 .this_arg = (void*) calls,
6440 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
6441 .free = LDKBroadcasterInterface_JCalls_free,
6445 long __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
6446 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6447 *res_ptr = LDKBroadcasterInterface_init(o);
6448 return (long)res_ptr;
6450 void __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
6451 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6452 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6453 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6454 LDKTransaction tx_ref;
6455 tx_ref.datalen = tx->arr_len;
6456 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
6457 memcpy(tx_ref.data, tx->elems, tx_ref.datalen);
6458 tx_ref.data_is_owned = true;
6459 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
6462 typedef struct LDKKeysInterface_JCalls {
6463 atomic_size_t refcnt;
6464 uint32_t instance_ptr;
6465 } LDKKeysInterface_JCalls;
6466 static void LDKKeysInterface_JCalls_free(void* this_arg) {
6467 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6468 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6472 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
6473 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6474 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 24);
6475 LDKSecretKey ret_ref;
6476 CHECK(ret->arr_len == 32);
6477 memcpy(ret_ref.bytes, ret->elems, 32);
6480 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
6481 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6482 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 25);
6483 LDKCVec_u8Z ret_ref;
6484 ret_ref.datalen = ret->arr_len;
6485 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6486 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
6489 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
6490 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6491 uint32_t ret = js_invoke_function_0(j_calls->instance_ptr, 26);
6492 LDKShutdownScript ret_conv;
6493 ret_conv.inner = (void*)(ret & (~1));
6494 ret_conv.is_owned = (ret & 1) || (ret == 0);
6495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6498 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
6499 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6500 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 27, (uint32_t)inbound, (uint32_t)channel_value_satoshis);
6501 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6502 CHECK_ACCESS(ret_ptr);
6503 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
6507 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
6508 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6509 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 28);
6510 LDKThirtyTwoBytes ret_ref;
6511 CHECK(ret->arr_len == 32);
6512 memcpy(ret_ref.data, ret->elems, 32);
6515 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
6516 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6517 LDKu8slice reader_var = reader;
6518 int8_tArray reader_arr = init_int8_tArray(reader_var.datalen);
6519 memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6520 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 29, (uint32_t)reader_arr);
6521 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6522 CHECK_ACCESS(ret_ptr);
6523 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
6527 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
6528 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6529 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
6530 int8_tArray invoice_preimage_arr = init_int8_tArray(invoice_preimage_var.datalen);
6531 memcpy(invoice_preimage_arr->elems, invoice_preimage_var.data, invoice_preimage_var.datalen);
6532 CVec_u8Z_free(invoice_preimage_var);
6533 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 30, (uint32_t)invoice_preimage_arr);
6534 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6535 CHECK_ACCESS(ret_ptr);
6536 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6540 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
6541 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6542 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 31);
6543 LDKThirtyTwoBytes ret_ref;
6544 CHECK(ret->arr_len == 32);
6545 memcpy(ret_ref.data, ret->elems, 32);
6548 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
6549 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
6550 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6552 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
6553 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
6554 atomic_init(&calls->refcnt, 1);
6555 calls->instance_ptr = o;
6557 LDKKeysInterface ret = {
6558 .this_arg = (void*) calls,
6559 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
6560 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
6561 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
6562 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
6563 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
6564 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
6565 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
6566 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
6567 .free = LDKKeysInterface_JCalls_free,
6571 long __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
6572 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6573 *res_ptr = LDKKeysInterface_init(o);
6574 return (long)res_ptr;
6576 int8_tArray __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
6577 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6578 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6579 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6580 int8_tArray ret_arr = init_int8_tArray(32);
6581 memcpy(ret_arr->elems, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
6585 int8_tArray __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
6586 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6587 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6588 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6589 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6590 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
6591 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6592 CVec_u8Z_free(ret_var);
6596 uint32_t __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
6597 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6598 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6599 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6600 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6601 uint64_t ret_ref = 0;
6602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6605 ret_ref = (uint64_t)ret_var.inner;
6606 if (ret_var.is_owned) {
6612 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) {
6613 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6614 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6615 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6616 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6617 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6618 return (uint64_t)ret_ret;
6621 int8_tArray __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
6622 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6623 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6624 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6625 int8_tArray ret_arr = init_int8_tArray(32);
6626 memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
6630 uint32_t __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
6631 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6632 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6633 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6634 LDKu8slice reader_ref;
6635 reader_ref.datalen = reader->arr_len;
6636 reader_ref.data = reader->elems;
6637 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6638 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6639 return (uint64_t)ret_conv;
6642 uint32_t __attribute__((export_name("TS_KeysInterface_sign_invoice"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
6643 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6644 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6645 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6646 LDKCVec_u8Z invoice_preimage_ref;
6647 invoice_preimage_ref.datalen = invoice_preimage->arr_len;
6648 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
6649 memcpy(invoice_preimage_ref.data, invoice_preimage->elems, invoice_preimage_ref.datalen);
6650 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6651 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
6652 return (uint64_t)ret_conv;
6655 int8_tArray __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) {
6656 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6657 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6658 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6659 int8_tArray ret_arr = init_int8_tArray(32);
6660 memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6664 typedef struct LDKFeeEstimator_JCalls {
6665 atomic_size_t refcnt;
6666 uint32_t instance_ptr;
6667 } LDKFeeEstimator_JCalls;
6668 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6669 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6670 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6674 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6675 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6676 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6677 return js_invoke_function_1(j_calls->instance_ptr, 32, (uint32_t)confirmation_target_conv);
6679 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6680 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6681 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6683 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
6684 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6685 atomic_init(&calls->refcnt, 1);
6686 calls->instance_ptr = o;
6688 LDKFeeEstimator ret = {
6689 .this_arg = (void*) calls,
6690 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6691 .free = LDKFeeEstimator_JCalls_free,
6695 long __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
6696 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6697 *res_ptr = LDKFeeEstimator_init(o);
6698 return (long)res_ptr;
6700 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) {
6701 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6702 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6703 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6704 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6705 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6709 typedef struct LDKLogger_JCalls {
6710 atomic_size_t refcnt;
6711 uint32_t instance_ptr;
6713 static void LDKLogger_JCalls_free(void* this_arg) {
6714 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6715 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6719 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
6720 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6721 LDKRecord record_var = *record;
6722 uint64_t record_ref = 0;
6723 record_var = Record_clone(record);
6724 CHECK((((uint64_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6725 CHECK((((uint64_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6726 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
6727 record_ref = (uint64_t)record_var.inner;
6728 if (record_var.is_owned) {
6731 js_invoke_function_1(j_calls->instance_ptr, 33, (uint32_t)record_ref);
6733 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
6734 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
6735 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6737 static inline LDKLogger LDKLogger_init (JSValue o) {
6738 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
6739 atomic_init(&calls->refcnt, 1);
6740 calls->instance_ptr = o;
6743 .this_arg = (void*) calls,
6744 .log = log_LDKLogger_jcall,
6745 .free = LDKLogger_JCalls_free,
6749 long __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
6750 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
6751 *res_ptr = LDKLogger_init(o);
6752 return (long)res_ptr;
6754 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6755 return ThirtyTwoBytes_clone(&owner->a);
6757 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t owner) {
6758 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6759 int8_tArray ret_arr = init_int8_tArray(32);
6760 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
6764 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6767 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t owner) {
6768 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6769 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6770 uint64_t ret_ref = 0;
6771 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6772 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6773 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6774 ret_ref = (uint64_t)ret_var.inner & ~1;
6778 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6779 CHECK(owner->result_ok);
6780 return &*owner->contents.result;
6782 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t owner) {
6783 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6784 uint64_t ret_ret = (uint64_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
6788 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6789 CHECK(!owner->result_ok);
6790 return DecodeError_clone(&*owner->contents.err);
6792 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t owner) {
6793 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6794 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6795 uint64_t ret_ref = 0;
6796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6799 ret_ref = (uint64_t)ret_var.inner;
6800 if (ret_var.is_owned) {
6806 typedef struct LDKMessageSendEventsProvider_JCalls {
6807 atomic_size_t refcnt;
6808 uint32_t instance_ptr;
6809 } LDKMessageSendEventsProvider_JCalls;
6810 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
6811 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6812 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6816 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
6817 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6818 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 34);
6819 LDKCVec_MessageSendEventZ ret_constr;
6820 ret_constr.datalen = ret->arr_len;
6821 if (ret_constr.datalen > 0)
6822 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6824 ret_constr.data = NULL;
6825 uint32_t* ret_vals = ret->elems;
6826 for (size_t s = 0; s < ret_constr.datalen; s++) {
6827 uint32_t ret_conv_18 = ret_vals[s];
6828 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
6829 CHECK_ACCESS(ret_conv_18_ptr);
6830 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
6831 FREE((void*)ret_conv_18);
6832 ret_constr.data[s] = ret_conv_18_conv;
6836 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
6837 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
6838 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6840 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
6841 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
6842 atomic_init(&calls->refcnt, 1);
6843 calls->instance_ptr = o;
6845 LDKMessageSendEventsProvider ret = {
6846 .this_arg = (void*) calls,
6847 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6848 .free = LDKMessageSendEventsProvider_JCalls_free,
6852 long __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
6853 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6854 *res_ptr = LDKMessageSendEventsProvider_init(o);
6855 return (long)res_ptr;
6857 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) {
6858 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6859 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6860 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
6861 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6862 uint32_tArray ret_arr = NULL;
6863 ret_arr = init_uint32_tArray(ret_var.datalen);
6864 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
6865 for (size_t s = 0; s < ret_var.datalen; s++) {
6866 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6867 *ret_conv_18_copy = ret_var.data[s];
6868 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6869 ret_arr_ptr[s] = ret_conv_18_ref;
6876 typedef struct LDKEventHandler_JCalls {
6877 atomic_size_t refcnt;
6878 uint32_t instance_ptr;
6879 } LDKEventHandler_JCalls;
6880 static void LDKEventHandler_JCalls_free(void* this_arg) {
6881 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6882 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6886 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
6887 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6888 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
6889 *ret_event = Event_clone(event);
6890 js_invoke_function_1(j_calls->instance_ptr, 35, (uint32_t)(uint64_t)ret_event);
6892 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
6893 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
6894 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6896 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
6897 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6898 atomic_init(&calls->refcnt, 1);
6899 calls->instance_ptr = o;
6901 LDKEventHandler ret = {
6902 .this_arg = (void*) calls,
6903 .handle_event = handle_event_LDKEventHandler_jcall,
6904 .free = LDKEventHandler_JCalls_free,
6908 long __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
6909 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6910 *res_ptr = LDKEventHandler_init(o);
6911 return (long)res_ptr;
6913 void __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
6914 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6915 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6916 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
6917 LDKEvent* event_conv = (LDKEvent*)event;
6918 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6921 typedef struct LDKEventsProvider_JCalls {
6922 atomic_size_t refcnt;
6923 uint32_t instance_ptr;
6924 } LDKEventsProvider_JCalls;
6925 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6926 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6927 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6931 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6932 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6933 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6934 *handler_ret = handler;
6935 js_invoke_function_1(j_calls->instance_ptr, 36, (uint32_t)(uint64_t)handler_ret);
6937 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
6938 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
6939 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6941 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
6942 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6943 atomic_init(&calls->refcnt, 1);
6944 calls->instance_ptr = o;
6946 LDKEventsProvider ret = {
6947 .this_arg = (void*) calls,
6948 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6949 .free = LDKEventsProvider_JCalls_free,
6953 long __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
6954 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6955 *res_ptr = LDKEventsProvider_init(o);
6956 return (long)res_ptr;
6958 void __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
6959 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6960 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6961 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
6962 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
6963 CHECK_ACCESS(handler_ptr);
6964 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
6965 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6968 typedef struct LDKListen_JCalls {
6969 atomic_size_t refcnt;
6970 uint32_t instance_ptr;
6972 static void LDKListen_JCalls_free(void* this_arg) {
6973 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6974 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6978 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6979 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6980 LDKu8slice block_var = block;
6981 int8_tArray block_arr = init_int8_tArray(block_var.datalen);
6982 memcpy(block_arr->elems, block_var.data, block_var.datalen);
6983 js_invoke_function_2(j_calls->instance_ptr, 37, (uint32_t)block_arr, (uint32_t)height);
6985 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6986 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6987 int8_tArray header_arr = init_int8_tArray(80);
6988 memcpy(header_arr->elems, *header, 80);
6989 js_invoke_function_2(j_calls->instance_ptr, 38, (uint32_t)header_arr, (uint32_t)height);
6991 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
6992 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
6993 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6995 static inline LDKListen LDKListen_init (JSValue o) {
6996 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6997 atomic_init(&calls->refcnt, 1);
6998 calls->instance_ptr = o;
7001 .this_arg = (void*) calls,
7002 .block_connected = block_connected_LDKListen_jcall,
7003 .block_disconnected = block_disconnected_LDKListen_jcall,
7004 .free = LDKListen_JCalls_free,
7008 long __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
7009 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
7010 *res_ptr = LDKListen_init(o);
7011 return (long)res_ptr;
7013 void __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
7014 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7015 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7016 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
7017 LDKu8slice block_ref;
7018 block_ref.datalen = block->arr_len;
7019 block_ref.data = block->elems;
7020 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
7023 void __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
7024 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7025 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7026 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
7027 unsigned char header_arr[80];
7028 CHECK(header->arr_len == 80);
7029 memcpy(header_arr, header->elems, 80);
7030 unsigned char (*header_ref)[80] = &header_arr;
7031 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
7034 typedef struct LDKConfirm_JCalls {
7035 atomic_size_t refcnt;
7036 uint32_t instance_ptr;
7037 } LDKConfirm_JCalls;
7038 static void LDKConfirm_JCalls_free(void* this_arg) {
7039 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7040 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7044 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
7045 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7046 int8_tArray header_arr = init_int8_tArray(80);
7047 memcpy(header_arr->elems, *header, 80);
7048 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
7049 uint32_tArray txdata_arr = NULL;
7050 txdata_arr = init_uint32_tArray(txdata_var.datalen);
7051 uint32_t *txdata_arr_ptr = (uint32_t*)(((uint8_t*)txdata_arr) + 4);
7052 for (size_t c = 0; c < txdata_var.datalen; c++) {
7053 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7054 *txdata_conv_28_conv = txdata_var.data[c];
7055 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
7058 FREE(txdata_var.data);
7059 js_invoke_function_3(j_calls->instance_ptr, 39, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height);
7061 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
7062 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7063 int8_tArray txid_arr = init_int8_tArray(32);
7064 memcpy(txid_arr->elems, *txid, 32);
7065 js_invoke_function_1(j_calls->instance_ptr, 40, (uint32_t)txid_arr);
7067 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7068 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7069 int8_tArray header_arr = init_int8_tArray(80);
7070 memcpy(header_arr->elems, *header, 80);
7071 js_invoke_function_2(j_calls->instance_ptr, 41, (uint32_t)header_arr, (uint32_t)height);
7073 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
7074 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7075 ptrArray ret = (ptrArray)js_invoke_function_0(j_calls->instance_ptr, 42);
7076 LDKCVec_TxidZ ret_constr;
7077 ret_constr.datalen = ret->arr_len;
7078 if (ret_constr.datalen > 0)
7079 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
7081 ret_constr.data = NULL;
7082 int8_tArray* ret_vals = (void*) ret->elems;
7083 for (size_t m = 0; m < ret_constr.datalen; m++) {
7084 int8_tArray ret_conv_12 = ret_vals[m];
7085 LDKThirtyTwoBytes ret_conv_12_ref;
7086 CHECK(ret_conv_12->arr_len == 32);
7087 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32);
7088 ret_constr.data[m] = ret_conv_12_ref;
7092 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
7093 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
7094 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7096 static inline LDKConfirm LDKConfirm_init (JSValue o) {
7097 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
7098 atomic_init(&calls->refcnt, 1);
7099 calls->instance_ptr = o;
7102 .this_arg = (void*) calls,
7103 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
7104 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
7105 .best_block_updated = best_block_updated_LDKConfirm_jcall,
7106 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
7107 .free = LDKConfirm_JCalls_free,
7111 long __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
7112 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
7113 *res_ptr = LDKConfirm_init(o);
7114 return (long)res_ptr;
7116 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) {
7117 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7118 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7119 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
7120 unsigned char header_arr[80];
7121 CHECK(header->arr_len == 80);
7122 memcpy(header_arr, header->elems, 80);
7123 unsigned char (*header_ref)[80] = &header_arr;
7124 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7125 txdata_constr.datalen = txdata->arr_len;
7126 if (txdata_constr.datalen > 0)
7127 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7129 txdata_constr.data = NULL;
7130 uint32_t* txdata_vals = txdata->elems;
7131 for (size_t c = 0; c < txdata_constr.datalen; c++) {
7132 uint32_t txdata_conv_28 = txdata_vals[c];
7133 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
7134 CHECK_ACCESS(txdata_conv_28_ptr);
7135 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
7136 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
7137 txdata_constr.data[c] = txdata_conv_28_conv;
7139 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
7142 void __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
7143 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7144 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7145 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
7146 unsigned char txid_arr[32];
7147 CHECK(txid->arr_len == 32);
7148 memcpy(txid_arr, txid->elems, 32);
7149 unsigned char (*txid_ref)[32] = &txid_arr;
7150 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
7153 void __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
7154 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7155 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7156 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
7157 unsigned char header_arr[80];
7158 CHECK(header->arr_len == 80);
7159 memcpy(header_arr, header->elems, 80);
7160 unsigned char (*header_ref)[80] = &header_arr;
7161 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
7164 ptrArray __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
7165 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7166 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7167 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
7168 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
7169 ptrArray ret_arr = NULL;
7170 ret_arr = init_ptrArray(ret_var.datalen);
7171 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
7172 for (size_t m = 0; m < ret_var.datalen; m++) {
7173 int8_tArray ret_conv_12_arr = init_int8_tArray(32);
7174 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
7175 ret_arr_ptr[m] = ret_conv_12_arr;
7182 typedef struct LDKPersist_JCalls {
7183 atomic_size_t refcnt;
7184 uint32_t instance_ptr;
7185 } LDKPersist_JCalls;
7186 static void LDKPersist_JCalls_free(void* this_arg) {
7187 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7188 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7192 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
7193 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7194 LDKOutPoint channel_id_var = channel_id;
7195 uint64_t channel_id_ref = 0;
7196 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7197 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7198 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
7199 channel_id_ref = (uint64_t)channel_id_var.inner;
7200 if (channel_id_var.is_owned) {
7201 channel_id_ref |= 1;
7203 LDKChannelMonitor data_var = *data;
7204 uint64_t data_ref = 0;
7205 data_var = ChannelMonitor_clone(data);
7206 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7207 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7208 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
7209 data_ref = (uint64_t)data_var.inner;
7210 if (data_var.is_owned) {
7213 LDKMonitorUpdateId update_id_var = update_id;
7214 uint64_t update_id_ref = 0;
7215 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7216 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7217 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
7218 update_id_ref = (uint64_t)update_id_var.inner;
7219 if (update_id_var.is_owned) {
7222 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);
7223 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7224 CHECK_ACCESS(ret_ptr);
7225 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
7229 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
7230 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7231 LDKOutPoint channel_id_var = channel_id;
7232 uint64_t channel_id_ref = 0;
7233 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7234 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7235 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
7236 channel_id_ref = (uint64_t)channel_id_var.inner;
7237 if (channel_id_var.is_owned) {
7238 channel_id_ref |= 1;
7240 LDKChannelMonitorUpdate update_var = *update;
7241 uint64_t update_ref = 0;
7242 if ((uint64_t)update_var.inner > 4096) {
7243 update_var = ChannelMonitorUpdate_clone(update);
7244 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7245 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7246 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
7247 update_ref = (uint64_t)update_var.inner;
7248 if (update_var.is_owned) {
7252 LDKChannelMonitor data_var = *data;
7253 uint64_t data_ref = 0;
7254 data_var = ChannelMonitor_clone(data);
7255 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7256 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7257 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
7258 data_ref = (uint64_t)data_var.inner;
7259 if (data_var.is_owned) {
7262 LDKMonitorUpdateId update_id_var = update_id;
7263 uint64_t update_id_ref = 0;
7264 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7265 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7266 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
7267 update_id_ref = (uint64_t)update_id_var.inner;
7268 if (update_id_var.is_owned) {
7271 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);
7272 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7273 CHECK_ACCESS(ret_ptr);
7274 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
7278 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
7279 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
7280 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7282 static inline LDKPersist LDKPersist_init (JSValue o) {
7283 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
7284 atomic_init(&calls->refcnt, 1);
7285 calls->instance_ptr = o;
7288 .this_arg = (void*) calls,
7289 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
7290 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
7291 .free = LDKPersist_JCalls_free,
7295 long __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
7296 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
7297 *res_ptr = LDKPersist_init(o);
7298 return (long)res_ptr;
7300 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) {
7301 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7302 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7303 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
7304 LDKOutPoint channel_id_conv;
7305 channel_id_conv.inner = (void*)(channel_id & (~1));
7306 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
7307 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
7308 channel_id_conv = OutPoint_clone(&channel_id_conv);
7309 LDKChannelMonitor data_conv;
7310 data_conv.inner = (void*)(data & (~1));
7311 data_conv.is_owned = false;
7312 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
7313 LDKMonitorUpdateId update_id_conv;
7314 update_id_conv.inner = (void*)(update_id & (~1));
7315 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
7316 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
7317 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
7318 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7319 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
7320 return (uint64_t)ret_conv;
7323 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) {
7324 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7325 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7326 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
7327 LDKOutPoint channel_id_conv;
7328 channel_id_conv.inner = (void*)(channel_id & (~1));
7329 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
7330 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
7331 channel_id_conv = OutPoint_clone(&channel_id_conv);
7332 LDKChannelMonitorUpdate update_conv;
7333 update_conv.inner = (void*)(update & (~1));
7334 update_conv.is_owned = false;
7335 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
7336 LDKChannelMonitor data_conv;
7337 data_conv.inner = (void*)(data & (~1));
7338 data_conv.is_owned = false;
7339 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
7340 LDKMonitorUpdateId update_id_conv;
7341 update_id_conv.inner = (void*)(update_id & (~1));
7342 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
7343 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
7344 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
7345 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7346 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
7347 return (uint64_t)ret_conv;
7350 typedef struct LDKChannelMessageHandler_JCalls {
7351 atomic_size_t refcnt;
7352 uint32_t instance_ptr;
7353 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7354 } LDKChannelMessageHandler_JCalls;
7355 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
7356 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7357 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7361 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
7362 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7363 int8_tArray their_node_id_arr = init_int8_tArray(33);
7364 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7365 LDKInitFeatures their_features_var = their_features;
7366 uint64_t their_features_ref = 0;
7367 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7368 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7369 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
7370 their_features_ref = (uint64_t)their_features_var.inner;
7371 if (their_features_var.is_owned) {
7372 their_features_ref |= 1;
7374 LDKOpenChannel msg_var = *msg;
7375 uint64_t msg_ref = 0;
7376 msg_var = OpenChannel_clone(msg);
7377 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7378 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7379 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7380 msg_ref = (uint64_t)msg_var.inner;
7381 if (msg_var.is_owned) {
7384 js_invoke_function_3(j_calls->instance_ptr, 45, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
7386 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
7387 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7388 int8_tArray their_node_id_arr = init_int8_tArray(33);
7389 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7390 LDKInitFeatures their_features_var = their_features;
7391 uint64_t their_features_ref = 0;
7392 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7393 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7394 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
7395 their_features_ref = (uint64_t)their_features_var.inner;
7396 if (their_features_var.is_owned) {
7397 their_features_ref |= 1;
7399 LDKAcceptChannel msg_var = *msg;
7400 uint64_t msg_ref = 0;
7401 msg_var = AcceptChannel_clone(msg);
7402 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7403 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7404 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7405 msg_ref = (uint64_t)msg_var.inner;
7406 if (msg_var.is_owned) {
7409 js_invoke_function_3(j_calls->instance_ptr, 46, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
7411 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
7412 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7413 int8_tArray their_node_id_arr = init_int8_tArray(33);
7414 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7415 LDKFundingCreated msg_var = *msg;
7416 uint64_t msg_ref = 0;
7417 msg_var = FundingCreated_clone(msg);
7418 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7419 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7420 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7421 msg_ref = (uint64_t)msg_var.inner;
7422 if (msg_var.is_owned) {
7425 js_invoke_function_2(j_calls->instance_ptr, 47, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7427 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7428 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7429 int8_tArray their_node_id_arr = init_int8_tArray(33);
7430 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7431 LDKFundingSigned msg_var = *msg;
7432 uint64_t msg_ref = 0;
7433 msg_var = FundingSigned_clone(msg);
7434 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7435 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7436 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7437 msg_ref = (uint64_t)msg_var.inner;
7438 if (msg_var.is_owned) {
7441 js_invoke_function_2(j_calls->instance_ptr, 48, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7443 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7444 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7445 int8_tArray their_node_id_arr = init_int8_tArray(33);
7446 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7447 LDKFundingLocked msg_var = *msg;
7448 uint64_t msg_ref = 0;
7449 msg_var = FundingLocked_clone(msg);
7450 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7451 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7452 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7453 msg_ref = (uint64_t)msg_var.inner;
7454 if (msg_var.is_owned) {
7457 js_invoke_function_2(j_calls->instance_ptr, 49, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7459 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7460 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7461 int8_tArray their_node_id_arr = init_int8_tArray(33);
7462 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7463 LDKInitFeatures their_features_var = *their_features;
7464 uint64_t their_features_ref = 0;
7465 their_features_var = InitFeatures_clone(their_features);
7466 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7467 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7468 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
7469 their_features_ref = (uint64_t)their_features_var.inner;
7470 if (their_features_var.is_owned) {
7471 their_features_ref |= 1;
7473 LDKShutdown msg_var = *msg;
7474 uint64_t msg_ref = 0;
7475 msg_var = Shutdown_clone(msg);
7476 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7477 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7478 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7479 msg_ref = (uint64_t)msg_var.inner;
7480 if (msg_var.is_owned) {
7483 js_invoke_function_3(j_calls->instance_ptr, 50, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
7485 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7486 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7487 int8_tArray their_node_id_arr = init_int8_tArray(33);
7488 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7489 LDKClosingSigned msg_var = *msg;
7490 uint64_t msg_ref = 0;
7491 msg_var = ClosingSigned_clone(msg);
7492 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7493 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7494 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7495 msg_ref = (uint64_t)msg_var.inner;
7496 if (msg_var.is_owned) {
7499 js_invoke_function_2(j_calls->instance_ptr, 51, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7501 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7502 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7503 int8_tArray their_node_id_arr = init_int8_tArray(33);
7504 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7505 LDKUpdateAddHTLC msg_var = *msg;
7506 uint64_t msg_ref = 0;
7507 msg_var = UpdateAddHTLC_clone(msg);
7508 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7509 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7510 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7511 msg_ref = (uint64_t)msg_var.inner;
7512 if (msg_var.is_owned) {
7515 js_invoke_function_2(j_calls->instance_ptr, 52, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7517 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7518 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7519 int8_tArray their_node_id_arr = init_int8_tArray(33);
7520 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7521 LDKUpdateFulfillHTLC msg_var = *msg;
7522 uint64_t msg_ref = 0;
7523 msg_var = UpdateFulfillHTLC_clone(msg);
7524 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7525 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7526 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7527 msg_ref = (uint64_t)msg_var.inner;
7528 if (msg_var.is_owned) {
7531 js_invoke_function_2(j_calls->instance_ptr, 53, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7533 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7534 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7535 int8_tArray their_node_id_arr = init_int8_tArray(33);
7536 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7537 LDKUpdateFailHTLC msg_var = *msg;
7538 uint64_t msg_ref = 0;
7539 msg_var = UpdateFailHTLC_clone(msg);
7540 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7541 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7542 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7543 msg_ref = (uint64_t)msg_var.inner;
7544 if (msg_var.is_owned) {
7547 js_invoke_function_2(j_calls->instance_ptr, 54, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7549 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7550 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7551 int8_tArray their_node_id_arr = init_int8_tArray(33);
7552 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7553 LDKUpdateFailMalformedHTLC msg_var = *msg;
7554 uint64_t msg_ref = 0;
7555 msg_var = UpdateFailMalformedHTLC_clone(msg);
7556 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7557 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7558 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7559 msg_ref = (uint64_t)msg_var.inner;
7560 if (msg_var.is_owned) {
7563 js_invoke_function_2(j_calls->instance_ptr, 55, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7565 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7566 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7567 int8_tArray their_node_id_arr = init_int8_tArray(33);
7568 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7569 LDKCommitmentSigned msg_var = *msg;
7570 uint64_t msg_ref = 0;
7571 msg_var = CommitmentSigned_clone(msg);
7572 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7573 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7574 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7575 msg_ref = (uint64_t)msg_var.inner;
7576 if (msg_var.is_owned) {
7579 js_invoke_function_2(j_calls->instance_ptr, 56, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7581 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7582 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7583 int8_tArray their_node_id_arr = init_int8_tArray(33);
7584 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7585 LDKRevokeAndACK msg_var = *msg;
7586 uint64_t msg_ref = 0;
7587 msg_var = RevokeAndACK_clone(msg);
7588 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7589 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7590 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7591 msg_ref = (uint64_t)msg_var.inner;
7592 if (msg_var.is_owned) {
7595 js_invoke_function_2(j_calls->instance_ptr, 57, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7597 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7598 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7599 int8_tArray their_node_id_arr = init_int8_tArray(33);
7600 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7601 LDKUpdateFee msg_var = *msg;
7602 uint64_t msg_ref = 0;
7603 msg_var = UpdateFee_clone(msg);
7604 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7605 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7606 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7607 msg_ref = (uint64_t)msg_var.inner;
7608 if (msg_var.is_owned) {
7611 js_invoke_function_2(j_calls->instance_ptr, 58, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7613 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7614 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7615 int8_tArray their_node_id_arr = init_int8_tArray(33);
7616 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7617 LDKAnnouncementSignatures msg_var = *msg;
7618 uint64_t msg_ref = 0;
7619 msg_var = AnnouncementSignatures_clone(msg);
7620 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7621 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7622 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7623 msg_ref = (uint64_t)msg_var.inner;
7624 if (msg_var.is_owned) {
7627 js_invoke_function_2(j_calls->instance_ptr, 59, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7629 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7630 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7631 int8_tArray their_node_id_arr = init_int8_tArray(33);
7632 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7633 js_invoke_function_2(j_calls->instance_ptr, 60, (uint32_t)their_node_id_arr, (uint32_t)no_connection_possible);
7635 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7636 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7637 int8_tArray their_node_id_arr = init_int8_tArray(33);
7638 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7639 LDKInit msg_var = *msg;
7640 uint64_t msg_ref = 0;
7641 msg_var = Init_clone(msg);
7642 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7643 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7644 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7645 msg_ref = (uint64_t)msg_var.inner;
7646 if (msg_var.is_owned) {
7649 js_invoke_function_2(j_calls->instance_ptr, 61, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7651 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7652 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7653 int8_tArray their_node_id_arr = init_int8_tArray(33);
7654 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7655 LDKChannelReestablish msg_var = *msg;
7656 uint64_t msg_ref = 0;
7657 msg_var = ChannelReestablish_clone(msg);
7658 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7659 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7660 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7661 msg_ref = (uint64_t)msg_var.inner;
7662 if (msg_var.is_owned) {
7665 js_invoke_function_2(j_calls->instance_ptr, 62, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7667 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
7668 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7669 int8_tArray their_node_id_arr = init_int8_tArray(33);
7670 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7671 LDKChannelUpdate msg_var = *msg;
7672 uint64_t msg_ref = 0;
7673 msg_var = ChannelUpdate_clone(msg);
7674 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7675 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7676 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7677 msg_ref = (uint64_t)msg_var.inner;
7678 if (msg_var.is_owned) {
7681 js_invoke_function_2(j_calls->instance_ptr, 63, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7683 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7684 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7685 int8_tArray their_node_id_arr = init_int8_tArray(33);
7686 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7687 LDKErrorMessage msg_var = *msg;
7688 uint64_t msg_ref = 0;
7689 msg_var = ErrorMessage_clone(msg);
7690 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7691 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7692 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7693 msg_ref = (uint64_t)msg_var.inner;
7694 if (msg_var.is_owned) {
7697 js_invoke_function_2(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7699 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
7700 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
7701 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7702 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7704 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
7705 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7706 atomic_init(&calls->refcnt, 1);
7707 calls->instance_ptr = o;
7709 LDKChannelMessageHandler ret = {
7710 .this_arg = (void*) calls,
7711 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7712 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7713 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7714 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7715 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7716 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7717 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7718 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7719 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7720 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7721 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7722 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7723 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7724 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7725 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7726 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7727 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7728 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7729 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7730 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7731 .free = LDKChannelMessageHandler_JCalls_free,
7732 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
7734 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7737 long __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
7738 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7739 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
7740 return (long)res_ptr;
7742 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) {
7743 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7744 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7745 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7746 LDKPublicKey their_node_id_ref;
7747 CHECK(their_node_id->arr_len == 33);
7748 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7749 LDKInitFeatures their_features_conv;
7750 their_features_conv.inner = (void*)(their_features & (~1));
7751 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7752 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
7753 their_features_conv = InitFeatures_clone(&their_features_conv);
7754 LDKOpenChannel msg_conv;
7755 msg_conv.inner = (void*)(msg & (~1));
7756 msg_conv.is_owned = false;
7757 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7758 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7761 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) {
7762 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7763 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7764 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7765 LDKPublicKey their_node_id_ref;
7766 CHECK(their_node_id->arr_len == 33);
7767 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7768 LDKInitFeatures their_features_conv;
7769 their_features_conv.inner = (void*)(their_features & (~1));
7770 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7771 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
7772 their_features_conv = InitFeatures_clone(&their_features_conv);
7773 LDKAcceptChannel msg_conv;
7774 msg_conv.inner = (void*)(msg & (~1));
7775 msg_conv.is_owned = false;
7776 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7777 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7780 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) {
7781 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7782 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7783 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7784 LDKPublicKey their_node_id_ref;
7785 CHECK(their_node_id->arr_len == 33);
7786 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7787 LDKFundingCreated msg_conv;
7788 msg_conv.inner = (void*)(msg & (~1));
7789 msg_conv.is_owned = false;
7790 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7791 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7794 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) {
7795 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7796 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7797 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7798 LDKPublicKey their_node_id_ref;
7799 CHECK(their_node_id->arr_len == 33);
7800 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7801 LDKFundingSigned msg_conv;
7802 msg_conv.inner = (void*)(msg & (~1));
7803 msg_conv.is_owned = false;
7804 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7805 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7808 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) {
7809 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7810 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7811 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7812 LDKPublicKey their_node_id_ref;
7813 CHECK(their_node_id->arr_len == 33);
7814 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7815 LDKFundingLocked msg_conv;
7816 msg_conv.inner = (void*)(msg & (~1));
7817 msg_conv.is_owned = false;
7818 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7819 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7822 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) {
7823 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7824 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7825 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7826 LDKPublicKey their_node_id_ref;
7827 CHECK(their_node_id->arr_len == 33);
7828 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7829 LDKInitFeatures their_features_conv;
7830 their_features_conv.inner = (void*)(their_features & (~1));
7831 their_features_conv.is_owned = false;
7832 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
7833 LDKShutdown msg_conv;
7834 msg_conv.inner = (void*)(msg & (~1));
7835 msg_conv.is_owned = false;
7836 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7837 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
7840 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) {
7841 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7842 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7843 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7844 LDKPublicKey their_node_id_ref;
7845 CHECK(their_node_id->arr_len == 33);
7846 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7847 LDKClosingSigned msg_conv;
7848 msg_conv.inner = (void*)(msg & (~1));
7849 msg_conv.is_owned = false;
7850 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7851 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7854 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) {
7855 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7856 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7857 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7858 LDKPublicKey their_node_id_ref;
7859 CHECK(their_node_id->arr_len == 33);
7860 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7861 LDKUpdateAddHTLC msg_conv;
7862 msg_conv.inner = (void*)(msg & (~1));
7863 msg_conv.is_owned = false;
7864 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7865 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7868 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) {
7869 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7870 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7871 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7872 LDKPublicKey their_node_id_ref;
7873 CHECK(their_node_id->arr_len == 33);
7874 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7875 LDKUpdateFulfillHTLC msg_conv;
7876 msg_conv.inner = (void*)(msg & (~1));
7877 msg_conv.is_owned = false;
7878 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7879 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7882 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) {
7883 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7884 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7885 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7886 LDKPublicKey their_node_id_ref;
7887 CHECK(their_node_id->arr_len == 33);
7888 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7889 LDKUpdateFailHTLC msg_conv;
7890 msg_conv.inner = (void*)(msg & (~1));
7891 msg_conv.is_owned = false;
7892 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7893 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7896 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) {
7897 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7898 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7899 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7900 LDKPublicKey their_node_id_ref;
7901 CHECK(their_node_id->arr_len == 33);
7902 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7903 LDKUpdateFailMalformedHTLC msg_conv;
7904 msg_conv.inner = (void*)(msg & (~1));
7905 msg_conv.is_owned = false;
7906 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7907 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7910 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) {
7911 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7912 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7913 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7914 LDKPublicKey their_node_id_ref;
7915 CHECK(their_node_id->arr_len == 33);
7916 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7917 LDKCommitmentSigned msg_conv;
7918 msg_conv.inner = (void*)(msg & (~1));
7919 msg_conv.is_owned = false;
7920 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7921 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7924 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) {
7925 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7926 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7927 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7928 LDKPublicKey their_node_id_ref;
7929 CHECK(their_node_id->arr_len == 33);
7930 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7931 LDKRevokeAndACK msg_conv;
7932 msg_conv.inner = (void*)(msg & (~1));
7933 msg_conv.is_owned = false;
7934 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7935 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7938 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) {
7939 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7940 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7941 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7942 LDKPublicKey their_node_id_ref;
7943 CHECK(their_node_id->arr_len == 33);
7944 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7945 LDKUpdateFee msg_conv;
7946 msg_conv.inner = (void*)(msg & (~1));
7947 msg_conv.is_owned = false;
7948 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7949 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7952 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) {
7953 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7954 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7955 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7956 LDKPublicKey their_node_id_ref;
7957 CHECK(their_node_id->arr_len == 33);
7958 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7959 LDKAnnouncementSignatures msg_conv;
7960 msg_conv.inner = (void*)(msg & (~1));
7961 msg_conv.is_owned = false;
7962 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7963 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7966 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) {
7967 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7968 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7969 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7970 LDKPublicKey their_node_id_ref;
7971 CHECK(their_node_id->arr_len == 33);
7972 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7973 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
7976 void __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7977 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7978 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7979 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7980 LDKPublicKey their_node_id_ref;
7981 CHECK(their_node_id->arr_len == 33);
7982 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7984 msg_conv.inner = (void*)(msg & (~1));
7985 msg_conv.is_owned = false;
7986 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7987 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7990 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) {
7991 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7992 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7993 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7994 LDKPublicKey their_node_id_ref;
7995 CHECK(their_node_id->arr_len == 33);
7996 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7997 LDKChannelReestablish msg_conv;
7998 msg_conv.inner = (void*)(msg & (~1));
7999 msg_conv.is_owned = false;
8000 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8001 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8004 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) {
8005 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8006 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8007 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8008 LDKPublicKey their_node_id_ref;
8009 CHECK(their_node_id->arr_len == 33);
8010 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8011 LDKChannelUpdate msg_conv;
8012 msg_conv.inner = (void*)(msg & (~1));
8013 msg_conv.is_owned = false;
8014 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8015 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8018 void __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8019 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8020 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8021 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8022 LDKPublicKey their_node_id_ref;
8023 CHECK(their_node_id->arr_len == 33);
8024 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8025 LDKErrorMessage msg_conv;
8026 msg_conv.inner = (void*)(msg & (~1));
8027 msg_conv.is_owned = false;
8028 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8029 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8032 typedef struct LDKRoutingMessageHandler_JCalls {
8033 atomic_size_t refcnt;
8034 uint32_t instance_ptr;
8035 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8036 } LDKRoutingMessageHandler_JCalls;
8037 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
8038 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8039 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8043 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
8044 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8045 LDKNodeAnnouncement msg_var = *msg;
8046 uint64_t msg_ref = 0;
8047 msg_var = NodeAnnouncement_clone(msg);
8048 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8049 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8050 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8051 msg_ref = (uint64_t)msg_var.inner;
8052 if (msg_var.is_owned) {
8055 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 65, (uint32_t)msg_ref);
8056 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8057 CHECK_ACCESS(ret_ptr);
8058 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
8062 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
8063 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8064 LDKChannelAnnouncement msg_var = *msg;
8065 uint64_t msg_ref = 0;
8066 msg_var = ChannelAnnouncement_clone(msg);
8067 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8068 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8069 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8070 msg_ref = (uint64_t)msg_var.inner;
8071 if (msg_var.is_owned) {
8074 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 66, (uint32_t)msg_ref);
8075 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8076 CHECK_ACCESS(ret_ptr);
8077 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
8081 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
8082 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8083 LDKChannelUpdate msg_var = *msg;
8084 uint64_t msg_ref = 0;
8085 msg_var = ChannelUpdate_clone(msg);
8086 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8087 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8088 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8089 msg_ref = (uint64_t)msg_var.inner;
8090 if (msg_var.is_owned) {
8093 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 67, (uint32_t)msg_ref);
8094 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8095 CHECK_ACCESS(ret_ptr);
8096 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
8100 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
8101 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8102 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->instance_ptr, 68, (uint32_t)starting_point, (uint32_t)batch_amount);
8103 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
8104 ret_constr.datalen = ret->arr_len;
8105 if (ret_constr.datalen > 0)
8106 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
8108 ret_constr.data = NULL;
8109 uint32_t* ret_vals = ret->elems;
8110 for (size_t h = 0; h < ret_constr.datalen; h++) {
8111 uint32_t ret_conv_59 = ret_vals[h];
8112 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
8113 CHECK_ACCESS(ret_conv_59_ptr);
8114 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
8115 FREE((void*)ret_conv_59);
8116 ret_constr.data[h] = ret_conv_59_conv;
8120 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
8121 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8122 int8_tArray starting_point_arr = init_int8_tArray(33);
8123 memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
8124 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->instance_ptr, 69, (uint32_t)starting_point_arr, (uint32_t)batch_amount);
8125 LDKCVec_NodeAnnouncementZ ret_constr;
8126 ret_constr.datalen = ret->arr_len;
8127 if (ret_constr.datalen > 0)
8128 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
8130 ret_constr.data = NULL;
8131 uint32_t* ret_vals = ret->elems;
8132 for (size_t s = 0; s < ret_constr.datalen; s++) {
8133 uint32_t ret_conv_18 = ret_vals[s];
8134 LDKNodeAnnouncement ret_conv_18_conv;
8135 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
8136 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
8137 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
8138 ret_constr.data[s] = ret_conv_18_conv;
8142 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
8143 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8144 int8_tArray their_node_id_arr = init_int8_tArray(33);
8145 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8146 LDKInit init_var = *init;
8147 uint64_t init_ref = 0;
8148 init_var = Init_clone(init);
8149 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8150 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8151 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
8152 init_ref = (uint64_t)init_var.inner;
8153 if (init_var.is_owned) {
8156 js_invoke_function_2(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, (uint32_t)init_ref);
8158 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
8159 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8160 int8_tArray their_node_id_arr = init_int8_tArray(33);
8161 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8162 LDKReplyChannelRange msg_var = msg;
8163 uint64_t msg_ref = 0;
8164 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8165 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8166 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8167 msg_ref = (uint64_t)msg_var.inner;
8168 if (msg_var.is_owned) {
8171 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8172 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8173 CHECK_ACCESS(ret_ptr);
8174 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
8178 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
8179 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8180 int8_tArray their_node_id_arr = init_int8_tArray(33);
8181 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8182 LDKReplyShortChannelIdsEnd msg_var = msg;
8183 uint64_t msg_ref = 0;
8184 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8185 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8186 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8187 msg_ref = (uint64_t)msg_var.inner;
8188 if (msg_var.is_owned) {
8191 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8192 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8193 CHECK_ACCESS(ret_ptr);
8194 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
8198 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
8199 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8200 int8_tArray their_node_id_arr = init_int8_tArray(33);
8201 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8202 LDKQueryChannelRange msg_var = msg;
8203 uint64_t msg_ref = 0;
8204 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8205 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8206 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8207 msg_ref = (uint64_t)msg_var.inner;
8208 if (msg_var.is_owned) {
8211 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8212 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8213 CHECK_ACCESS(ret_ptr);
8214 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
8218 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
8219 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8220 int8_tArray their_node_id_arr = init_int8_tArray(33);
8221 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8222 LDKQueryShortChannelIds msg_var = msg;
8223 uint64_t msg_ref = 0;
8224 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8225 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8226 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8227 msg_ref = (uint64_t)msg_var.inner;
8228 if (msg_var.is_owned) {
8231 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8232 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8233 CHECK_ACCESS(ret_ptr);
8234 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
8238 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
8239 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
8240 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8241 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8243 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
8244 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
8245 atomic_init(&calls->refcnt, 1);
8246 calls->instance_ptr = o;
8248 LDKRoutingMessageHandler ret = {
8249 .this_arg = (void*) calls,
8250 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
8251 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
8252 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
8253 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
8254 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
8255 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
8256 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
8257 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
8258 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
8259 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
8260 .free = LDKRoutingMessageHandler_JCalls_free,
8261 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
8263 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8266 long __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
8267 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
8268 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
8269 return (long)res_ptr;
8271 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
8272 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8273 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8274 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8275 LDKNodeAnnouncement msg_conv;
8276 msg_conv.inner = (void*)(msg & (~1));
8277 msg_conv.is_owned = false;
8278 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8279 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8280 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
8281 return (uint64_t)ret_conv;
8284 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
8285 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8286 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8287 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8288 LDKChannelAnnouncement msg_conv;
8289 msg_conv.inner = (void*)(msg & (~1));
8290 msg_conv.is_owned = false;
8291 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8292 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8293 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
8294 return (uint64_t)ret_conv;
8297 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
8298 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8299 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8300 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8301 LDKChannelUpdate msg_conv;
8302 msg_conv.inner = (void*)(msg & (~1));
8303 msg_conv.is_owned = false;
8304 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8305 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8306 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
8307 return (uint64_t)ret_conv;
8310 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) {
8311 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8312 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8313 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8314 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
8315 uint32_tArray ret_arr = NULL;
8316 ret_arr = init_uint32_tArray(ret_var.datalen);
8317 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
8318 for (size_t h = 0; h < ret_var.datalen; h++) {
8319 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
8320 *ret_conv_59_conv = ret_var.data[h];
8321 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
8328 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) {
8329 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8330 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8331 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8332 LDKPublicKey starting_point_ref;
8333 CHECK(starting_point->arr_len == 33);
8334 memcpy(starting_point_ref.compressed_form, starting_point->elems, 33);
8335 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8336 uint32_tArray ret_arr = NULL;
8337 ret_arr = init_uint32_tArray(ret_var.datalen);
8338 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
8339 for (size_t s = 0; s < ret_var.datalen; s++) {
8340 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8341 uint64_t ret_conv_18_ref = 0;
8342 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8343 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
8345 ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8346 if (ret_conv_18_var.is_owned) {
8347 ret_conv_18_ref |= 1;
8349 ret_arr_ptr[s] = ret_conv_18_ref;
8356 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) {
8357 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8358 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8359 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8360 LDKPublicKey their_node_id_ref;
8361 CHECK(their_node_id->arr_len == 33);
8362 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8364 init_conv.inner = (void*)(init & (~1));
8365 init_conv.is_owned = false;
8366 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
8367 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8370 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) {
8371 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8372 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8373 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8374 LDKPublicKey their_node_id_ref;
8375 CHECK(their_node_id->arr_len == 33);
8376 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8377 LDKReplyChannelRange msg_conv;
8378 msg_conv.inner = (void*)(msg & (~1));
8379 msg_conv.is_owned = (msg & 1) || (msg == 0);
8380 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8381 msg_conv = ReplyChannelRange_clone(&msg_conv);
8382 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8383 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8384 return (uint64_t)ret_conv;
8387 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) {
8388 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8389 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8390 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8391 LDKPublicKey their_node_id_ref;
8392 CHECK(their_node_id->arr_len == 33);
8393 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8394 LDKReplyShortChannelIdsEnd msg_conv;
8395 msg_conv.inner = (void*)(msg & (~1));
8396 msg_conv.is_owned = (msg & 1) || (msg == 0);
8397 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8398 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8399 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8400 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8401 return (uint64_t)ret_conv;
8404 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) {
8405 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8406 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8407 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8408 LDKPublicKey their_node_id_ref;
8409 CHECK(their_node_id->arr_len == 33);
8410 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8411 LDKQueryChannelRange msg_conv;
8412 msg_conv.inner = (void*)(msg & (~1));
8413 msg_conv.is_owned = (msg & 1) || (msg == 0);
8414 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8415 msg_conv = QueryChannelRange_clone(&msg_conv);
8416 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8417 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8418 return (uint64_t)ret_conv;
8421 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) {
8422 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8423 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8424 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8425 LDKPublicKey their_node_id_ref;
8426 CHECK(their_node_id->arr_len == 33);
8427 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8428 LDKQueryShortChannelIds msg_conv;
8429 msg_conv.inner = (void*)(msg & (~1));
8430 msg_conv.is_owned = (msg & 1) || (msg == 0);
8431 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8432 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8433 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8434 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8435 return (uint64_t)ret_conv;
8438 typedef struct LDKCustomMessageReader_JCalls {
8439 atomic_size_t refcnt;
8440 uint32_t instance_ptr;
8441 } LDKCustomMessageReader_JCalls;
8442 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
8443 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
8444 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8448 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
8449 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
8450 LDKu8slice buffer_var = buffer;
8451 int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen);
8452 memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
8453 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 75, (uint32_t)message_type, (uint32_t)buffer_arr);
8454 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8455 CHECK_ACCESS(ret_ptr);
8456 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
8460 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
8461 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
8462 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8464 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
8465 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
8466 atomic_init(&calls->refcnt, 1);
8467 calls->instance_ptr = o;
8469 LDKCustomMessageReader ret = {
8470 .this_arg = (void*) calls,
8471 .read = read_LDKCustomMessageReader_jcall,
8472 .free = LDKCustomMessageReader_JCalls_free,
8476 long __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
8477 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
8478 *res_ptr = LDKCustomMessageReader_init(o);
8479 return (long)res_ptr;
8481 uint32_t __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
8482 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8483 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8484 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
8485 LDKu8slice buffer_ref;
8486 buffer_ref.datalen = buffer->arr_len;
8487 buffer_ref.data = buffer->elems;
8488 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
8489 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
8490 return (uint64_t)ret_conv;
8493 typedef struct LDKCustomMessageHandler_JCalls {
8494 atomic_size_t refcnt;
8495 uint32_t instance_ptr;
8496 LDKCustomMessageReader_JCalls* CustomMessageReader;
8497 } LDKCustomMessageHandler_JCalls;
8498 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
8499 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
8500 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8504 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
8505 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
8506 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
8508 int8_tArray sender_node_id_arr = init_int8_tArray(33);
8509 memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
8510 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 76, (uint32_t)(uint64_t)msg_ret, (uint32_t)sender_node_id_arr);
8511 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8512 CHECK_ACCESS(ret_ptr);
8513 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
8517 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
8518 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
8519 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 77);
8520 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
8521 ret_constr.datalen = ret->arr_len;
8522 if (ret_constr.datalen > 0)
8523 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
8525 ret_constr.data = NULL;
8526 uint32_t* ret_vals = ret->elems;
8527 for (size_t z = 0; z < ret_constr.datalen; z++) {
8528 uint32_t ret_conv_25 = ret_vals[z];
8529 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
8530 CHECK_ACCESS(ret_conv_25_ptr);
8531 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
8532 FREE((void*)ret_conv_25);
8533 ret_constr.data[z] = ret_conv_25_conv;
8537 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
8538 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
8539 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8540 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
8542 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
8543 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
8544 atomic_init(&calls->refcnt, 1);
8545 calls->instance_ptr = o;
8547 LDKCustomMessageHandler ret = {
8548 .this_arg = (void*) calls,
8549 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
8550 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
8551 .free = LDKCustomMessageHandler_JCalls_free,
8552 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
8554 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
8557 long __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
8558 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
8559 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
8560 return (long)res_ptr;
8562 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) {
8563 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8564 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8565 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
8566 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
8567 CHECK_ACCESS(msg_ptr);
8568 LDKType msg_conv = *(LDKType*)(msg_ptr);
8569 LDKPublicKey sender_node_id_ref;
8570 CHECK(sender_node_id->arr_len == 33);
8571 memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33);
8572 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8573 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
8574 return (uint64_t)ret_conv;
8577 uint32_tArray __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
8578 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8579 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8580 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
8581 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
8582 uint32_tArray ret_arr = NULL;
8583 ret_arr = init_uint32_tArray(ret_var.datalen);
8584 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
8585 for (size_t z = 0; z < ret_var.datalen; z++) {
8586 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
8587 *ret_conv_25_conv = ret_var.data[z];
8588 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
8595 typedef struct LDKSocketDescriptor_JCalls {
8596 atomic_size_t refcnt;
8597 uint32_t instance_ptr;
8598 } LDKSocketDescriptor_JCalls;
8599 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8600 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8601 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8605 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8606 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8607 LDKu8slice data_var = data;
8608 int8_tArray data_arr = init_int8_tArray(data_var.datalen);
8609 memcpy(data_arr->elems, data_var.data, data_var.datalen);
8610 return js_invoke_function_2(j_calls->instance_ptr, 78, (uint32_t)data_arr, (uint32_t)resume_read);
8612 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8613 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8614 js_invoke_function_0(j_calls->instance_ptr, 79);
8616 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8617 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8618 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8619 *other_arg_clone = SocketDescriptor_clone(other_arg);
8620 return js_invoke_function_1(j_calls->instance_ptr, 80, (uint32_t)(uint64_t)other_arg_clone);
8622 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8623 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8624 return js_invoke_function_0(j_calls->instance_ptr, 81);
8626 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
8627 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
8628 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8630 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
8631 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8632 atomic_init(&calls->refcnt, 1);
8633 calls->instance_ptr = o;
8635 LDKSocketDescriptor ret = {
8636 .this_arg = (void*) calls,
8637 .send_data = send_data_LDKSocketDescriptor_jcall,
8638 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8639 .eq = eq_LDKSocketDescriptor_jcall,
8640 .hash = hash_LDKSocketDescriptor_jcall,
8641 .cloned = LDKSocketDescriptor_JCalls_cloned,
8642 .free = LDKSocketDescriptor_JCalls_free,
8646 long __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
8647 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8648 *res_ptr = LDKSocketDescriptor_init(o);
8649 return (long)res_ptr;
8651 int64_t __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
8652 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8653 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8654 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
8655 LDKu8slice data_ref;
8656 data_ref.datalen = data->arr_len;
8657 data_ref.data = data->elems;
8658 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8662 void __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
8663 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8664 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8665 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
8666 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8669 int64_t __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
8670 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8671 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8672 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
8673 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8677 typedef struct LDKScore_JCalls {
8678 atomic_size_t refcnt;
8679 uint32_t instance_ptr;
8681 static void LDKScore_JCalls_free(void* this_arg) {
8682 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8683 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8687 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) {
8688 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8689 LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8690 *channel_capacity_msat_copy = channel_capacity_msat;
8691 uint64_t channel_capacity_msat_ref = (uint64_t)channel_capacity_msat_copy;
8692 LDKNodeId source_var = *source;
8693 uint64_t source_ref = 0;
8694 source_var = NodeId_clone(source);
8695 CHECK((((uint64_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8696 CHECK((((uint64_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8697 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8698 source_ref = (uint64_t)source_var.inner;
8699 if (source_var.is_owned) {
8702 LDKNodeId target_var = *target;
8703 uint64_t target_ref = 0;
8704 target_var = NodeId_clone(target);
8705 CHECK((((uint64_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8706 CHECK((((uint64_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8707 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8708 target_ref = (uint64_t)target_var.inner;
8709 if (target_var.is_owned) {
8712 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);
8714 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8715 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8716 LDKCVec_RouteHopZ path_var = path;
8717 uint32_tArray path_arr = NULL;
8718 path_arr = init_uint32_tArray(path_var.datalen);
8719 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8720 for (size_t k = 0; k < path_var.datalen; k++) {
8721 LDKRouteHop path_conv_10_var = path_var.data[k];
8722 uint64_t path_conv_10_ref = 0;
8723 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8724 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8725 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8726 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
8727 if (path_conv_10_var.is_owned) {
8728 path_conv_10_ref |= 1;
8730 path_arr_ptr[k] = path_conv_10_ref;
8733 FREE(path_var.data);
8734 js_invoke_function_2(j_calls->instance_ptr, 83, (uint32_t)path_arr, (uint32_t)short_channel_id);
8736 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8737 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8738 LDKCVec_RouteHopZ path_var = path;
8739 uint32_tArray path_arr = NULL;
8740 path_arr = init_uint32_tArray(path_var.datalen);
8741 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8742 for (size_t k = 0; k < path_var.datalen; k++) {
8743 LDKRouteHop path_conv_10_var = path_var.data[k];
8744 uint64_t path_conv_10_ref = 0;
8745 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8746 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8747 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8748 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
8749 if (path_conv_10_var.is_owned) {
8750 path_conv_10_ref |= 1;
8752 path_arr_ptr[k] = path_conv_10_ref;
8755 FREE(path_var.data);
8756 js_invoke_function_1(j_calls->instance_ptr, 84, (uint32_t)path_arr);
8758 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8759 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8760 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 85);
8761 LDKCVec_u8Z ret_ref;
8762 ret_ref.datalen = ret->arr_len;
8763 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8764 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
8767 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8768 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8769 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8771 static inline LDKScore LDKScore_init (JSValue o) {
8772 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8773 atomic_init(&calls->refcnt, 1);
8774 calls->instance_ptr = o;
8777 .this_arg = (void*) calls,
8778 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8779 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8780 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8781 .write = write_LDKScore_jcall,
8782 .free = LDKScore_JCalls_free,
8786 long __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
8787 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8788 *res_ptr = LDKScore_init(o);
8789 return (long)res_ptr;
8791 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) {
8792 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8793 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8794 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8795 void* channel_capacity_msat_ptr = (void*)(((uint64_t)channel_capacity_msat) & ~1);
8796 CHECK_ACCESS(channel_capacity_msat_ptr);
8797 LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr);
8798 channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)channel_capacity_msat) & ~1));
8799 LDKNodeId source_conv;
8800 source_conv.inner = (void*)(source & (~1));
8801 source_conv.is_owned = false;
8802 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8803 LDKNodeId target_conv;
8804 target_conv.inner = (void*)(target & (~1));
8805 target_conv.is_owned = false;
8806 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8807 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);
8811 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) {
8812 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8813 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8814 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8815 LDKCVec_RouteHopZ path_constr;
8816 path_constr.datalen = path->arr_len;
8817 if (path_constr.datalen > 0)
8818 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8820 path_constr.data = NULL;
8821 uint32_t* path_vals = path->elems;
8822 for (size_t k = 0; k < path_constr.datalen; k++) {
8823 uint32_t path_conv_10 = path_vals[k];
8824 LDKRouteHop path_conv_10_conv;
8825 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8826 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8827 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8828 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8829 path_constr.data[k] = path_conv_10_conv;
8831 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8834 void __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) {
8835 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8836 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8837 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8838 LDKCVec_RouteHopZ path_constr;
8839 path_constr.datalen = path->arr_len;
8840 if (path_constr.datalen > 0)
8841 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8843 path_constr.data = NULL;
8844 uint32_t* path_vals = path->elems;
8845 for (size_t k = 0; k < path_constr.datalen; k++) {
8846 uint32_t path_conv_10 = path_vals[k];
8847 LDKRouteHop path_conv_10_conv;
8848 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8849 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8850 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8851 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8852 path_constr.data[k] = path_conv_10_conv;
8854 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8857 int8_tArray __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint32_t this_arg) {
8858 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8859 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8860 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8861 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8862 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
8863 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8864 CVec_u8Z_free(ret_var);
8868 typedef struct LDKLockableScore_JCalls {
8869 atomic_size_t refcnt;
8870 uint32_t instance_ptr;
8871 } LDKLockableScore_JCalls;
8872 static void LDKLockableScore_JCalls_free(void* this_arg) {
8873 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8874 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8878 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
8879 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8880 uint32_t ret = js_invoke_function_0(j_calls->instance_ptr, 86);
8881 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8882 CHECK_ACCESS(ret_ptr);
8883 LDKScore ret_conv = *(LDKScore*)(ret_ptr);// Warning: we may need a move here but no clone is available for LDKScore
8887 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
8888 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
8889 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8891 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
8892 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
8893 atomic_init(&calls->refcnt, 1);
8894 calls->instance_ptr = o;
8896 LDKLockableScore ret = {
8897 .this_arg = (void*) calls,
8898 .lock = lock_LDKLockableScore_jcall,
8899 .free = LDKLockableScore_JCalls_free,
8903 long __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
8904 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
8905 *res_ptr = LDKLockableScore_init(o);
8906 return (long)res_ptr;
8908 uint32_t __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint32_t this_arg) {
8909 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8910 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8911 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
8912 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
8913 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
8914 return (uint64_t)ret_ret;
8917 jstring __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
8918 LDKStr ret_str = _ldk_get_compiled_version();
8919 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8924 jstring __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
8925 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
8926 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8931 void __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
8932 LDKTransaction _res_ref;
8933 _res_ref.datalen = _res->arr_len;
8934 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
8935 memcpy(_res_ref.data, _res->elems, _res_ref.datalen);
8936 _res_ref.data_is_owned = true;
8937 Transaction_free(_res_ref);
8940 uint32_t __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
8941 LDKCVec_u8Z script_pubkey_ref;
8942 script_pubkey_ref.datalen = script_pubkey->arr_len;
8943 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
8944 memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen);
8945 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8946 *ret_ref = TxOut_new(script_pubkey_ref, value);
8947 return (uint64_t)ret_ref;
8950 void __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint32_t _res) {
8951 if ((_res & 1) != 0) return;
8952 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8953 CHECK_ACCESS(_res_ptr);
8954 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
8956 TxOut_free(_res_conv);
8959 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
8960 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8961 *ret_ref = TxOut_clone(arg);
8962 return (uint64_t)ret_ref;
8964 int64_t __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint32_t arg) {
8965 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
8966 int64_t ret_val = TxOut_clone_ptr(arg_conv);
8970 uint32_t __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint32_t orig) {
8971 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
8972 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8973 *ret_ref = TxOut_clone(orig_conv);
8974 return (uint64_t)ret_ref;
8977 void __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
8978 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
8982 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
8983 LDKChannelConfig o_conv;
8984 o_conv.inner = (void*)(o & (~1));
8985 o_conv.is_owned = (o & 1) || (o == 0);
8986 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8987 o_conv = ChannelConfig_clone(&o_conv);
8988 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8989 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
8990 return (uint64_t)ret_conv;
8993 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
8994 LDKDecodeError e_conv;
8995 e_conv.inner = (void*)(e & (~1));
8996 e_conv.is_owned = (e & 1) || (e == 0);
8997 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8998 e_conv = DecodeError_clone(&e_conv);
8999 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9000 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
9001 return (uint64_t)ret_conv;
9004 jboolean __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
9005 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
9006 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
9010 void __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
9011 if ((_res & 1) != 0) return;
9012 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9013 CHECK_ACCESS(_res_ptr);
9014 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
9016 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
9019 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
9020 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9021 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
9022 return (uint64_t)ret_conv;
9024 int64_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
9025 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
9026 int64_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
9030 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
9031 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
9032 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9033 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
9034 return (uint64_t)ret_conv;
9037 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
9039 o_conv.inner = (void*)(o & (~1));
9040 o_conv.is_owned = (o & 1) || (o == 0);
9041 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9042 o_conv = OutPoint_clone(&o_conv);
9043 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9044 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
9045 return (uint64_t)ret_conv;
9048 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
9049 LDKDecodeError e_conv;
9050 e_conv.inner = (void*)(e & (~1));
9051 e_conv.is_owned = (e & 1) || (e == 0);
9052 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9053 e_conv = DecodeError_clone(&e_conv);
9054 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9055 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
9056 return (uint64_t)ret_conv;
9059 jboolean __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
9060 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
9061 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
9065 void __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
9066 if ((_res & 1) != 0) return;
9067 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9068 CHECK_ACCESS(_res_ptr);
9069 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
9071 CResult_OutPointDecodeErrorZ_free(_res_conv);
9074 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
9075 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9076 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
9077 return (uint64_t)ret_conv;
9079 int64_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
9080 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
9081 int64_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
9085 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
9086 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
9087 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9088 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
9089 return (uint64_t)ret_conv;
9092 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
9094 CHECK(o->arr_len == 32);
9095 memcpy(o_ref.bytes, o->elems, 32);
9096 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
9097 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
9098 return (uint64_t)ret_conv;
9101 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
9102 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9103 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
9104 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
9105 return (uint64_t)ret_conv;
9108 jboolean __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
9109 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
9110 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
9114 void __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
9115 if ((_res & 1) != 0) return;
9116 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9117 CHECK_ACCESS(_res_ptr);
9118 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
9120 CResult_SecretKeyErrorZ_free(_res_conv);
9123 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
9125 CHECK(o->arr_len == 33);
9126 memcpy(o_ref.compressed_form, o->elems, 33);
9127 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9128 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
9129 return (uint64_t)ret_conv;
9132 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
9133 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9134 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9135 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
9136 return (uint64_t)ret_conv;
9139 jboolean __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
9140 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
9141 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
9145 void __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
9146 if ((_res & 1) != 0) return;
9147 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9148 CHECK_ACCESS(_res_ptr);
9149 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
9151 CResult_PublicKeyErrorZ_free(_res_conv);
9154 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
9155 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9156 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
9157 return (uint64_t)ret_conv;
9159 int64_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
9160 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
9161 int64_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
9165 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
9166 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
9167 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9168 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
9169 return (uint64_t)ret_conv;
9172 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
9173 LDKTxCreationKeys o_conv;
9174 o_conv.inner = (void*)(o & (~1));
9175 o_conv.is_owned = (o & 1) || (o == 0);
9176 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9177 o_conv = TxCreationKeys_clone(&o_conv);
9178 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9179 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
9180 return (uint64_t)ret_conv;
9183 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
9184 LDKDecodeError e_conv;
9185 e_conv.inner = (void*)(e & (~1));
9186 e_conv.is_owned = (e & 1) || (e == 0);
9187 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9188 e_conv = DecodeError_clone(&e_conv);
9189 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9190 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
9191 return (uint64_t)ret_conv;
9194 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
9195 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
9196 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
9200 void __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
9201 if ((_res & 1) != 0) return;
9202 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9203 CHECK_ACCESS(_res_ptr);
9204 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
9206 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
9209 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
9210 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9211 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
9212 return (uint64_t)ret_conv;
9214 int64_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
9215 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
9216 int64_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
9220 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
9221 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
9222 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9223 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
9224 return (uint64_t)ret_conv;
9227 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
9228 LDKChannelPublicKeys o_conv;
9229 o_conv.inner = (void*)(o & (~1));
9230 o_conv.is_owned = (o & 1) || (o == 0);
9231 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9232 o_conv = ChannelPublicKeys_clone(&o_conv);
9233 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9234 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
9235 return (uint64_t)ret_conv;
9238 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
9239 LDKDecodeError e_conv;
9240 e_conv.inner = (void*)(e & (~1));
9241 e_conv.is_owned = (e & 1) || (e == 0);
9242 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9243 e_conv = DecodeError_clone(&e_conv);
9244 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9245 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
9246 return (uint64_t)ret_conv;
9249 jboolean __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
9250 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
9251 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
9255 void __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
9256 if ((_res & 1) != 0) return;
9257 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9258 CHECK_ACCESS(_res_ptr);
9259 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
9261 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
9264 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
9265 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9266 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
9267 return (uint64_t)ret_conv;
9269 int64_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
9270 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
9271 int64_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
9275 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
9276 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
9277 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9278 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
9279 return (uint64_t)ret_conv;
9282 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
9283 LDKTxCreationKeys o_conv;
9284 o_conv.inner = (void*)(o & (~1));
9285 o_conv.is_owned = (o & 1) || (o == 0);
9286 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9287 o_conv = TxCreationKeys_clone(&o_conv);
9288 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9289 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
9290 return (uint64_t)ret_conv;
9293 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
9294 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9295 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9296 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
9297 return (uint64_t)ret_conv;
9300 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
9301 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
9302 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
9306 void __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
9307 if ((_res & 1) != 0) return;
9308 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9309 CHECK_ACCESS(_res_ptr);
9310 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
9312 CResult_TxCreationKeysErrorZ_free(_res_conv);
9315 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
9316 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9317 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
9318 return (uint64_t)ret_conv;
9320 int64_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
9321 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
9322 int64_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
9326 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
9327 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
9328 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9329 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
9330 return (uint64_t)ret_conv;
9333 uint32_t __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
9334 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9335 *ret_copy = COption_u32Z_some(o);
9336 uint64_t ret_ref = (uint64_t)ret_copy;
9340 uint32_t __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
9341 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9342 *ret_copy = COption_u32Z_none();
9343 uint64_t ret_ref = (uint64_t)ret_copy;
9347 void __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint32_t _res) {
9348 if ((_res & 1) != 0) return;
9349 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9350 CHECK_ACCESS(_res_ptr);
9351 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
9353 COption_u32Z_free(_res_conv);
9356 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
9357 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9358 *ret_copy = COption_u32Z_clone(arg);
9359 uint64_t ret_ref = (uint64_t)ret_copy;
9362 int64_t __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
9363 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
9364 int64_t ret_val = COption_u32Z_clone_ptr(arg_conv);
9368 uint32_t __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint32_t orig) {
9369 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
9370 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9371 *ret_copy = COption_u32Z_clone(orig_conv);
9372 uint64_t ret_ref = (uint64_t)ret_copy;
9376 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
9377 LDKHTLCOutputInCommitment o_conv;
9378 o_conv.inner = (void*)(o & (~1));
9379 o_conv.is_owned = (o & 1) || (o == 0);
9380 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9381 o_conv = HTLCOutputInCommitment_clone(&o_conv);
9382 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9383 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
9384 return (uint64_t)ret_conv;
9387 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
9388 LDKDecodeError e_conv;
9389 e_conv.inner = (void*)(e & (~1));
9390 e_conv.is_owned = (e & 1) || (e == 0);
9391 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9392 e_conv = DecodeError_clone(&e_conv);
9393 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9394 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
9395 return (uint64_t)ret_conv;
9398 jboolean __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
9399 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
9400 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
9404 void __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
9405 if ((_res & 1) != 0) return;
9406 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9407 CHECK_ACCESS(_res_ptr);
9408 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
9410 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
9413 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
9414 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9415 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
9416 return (uint64_t)ret_conv;
9418 int64_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
9419 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
9420 int64_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
9424 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
9425 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
9426 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9427 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
9428 return (uint64_t)ret_conv;
9431 uint32_t __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
9432 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
9436 uint32_t __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
9437 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
9441 void __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
9442 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
9443 COption_NoneZ_free(_res_conv);
9446 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
9447 LDKCounterpartyChannelTransactionParameters o_conv;
9448 o_conv.inner = (void*)(o & (~1));
9449 o_conv.is_owned = (o & 1) || (o == 0);
9450 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9451 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
9452 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9453 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9454 return (uint64_t)ret_conv;
9457 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
9458 LDKDecodeError e_conv;
9459 e_conv.inner = (void*)(e & (~1));
9460 e_conv.is_owned = (e & 1) || (e == 0);
9461 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9462 e_conv = DecodeError_clone(&e_conv);
9463 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9464 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
9465 return (uint64_t)ret_conv;
9468 jboolean __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
9469 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
9470 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
9474 void __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
9475 if ((_res & 1) != 0) return;
9476 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9477 CHECK_ACCESS(_res_ptr);
9478 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
9480 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9483 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
9484 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9485 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
9486 return (uint64_t)ret_conv;
9488 int64_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
9489 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
9490 int64_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
9494 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
9495 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9496 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9497 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9498 return (uint64_t)ret_conv;
9501 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
9502 LDKChannelTransactionParameters o_conv;
9503 o_conv.inner = (void*)(o & (~1));
9504 o_conv.is_owned = (o & 1) || (o == 0);
9505 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9506 o_conv = ChannelTransactionParameters_clone(&o_conv);
9507 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9508 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9509 return (uint64_t)ret_conv;
9512 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
9513 LDKDecodeError e_conv;
9514 e_conv.inner = (void*)(e & (~1));
9515 e_conv.is_owned = (e & 1) || (e == 0);
9516 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9517 e_conv = DecodeError_clone(&e_conv);
9518 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9519 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
9520 return (uint64_t)ret_conv;
9523 jboolean __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
9524 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
9525 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
9529 void __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
9530 if ((_res & 1) != 0) return;
9531 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9532 CHECK_ACCESS(_res_ptr);
9533 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
9535 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9538 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
9539 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9540 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
9541 return (uint64_t)ret_conv;
9543 int64_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
9544 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
9545 int64_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
9549 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
9550 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9551 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9552 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9553 return (uint64_t)ret_conv;
9556 void __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
9557 LDKCVec_SignatureZ _res_constr;
9558 _res_constr.datalen = _res->arr_len;
9559 if (_res_constr.datalen > 0)
9560 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9562 _res_constr.data = NULL;
9563 int8_tArray* _res_vals = (void*) _res->elems;
9564 for (size_t m = 0; m < _res_constr.datalen; m++) {
9565 int8_tArray _res_conv_12 = _res_vals[m];
9566 LDKSignature _res_conv_12_ref;
9567 CHECK(_res_conv_12->arr_len == 64);
9568 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64);
9569 _res_constr.data[m] = _res_conv_12_ref;
9571 CVec_SignatureZ_free(_res_constr);
9574 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
9575 LDKHolderCommitmentTransaction o_conv;
9576 o_conv.inner = (void*)(o & (~1));
9577 o_conv.is_owned = (o & 1) || (o == 0);
9578 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9579 o_conv = HolderCommitmentTransaction_clone(&o_conv);
9580 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9581 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
9582 return (uint64_t)ret_conv;
9585 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
9586 LDKDecodeError e_conv;
9587 e_conv.inner = (void*)(e & (~1));
9588 e_conv.is_owned = (e & 1) || (e == 0);
9589 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9590 e_conv = DecodeError_clone(&e_conv);
9591 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9592 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
9593 return (uint64_t)ret_conv;
9596 jboolean __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
9597 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
9598 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
9602 void __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
9603 if ((_res & 1) != 0) return;
9604 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9605 CHECK_ACCESS(_res_ptr);
9606 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
9608 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
9611 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
9612 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9613 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
9614 return (uint64_t)ret_conv;
9616 int64_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
9617 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
9618 int64_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
9622 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
9623 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9624 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9625 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9626 return (uint64_t)ret_conv;
9629 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
9630 LDKBuiltCommitmentTransaction o_conv;
9631 o_conv.inner = (void*)(o & (~1));
9632 o_conv.is_owned = (o & 1) || (o == 0);
9633 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9634 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
9635 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9636 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
9637 return (uint64_t)ret_conv;
9640 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
9641 LDKDecodeError e_conv;
9642 e_conv.inner = (void*)(e & (~1));
9643 e_conv.is_owned = (e & 1) || (e == 0);
9644 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9645 e_conv = DecodeError_clone(&e_conv);
9646 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9647 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
9648 return (uint64_t)ret_conv;
9651 jboolean __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
9652 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
9653 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
9657 void __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
9658 if ((_res & 1) != 0) return;
9659 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9660 CHECK_ACCESS(_res_ptr);
9661 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
9663 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
9666 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
9667 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9668 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
9669 return (uint64_t)ret_conv;
9671 int64_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
9672 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
9673 int64_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
9677 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
9678 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9679 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9680 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9681 return (uint64_t)ret_conv;
9684 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
9685 LDKTrustedClosingTransaction o_conv;
9686 o_conv.inner = (void*)(o & (~1));
9687 o_conv.is_owned = (o & 1) || (o == 0);
9688 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9689 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
9690 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
9691 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
9692 return (uint64_t)ret_conv;
9695 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
9696 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
9697 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
9698 return (uint64_t)ret_conv;
9701 jboolean __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
9702 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
9703 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
9707 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
9708 if ((_res & 1) != 0) return;
9709 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9710 CHECK_ACCESS(_res_ptr);
9711 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
9713 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
9716 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
9717 LDKCommitmentTransaction o_conv;
9718 o_conv.inner = (void*)(o & (~1));
9719 o_conv.is_owned = (o & 1) || (o == 0);
9720 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9721 o_conv = CommitmentTransaction_clone(&o_conv);
9722 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9723 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9724 return (uint64_t)ret_conv;
9727 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
9728 LDKDecodeError e_conv;
9729 e_conv.inner = (void*)(e & (~1));
9730 e_conv.is_owned = (e & 1) || (e == 0);
9731 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9732 e_conv = DecodeError_clone(&e_conv);
9733 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9734 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9735 return (uint64_t)ret_conv;
9738 jboolean __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
9739 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
9740 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
9744 void __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
9745 if ((_res & 1) != 0) return;
9746 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9747 CHECK_ACCESS(_res_ptr);
9748 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
9750 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9753 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
9754 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9755 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
9756 return (uint64_t)ret_conv;
9758 int64_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
9759 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
9760 int64_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
9764 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
9765 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9766 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9767 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9768 return (uint64_t)ret_conv;
9771 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
9772 LDKTrustedCommitmentTransaction o_conv;
9773 o_conv.inner = (void*)(o & (~1));
9774 o_conv.is_owned = (o & 1) || (o == 0);
9775 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9776 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9777 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9778 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9779 return (uint64_t)ret_conv;
9782 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
9783 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9784 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9785 return (uint64_t)ret_conv;
9788 jboolean __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
9789 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
9790 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
9794 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
9795 if ((_res & 1) != 0) return;
9796 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9797 CHECK_ACCESS(_res_ptr);
9798 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
9800 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9803 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
9804 LDKCVec_SignatureZ o_constr;
9805 o_constr.datalen = o->arr_len;
9806 if (o_constr.datalen > 0)
9807 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9809 o_constr.data = NULL;
9810 int8_tArray* o_vals = (void*) o->elems;
9811 for (size_t m = 0; m < o_constr.datalen; m++) {
9812 int8_tArray o_conv_12 = o_vals[m];
9813 LDKSignature o_conv_12_ref;
9814 CHECK(o_conv_12->arr_len == 64);
9815 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64);
9816 o_constr.data[m] = o_conv_12_ref;
9818 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9819 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9820 return (uint64_t)ret_conv;
9823 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
9824 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9825 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9826 return (uint64_t)ret_conv;
9829 jboolean __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
9830 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
9831 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
9835 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
9836 if ((_res & 1) != 0) return;
9837 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9838 CHECK_ACCESS(_res_ptr);
9839 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
9841 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9844 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
9845 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9846 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
9847 return (uint64_t)ret_conv;
9849 int64_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
9850 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
9851 int64_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
9855 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
9856 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9857 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9858 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9859 return (uint64_t)ret_conv;
9862 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
9863 LDKShutdownScript o_conv;
9864 o_conv.inner = (void*)(o & (~1));
9865 o_conv.is_owned = (o & 1) || (o == 0);
9866 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9867 o_conv = ShutdownScript_clone(&o_conv);
9868 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9869 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
9870 return (uint64_t)ret_conv;
9873 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
9874 LDKDecodeError e_conv;
9875 e_conv.inner = (void*)(e & (~1));
9876 e_conv.is_owned = (e & 1) || (e == 0);
9877 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9878 e_conv = DecodeError_clone(&e_conv);
9879 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9880 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
9881 return (uint64_t)ret_conv;
9884 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
9885 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
9886 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
9890 void __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
9891 if ((_res & 1) != 0) return;
9892 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9893 CHECK_ACCESS(_res_ptr);
9894 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
9896 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
9899 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
9900 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9901 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
9902 return (uint64_t)ret_conv;
9904 int64_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
9905 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
9906 int64_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
9910 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
9911 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
9912 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9913 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
9914 return (uint64_t)ret_conv;
9917 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
9918 LDKShutdownScript o_conv;
9919 o_conv.inner = (void*)(o & (~1));
9920 o_conv.is_owned = (o & 1) || (o == 0);
9921 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9922 o_conv = ShutdownScript_clone(&o_conv);
9923 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9924 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
9925 return (uint64_t)ret_conv;
9928 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
9929 LDKInvalidShutdownScript e_conv;
9930 e_conv.inner = (void*)(e & (~1));
9931 e_conv.is_owned = (e & 1) || (e == 0);
9932 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9933 e_conv = InvalidShutdownScript_clone(&e_conv);
9934 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9935 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
9936 return (uint64_t)ret_conv;
9939 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
9940 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
9941 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
9945 void __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
9946 if ((_res & 1) != 0) return;
9947 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9948 CHECK_ACCESS(_res_ptr);
9949 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
9951 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
9954 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
9955 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9956 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
9957 return (uint64_t)ret_conv;
9959 int64_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
9960 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
9961 int64_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
9965 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
9966 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
9967 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9968 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
9969 return (uint64_t)ret_conv;
9972 uint32_t __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint32_t o) {
9973 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9974 CHECK_ACCESS(o_ptr);
9975 LDKType o_conv = *(LDKType*)(o_ptr);
9976 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9977 *ret_copy = COption_TypeZ_some(o_conv);
9978 uint64_t ret_ref = (uint64_t)ret_copy;
9982 uint32_t __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
9983 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9984 *ret_copy = COption_TypeZ_none();
9985 uint64_t ret_ref = (uint64_t)ret_copy;
9989 void __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint32_t _res) {
9990 if ((_res & 1) != 0) return;
9991 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9992 CHECK_ACCESS(_res_ptr);
9993 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
9995 COption_TypeZ_free(_res_conv);
9998 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
9999 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
10000 *ret_copy = COption_TypeZ_clone(arg);
10001 uint64_t ret_ref = (uint64_t)ret_copy;
10004 int64_t __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
10005 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
10006 int64_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
10010 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint32_t orig) {
10011 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
10012 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
10013 *ret_copy = COption_TypeZ_clone(orig_conv);
10014 uint64_t ret_ref = (uint64_t)ret_copy;
10018 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
10019 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10020 CHECK_ACCESS(o_ptr);
10021 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
10022 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
10023 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10024 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
10025 return (uint64_t)ret_conv;
10028 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
10029 LDKDecodeError e_conv;
10030 e_conv.inner = (void*)(e & (~1));
10031 e_conv.is_owned = (e & 1) || (e == 0);
10032 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10033 e_conv = DecodeError_clone(&e_conv);
10034 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10035 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
10036 return (uint64_t)ret_conv;
10039 jboolean __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
10040 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
10041 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
10045 void __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
10046 if ((_res & 1) != 0) return;
10047 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10048 CHECK_ACCESS(_res_ptr);
10049 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
10051 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
10054 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
10055 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10056 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
10057 return (uint64_t)ret_conv;
10059 int64_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
10060 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
10061 int64_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
10065 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
10066 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
10067 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10068 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
10069 return (uint64_t)ret_conv;
10072 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
10073 LDKStr o_conv = str_ref_to_owned_c(o);
10074 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10075 *ret_conv = CResult_StringErrorZ_ok(o_conv);
10076 return (uint64_t)ret_conv;
10079 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
10080 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10081 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10082 *ret_conv = CResult_StringErrorZ_err(e_conv);
10083 return (uint64_t)ret_conv;
10086 jboolean __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
10087 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
10088 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
10092 void __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
10093 if ((_res & 1) != 0) return;
10094 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10095 CHECK_ACCESS(_res_ptr);
10096 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
10098 CResult_StringErrorZ_free(_res_conv);
10101 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
10102 LDKChannelMonitorUpdate o_conv;
10103 o_conv.inner = (void*)(o & (~1));
10104 o_conv.is_owned = (o & 1) || (o == 0);
10105 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10106 o_conv = ChannelMonitorUpdate_clone(&o_conv);
10107 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10108 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
10109 return (uint64_t)ret_conv;
10112 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
10113 LDKDecodeError e_conv;
10114 e_conv.inner = (void*)(e & (~1));
10115 e_conv.is_owned = (e & 1) || (e == 0);
10116 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10117 e_conv = DecodeError_clone(&e_conv);
10118 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10119 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
10120 return (uint64_t)ret_conv;
10123 jboolean __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
10124 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
10125 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
10129 void __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
10130 if ((_res & 1) != 0) return;
10131 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10132 CHECK_ACCESS(_res_ptr);
10133 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
10135 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
10138 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
10139 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10140 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
10141 return (uint64_t)ret_conv;
10143 int64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
10144 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
10145 int64_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
10149 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
10150 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
10151 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10152 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
10153 return (uint64_t)ret_conv;
10156 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint32_t o) {
10157 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10158 CHECK_ACCESS(o_ptr);
10159 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
10160 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)o) & ~1));
10161 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10162 *ret_copy = COption_MonitorEventZ_some(o_conv);
10163 uint64_t ret_ref = (uint64_t)ret_copy;
10167 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
10168 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10169 *ret_copy = COption_MonitorEventZ_none();
10170 uint64_t ret_ref = (uint64_t)ret_copy;
10174 void __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
10175 if ((_res & 1) != 0) return;
10176 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10177 CHECK_ACCESS(_res_ptr);
10178 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
10180 COption_MonitorEventZ_free(_res_conv);
10183 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
10184 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10185 *ret_copy = COption_MonitorEventZ_clone(arg);
10186 uint64_t ret_ref = (uint64_t)ret_copy;
10189 int64_t __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
10190 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
10191 int64_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
10195 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
10196 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
10197 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10198 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
10199 uint64_t ret_ref = (uint64_t)ret_copy;
10203 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
10204 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10205 CHECK_ACCESS(o_ptr);
10206 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
10207 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uint64_t)o) & ~1));
10208 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
10209 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
10210 return (uint64_t)ret_conv;
10213 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
10214 LDKDecodeError e_conv;
10215 e_conv.inner = (void*)(e & (~1));
10216 e_conv.is_owned = (e & 1) || (e == 0);
10217 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10218 e_conv = DecodeError_clone(&e_conv);
10219 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
10220 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
10221 return (uint64_t)ret_conv;
10224 jboolean __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
10225 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
10226 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
10230 void __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
10231 if ((_res & 1) != 0) return;
10232 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10233 CHECK_ACCESS(_res_ptr);
10234 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
10236 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
10239 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
10240 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
10241 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
10242 return (uint64_t)ret_conv;
10244 int64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
10245 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
10246 int64_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
10250 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
10251 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
10252 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
10253 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
10254 return (uint64_t)ret_conv;
10257 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
10258 LDKHTLCUpdate o_conv;
10259 o_conv.inner = (void*)(o & (~1));
10260 o_conv.is_owned = (o & 1) || (o == 0);
10261 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10262 o_conv = HTLCUpdate_clone(&o_conv);
10263 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10264 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
10265 return (uint64_t)ret_conv;
10268 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
10269 LDKDecodeError e_conv;
10270 e_conv.inner = (void*)(e & (~1));
10271 e_conv.is_owned = (e & 1) || (e == 0);
10272 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10273 e_conv = DecodeError_clone(&e_conv);
10274 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10275 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
10276 return (uint64_t)ret_conv;
10279 jboolean __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
10280 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
10281 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
10285 void __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
10286 if ((_res & 1) != 0) return;
10287 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10288 CHECK_ACCESS(_res_ptr);
10289 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
10291 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
10294 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
10295 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10296 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
10297 return (uint64_t)ret_conv;
10299 int64_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
10300 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
10301 int64_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
10305 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
10306 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
10307 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10308 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
10309 return (uint64_t)ret_conv;
10312 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
10313 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10314 *ret_conv = CResult_NoneNoneZ_ok();
10315 return (uint64_t)ret_conv;
10318 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
10319 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10320 *ret_conv = CResult_NoneNoneZ_err();
10321 return (uint64_t)ret_conv;
10324 jboolean __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
10325 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
10326 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
10330 void __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
10331 if ((_res & 1) != 0) return;
10332 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10333 CHECK_ACCESS(_res_ptr);
10334 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
10336 CResult_NoneNoneZ_free(_res_conv);
10339 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
10340 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10341 *ret_conv = CResult_NoneNoneZ_clone(arg);
10342 return (uint64_t)ret_conv;
10344 int64_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
10345 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
10346 int64_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
10350 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
10351 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
10352 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10353 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
10354 return (uint64_t)ret_conv;
10357 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
10358 LDKOutPoint a_conv;
10359 a_conv.inner = (void*)(a & (~1));
10360 a_conv.is_owned = (a & 1) || (a == 0);
10361 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
10362 a_conv = OutPoint_clone(&a_conv);
10364 b_ref.datalen = b->arr_len;
10365 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10366 memcpy(b_ref.data, b->elems, b_ref.datalen);
10367 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10368 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
10369 return ((uint64_t)ret_conv);
10372 void __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
10373 if ((_res & 1) != 0) return;
10374 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10375 CHECK_ACCESS(_res_ptr);
10376 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
10378 C2Tuple_OutPointScriptZ_free(_res_conv);
10381 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
10383 b_ref.datalen = b->arr_len;
10384 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10385 memcpy(b_ref.data, b->elems, b_ref.datalen);
10386 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10387 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
10388 return ((uint64_t)ret_conv);
10391 void __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
10392 if ((_res & 1) != 0) return;
10393 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10394 CHECK_ACCESS(_res_ptr);
10395 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
10397 C2Tuple_u32ScriptZ_free(_res_conv);
10400 void __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
10401 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
10402 _res_constr.datalen = _res->arr_len;
10403 if (_res_constr.datalen > 0)
10404 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10406 _res_constr.data = NULL;
10407 uint32_t* _res_vals = _res->elems;
10408 for (size_t v = 0; v < _res_constr.datalen; v++) {
10409 uint32_t _res_conv_21 = _res_vals[v];
10410 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
10411 CHECK_ACCESS(_res_conv_21_ptr);
10412 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
10413 FREE((void*)_res_conv_21);
10414 _res_constr.data[v] = _res_conv_21_conv;
10416 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
10419 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
10420 LDKThirtyTwoBytes a_ref;
10421 CHECK(a->arr_len == 32);
10422 memcpy(a_ref.data, a->elems, 32);
10423 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
10424 b_constr.datalen = b->arr_len;
10425 if (b_constr.datalen > 0)
10426 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10428 b_constr.data = NULL;
10429 uint32_t* b_vals = b->elems;
10430 for (size_t v = 0; v < b_constr.datalen; v++) {
10431 uint32_t b_conv_21 = b_vals[v];
10432 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
10433 CHECK_ACCESS(b_conv_21_ptr);
10434 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
10435 // Warning: we may need a move here but no clone is available for LDKC2Tuple_u32ScriptZ
10436 b_constr.data[v] = b_conv_21_conv;
10438 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10439 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
10440 return ((uint64_t)ret_conv);
10443 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
10444 if ((_res & 1) != 0) return;
10445 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10446 CHECK_ACCESS(_res_ptr);
10447 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
10449 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
10452 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
10453 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
10454 _res_constr.datalen = _res->arr_len;
10455 if (_res_constr.datalen > 0)
10456 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
10458 _res_constr.data = NULL;
10459 uint32_t* _res_vals = _res->elems;
10460 for (size_t o = 0; o < _res_constr.datalen; o++) {
10461 uint32_t _res_conv_40 = _res_vals[o];
10462 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
10463 CHECK_ACCESS(_res_conv_40_ptr);
10464 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
10465 FREE((void*)_res_conv_40);
10466 _res_constr.data[o] = _res_conv_40_conv;
10468 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
10471 void __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
10472 LDKCVec_MonitorEventZ _res_constr;
10473 _res_constr.datalen = _res->arr_len;
10474 if (_res_constr.datalen > 0)
10475 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
10477 _res_constr.data = NULL;
10478 uint32_t* _res_vals = _res->elems;
10479 for (size_t o = 0; o < _res_constr.datalen; o++) {
10480 uint32_t _res_conv_14 = _res_vals[o];
10481 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
10482 CHECK_ACCESS(_res_conv_14_ptr);
10483 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
10484 FREE((void*)_res_conv_14);
10485 _res_constr.data[o] = _res_conv_14_conv;
10487 CVec_MonitorEventZ_free(_res_constr);
10490 void __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint32_tArray _res) {
10491 LDKCVec_EventZ _res_constr;
10492 _res_constr.datalen = _res->arr_len;
10493 if (_res_constr.datalen > 0)
10494 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
10496 _res_constr.data = NULL;
10497 uint32_t* _res_vals = _res->elems;
10498 for (size_t h = 0; h < _res_constr.datalen; h++) {
10499 uint32_t _res_conv_7 = _res_vals[h];
10500 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
10501 CHECK_ACCESS(_res_conv_7_ptr);
10502 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
10503 FREE((void*)_res_conv_7);
10504 _res_constr.data[h] = _res_conv_7_conv;
10506 CVec_EventZ_free(_res_constr);
10509 void __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
10510 LDKCVec_TransactionZ _res_constr;
10511 _res_constr.datalen = _res->arr_len;
10512 if (_res_constr.datalen > 0)
10513 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
10515 _res_constr.data = NULL;
10516 int8_tArray* _res_vals = (void*) _res->elems;
10517 for (size_t m = 0; m < _res_constr.datalen; m++) {
10518 int8_tArray _res_conv_12 = _res_vals[m];
10519 LDKTransaction _res_conv_12_ref;
10520 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
10521 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
10522 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen);
10523 _res_conv_12_ref.data_is_owned = true;
10524 _res_constr.data[m] = _res_conv_12_ref;
10526 CVec_TransactionZ_free(_res_constr);
10529 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
10530 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10531 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
10532 return ((uint64_t)ret_conv);
10534 int64_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
10535 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
10536 int64_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
10540 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
10541 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
10542 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10543 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
10544 return ((uint64_t)ret_conv);
10547 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
10548 LDKTransaction b_ref;
10549 b_ref.datalen = b->arr_len;
10550 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
10551 memcpy(b_ref.data, b->elems, b_ref.datalen);
10552 b_ref.data_is_owned = true;
10553 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10554 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
10555 return ((uint64_t)ret_conv);
10558 void __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
10559 if ((_res & 1) != 0) return;
10560 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10561 CHECK_ACCESS(_res_ptr);
10562 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
10564 C2Tuple_usizeTransactionZ_free(_res_conv);
10567 void __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
10568 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
10569 _res_constr.datalen = _res->arr_len;
10570 if (_res_constr.datalen > 0)
10571 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10573 _res_constr.data = NULL;
10574 uint32_t* _res_vals = _res->elems;
10575 for (size_t c = 0; c < _res_constr.datalen; c++) {
10576 uint32_t _res_conv_28 = _res_vals[c];
10577 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
10578 CHECK_ACCESS(_res_conv_28_ptr);
10579 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
10580 FREE((void*)_res_conv_28);
10581 _res_constr.data[c] = _res_conv_28_conv;
10583 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
10586 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
10587 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10588 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
10589 return ((uint64_t)ret_conv);
10591 int64_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
10592 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
10593 int64_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
10597 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
10598 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
10599 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10600 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
10601 return ((uint64_t)ret_conv);
10604 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
10605 void* b_ptr = (void*)(((uint64_t)b) & ~1);
10606 CHECK_ACCESS(b_ptr);
10607 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
10608 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
10609 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10610 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
10611 return ((uint64_t)ret_conv);
10614 void __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
10615 if ((_res & 1) != 0) return;
10616 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10617 CHECK_ACCESS(_res_ptr);
10618 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
10620 C2Tuple_u32TxOutZ_free(_res_conv);
10623 void __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
10624 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
10625 _res_constr.datalen = _res->arr_len;
10626 if (_res_constr.datalen > 0)
10627 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10629 _res_constr.data = NULL;
10630 uint32_t* _res_vals = _res->elems;
10631 for (size_t u = 0; u < _res_constr.datalen; u++) {
10632 uint32_t _res_conv_20 = _res_vals[u];
10633 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
10634 CHECK_ACCESS(_res_conv_20_ptr);
10635 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
10636 FREE((void*)_res_conv_20);
10637 _res_constr.data[u] = _res_conv_20_conv;
10639 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
10642 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
10643 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10644 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
10645 return ((uint64_t)ret_conv);
10647 int64_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
10648 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
10649 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
10653 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
10654 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
10655 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10656 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
10657 return ((uint64_t)ret_conv);
10660 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
10661 LDKThirtyTwoBytes a_ref;
10662 CHECK(a->arr_len == 32);
10663 memcpy(a_ref.data, a->elems, 32);
10664 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
10665 b_constr.datalen = b->arr_len;
10666 if (b_constr.datalen > 0)
10667 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10669 b_constr.data = NULL;
10670 uint32_t* b_vals = b->elems;
10671 for (size_t u = 0; u < b_constr.datalen; u++) {
10672 uint32_t b_conv_20 = b_vals[u];
10673 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
10674 CHECK_ACCESS(b_conv_20_ptr);
10675 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
10676 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
10677 b_constr.data[u] = b_conv_20_conv;
10679 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10680 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
10681 return ((uint64_t)ret_conv);
10684 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
10685 if ((_res & 1) != 0) return;
10686 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10687 CHECK_ACCESS(_res_ptr);
10688 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
10690 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
10693 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
10694 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
10695 _res_constr.datalen = _res->arr_len;
10696 if (_res_constr.datalen > 0)
10697 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
10699 _res_constr.data = NULL;
10700 uint32_t* _res_vals = _res->elems;
10701 for (size_t n = 0; n < _res_constr.datalen; n++) {
10702 uint32_t _res_conv_39 = _res_vals[n];
10703 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
10704 CHECK_ACCESS(_res_conv_39_ptr);
10705 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
10706 FREE((void*)_res_conv_39);
10707 _res_constr.data[n] = _res_conv_39_conv;
10709 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
10712 void __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
10713 LDKCVec_TxidZ _res_constr;
10714 _res_constr.datalen = _res->arr_len;
10715 if (_res_constr.datalen > 0)
10716 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10718 _res_constr.data = NULL;
10719 int8_tArray* _res_vals = (void*) _res->elems;
10720 for (size_t m = 0; m < _res_constr.datalen; m++) {
10721 int8_tArray _res_conv_12 = _res_vals[m];
10722 LDKThirtyTwoBytes _res_conv_12_ref;
10723 CHECK(_res_conv_12->arr_len == 32);
10724 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32);
10725 _res_constr.data[m] = _res_conv_12_ref;
10727 CVec_TxidZ_free(_res_constr);
10730 void __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
10731 LDKCVec_BalanceZ _res_constr;
10732 _res_constr.datalen = _res->arr_len;
10733 if (_res_constr.datalen > 0)
10734 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
10736 _res_constr.data = NULL;
10737 uint32_t* _res_vals = _res->elems;
10738 for (size_t j = 0; j < _res_constr.datalen; j++) {
10739 uint32_t _res_conv_9 = _res_vals[j];
10740 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
10741 CHECK_ACCESS(_res_conv_9_ptr);
10742 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
10743 FREE((void*)_res_conv_9);
10744 _res_constr.data[j] = _res_conv_9_conv;
10746 CVec_BalanceZ_free(_res_constr);
10749 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
10750 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10751 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
10752 return ((uint64_t)ret_conv);
10754 int64_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
10755 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
10756 int64_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
10760 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
10761 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
10762 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10763 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
10764 return ((uint64_t)ret_conv);
10767 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
10768 LDKThirtyTwoBytes a_ref;
10769 CHECK(a->arr_len == 32);
10770 memcpy(a_ref.data, a->elems, 32);
10771 LDKChannelMonitor b_conv;
10772 b_conv.inner = (void*)(b & (~1));
10773 b_conv.is_owned = (b & 1) || (b == 0);
10774 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
10775 b_conv = ChannelMonitor_clone(&b_conv);
10776 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10777 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10778 return ((uint64_t)ret_conv);
10781 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
10782 if ((_res & 1) != 0) return;
10783 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10784 CHECK_ACCESS(_res_ptr);
10785 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
10787 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10790 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
10791 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10792 CHECK_ACCESS(o_ptr);
10793 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
10794 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
10795 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10796 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
10797 return (uint64_t)ret_conv;
10800 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
10801 LDKDecodeError e_conv;
10802 e_conv.inner = (void*)(e & (~1));
10803 e_conv.is_owned = (e & 1) || (e == 0);
10804 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10805 e_conv = DecodeError_clone(&e_conv);
10806 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10807 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
10808 return (uint64_t)ret_conv;
10811 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
10812 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
10813 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
10817 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
10818 if ((_res & 1) != 0) return;
10819 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10820 CHECK_ACCESS(_res_ptr);
10821 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
10823 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
10826 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
10827 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10828 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
10829 return (uint64_t)ret_conv;
10831 int64_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
10832 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
10833 int64_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
10837 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
10838 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
10839 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10840 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
10841 return (uint64_t)ret_conv;
10844 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
10845 LDKRouteHop o_conv;
10846 o_conv.inner = (void*)(o & (~1));
10847 o_conv.is_owned = (o & 1) || (o == 0);
10848 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10849 o_conv = RouteHop_clone(&o_conv);
10850 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10851 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
10852 return (uint64_t)ret_conv;
10855 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
10856 LDKDecodeError e_conv;
10857 e_conv.inner = (void*)(e & (~1));
10858 e_conv.is_owned = (e & 1) || (e == 0);
10859 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10860 e_conv = DecodeError_clone(&e_conv);
10861 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10862 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
10863 return (uint64_t)ret_conv;
10866 jboolean __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
10867 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
10868 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
10872 void __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
10873 if ((_res & 1) != 0) return;
10874 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10875 CHECK_ACCESS(_res_ptr);
10876 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
10878 CResult_RouteHopDecodeErrorZ_free(_res_conv);
10881 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
10882 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10883 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
10884 return (uint64_t)ret_conv;
10886 int64_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
10887 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
10888 int64_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
10892 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
10893 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
10894 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10895 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
10896 return (uint64_t)ret_conv;
10899 void __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
10900 LDKCVec_RouteHopZ _res_constr;
10901 _res_constr.datalen = _res->arr_len;
10902 if (_res_constr.datalen > 0)
10903 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10905 _res_constr.data = NULL;
10906 uint32_t* _res_vals = _res->elems;
10907 for (size_t k = 0; k < _res_constr.datalen; k++) {
10908 uint32_t _res_conv_10 = _res_vals[k];
10909 LDKRouteHop _res_conv_10_conv;
10910 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
10911 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
10912 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
10913 _res_constr.data[k] = _res_conv_10_conv;
10915 CVec_RouteHopZ_free(_res_constr);
10918 void __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
10919 LDKCVec_CVec_RouteHopZZ _res_constr;
10920 _res_constr.datalen = _res->arr_len;
10921 if (_res_constr.datalen > 0)
10922 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
10924 _res_constr.data = NULL;
10925 uint32_tArray* _res_vals = (void*) _res->elems;
10926 for (size_t m = 0; m < _res_constr.datalen; m++) {
10927 uint32_tArray _res_conv_12 = _res_vals[m];
10928 LDKCVec_RouteHopZ _res_conv_12_constr;
10929 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
10930 if (_res_conv_12_constr.datalen > 0)
10931 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10933 _res_conv_12_constr.data = NULL;
10934 uint32_t* _res_conv_12_vals = _res_conv_12->elems;
10935 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
10936 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
10937 LDKRouteHop _res_conv_12_conv_10_conv;
10938 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
10939 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
10940 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
10941 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
10943 _res_constr.data[m] = _res_conv_12_constr;
10945 CVec_CVec_RouteHopZZ_free(_res_constr);
10948 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
10950 o_conv.inner = (void*)(o & (~1));
10951 o_conv.is_owned = (o & 1) || (o == 0);
10952 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10953 o_conv = Route_clone(&o_conv);
10954 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10955 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
10956 return (uint64_t)ret_conv;
10959 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
10960 LDKDecodeError e_conv;
10961 e_conv.inner = (void*)(e & (~1));
10962 e_conv.is_owned = (e & 1) || (e == 0);
10963 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10964 e_conv = DecodeError_clone(&e_conv);
10965 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10966 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
10967 return (uint64_t)ret_conv;
10970 jboolean __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
10971 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
10972 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
10976 void __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
10977 if ((_res & 1) != 0) return;
10978 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10979 CHECK_ACCESS(_res_ptr);
10980 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
10982 CResult_RouteDecodeErrorZ_free(_res_conv);
10985 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
10986 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10987 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
10988 return (uint64_t)ret_conv;
10990 int64_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
10991 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
10992 int64_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
10996 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
10997 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
10998 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10999 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
11000 return (uint64_t)ret_conv;
11003 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
11004 LDKRouteParameters o_conv;
11005 o_conv.inner = (void*)(o & (~1));
11006 o_conv.is_owned = (o & 1) || (o == 0);
11007 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11008 o_conv = RouteParameters_clone(&o_conv);
11009 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11010 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
11011 return (uint64_t)ret_conv;
11014 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
11015 LDKDecodeError e_conv;
11016 e_conv.inner = (void*)(e & (~1));
11017 e_conv.is_owned = (e & 1) || (e == 0);
11018 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11019 e_conv = DecodeError_clone(&e_conv);
11020 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11021 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
11022 return (uint64_t)ret_conv;
11025 jboolean __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
11026 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
11027 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
11031 void __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
11032 if ((_res & 1) != 0) return;
11033 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11034 CHECK_ACCESS(_res_ptr);
11035 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
11037 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
11040 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
11041 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11042 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
11043 return (uint64_t)ret_conv;
11045 int64_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11046 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
11047 int64_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
11051 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
11052 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
11053 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11054 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
11055 return (uint64_t)ret_conv;
11058 void __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
11059 LDKCVec_RouteHintZ _res_constr;
11060 _res_constr.datalen = _res->arr_len;
11061 if (_res_constr.datalen > 0)
11062 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
11064 _res_constr.data = NULL;
11065 uint32_t* _res_vals = _res->elems;
11066 for (size_t l = 0; l < _res_constr.datalen; l++) {
11067 uint32_t _res_conv_11 = _res_vals[l];
11068 LDKRouteHint _res_conv_11_conv;
11069 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
11070 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
11071 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
11072 _res_constr.data[l] = _res_conv_11_conv;
11074 CVec_RouteHintZ_free(_res_constr);
11077 uint32_t __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
11078 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11079 *ret_copy = COption_u64Z_some(o);
11080 uint64_t ret_ref = (uint64_t)ret_copy;
11084 uint32_t __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
11085 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11086 *ret_copy = COption_u64Z_none();
11087 uint64_t ret_ref = (uint64_t)ret_copy;
11091 void __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint32_t _res) {
11092 if ((_res & 1) != 0) return;
11093 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11094 CHECK_ACCESS(_res_ptr);
11095 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
11097 COption_u64Z_free(_res_conv);
11100 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
11101 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11102 *ret_copy = COption_u64Z_clone(arg);
11103 uint64_t ret_ref = (uint64_t)ret_copy;
11106 int64_t __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
11107 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
11108 int64_t ret_val = COption_u64Z_clone_ptr(arg_conv);
11112 uint32_t __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint32_t orig) {
11113 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
11114 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11115 *ret_copy = COption_u64Z_clone(orig_conv);
11116 uint64_t ret_ref = (uint64_t)ret_copy;
11120 uint32_t __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_ok"))) TS_CResult_PayeeDecodeErrorZ_ok(uint32_t o) {
11122 o_conv.inner = (void*)(o & (~1));
11123 o_conv.is_owned = (o & 1) || (o == 0);
11124 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11125 o_conv = Payee_clone(&o_conv);
11126 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
11127 *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv);
11128 return (uint64_t)ret_conv;
11131 uint32_t __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_err"))) TS_CResult_PayeeDecodeErrorZ_err(uint32_t e) {
11132 LDKDecodeError e_conv;
11133 e_conv.inner = (void*)(e & (~1));
11134 e_conv.is_owned = (e & 1) || (e == 0);
11135 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11136 e_conv = DecodeError_clone(&e_conv);
11137 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
11138 *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv);
11139 return (uint64_t)ret_conv;
11142 jboolean __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_is_ok"))) TS_CResult_PayeeDecodeErrorZ_is_ok(uint32_t o) {
11143 LDKCResult_PayeeDecodeErrorZ* o_conv = (LDKCResult_PayeeDecodeErrorZ*)(o & ~1);
11144 jboolean ret_val = CResult_PayeeDecodeErrorZ_is_ok(o_conv);
11148 void __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_free"))) TS_CResult_PayeeDecodeErrorZ_free(uint32_t _res) {
11149 if ((_res & 1) != 0) return;
11150 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11151 CHECK_ACCESS(_res_ptr);
11152 LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr);
11154 CResult_PayeeDecodeErrorZ_free(_res_conv);
11157 static inline uintptr_t CResult_PayeeDecodeErrorZ_clone_ptr(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR arg) {
11158 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
11159 *ret_conv = CResult_PayeeDecodeErrorZ_clone(arg);
11160 return (uint64_t)ret_conv;
11162 int64_t __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_clone_ptr"))) TS_CResult_PayeeDecodeErrorZ_clone_ptr(uint32_t arg) {
11163 LDKCResult_PayeeDecodeErrorZ* arg_conv = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
11164 int64_t ret_val = CResult_PayeeDecodeErrorZ_clone_ptr(arg_conv);
11168 uint32_t __attribute__((export_name("TS_CResult_PayeeDecodeErrorZ_clone"))) TS_CResult_PayeeDecodeErrorZ_clone(uint32_t orig) {
11169 LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1);
11170 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
11171 *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv);
11172 return (uint64_t)ret_conv;
11175 void __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
11176 LDKCVec_RouteHintHopZ _res_constr;
11177 _res_constr.datalen = _res->arr_len;
11178 if (_res_constr.datalen > 0)
11179 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
11181 _res_constr.data = NULL;
11182 uint32_t* _res_vals = _res->elems;
11183 for (size_t o = 0; o < _res_constr.datalen; o++) {
11184 uint32_t _res_conv_14 = _res_vals[o];
11185 LDKRouteHintHop _res_conv_14_conv;
11186 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
11187 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
11188 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
11189 _res_constr.data[o] = _res_conv_14_conv;
11191 CVec_RouteHintHopZ_free(_res_constr);
11194 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
11195 LDKRouteHint o_conv;
11196 o_conv.inner = (void*)(o & (~1));
11197 o_conv.is_owned = (o & 1) || (o == 0);
11198 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11199 o_conv = RouteHint_clone(&o_conv);
11200 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11201 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
11202 return (uint64_t)ret_conv;
11205 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
11206 LDKDecodeError e_conv;
11207 e_conv.inner = (void*)(e & (~1));
11208 e_conv.is_owned = (e & 1) || (e == 0);
11209 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11210 e_conv = DecodeError_clone(&e_conv);
11211 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11212 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
11213 return (uint64_t)ret_conv;
11216 jboolean __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
11217 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
11218 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
11222 void __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
11223 if ((_res & 1) != 0) return;
11224 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11225 CHECK_ACCESS(_res_ptr);
11226 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
11228 CResult_RouteHintDecodeErrorZ_free(_res_conv);
11231 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
11232 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11233 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
11234 return (uint64_t)ret_conv;
11236 int64_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
11237 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
11238 int64_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
11242 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
11243 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
11244 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11245 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
11246 return (uint64_t)ret_conv;
11249 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
11250 LDKRouteHintHop o_conv;
11251 o_conv.inner = (void*)(o & (~1));
11252 o_conv.is_owned = (o & 1) || (o == 0);
11253 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11254 o_conv = RouteHintHop_clone(&o_conv);
11255 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11256 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
11257 return (uint64_t)ret_conv;
11260 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
11261 LDKDecodeError e_conv;
11262 e_conv.inner = (void*)(e & (~1));
11263 e_conv.is_owned = (e & 1) || (e == 0);
11264 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11265 e_conv = DecodeError_clone(&e_conv);
11266 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11267 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
11268 return (uint64_t)ret_conv;
11271 jboolean __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
11272 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
11273 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
11277 void __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
11278 if ((_res & 1) != 0) return;
11279 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11280 CHECK_ACCESS(_res_ptr);
11281 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
11283 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
11286 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
11287 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11288 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
11289 return (uint64_t)ret_conv;
11291 int64_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
11292 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
11293 int64_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
11297 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
11298 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
11299 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11300 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
11301 return (uint64_t)ret_conv;
11304 void __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
11305 LDKCVec_ChannelDetailsZ _res_constr;
11306 _res_constr.datalen = _res->arr_len;
11307 if (_res_constr.datalen > 0)
11308 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11310 _res_constr.data = NULL;
11311 uint32_t* _res_vals = _res->elems;
11312 for (size_t q = 0; q < _res_constr.datalen; q++) {
11313 uint32_t _res_conv_16 = _res_vals[q];
11314 LDKChannelDetails _res_conv_16_conv;
11315 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11316 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11317 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
11318 _res_constr.data[q] = _res_conv_16_conv;
11320 CVec_ChannelDetailsZ_free(_res_constr);
11323 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
11325 o_conv.inner = (void*)(o & (~1));
11326 o_conv.is_owned = (o & 1) || (o == 0);
11327 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11328 o_conv = Route_clone(&o_conv);
11329 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11330 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
11331 return (uint64_t)ret_conv;
11334 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
11335 LDKLightningError e_conv;
11336 e_conv.inner = (void*)(e & (~1));
11337 e_conv.is_owned = (e & 1) || (e == 0);
11338 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11339 e_conv = LightningError_clone(&e_conv);
11340 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11341 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
11342 return (uint64_t)ret_conv;
11345 jboolean __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
11346 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
11347 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
11351 void __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
11352 if ((_res & 1) != 0) return;
11353 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11354 CHECK_ACCESS(_res_ptr);
11355 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
11357 CResult_RouteLightningErrorZ_free(_res_conv);
11360 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
11361 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11362 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
11363 return (uint64_t)ret_conv;
11365 int64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
11366 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
11367 int64_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
11371 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
11372 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
11373 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11374 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
11375 return (uint64_t)ret_conv;
11378 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
11379 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11380 *ret_conv = CResult_NoneLightningErrorZ_ok();
11381 return (uint64_t)ret_conv;
11384 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
11385 LDKLightningError e_conv;
11386 e_conv.inner = (void*)(e & (~1));
11387 e_conv.is_owned = (e & 1) || (e == 0);
11388 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11389 e_conv = LightningError_clone(&e_conv);
11390 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11391 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11392 return (uint64_t)ret_conv;
11395 jboolean __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
11396 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
11397 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
11401 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
11402 if ((_res & 1) != 0) return;
11403 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11404 CHECK_ACCESS(_res_ptr);
11405 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
11407 CResult_NoneLightningErrorZ_free(_res_conv);
11410 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
11411 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11412 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
11413 return (uint64_t)ret_conv;
11415 int64_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
11416 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
11417 int64_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
11421 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
11422 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11423 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11424 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11425 return (uint64_t)ret_conv;
11428 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
11429 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11430 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
11431 return ((uint64_t)ret_conv);
11433 int64_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
11434 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
11435 int64_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
11439 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
11440 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
11441 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11442 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
11443 return ((uint64_t)ret_conv);
11446 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
11447 LDKPublicKey a_ref;
11448 CHECK(a->arr_len == 33);
11449 memcpy(a_ref.compressed_form, a->elems, 33);
11450 void* b_ptr = (void*)(((uint64_t)b) & ~1);
11451 CHECK_ACCESS(b_ptr);
11452 LDKType b_conv = *(LDKType*)(b_ptr);
11453 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11454 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
11455 return ((uint64_t)ret_conv);
11458 void __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
11459 if ((_res & 1) != 0) return;
11460 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11461 CHECK_ACCESS(_res_ptr);
11462 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
11464 C2Tuple_PublicKeyTypeZ_free(_res_conv);
11467 void __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
11468 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
11469 _res_constr.datalen = _res->arr_len;
11470 if (_res_constr.datalen > 0)
11471 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
11473 _res_constr.data = NULL;
11474 uint32_t* _res_vals = _res->elems;
11475 for (size_t z = 0; z < _res_constr.datalen; z++) {
11476 uint32_t _res_conv_25 = _res_vals[z];
11477 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
11478 CHECK_ACCESS(_res_conv_25_ptr);
11479 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
11480 FREE((void*)_res_conv_25);
11481 _res_constr.data[z] = _res_conv_25_conv;
11483 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
11486 void __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
11487 LDKCVec_MessageSendEventZ _res_constr;
11488 _res_constr.datalen = _res->arr_len;
11489 if (_res_constr.datalen > 0)
11490 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
11492 _res_constr.data = NULL;
11493 uint32_t* _res_vals = _res->elems;
11494 for (size_t s = 0; s < _res_constr.datalen; s++) {
11495 uint32_t _res_conv_18 = _res_vals[s];
11496 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
11497 CHECK_ACCESS(_res_conv_18_ptr);
11498 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
11499 FREE((void*)_res_conv_18);
11500 _res_constr.data[s] = _res_conv_18_conv;
11502 CVec_MessageSendEventZ_free(_res_constr);
11505 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
11506 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11507 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11508 return (uint64_t)ret_conv;
11511 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
11512 LDKLightningError e_conv;
11513 e_conv.inner = (void*)(e & (~1));
11514 e_conv.is_owned = (e & 1) || (e == 0);
11515 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11516 e_conv = LightningError_clone(&e_conv);
11517 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11518 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11519 return (uint64_t)ret_conv;
11522 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
11523 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
11524 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
11528 void __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
11529 if ((_res & 1) != 0) return;
11530 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11531 CHECK_ACCESS(_res_ptr);
11532 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
11534 CResult_boolLightningErrorZ_free(_res_conv);
11537 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
11538 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11539 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
11540 return (uint64_t)ret_conv;
11542 int64_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
11543 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
11544 int64_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
11548 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
11549 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11550 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11551 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11552 return (uint64_t)ret_conv;
11555 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
11556 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11557 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
11558 return ((uint64_t)ret_conv);
11560 int64_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
11561 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
11562 int64_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
11566 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
11567 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11568 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11569 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11570 return ((uint64_t)ret_conv);
11573 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
11574 LDKChannelAnnouncement a_conv;
11575 a_conv.inner = (void*)(a & (~1));
11576 a_conv.is_owned = (a & 1) || (a == 0);
11577 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
11578 a_conv = ChannelAnnouncement_clone(&a_conv);
11579 LDKChannelUpdate b_conv;
11580 b_conv.inner = (void*)(b & (~1));
11581 b_conv.is_owned = (b & 1) || (b == 0);
11582 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
11583 b_conv = ChannelUpdate_clone(&b_conv);
11584 LDKChannelUpdate c_conv;
11585 c_conv.inner = (void*)(c & (~1));
11586 c_conv.is_owned = (c & 1) || (c == 0);
11587 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
11588 c_conv = ChannelUpdate_clone(&c_conv);
11589 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11590 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11591 return ((uint64_t)ret_conv);
11594 void __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
11595 if ((_res & 1) != 0) return;
11596 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11597 CHECK_ACCESS(_res_ptr);
11598 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
11600 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11603 void __attribute__((export_name("TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
11604 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11605 _res_constr.datalen = _res->arr_len;
11606 if (_res_constr.datalen > 0)
11607 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11609 _res_constr.data = NULL;
11610 uint32_t* _res_vals = _res->elems;
11611 for (size_t h = 0; h < _res_constr.datalen; h++) {
11612 uint32_t _res_conv_59 = _res_vals[h];
11613 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
11614 CHECK_ACCESS(_res_conv_59_ptr);
11615 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
11616 FREE((void*)_res_conv_59);
11617 _res_constr.data[h] = _res_conv_59_conv;
11619 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11622 void __attribute__((export_name("TS_CVec_NodeAnnouncementZ_free"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
11623 LDKCVec_NodeAnnouncementZ _res_constr;
11624 _res_constr.datalen = _res->arr_len;
11625 if (_res_constr.datalen > 0)
11626 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11628 _res_constr.data = NULL;
11629 uint32_t* _res_vals = _res->elems;
11630 for (size_t s = 0; s < _res_constr.datalen; s++) {
11631 uint32_t _res_conv_18 = _res_vals[s];
11632 LDKNodeAnnouncement _res_conv_18_conv;
11633 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11634 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11635 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
11636 _res_constr.data[s] = _res_conv_18_conv;
11638 CVec_NodeAnnouncementZ_free(_res_constr);
11641 void __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
11642 LDKCVec_PublicKeyZ _res_constr;
11643 _res_constr.datalen = _res->arr_len;
11644 if (_res_constr.datalen > 0)
11645 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11647 _res_constr.data = NULL;
11648 int8_tArray* _res_vals = (void*) _res->elems;
11649 for (size_t m = 0; m < _res_constr.datalen; m++) {
11650 int8_tArray _res_conv_12 = _res_vals[m];
11651 LDKPublicKey _res_conv_12_ref;
11652 CHECK(_res_conv_12->arr_len == 33);
11653 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33);
11654 _res_constr.data[m] = _res_conv_12_ref;
11656 CVec_PublicKeyZ_free(_res_constr);
11659 void __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
11660 LDKCVec_u8Z _res_ref;
11661 _res_ref.datalen = _res->arr_len;
11662 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
11663 memcpy(_res_ref.data, _res->elems, _res_ref.datalen);
11664 CVec_u8Z_free(_res_ref);
11667 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
11669 o_ref.datalen = o->arr_len;
11670 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11671 memcpy(o_ref.data, o->elems, o_ref.datalen);
11672 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11673 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11674 return (uint64_t)ret_conv;
11677 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
11678 LDKPeerHandleError e_conv;
11679 e_conv.inner = (void*)(e & (~1));
11680 e_conv.is_owned = (e & 1) || (e == 0);
11681 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11682 e_conv = PeerHandleError_clone(&e_conv);
11683 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11684 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11685 return (uint64_t)ret_conv;
11688 jboolean __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
11689 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
11690 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
11694 void __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
11695 if ((_res & 1) != 0) return;
11696 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11697 CHECK_ACCESS(_res_ptr);
11698 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
11700 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11703 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
11704 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11705 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
11706 return (uint64_t)ret_conv;
11708 int64_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
11709 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
11710 int64_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
11714 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
11715 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11716 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11717 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11718 return (uint64_t)ret_conv;
11721 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
11722 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11723 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11724 return (uint64_t)ret_conv;
11727 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
11728 LDKPeerHandleError e_conv;
11729 e_conv.inner = (void*)(e & (~1));
11730 e_conv.is_owned = (e & 1) || (e == 0);
11731 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11732 e_conv = PeerHandleError_clone(&e_conv);
11733 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11734 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11735 return (uint64_t)ret_conv;
11738 jboolean __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
11739 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
11740 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
11744 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
11745 if ((_res & 1) != 0) return;
11746 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11747 CHECK_ACCESS(_res_ptr);
11748 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
11750 CResult_NonePeerHandleErrorZ_free(_res_conv);
11753 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
11754 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11755 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
11756 return (uint64_t)ret_conv;
11758 int64_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
11759 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
11760 int64_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
11764 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
11765 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
11766 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11767 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
11768 return (uint64_t)ret_conv;
11771 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
11772 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11773 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11774 return (uint64_t)ret_conv;
11777 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
11778 LDKPeerHandleError e_conv;
11779 e_conv.inner = (void*)(e & (~1));
11780 e_conv.is_owned = (e & 1) || (e == 0);
11781 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11782 e_conv = PeerHandleError_clone(&e_conv);
11783 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11784 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11785 return (uint64_t)ret_conv;
11788 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
11789 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
11790 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
11794 void __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
11795 if ((_res & 1) != 0) return;
11796 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11797 CHECK_ACCESS(_res_ptr);
11798 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
11800 CResult_boolPeerHandleErrorZ_free(_res_conv);
11803 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
11804 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11805 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
11806 return (uint64_t)ret_conv;
11808 int64_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
11809 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
11810 int64_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
11814 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
11815 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11816 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11817 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11818 return (uint64_t)ret_conv;
11821 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
11822 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11823 CHECK_ACCESS(o_ptr);
11824 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
11825 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
11826 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11827 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
11828 return (uint64_t)ret_conv;
11831 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
11832 LDKAccessError e_conv = LDKAccessError_from_js(e);
11833 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11834 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
11835 return (uint64_t)ret_conv;
11838 jboolean __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
11839 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
11840 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
11844 void __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
11845 if ((_res & 1) != 0) return;
11846 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11847 CHECK_ACCESS(_res_ptr);
11848 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
11850 CResult_TxOutAccessErrorZ_free(_res_conv);
11853 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
11854 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11855 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
11856 return (uint64_t)ret_conv;
11858 int64_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
11859 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
11860 int64_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
11864 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
11865 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
11866 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11867 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
11868 return (uint64_t)ret_conv;
11871 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
11872 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11873 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
11874 return (uint64_t)ret_conv;
11877 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
11878 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
11879 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11880 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
11881 return (uint64_t)ret_conv;
11884 jboolean __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
11885 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
11886 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
11890 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_free"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
11891 if ((_res & 1) != 0) return;
11892 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11893 CHECK_ACCESS(_res_ptr);
11894 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
11896 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
11899 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
11900 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11901 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
11902 return (uint64_t)ret_conv;
11904 int64_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
11905 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
11906 int64_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
11910 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
11911 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
11912 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11913 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
11914 return (uint64_t)ret_conv;
11917 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_some"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
11918 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11919 CHECK_ACCESS(o_ptr);
11920 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
11921 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
11922 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11923 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
11924 uint64_t ret_ref = (uint64_t)ret_copy;
11928 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_none"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
11929 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11930 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
11931 uint64_t ret_ref = (uint64_t)ret_copy;
11935 void __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_free"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
11936 if ((_res & 1) != 0) return;
11937 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11938 CHECK_ACCESS(_res_ptr);
11939 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
11941 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
11944 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
11945 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11946 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
11947 uint64_t ret_ref = (uint64_t)ret_copy;
11950 int64_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
11951 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
11952 int64_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
11956 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
11957 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
11958 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11959 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
11960 uint64_t ret_ref = (uint64_t)ret_copy;
11964 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
11965 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11966 CHECK_ACCESS(o_ptr);
11967 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
11968 o_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)o) & ~1));
11969 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11970 *ret_copy = COption_ClosureReasonZ_some(o_conv);
11971 uint64_t ret_ref = (uint64_t)ret_copy;
11975 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
11976 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11977 *ret_copy = COption_ClosureReasonZ_none();
11978 uint64_t ret_ref = (uint64_t)ret_copy;
11982 void __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
11983 if ((_res & 1) != 0) return;
11984 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11985 CHECK_ACCESS(_res_ptr);
11986 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
11988 COption_ClosureReasonZ_free(_res_conv);
11991 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
11992 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11993 *ret_copy = COption_ClosureReasonZ_clone(arg);
11994 uint64_t ret_ref = (uint64_t)ret_copy;
11997 int64_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
11998 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
11999 int64_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
12003 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
12004 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
12005 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12006 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
12007 uint64_t ret_ref = (uint64_t)ret_copy;
12011 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
12012 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12013 CHECK_ACCESS(o_ptr);
12014 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
12015 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uint64_t)o) & ~1));
12016 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12017 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
12018 return (uint64_t)ret_conv;
12021 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
12022 LDKDecodeError e_conv;
12023 e_conv.inner = (void*)(e & (~1));
12024 e_conv.is_owned = (e & 1) || (e == 0);
12025 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12026 e_conv = DecodeError_clone(&e_conv);
12027 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12028 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
12029 return (uint64_t)ret_conv;
12032 jboolean __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
12033 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
12034 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
12038 void __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
12039 if ((_res & 1) != 0) return;
12040 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12041 CHECK_ACCESS(_res_ptr);
12042 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
12044 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
12047 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
12048 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12049 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
12050 return (uint64_t)ret_conv;
12052 int64_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
12053 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
12054 int64_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
12058 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
12059 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
12060 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12061 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
12062 return (uint64_t)ret_conv;
12065 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
12066 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12067 CHECK_ACCESS(o_ptr);
12068 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
12069 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
12070 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12071 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
12072 uint64_t ret_ref = (uint64_t)ret_copy;
12076 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
12077 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12078 *ret_copy = COption_NetworkUpdateZ_none();
12079 uint64_t ret_ref = (uint64_t)ret_copy;
12083 void __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
12084 if ((_res & 1) != 0) return;
12085 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12086 CHECK_ACCESS(_res_ptr);
12087 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
12089 COption_NetworkUpdateZ_free(_res_conv);
12092 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
12093 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12094 *ret_copy = COption_NetworkUpdateZ_clone(arg);
12095 uint64_t ret_ref = (uint64_t)ret_copy;
12098 int64_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
12099 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
12100 int64_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
12104 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
12105 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
12106 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12107 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
12108 uint64_t ret_ref = (uint64_t)ret_copy;
12112 void __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
12113 LDKCVec_SpendableOutputDescriptorZ _res_constr;
12114 _res_constr.datalen = _res->arr_len;
12115 if (_res_constr.datalen > 0)
12116 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
12118 _res_constr.data = NULL;
12119 uint32_t* _res_vals = _res->elems;
12120 for (size_t b = 0; b < _res_constr.datalen; b++) {
12121 uint32_t _res_conv_27 = _res_vals[b];
12122 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
12123 CHECK_ACCESS(_res_conv_27_ptr);
12124 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
12125 FREE((void*)_res_conv_27);
12126 _res_constr.data[b] = _res_conv_27_conv;
12128 CVec_SpendableOutputDescriptorZ_free(_res_constr);
12131 uint32_t __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint32_t o) {
12132 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12133 CHECK_ACCESS(o_ptr);
12134 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
12135 o_conv = Event_clone((LDKEvent*)(((uint64_t)o) & ~1));
12136 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12137 *ret_copy = COption_EventZ_some(o_conv);
12138 uint64_t ret_ref = (uint64_t)ret_copy;
12142 uint32_t __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
12143 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12144 *ret_copy = COption_EventZ_none();
12145 uint64_t ret_ref = (uint64_t)ret_copy;
12149 void __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint32_t _res) {
12150 if ((_res & 1) != 0) return;
12151 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12152 CHECK_ACCESS(_res_ptr);
12153 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
12155 COption_EventZ_free(_res_conv);
12158 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
12159 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12160 *ret_copy = COption_EventZ_clone(arg);
12161 uint64_t ret_ref = (uint64_t)ret_copy;
12164 int64_t __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
12165 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
12166 int64_t ret_val = COption_EventZ_clone_ptr(arg_conv);
12170 uint32_t __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint32_t orig) {
12171 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
12172 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12173 *ret_copy = COption_EventZ_clone(orig_conv);
12174 uint64_t ret_ref = (uint64_t)ret_copy;
12178 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
12179 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12180 CHECK_ACCESS(o_ptr);
12181 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
12182 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uint64_t)o) & ~1));
12183 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12184 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
12185 return (uint64_t)ret_conv;
12188 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
12189 LDKDecodeError e_conv;
12190 e_conv.inner = (void*)(e & (~1));
12191 e_conv.is_owned = (e & 1) || (e == 0);
12192 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12193 e_conv = DecodeError_clone(&e_conv);
12194 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12195 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
12196 return (uint64_t)ret_conv;
12199 jboolean __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
12200 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
12201 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
12205 void __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
12206 if ((_res & 1) != 0) return;
12207 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12208 CHECK_ACCESS(_res_ptr);
12209 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
12211 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
12214 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
12215 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12216 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
12217 return (uint64_t)ret_conv;
12219 int64_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
12220 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
12221 int64_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
12225 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
12226 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
12227 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12228 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
12229 return (uint64_t)ret_conv;
12232 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
12234 o_conv.inner = (void*)(o & (~1));
12235 o_conv.is_owned = (o & 1) || (o == 0);
12236 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12237 o_conv = NodeId_clone(&o_conv);
12238 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12239 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
12240 return (uint64_t)ret_conv;
12243 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
12244 LDKDecodeError e_conv;
12245 e_conv.inner = (void*)(e & (~1));
12246 e_conv.is_owned = (e & 1) || (e == 0);
12247 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12248 e_conv = DecodeError_clone(&e_conv);
12249 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12250 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
12251 return (uint64_t)ret_conv;
12254 jboolean __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
12255 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
12256 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
12260 void __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
12261 if ((_res & 1) != 0) return;
12262 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12263 CHECK_ACCESS(_res_ptr);
12264 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
12266 CResult_NodeIdDecodeErrorZ_free(_res_conv);
12269 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
12270 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12271 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
12272 return (uint64_t)ret_conv;
12274 int64_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
12275 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
12276 int64_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
12280 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
12281 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
12282 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12283 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
12284 return (uint64_t)ret_conv;
12287 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
12288 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12289 CHECK_ACCESS(o_ptr);
12290 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
12291 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)o) & ~1));
12292 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12293 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
12294 return (uint64_t)ret_conv;
12297 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
12298 LDKDecodeError e_conv;
12299 e_conv.inner = (void*)(e & (~1));
12300 e_conv.is_owned = (e & 1) || (e == 0);
12301 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12302 e_conv = DecodeError_clone(&e_conv);
12303 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12304 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
12305 return (uint64_t)ret_conv;
12308 jboolean __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
12309 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
12310 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
12314 void __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
12315 if ((_res & 1) != 0) return;
12316 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12317 CHECK_ACCESS(_res_ptr);
12318 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
12320 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
12323 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
12324 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12325 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
12326 return (uint64_t)ret_conv;
12328 int64_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
12329 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
12330 int64_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
12334 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
12335 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
12336 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12337 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
12338 return (uint64_t)ret_conv;
12341 uint32_t __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint32_t o) {
12342 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12343 CHECK_ACCESS(o_ptr);
12344 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
12345 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
12346 *ret_copy = COption_AccessZ_some(o_conv);
12347 uint64_t ret_ref = (uint64_t)ret_copy;
12351 uint32_t __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
12352 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
12353 *ret_copy = COption_AccessZ_none();
12354 uint64_t ret_ref = (uint64_t)ret_copy;
12358 void __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint32_t _res) {
12359 if ((_res & 1) != 0) return;
12360 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12361 CHECK_ACCESS(_res_ptr);
12362 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
12364 COption_AccessZ_free(_res_conv);
12367 uint32_t __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
12368 LDKDirectionalChannelInfo o_conv;
12369 o_conv.inner = (void*)(o & (~1));
12370 o_conv.is_owned = (o & 1) || (o == 0);
12371 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12372 o_conv = DirectionalChannelInfo_clone(&o_conv);
12373 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12374 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
12375 return (uint64_t)ret_conv;
12378 uint32_t __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_err"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
12379 LDKDecodeError e_conv;
12380 e_conv.inner = (void*)(e & (~1));
12381 e_conv.is_owned = (e & 1) || (e == 0);
12382 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12383 e_conv = DecodeError_clone(&e_conv);
12384 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12385 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
12386 return (uint64_t)ret_conv;
12389 jboolean __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
12390 LDKCResult_DirectionalChannelInfoDecodeErrorZ* o_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(o & ~1);
12391 jboolean ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o_conv);
12395 void __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_free"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
12396 if ((_res & 1) != 0) return;
12397 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12398 CHECK_ACCESS(_res_ptr);
12399 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
12401 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
12404 static inline uintptr_t CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
12405 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12406 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(arg);
12407 return (uint64_t)ret_conv;
12409 int64_t __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12410 LDKCResult_DirectionalChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
12411 int64_t ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
12415 uint32_t __attribute__((export_name("TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
12416 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
12417 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12418 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
12419 return (uint64_t)ret_conv;
12422 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
12423 LDKChannelInfo o_conv;
12424 o_conv.inner = (void*)(o & (~1));
12425 o_conv.is_owned = (o & 1) || (o == 0);
12426 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12427 o_conv = ChannelInfo_clone(&o_conv);
12428 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12429 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
12430 return (uint64_t)ret_conv;
12433 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
12434 LDKDecodeError e_conv;
12435 e_conv.inner = (void*)(e & (~1));
12436 e_conv.is_owned = (e & 1) || (e == 0);
12437 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12438 e_conv = DecodeError_clone(&e_conv);
12439 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12440 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
12441 return (uint64_t)ret_conv;
12444 jboolean __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
12445 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
12446 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
12450 void __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
12451 if ((_res & 1) != 0) return;
12452 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12453 CHECK_ACCESS(_res_ptr);
12454 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
12456 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
12459 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
12460 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12461 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
12462 return (uint64_t)ret_conv;
12464 int64_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12465 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
12466 int64_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
12470 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
12471 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
12472 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12473 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
12474 return (uint64_t)ret_conv;
12477 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
12478 LDKRoutingFees o_conv;
12479 o_conv.inner = (void*)(o & (~1));
12480 o_conv.is_owned = (o & 1) || (o == 0);
12481 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12482 o_conv = RoutingFees_clone(&o_conv);
12483 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12484 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
12485 return (uint64_t)ret_conv;
12488 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
12489 LDKDecodeError e_conv;
12490 e_conv.inner = (void*)(e & (~1));
12491 e_conv.is_owned = (e & 1) || (e == 0);
12492 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12493 e_conv = DecodeError_clone(&e_conv);
12494 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12495 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
12496 return (uint64_t)ret_conv;
12499 jboolean __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
12500 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
12501 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
12505 void __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
12506 if ((_res & 1) != 0) return;
12507 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12508 CHECK_ACCESS(_res_ptr);
12509 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
12511 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
12514 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
12515 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12516 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
12517 return (uint64_t)ret_conv;
12519 int64_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
12520 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
12521 int64_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
12525 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
12526 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
12527 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12528 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
12529 return (uint64_t)ret_conv;
12532 void __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
12533 LDKCVec_NetAddressZ _res_constr;
12534 _res_constr.datalen = _res->arr_len;
12535 if (_res_constr.datalen > 0)
12536 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12538 _res_constr.data = NULL;
12539 uint32_t* _res_vals = _res->elems;
12540 for (size_t m = 0; m < _res_constr.datalen; m++) {
12541 uint32_t _res_conv_12 = _res_vals[m];
12542 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
12543 CHECK_ACCESS(_res_conv_12_ptr);
12544 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
12545 FREE((void*)_res_conv_12);
12546 _res_constr.data[m] = _res_conv_12_conv;
12548 CVec_NetAddressZ_free(_res_constr);
12551 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
12552 LDKNodeAnnouncementInfo o_conv;
12553 o_conv.inner = (void*)(o & (~1));
12554 o_conv.is_owned = (o & 1) || (o == 0);
12555 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12556 o_conv = NodeAnnouncementInfo_clone(&o_conv);
12557 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12558 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
12559 return (uint64_t)ret_conv;
12562 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
12563 LDKDecodeError e_conv;
12564 e_conv.inner = (void*)(e & (~1));
12565 e_conv.is_owned = (e & 1) || (e == 0);
12566 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12567 e_conv = DecodeError_clone(&e_conv);
12568 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12569 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
12570 return (uint64_t)ret_conv;
12573 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
12574 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
12575 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
12579 void __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
12580 if ((_res & 1) != 0) return;
12581 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12582 CHECK_ACCESS(_res_ptr);
12583 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
12585 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
12588 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
12589 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12590 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
12591 return (uint64_t)ret_conv;
12593 int64_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12594 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
12595 int64_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
12599 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
12600 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
12601 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12602 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
12603 return (uint64_t)ret_conv;
12606 void __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
12607 LDKCVec_u64Z _res_constr;
12608 _res_constr.datalen = _res->arr_len;
12609 if (_res_constr.datalen > 0)
12610 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12612 _res_constr.data = NULL;
12613 int64_t* _res_vals = _res->elems;
12614 for (size_t i = 0; i < _res_constr.datalen; i++) {
12615 int64_t _res_conv_8 = _res_vals[i];
12616 _res_constr.data[i] = _res_conv_8;
12618 CVec_u64Z_free(_res_constr);
12621 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
12622 LDKNodeInfo o_conv;
12623 o_conv.inner = (void*)(o & (~1));
12624 o_conv.is_owned = (o & 1) || (o == 0);
12625 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12626 o_conv = NodeInfo_clone(&o_conv);
12627 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12628 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
12629 return (uint64_t)ret_conv;
12632 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
12633 LDKDecodeError e_conv;
12634 e_conv.inner = (void*)(e & (~1));
12635 e_conv.is_owned = (e & 1) || (e == 0);
12636 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12637 e_conv = DecodeError_clone(&e_conv);
12638 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12639 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
12640 return (uint64_t)ret_conv;
12643 jboolean __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
12644 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
12645 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
12649 void __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
12650 if ((_res & 1) != 0) return;
12651 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12652 CHECK_ACCESS(_res_ptr);
12653 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
12655 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
12658 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
12659 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12660 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
12661 return (uint64_t)ret_conv;
12663 int64_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12664 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
12665 int64_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
12669 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
12670 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
12671 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12672 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
12673 return (uint64_t)ret_conv;
12676 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
12677 LDKNetworkGraph o_conv;
12678 o_conv.inner = (void*)(o & (~1));
12679 o_conv.is_owned = (o & 1) || (o == 0);
12680 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12681 o_conv = NetworkGraph_clone(&o_conv);
12682 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12683 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
12684 return (uint64_t)ret_conv;
12687 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
12688 LDKDecodeError e_conv;
12689 e_conv.inner = (void*)(e & (~1));
12690 e_conv.is_owned = (e & 1) || (e == 0);
12691 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12692 e_conv = DecodeError_clone(&e_conv);
12693 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12694 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
12695 return (uint64_t)ret_conv;
12698 jboolean __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
12699 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
12700 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
12704 void __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
12705 if ((_res & 1) != 0) return;
12706 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12707 CHECK_ACCESS(_res_ptr);
12708 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
12710 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
12713 static inline uintptr_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
12714 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12715 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
12716 return (uint64_t)ret_conv;
12718 int64_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr"))) TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr(uint32_t arg) {
12719 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
12720 int64_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
12724 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_clone"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
12725 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
12726 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12727 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
12728 return (uint64_t)ret_conv;
12731 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
12732 LDKCVec_NetAddressZ o_constr;
12733 o_constr.datalen = o->arr_len;
12734 if (o_constr.datalen > 0)
12735 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12737 o_constr.data = NULL;
12738 uint32_t* o_vals = o->elems;
12739 for (size_t m = 0; m < o_constr.datalen; m++) {
12740 uint32_t o_conv_12 = o_vals[m];
12741 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
12742 CHECK_ACCESS(o_conv_12_ptr);
12743 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
12744 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
12745 o_constr.data[m] = o_conv_12_conv;
12747 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12748 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
12749 uint64_t ret_ref = (uint64_t)ret_copy;
12753 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
12754 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12755 *ret_copy = COption_CVec_NetAddressZZ_none();
12756 uint64_t ret_ref = (uint64_t)ret_copy;
12760 void __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
12761 if ((_res & 1) != 0) return;
12762 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12763 CHECK_ACCESS(_res_ptr);
12764 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
12766 COption_CVec_NetAddressZZ_free(_res_conv);
12769 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
12770 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12771 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
12772 uint64_t ret_ref = (uint64_t)ret_copy;
12775 int64_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
12776 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
12777 int64_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
12781 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
12782 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
12783 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12784 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
12785 uint64_t ret_ref = (uint64_t)ret_copy;
12789 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_ok"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) {
12790 LDKScoringParameters o_conv;
12791 o_conv.inner = (void*)(o & (~1));
12792 o_conv.is_owned = (o & 1) || (o == 0);
12793 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12794 // Warning: we need a move here but no clone is available for LDKScoringParameters
12795 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12796 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
12797 return (uint64_t)ret_conv;
12800 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_err"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) {
12801 LDKDecodeError e_conv;
12802 e_conv.inner = (void*)(e & (~1));
12803 e_conv.is_owned = (e & 1) || (e == 0);
12804 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12805 e_conv = DecodeError_clone(&e_conv);
12806 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12807 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
12808 return (uint64_t)ret_conv;
12811 jboolean __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_is_ok"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) {
12812 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
12813 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
12817 void __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_free"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) {
12818 if ((_res & 1) != 0) return;
12819 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12820 CHECK_ACCESS(_res_ptr);
12821 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
12823 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
12826 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
12827 LDKInitFeatures o_conv;
12828 o_conv.inner = (void*)(o & (~1));
12829 o_conv.is_owned = (o & 1) || (o == 0);
12830 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12831 o_conv = InitFeatures_clone(&o_conv);
12832 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12833 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
12834 return (uint64_t)ret_conv;
12837 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
12838 LDKDecodeError e_conv;
12839 e_conv.inner = (void*)(e & (~1));
12840 e_conv.is_owned = (e & 1) || (e == 0);
12841 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12842 e_conv = DecodeError_clone(&e_conv);
12843 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12844 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
12845 return (uint64_t)ret_conv;
12848 jboolean __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12849 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
12850 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
12854 void __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
12855 if ((_res & 1) != 0) return;
12856 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12857 CHECK_ACCESS(_res_ptr);
12858 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
12860 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
12863 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
12864 LDKChannelFeatures o_conv;
12865 o_conv.inner = (void*)(o & (~1));
12866 o_conv.is_owned = (o & 1) || (o == 0);
12867 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12868 o_conv = ChannelFeatures_clone(&o_conv);
12869 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12870 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
12871 return (uint64_t)ret_conv;
12874 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
12875 LDKDecodeError e_conv;
12876 e_conv.inner = (void*)(e & (~1));
12877 e_conv.is_owned = (e & 1) || (e == 0);
12878 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12879 e_conv = DecodeError_clone(&e_conv);
12880 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12881 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
12882 return (uint64_t)ret_conv;
12885 jboolean __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12886 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
12887 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
12891 void __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
12892 if ((_res & 1) != 0) return;
12893 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12894 CHECK_ACCESS(_res_ptr);
12895 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
12897 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
12900 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
12901 LDKNodeFeatures o_conv;
12902 o_conv.inner = (void*)(o & (~1));
12903 o_conv.is_owned = (o & 1) || (o == 0);
12904 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12905 o_conv = NodeFeatures_clone(&o_conv);
12906 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12907 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
12908 return (uint64_t)ret_conv;
12911 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
12912 LDKDecodeError e_conv;
12913 e_conv.inner = (void*)(e & (~1));
12914 e_conv.is_owned = (e & 1) || (e == 0);
12915 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12916 e_conv = DecodeError_clone(&e_conv);
12917 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12918 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
12919 return (uint64_t)ret_conv;
12922 jboolean __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12923 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
12924 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
12928 void __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
12929 if ((_res & 1) != 0) return;
12930 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12931 CHECK_ACCESS(_res_ptr);
12932 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
12934 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
12937 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
12938 LDKInvoiceFeatures o_conv;
12939 o_conv.inner = (void*)(o & (~1));
12940 o_conv.is_owned = (o & 1) || (o == 0);
12941 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12942 o_conv = InvoiceFeatures_clone(&o_conv);
12943 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12944 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
12945 return (uint64_t)ret_conv;
12948 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
12949 LDKDecodeError e_conv;
12950 e_conv.inner = (void*)(e & (~1));
12951 e_conv.is_owned = (e & 1) || (e == 0);
12952 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12953 e_conv = DecodeError_clone(&e_conv);
12954 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12955 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
12956 return (uint64_t)ret_conv;
12959 jboolean __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12960 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
12961 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
12965 void __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
12966 if ((_res & 1) != 0) return;
12967 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12968 CHECK_ACCESS(_res_ptr);
12969 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
12971 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
12974 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) {
12975 LDKChannelTypeFeatures o_conv;
12976 o_conv.inner = (void*)(o & (~1));
12977 o_conv.is_owned = (o & 1) || (o == 0);
12978 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12979 o_conv = ChannelTypeFeatures_clone(&o_conv);
12980 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12981 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
12982 return (uint64_t)ret_conv;
12985 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) {
12986 LDKDecodeError e_conv;
12987 e_conv.inner = (void*)(e & (~1));
12988 e_conv.is_owned = (e & 1) || (e == 0);
12989 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12990 e_conv = DecodeError_clone(&e_conv);
12991 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12992 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
12993 return (uint64_t)ret_conv;
12996 jboolean __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12997 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
12998 jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
13002 void __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) {
13003 if ((_res & 1) != 0) return;
13004 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13005 CHECK_ACCESS(_res_ptr);
13006 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
13008 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
13011 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
13012 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13013 CHECK_ACCESS(o_ptr);
13014 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
13015 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
13016 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13017 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
13018 return (uint64_t)ret_conv;
13021 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
13022 LDKDecodeError e_conv;
13023 e_conv.inner = (void*)(e & (~1));
13024 e_conv.is_owned = (e & 1) || (e == 0);
13025 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13026 e_conv = DecodeError_clone(&e_conv);
13027 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13028 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
13029 return (uint64_t)ret_conv;
13032 jboolean __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
13033 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
13034 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
13038 void __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
13039 if ((_res & 1) != 0) return;
13040 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13041 CHECK_ACCESS(_res_ptr);
13042 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
13044 CResult_NetAddressDecodeErrorZ_free(_res_conv);
13047 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
13048 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13049 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
13050 return (uint64_t)ret_conv;
13052 int64_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
13053 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
13054 int64_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
13058 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
13059 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
13060 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13061 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
13062 return (uint64_t)ret_conv;
13065 void __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
13066 LDKCVec_UpdateAddHTLCZ _res_constr;
13067 _res_constr.datalen = _res->arr_len;
13068 if (_res_constr.datalen > 0)
13069 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13071 _res_constr.data = NULL;
13072 uint32_t* _res_vals = _res->elems;
13073 for (size_t p = 0; p < _res_constr.datalen; p++) {
13074 uint32_t _res_conv_15 = _res_vals[p];
13075 LDKUpdateAddHTLC _res_conv_15_conv;
13076 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
13077 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
13078 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
13079 _res_constr.data[p] = _res_conv_15_conv;
13081 CVec_UpdateAddHTLCZ_free(_res_constr);
13084 void __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
13085 LDKCVec_UpdateFulfillHTLCZ _res_constr;
13086 _res_constr.datalen = _res->arr_len;
13087 if (_res_constr.datalen > 0)
13088 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13090 _res_constr.data = NULL;
13091 uint32_t* _res_vals = _res->elems;
13092 for (size_t t = 0; t < _res_constr.datalen; t++) {
13093 uint32_t _res_conv_19 = _res_vals[t];
13094 LDKUpdateFulfillHTLC _res_conv_19_conv;
13095 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
13096 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
13097 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
13098 _res_constr.data[t] = _res_conv_19_conv;
13100 CVec_UpdateFulfillHTLCZ_free(_res_constr);
13103 void __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
13104 LDKCVec_UpdateFailHTLCZ _res_constr;
13105 _res_constr.datalen = _res->arr_len;
13106 if (_res_constr.datalen > 0)
13107 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13109 _res_constr.data = NULL;
13110 uint32_t* _res_vals = _res->elems;
13111 for (size_t q = 0; q < _res_constr.datalen; q++) {
13112 uint32_t _res_conv_16 = _res_vals[q];
13113 LDKUpdateFailHTLC _res_conv_16_conv;
13114 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
13115 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
13116 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
13117 _res_constr.data[q] = _res_conv_16_conv;
13119 CVec_UpdateFailHTLCZ_free(_res_constr);
13122 void __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
13123 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
13124 _res_constr.datalen = _res->arr_len;
13125 if (_res_constr.datalen > 0)
13126 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13128 _res_constr.data = NULL;
13129 uint32_t* _res_vals = _res->elems;
13130 for (size_t z = 0; z < _res_constr.datalen; z++) {
13131 uint32_t _res_conv_25 = _res_vals[z];
13132 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
13133 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
13134 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
13135 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
13136 _res_constr.data[z] = _res_conv_25_conv;
13138 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
13141 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
13142 LDKAcceptChannel o_conv;
13143 o_conv.inner = (void*)(o & (~1));
13144 o_conv.is_owned = (o & 1) || (o == 0);
13145 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13146 o_conv = AcceptChannel_clone(&o_conv);
13147 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13148 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
13149 return (uint64_t)ret_conv;
13152 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
13153 LDKDecodeError e_conv;
13154 e_conv.inner = (void*)(e & (~1));
13155 e_conv.is_owned = (e & 1) || (e == 0);
13156 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13157 e_conv = DecodeError_clone(&e_conv);
13158 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13159 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
13160 return (uint64_t)ret_conv;
13163 jboolean __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
13164 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
13165 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
13169 void __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
13170 if ((_res & 1) != 0) return;
13171 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13172 CHECK_ACCESS(_res_ptr);
13173 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
13175 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
13178 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
13179 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13180 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
13181 return (uint64_t)ret_conv;
13183 int64_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
13184 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
13185 int64_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
13189 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
13190 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
13191 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13192 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
13193 return (uint64_t)ret_conv;
13196 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
13197 LDKAnnouncementSignatures o_conv;
13198 o_conv.inner = (void*)(o & (~1));
13199 o_conv.is_owned = (o & 1) || (o == 0);
13200 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13201 o_conv = AnnouncementSignatures_clone(&o_conv);
13202 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13203 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
13204 return (uint64_t)ret_conv;
13207 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
13208 LDKDecodeError e_conv;
13209 e_conv.inner = (void*)(e & (~1));
13210 e_conv.is_owned = (e & 1) || (e == 0);
13211 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13212 e_conv = DecodeError_clone(&e_conv);
13213 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13214 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
13215 return (uint64_t)ret_conv;
13218 jboolean __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
13219 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
13220 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
13224 void __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
13225 if ((_res & 1) != 0) return;
13226 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13227 CHECK_ACCESS(_res_ptr);
13228 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
13230 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
13233 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
13234 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13235 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
13236 return (uint64_t)ret_conv;
13238 int64_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13239 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
13240 int64_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
13244 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
13245 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
13246 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13247 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
13248 return (uint64_t)ret_conv;
13251 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
13252 LDKChannelReestablish o_conv;
13253 o_conv.inner = (void*)(o & (~1));
13254 o_conv.is_owned = (o & 1) || (o == 0);
13255 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13256 o_conv = ChannelReestablish_clone(&o_conv);
13257 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13258 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
13259 return (uint64_t)ret_conv;
13262 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
13263 LDKDecodeError e_conv;
13264 e_conv.inner = (void*)(e & (~1));
13265 e_conv.is_owned = (e & 1) || (e == 0);
13266 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13267 e_conv = DecodeError_clone(&e_conv);
13268 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13269 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
13270 return (uint64_t)ret_conv;
13273 jboolean __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
13274 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
13275 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
13279 void __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
13280 if ((_res & 1) != 0) return;
13281 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13282 CHECK_ACCESS(_res_ptr);
13283 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
13285 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
13288 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
13289 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13290 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
13291 return (uint64_t)ret_conv;
13293 int64_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
13294 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
13295 int64_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
13299 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
13300 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
13301 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13302 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
13303 return (uint64_t)ret_conv;
13306 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
13307 LDKClosingSigned o_conv;
13308 o_conv.inner = (void*)(o & (~1));
13309 o_conv.is_owned = (o & 1) || (o == 0);
13310 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13311 o_conv = ClosingSigned_clone(&o_conv);
13312 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13313 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
13314 return (uint64_t)ret_conv;
13317 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
13318 LDKDecodeError e_conv;
13319 e_conv.inner = (void*)(e & (~1));
13320 e_conv.is_owned = (e & 1) || (e == 0);
13321 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13322 e_conv = DecodeError_clone(&e_conv);
13323 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13324 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
13325 return (uint64_t)ret_conv;
13328 jboolean __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
13329 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
13330 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
13334 void __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
13335 if ((_res & 1) != 0) return;
13336 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13337 CHECK_ACCESS(_res_ptr);
13338 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
13340 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
13343 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
13344 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13345 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
13346 return (uint64_t)ret_conv;
13348 int64_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
13349 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
13350 int64_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
13354 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
13355 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
13356 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13357 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
13358 return (uint64_t)ret_conv;
13361 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
13362 LDKClosingSignedFeeRange o_conv;
13363 o_conv.inner = (void*)(o & (~1));
13364 o_conv.is_owned = (o & 1) || (o == 0);
13365 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13366 o_conv = ClosingSignedFeeRange_clone(&o_conv);
13367 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13368 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
13369 return (uint64_t)ret_conv;
13372 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
13373 LDKDecodeError e_conv;
13374 e_conv.inner = (void*)(e & (~1));
13375 e_conv.is_owned = (e & 1) || (e == 0);
13376 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13377 e_conv = DecodeError_clone(&e_conv);
13378 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13379 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
13380 return (uint64_t)ret_conv;
13383 jboolean __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
13384 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
13385 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
13389 void __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
13390 if ((_res & 1) != 0) return;
13391 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13392 CHECK_ACCESS(_res_ptr);
13393 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
13395 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
13398 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
13399 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13400 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
13401 return (uint64_t)ret_conv;
13403 int64_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
13404 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
13405 int64_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
13409 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
13410 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
13411 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13412 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
13413 return (uint64_t)ret_conv;
13416 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
13417 LDKCommitmentSigned o_conv;
13418 o_conv.inner = (void*)(o & (~1));
13419 o_conv.is_owned = (o & 1) || (o == 0);
13420 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13421 o_conv = CommitmentSigned_clone(&o_conv);
13422 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13423 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
13424 return (uint64_t)ret_conv;
13427 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
13428 LDKDecodeError e_conv;
13429 e_conv.inner = (void*)(e & (~1));
13430 e_conv.is_owned = (e & 1) || (e == 0);
13431 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13432 e_conv = DecodeError_clone(&e_conv);
13433 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13434 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
13435 return (uint64_t)ret_conv;
13438 jboolean __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
13439 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
13440 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
13444 void __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
13445 if ((_res & 1) != 0) return;
13446 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13447 CHECK_ACCESS(_res_ptr);
13448 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
13450 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
13453 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
13454 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13455 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
13456 return (uint64_t)ret_conv;
13458 int64_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
13459 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
13460 int64_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
13464 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
13465 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
13466 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13467 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
13468 return (uint64_t)ret_conv;
13471 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
13472 LDKFundingCreated o_conv;
13473 o_conv.inner = (void*)(o & (~1));
13474 o_conv.is_owned = (o & 1) || (o == 0);
13475 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13476 o_conv = FundingCreated_clone(&o_conv);
13477 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13478 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
13479 return (uint64_t)ret_conv;
13482 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
13483 LDKDecodeError e_conv;
13484 e_conv.inner = (void*)(e & (~1));
13485 e_conv.is_owned = (e & 1) || (e == 0);
13486 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13487 e_conv = DecodeError_clone(&e_conv);
13488 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13489 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
13490 return (uint64_t)ret_conv;
13493 jboolean __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
13494 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
13495 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
13499 void __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
13500 if ((_res & 1) != 0) return;
13501 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13502 CHECK_ACCESS(_res_ptr);
13503 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
13505 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
13508 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
13509 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13510 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
13511 return (uint64_t)ret_conv;
13513 int64_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
13514 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
13515 int64_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
13519 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
13520 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
13521 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13522 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
13523 return (uint64_t)ret_conv;
13526 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
13527 LDKFundingSigned o_conv;
13528 o_conv.inner = (void*)(o & (~1));
13529 o_conv.is_owned = (o & 1) || (o == 0);
13530 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13531 o_conv = FundingSigned_clone(&o_conv);
13532 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13533 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
13534 return (uint64_t)ret_conv;
13537 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
13538 LDKDecodeError e_conv;
13539 e_conv.inner = (void*)(e & (~1));
13540 e_conv.is_owned = (e & 1) || (e == 0);
13541 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13542 e_conv = DecodeError_clone(&e_conv);
13543 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13544 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
13545 return (uint64_t)ret_conv;
13548 jboolean __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
13549 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
13550 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
13554 void __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
13555 if ((_res & 1) != 0) return;
13556 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13557 CHECK_ACCESS(_res_ptr);
13558 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
13560 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
13563 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
13564 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13565 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
13566 return (uint64_t)ret_conv;
13568 int64_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
13569 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
13570 int64_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
13574 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
13575 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
13576 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13577 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
13578 return (uint64_t)ret_conv;
13581 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_ok"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
13582 LDKFundingLocked o_conv;
13583 o_conv.inner = (void*)(o & (~1));
13584 o_conv.is_owned = (o & 1) || (o == 0);
13585 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13586 o_conv = FundingLocked_clone(&o_conv);
13587 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13588 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
13589 return (uint64_t)ret_conv;
13592 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_err"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
13593 LDKDecodeError e_conv;
13594 e_conv.inner = (void*)(e & (~1));
13595 e_conv.is_owned = (e & 1) || (e == 0);
13596 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13597 e_conv = DecodeError_clone(&e_conv);
13598 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13599 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
13600 return (uint64_t)ret_conv;
13603 jboolean __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_is_ok"))) TS_CResult_FundingLockedDecodeErrorZ_is_ok(uint32_t o) {
13604 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
13605 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
13609 void __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_free"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
13610 if ((_res & 1) != 0) return;
13611 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13612 CHECK_ACCESS(_res_ptr);
13613 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
13615 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
13618 static inline uintptr_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
13619 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13620 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
13621 return (uint64_t)ret_conv;
13623 int64_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingLockedDecodeErrorZ_clone_ptr(uint32_t arg) {
13624 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
13625 int64_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
13629 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_clone"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
13630 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
13631 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13632 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
13633 return (uint64_t)ret_conv;
13636 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
13638 o_conv.inner = (void*)(o & (~1));
13639 o_conv.is_owned = (o & 1) || (o == 0);
13640 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13641 o_conv = Init_clone(&o_conv);
13642 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13643 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
13644 return (uint64_t)ret_conv;
13647 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
13648 LDKDecodeError e_conv;
13649 e_conv.inner = (void*)(e & (~1));
13650 e_conv.is_owned = (e & 1) || (e == 0);
13651 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13652 e_conv = DecodeError_clone(&e_conv);
13653 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13654 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
13655 return (uint64_t)ret_conv;
13658 jboolean __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
13659 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
13660 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
13664 void __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
13665 if ((_res & 1) != 0) return;
13666 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13667 CHECK_ACCESS(_res_ptr);
13668 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
13670 CResult_InitDecodeErrorZ_free(_res_conv);
13673 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
13674 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13675 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
13676 return (uint64_t)ret_conv;
13678 int64_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
13679 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
13680 int64_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
13684 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
13685 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
13686 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13687 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
13688 return (uint64_t)ret_conv;
13691 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
13692 LDKOpenChannel o_conv;
13693 o_conv.inner = (void*)(o & (~1));
13694 o_conv.is_owned = (o & 1) || (o == 0);
13695 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13696 o_conv = OpenChannel_clone(&o_conv);
13697 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13698 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
13699 return (uint64_t)ret_conv;
13702 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
13703 LDKDecodeError e_conv;
13704 e_conv.inner = (void*)(e & (~1));
13705 e_conv.is_owned = (e & 1) || (e == 0);
13706 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13707 e_conv = DecodeError_clone(&e_conv);
13708 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13709 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
13710 return (uint64_t)ret_conv;
13713 jboolean __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
13714 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
13715 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
13719 void __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
13720 if ((_res & 1) != 0) return;
13721 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13722 CHECK_ACCESS(_res_ptr);
13723 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
13725 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
13728 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
13729 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13730 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
13731 return (uint64_t)ret_conv;
13733 int64_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
13734 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
13735 int64_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
13739 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
13740 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
13741 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13742 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
13743 return (uint64_t)ret_conv;
13746 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
13747 LDKRevokeAndACK o_conv;
13748 o_conv.inner = (void*)(o & (~1));
13749 o_conv.is_owned = (o & 1) || (o == 0);
13750 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13751 o_conv = RevokeAndACK_clone(&o_conv);
13752 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13753 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
13754 return (uint64_t)ret_conv;
13757 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
13758 LDKDecodeError e_conv;
13759 e_conv.inner = (void*)(e & (~1));
13760 e_conv.is_owned = (e & 1) || (e == 0);
13761 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13762 e_conv = DecodeError_clone(&e_conv);
13763 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13764 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
13765 return (uint64_t)ret_conv;
13768 jboolean __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
13769 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
13770 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
13774 void __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
13775 if ((_res & 1) != 0) return;
13776 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13777 CHECK_ACCESS(_res_ptr);
13778 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
13780 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
13783 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
13784 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13785 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
13786 return (uint64_t)ret_conv;
13788 int64_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
13789 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
13790 int64_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
13794 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
13795 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
13796 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13797 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
13798 return (uint64_t)ret_conv;
13801 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
13802 LDKShutdown o_conv;
13803 o_conv.inner = (void*)(o & (~1));
13804 o_conv.is_owned = (o & 1) || (o == 0);
13805 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13806 o_conv = Shutdown_clone(&o_conv);
13807 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13808 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
13809 return (uint64_t)ret_conv;
13812 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
13813 LDKDecodeError e_conv;
13814 e_conv.inner = (void*)(e & (~1));
13815 e_conv.is_owned = (e & 1) || (e == 0);
13816 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13817 e_conv = DecodeError_clone(&e_conv);
13818 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13819 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
13820 return (uint64_t)ret_conv;
13823 jboolean __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
13824 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
13825 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
13829 void __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
13830 if ((_res & 1) != 0) return;
13831 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13832 CHECK_ACCESS(_res_ptr);
13833 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
13835 CResult_ShutdownDecodeErrorZ_free(_res_conv);
13838 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
13839 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13840 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
13841 return (uint64_t)ret_conv;
13843 int64_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
13844 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
13845 int64_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
13849 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
13850 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
13851 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13852 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
13853 return (uint64_t)ret_conv;
13856 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
13857 LDKUpdateFailHTLC o_conv;
13858 o_conv.inner = (void*)(o & (~1));
13859 o_conv.is_owned = (o & 1) || (o == 0);
13860 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13861 o_conv = UpdateFailHTLC_clone(&o_conv);
13862 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13863 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
13864 return (uint64_t)ret_conv;
13867 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
13868 LDKDecodeError e_conv;
13869 e_conv.inner = (void*)(e & (~1));
13870 e_conv.is_owned = (e & 1) || (e == 0);
13871 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13872 e_conv = DecodeError_clone(&e_conv);
13873 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13874 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
13875 return (uint64_t)ret_conv;
13878 jboolean __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
13879 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
13880 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
13884 void __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
13885 if ((_res & 1) != 0) return;
13886 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13887 CHECK_ACCESS(_res_ptr);
13888 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
13890 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
13893 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
13894 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13895 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
13896 return (uint64_t)ret_conv;
13898 int64_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
13899 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
13900 int64_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
13904 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
13905 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
13906 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13907 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
13908 return (uint64_t)ret_conv;
13911 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
13912 LDKUpdateFailMalformedHTLC o_conv;
13913 o_conv.inner = (void*)(o & (~1));
13914 o_conv.is_owned = (o & 1) || (o == 0);
13915 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13916 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
13917 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13918 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
13919 return (uint64_t)ret_conv;
13922 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
13923 LDKDecodeError e_conv;
13924 e_conv.inner = (void*)(e & (~1));
13925 e_conv.is_owned = (e & 1) || (e == 0);
13926 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13927 e_conv = DecodeError_clone(&e_conv);
13928 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13929 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
13930 return (uint64_t)ret_conv;
13933 jboolean __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
13934 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
13935 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
13939 void __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
13940 if ((_res & 1) != 0) return;
13941 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13942 CHECK_ACCESS(_res_ptr);
13943 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
13945 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
13948 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
13949 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13950 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
13951 return (uint64_t)ret_conv;
13953 int64_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
13954 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
13955 int64_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
13959 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
13960 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
13961 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13962 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
13963 return (uint64_t)ret_conv;
13966 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
13967 LDKUpdateFee o_conv;
13968 o_conv.inner = (void*)(o & (~1));
13969 o_conv.is_owned = (o & 1) || (o == 0);
13970 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13971 o_conv = UpdateFee_clone(&o_conv);
13972 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13973 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
13974 return (uint64_t)ret_conv;
13977 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
13978 LDKDecodeError e_conv;
13979 e_conv.inner = (void*)(e & (~1));
13980 e_conv.is_owned = (e & 1) || (e == 0);
13981 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13982 e_conv = DecodeError_clone(&e_conv);
13983 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13984 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
13985 return (uint64_t)ret_conv;
13988 jboolean __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
13989 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
13990 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
13994 void __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
13995 if ((_res & 1) != 0) return;
13996 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13997 CHECK_ACCESS(_res_ptr);
13998 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
14000 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
14003 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
14004 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14005 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
14006 return (uint64_t)ret_conv;
14008 int64_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
14009 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
14010 int64_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
14014 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
14015 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
14016 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14017 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
14018 return (uint64_t)ret_conv;
14021 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
14022 LDKUpdateFulfillHTLC o_conv;
14023 o_conv.inner = (void*)(o & (~1));
14024 o_conv.is_owned = (o & 1) || (o == 0);
14025 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14026 o_conv = UpdateFulfillHTLC_clone(&o_conv);
14027 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14028 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
14029 return (uint64_t)ret_conv;
14032 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
14033 LDKDecodeError e_conv;
14034 e_conv.inner = (void*)(e & (~1));
14035 e_conv.is_owned = (e & 1) || (e == 0);
14036 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14037 e_conv = DecodeError_clone(&e_conv);
14038 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14039 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
14040 return (uint64_t)ret_conv;
14043 jboolean __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
14044 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
14045 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
14049 void __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
14050 if ((_res & 1) != 0) return;
14051 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14052 CHECK_ACCESS(_res_ptr);
14053 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
14055 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
14058 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
14059 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14060 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
14061 return (uint64_t)ret_conv;
14063 int64_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
14064 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
14065 int64_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
14069 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
14070 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
14071 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14072 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
14073 return (uint64_t)ret_conv;
14076 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
14077 LDKUpdateAddHTLC o_conv;
14078 o_conv.inner = (void*)(o & (~1));
14079 o_conv.is_owned = (o & 1) || (o == 0);
14080 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14081 o_conv = UpdateAddHTLC_clone(&o_conv);
14082 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14083 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
14084 return (uint64_t)ret_conv;
14087 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
14088 LDKDecodeError e_conv;
14089 e_conv.inner = (void*)(e & (~1));
14090 e_conv.is_owned = (e & 1) || (e == 0);
14091 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14092 e_conv = DecodeError_clone(&e_conv);
14093 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14094 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
14095 return (uint64_t)ret_conv;
14098 jboolean __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
14099 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
14100 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
14104 void __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
14105 if ((_res & 1) != 0) return;
14106 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14107 CHECK_ACCESS(_res_ptr);
14108 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
14110 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
14113 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
14114 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14115 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
14116 return (uint64_t)ret_conv;
14118 int64_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
14119 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
14120 int64_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
14124 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
14125 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
14126 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14127 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
14128 return (uint64_t)ret_conv;
14131 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
14133 o_conv.inner = (void*)(o & (~1));
14134 o_conv.is_owned = (o & 1) || (o == 0);
14135 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14136 o_conv = Ping_clone(&o_conv);
14137 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14138 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
14139 return (uint64_t)ret_conv;
14142 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
14143 LDKDecodeError e_conv;
14144 e_conv.inner = (void*)(e & (~1));
14145 e_conv.is_owned = (e & 1) || (e == 0);
14146 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14147 e_conv = DecodeError_clone(&e_conv);
14148 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14149 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
14150 return (uint64_t)ret_conv;
14153 jboolean __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
14154 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
14155 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
14159 void __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
14160 if ((_res & 1) != 0) return;
14161 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14162 CHECK_ACCESS(_res_ptr);
14163 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
14165 CResult_PingDecodeErrorZ_free(_res_conv);
14168 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
14169 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14170 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
14171 return (uint64_t)ret_conv;
14173 int64_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
14174 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
14175 int64_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
14179 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
14180 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
14181 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14182 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
14183 return (uint64_t)ret_conv;
14186 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
14188 o_conv.inner = (void*)(o & (~1));
14189 o_conv.is_owned = (o & 1) || (o == 0);
14190 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14191 o_conv = Pong_clone(&o_conv);
14192 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14193 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
14194 return (uint64_t)ret_conv;
14197 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
14198 LDKDecodeError e_conv;
14199 e_conv.inner = (void*)(e & (~1));
14200 e_conv.is_owned = (e & 1) || (e == 0);
14201 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14202 e_conv = DecodeError_clone(&e_conv);
14203 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14204 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
14205 return (uint64_t)ret_conv;
14208 jboolean __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
14209 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
14210 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
14214 void __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
14215 if ((_res & 1) != 0) return;
14216 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14217 CHECK_ACCESS(_res_ptr);
14218 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
14220 CResult_PongDecodeErrorZ_free(_res_conv);
14223 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
14224 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14225 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
14226 return (uint64_t)ret_conv;
14228 int64_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
14229 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
14230 int64_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
14234 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
14235 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
14236 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14237 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
14238 return (uint64_t)ret_conv;
14241 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
14242 LDKUnsignedChannelAnnouncement o_conv;
14243 o_conv.inner = (void*)(o & (~1));
14244 o_conv.is_owned = (o & 1) || (o == 0);
14245 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14246 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
14247 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14248 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
14249 return (uint64_t)ret_conv;
14252 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
14253 LDKDecodeError e_conv;
14254 e_conv.inner = (void*)(e & (~1));
14255 e_conv.is_owned = (e & 1) || (e == 0);
14256 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14257 e_conv = DecodeError_clone(&e_conv);
14258 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14259 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
14260 return (uint64_t)ret_conv;
14263 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14264 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
14265 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
14269 void __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
14270 if ((_res & 1) != 0) return;
14271 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14272 CHECK_ACCESS(_res_ptr);
14273 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
14275 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
14278 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14279 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14280 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
14281 return (uint64_t)ret_conv;
14283 int64_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14284 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
14285 int64_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14289 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14290 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14291 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14292 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14293 return (uint64_t)ret_conv;
14296 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
14297 LDKChannelAnnouncement o_conv;
14298 o_conv.inner = (void*)(o & (~1));
14299 o_conv.is_owned = (o & 1) || (o == 0);
14300 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14301 o_conv = ChannelAnnouncement_clone(&o_conv);
14302 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14303 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
14304 return (uint64_t)ret_conv;
14307 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
14308 LDKDecodeError e_conv;
14309 e_conv.inner = (void*)(e & (~1));
14310 e_conv.is_owned = (e & 1) || (e == 0);
14311 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14312 e_conv = DecodeError_clone(&e_conv);
14313 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14314 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
14315 return (uint64_t)ret_conv;
14318 jboolean __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14319 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
14320 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
14324 void __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
14325 if ((_res & 1) != 0) return;
14326 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14327 CHECK_ACCESS(_res_ptr);
14328 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
14330 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
14333 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14334 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14335 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
14336 return (uint64_t)ret_conv;
14338 int64_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14339 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
14340 int64_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14344 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14345 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14346 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14347 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14348 return (uint64_t)ret_conv;
14351 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
14352 LDKUnsignedChannelUpdate o_conv;
14353 o_conv.inner = (void*)(o & (~1));
14354 o_conv.is_owned = (o & 1) || (o == 0);
14355 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14356 o_conv = UnsignedChannelUpdate_clone(&o_conv);
14357 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14358 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
14359 return (uint64_t)ret_conv;
14362 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
14363 LDKDecodeError e_conv;
14364 e_conv.inner = (void*)(e & (~1));
14365 e_conv.is_owned = (e & 1) || (e == 0);
14366 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14367 e_conv = DecodeError_clone(&e_conv);
14368 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14369 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
14370 return (uint64_t)ret_conv;
14373 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
14374 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
14375 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
14379 void __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
14380 if ((_res & 1) != 0) return;
14381 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14382 CHECK_ACCESS(_res_ptr);
14383 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
14385 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
14388 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
14389 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14390 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
14391 return (uint64_t)ret_conv;
14393 int64_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
14394 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
14395 int64_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
14399 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
14400 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
14401 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14402 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
14403 return (uint64_t)ret_conv;
14406 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
14407 LDKChannelUpdate o_conv;
14408 o_conv.inner = (void*)(o & (~1));
14409 o_conv.is_owned = (o & 1) || (o == 0);
14410 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14411 o_conv = ChannelUpdate_clone(&o_conv);
14412 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14413 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
14414 return (uint64_t)ret_conv;
14417 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
14418 LDKDecodeError e_conv;
14419 e_conv.inner = (void*)(e & (~1));
14420 e_conv.is_owned = (e & 1) || (e == 0);
14421 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14422 e_conv = DecodeError_clone(&e_conv);
14423 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14424 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
14425 return (uint64_t)ret_conv;
14428 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
14429 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
14430 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
14434 void __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
14435 if ((_res & 1) != 0) return;
14436 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14437 CHECK_ACCESS(_res_ptr);
14438 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
14440 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
14443 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
14444 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14445 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
14446 return (uint64_t)ret_conv;
14448 int64_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
14449 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
14450 int64_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
14454 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
14455 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
14456 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14457 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
14458 return (uint64_t)ret_conv;
14461 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
14462 LDKErrorMessage o_conv;
14463 o_conv.inner = (void*)(o & (~1));
14464 o_conv.is_owned = (o & 1) || (o == 0);
14465 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14466 o_conv = ErrorMessage_clone(&o_conv);
14467 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14468 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
14469 return (uint64_t)ret_conv;
14472 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
14473 LDKDecodeError e_conv;
14474 e_conv.inner = (void*)(e & (~1));
14475 e_conv.is_owned = (e & 1) || (e == 0);
14476 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14477 e_conv = DecodeError_clone(&e_conv);
14478 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14479 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
14480 return (uint64_t)ret_conv;
14483 jboolean __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
14484 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
14485 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
14489 void __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
14490 if ((_res & 1) != 0) return;
14491 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14492 CHECK_ACCESS(_res_ptr);
14493 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
14495 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
14498 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
14499 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14500 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
14501 return (uint64_t)ret_conv;
14503 int64_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
14504 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
14505 int64_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
14509 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
14510 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
14511 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14512 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
14513 return (uint64_t)ret_conv;
14516 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
14517 LDKUnsignedNodeAnnouncement o_conv;
14518 o_conv.inner = (void*)(o & (~1));
14519 o_conv.is_owned = (o & 1) || (o == 0);
14520 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14521 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
14522 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14523 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
14524 return (uint64_t)ret_conv;
14527 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
14528 LDKDecodeError e_conv;
14529 e_conv.inner = (void*)(e & (~1));
14530 e_conv.is_owned = (e & 1) || (e == 0);
14531 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14532 e_conv = DecodeError_clone(&e_conv);
14533 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14534 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
14535 return (uint64_t)ret_conv;
14538 jboolean __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14539 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
14540 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
14544 void __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
14545 if ((_res & 1) != 0) return;
14546 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14547 CHECK_ACCESS(_res_ptr);
14548 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
14550 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
14553 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14554 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14555 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
14556 return (uint64_t)ret_conv;
14558 int64_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14559 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
14560 int64_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14564 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14565 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
14566 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14567 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
14568 return (uint64_t)ret_conv;
14571 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
14572 LDKNodeAnnouncement o_conv;
14573 o_conv.inner = (void*)(o & (~1));
14574 o_conv.is_owned = (o & 1) || (o == 0);
14575 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14576 o_conv = NodeAnnouncement_clone(&o_conv);
14577 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14578 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
14579 return (uint64_t)ret_conv;
14582 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
14583 LDKDecodeError e_conv;
14584 e_conv.inner = (void*)(e & (~1));
14585 e_conv.is_owned = (e & 1) || (e == 0);
14586 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14587 e_conv = DecodeError_clone(&e_conv);
14588 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14589 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
14590 return (uint64_t)ret_conv;
14593 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14594 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
14595 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
14599 void __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
14600 if ((_res & 1) != 0) return;
14601 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14602 CHECK_ACCESS(_res_ptr);
14603 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
14605 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
14608 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14609 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14610 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
14611 return (uint64_t)ret_conv;
14613 int64_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14614 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
14615 int64_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14619 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14620 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
14621 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14622 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
14623 return (uint64_t)ret_conv;
14626 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
14627 LDKQueryShortChannelIds o_conv;
14628 o_conv.inner = (void*)(o & (~1));
14629 o_conv.is_owned = (o & 1) || (o == 0);
14630 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14631 o_conv = QueryShortChannelIds_clone(&o_conv);
14632 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14633 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
14634 return (uint64_t)ret_conv;
14637 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
14638 LDKDecodeError e_conv;
14639 e_conv.inner = (void*)(e & (~1));
14640 e_conv.is_owned = (e & 1) || (e == 0);
14641 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14642 e_conv = DecodeError_clone(&e_conv);
14643 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14644 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
14645 return (uint64_t)ret_conv;
14648 jboolean __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
14649 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
14650 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
14654 void __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
14655 if ((_res & 1) != 0) return;
14656 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14657 CHECK_ACCESS(_res_ptr);
14658 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
14660 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
14663 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
14664 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14665 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
14666 return (uint64_t)ret_conv;
14668 int64_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
14669 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
14670 int64_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
14674 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
14675 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
14676 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14677 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
14678 return (uint64_t)ret_conv;
14681 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
14682 LDKReplyShortChannelIdsEnd o_conv;
14683 o_conv.inner = (void*)(o & (~1));
14684 o_conv.is_owned = (o & 1) || (o == 0);
14685 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14686 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
14687 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14688 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
14689 return (uint64_t)ret_conv;
14692 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
14693 LDKDecodeError e_conv;
14694 e_conv.inner = (void*)(e & (~1));
14695 e_conv.is_owned = (e & 1) || (e == 0);
14696 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14697 e_conv = DecodeError_clone(&e_conv);
14698 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14699 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
14700 return (uint64_t)ret_conv;
14703 jboolean __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
14704 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
14705 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
14709 void __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
14710 if ((_res & 1) != 0) return;
14711 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14712 CHECK_ACCESS(_res_ptr);
14713 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
14715 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
14718 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
14719 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14720 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
14721 return (uint64_t)ret_conv;
14723 int64_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
14724 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
14725 int64_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
14729 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
14730 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
14731 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14732 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
14733 return (uint64_t)ret_conv;
14736 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
14737 LDKQueryChannelRange o_conv;
14738 o_conv.inner = (void*)(o & (~1));
14739 o_conv.is_owned = (o & 1) || (o == 0);
14740 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14741 o_conv = QueryChannelRange_clone(&o_conv);
14742 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14743 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
14744 return (uint64_t)ret_conv;
14747 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
14748 LDKDecodeError e_conv;
14749 e_conv.inner = (void*)(e & (~1));
14750 e_conv.is_owned = (e & 1) || (e == 0);
14751 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14752 e_conv = DecodeError_clone(&e_conv);
14753 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14754 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
14755 return (uint64_t)ret_conv;
14758 jboolean __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
14759 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
14760 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
14764 void __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
14765 if ((_res & 1) != 0) return;
14766 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14767 CHECK_ACCESS(_res_ptr);
14768 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
14770 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
14773 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
14774 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14775 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
14776 return (uint64_t)ret_conv;
14778 int64_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
14779 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
14780 int64_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
14784 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
14785 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
14786 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14787 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
14788 return (uint64_t)ret_conv;
14791 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
14792 LDKReplyChannelRange o_conv;
14793 o_conv.inner = (void*)(o & (~1));
14794 o_conv.is_owned = (o & 1) || (o == 0);
14795 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14796 o_conv = ReplyChannelRange_clone(&o_conv);
14797 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14798 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
14799 return (uint64_t)ret_conv;
14802 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
14803 LDKDecodeError e_conv;
14804 e_conv.inner = (void*)(e & (~1));
14805 e_conv.is_owned = (e & 1) || (e == 0);
14806 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14807 e_conv = DecodeError_clone(&e_conv);
14808 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14809 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
14810 return (uint64_t)ret_conv;
14813 jboolean __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
14814 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
14815 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
14819 void __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
14820 if ((_res & 1) != 0) return;
14821 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14822 CHECK_ACCESS(_res_ptr);
14823 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
14825 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
14828 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
14829 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14830 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
14831 return (uint64_t)ret_conv;
14833 int64_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
14834 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
14835 int64_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
14839 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
14840 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
14841 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14842 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
14843 return (uint64_t)ret_conv;
14846 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
14847 LDKGossipTimestampFilter o_conv;
14848 o_conv.inner = (void*)(o & (~1));
14849 o_conv.is_owned = (o & 1) || (o == 0);
14850 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14851 o_conv = GossipTimestampFilter_clone(&o_conv);
14852 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14853 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
14854 return (uint64_t)ret_conv;
14857 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
14858 LDKDecodeError e_conv;
14859 e_conv.inner = (void*)(e & (~1));
14860 e_conv.is_owned = (e & 1) || (e == 0);
14861 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14862 e_conv = DecodeError_clone(&e_conv);
14863 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14864 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
14865 return (uint64_t)ret_conv;
14868 jboolean __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
14869 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
14870 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
14874 void __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
14875 if ((_res & 1) != 0) return;
14876 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14877 CHECK_ACCESS(_res_ptr);
14878 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
14880 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
14883 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
14884 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14885 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
14886 return (uint64_t)ret_conv;
14888 int64_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
14889 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
14890 int64_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
14894 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
14895 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
14896 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14897 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
14898 return (uint64_t)ret_conv;
14901 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14902 LDKDelayedPaymentOutputDescriptor o_conv;
14903 o_conv.inner = (void*)(o & (~1));
14904 o_conv.is_owned = (o & 1) || (o == 0);
14905 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14906 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
14907 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14908 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14909 return (uint64_t)ret_conv;
14912 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14913 LDKDecodeError e_conv;
14914 e_conv.inner = (void*)(e & (~1));
14915 e_conv.is_owned = (e & 1) || (e == 0);
14916 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14917 e_conv = DecodeError_clone(&e_conv);
14918 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14919 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14920 return (uint64_t)ret_conv;
14923 jboolean __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14924 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14925 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14929 void __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14930 if ((_res & 1) != 0) return;
14931 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14932 CHECK_ACCESS(_res_ptr);
14933 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14935 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14938 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14939 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14940 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14941 return (uint64_t)ret_conv;
14943 int64_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14944 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14945 int64_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14949 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14950 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
14951 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14952 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14953 return (uint64_t)ret_conv;
14956 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14957 LDKStaticPaymentOutputDescriptor o_conv;
14958 o_conv.inner = (void*)(o & (~1));
14959 o_conv.is_owned = (o & 1) || (o == 0);
14960 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14961 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
14962 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14963 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14964 return (uint64_t)ret_conv;
14967 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14968 LDKDecodeError e_conv;
14969 e_conv.inner = (void*)(e & (~1));
14970 e_conv.is_owned = (e & 1) || (e == 0);
14971 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14972 e_conv = DecodeError_clone(&e_conv);
14973 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14974 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14975 return (uint64_t)ret_conv;
14978 jboolean __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14979 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14980 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14984 void __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14985 if ((_res & 1) != 0) return;
14986 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14987 CHECK_ACCESS(_res_ptr);
14988 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14990 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14993 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14994 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14995 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14996 return (uint64_t)ret_conv;
14998 int64_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14999 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
15000 int64_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15004 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
15005 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
15006 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15007 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15008 return (uint64_t)ret_conv;
15011 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
15012 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15013 CHECK_ACCESS(o_ptr);
15014 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
15015 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
15016 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15017 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
15018 return (uint64_t)ret_conv;
15021 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
15022 LDKDecodeError e_conv;
15023 e_conv.inner = (void*)(e & (~1));
15024 e_conv.is_owned = (e & 1) || (e == 0);
15025 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15026 e_conv = DecodeError_clone(&e_conv);
15027 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15028 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
15029 return (uint64_t)ret_conv;
15032 jboolean __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
15033 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
15034 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15038 void __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
15039 if ((_res & 1) != 0) return;
15040 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15041 CHECK_ACCESS(_res_ptr);
15042 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
15044 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
15047 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15048 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15049 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
15050 return (uint64_t)ret_conv;
15052 int64_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
15053 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
15054 int64_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15058 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
15059 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
15060 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15061 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
15062 return (uint64_t)ret_conv;
15065 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
15066 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15067 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
15068 return ((uint64_t)ret_conv);
15070 int64_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
15071 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
15072 int64_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
15076 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
15077 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
15078 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15079 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
15080 return ((uint64_t)ret_conv);
15083 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
15084 LDKSignature a_ref;
15085 CHECK(a->arr_len == 64);
15086 memcpy(a_ref.compact_form, a->elems, 64);
15087 LDKCVec_SignatureZ b_constr;
15088 b_constr.datalen = b->arr_len;
15089 if (b_constr.datalen > 0)
15090 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15092 b_constr.data = NULL;
15093 int8_tArray* b_vals = (void*) b->elems;
15094 for (size_t m = 0; m < b_constr.datalen; m++) {
15095 int8_tArray b_conv_12 = b_vals[m];
15096 LDKSignature b_conv_12_ref;
15097 CHECK(b_conv_12->arr_len == 64);
15098 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64);
15099 b_constr.data[m] = b_conv_12_ref;
15101 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15102 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
15103 return ((uint64_t)ret_conv);
15106 void __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
15107 if ((_res & 1) != 0) return;
15108 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15109 CHECK_ACCESS(_res_ptr);
15110 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
15112 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
15115 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
15116 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15117 CHECK_ACCESS(o_ptr);
15118 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
15119 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
15120 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15121 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
15122 return (uint64_t)ret_conv;
15125 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
15126 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15127 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
15128 return (uint64_t)ret_conv;
15131 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
15132 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
15133 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
15137 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
15138 if ((_res & 1) != 0) return;
15139 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15140 CHECK_ACCESS(_res_ptr);
15141 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
15143 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
15146 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
15147 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15148 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
15149 return (uint64_t)ret_conv;
15151 int64_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
15152 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
15153 int64_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
15157 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
15158 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
15159 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15160 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
15161 return (uint64_t)ret_conv;
15164 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
15165 LDKSignature o_ref;
15166 CHECK(o->arr_len == 64);
15167 memcpy(o_ref.compact_form, o->elems, 64);
15168 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15169 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
15170 return (uint64_t)ret_conv;
15173 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
15174 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15175 *ret_conv = CResult_SignatureNoneZ_err();
15176 return (uint64_t)ret_conv;
15179 jboolean __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
15180 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
15181 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
15185 void __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
15186 if ((_res & 1) != 0) return;
15187 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15188 CHECK_ACCESS(_res_ptr);
15189 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
15191 CResult_SignatureNoneZ_free(_res_conv);
15194 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
15195 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15196 *ret_conv = CResult_SignatureNoneZ_clone(arg);
15197 return (uint64_t)ret_conv;
15199 int64_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
15200 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
15201 int64_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
15205 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
15206 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
15207 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15208 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
15209 return (uint64_t)ret_conv;
15212 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
15213 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15214 CHECK_ACCESS(o_ptr);
15215 LDKSign o_conv = *(LDKSign*)(o_ptr);
15216 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15217 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
15218 return (uint64_t)ret_conv;
15221 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
15222 LDKDecodeError e_conv;
15223 e_conv.inner = (void*)(e & (~1));
15224 e_conv.is_owned = (e & 1) || (e == 0);
15225 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15226 e_conv = DecodeError_clone(&e_conv);
15227 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15228 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
15229 return (uint64_t)ret_conv;
15232 jboolean __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
15233 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
15234 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
15238 void __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
15239 if ((_res & 1) != 0) return;
15240 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15241 CHECK_ACCESS(_res_ptr);
15242 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
15244 CResult_SignDecodeErrorZ_free(_res_conv);
15247 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
15248 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15249 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
15250 return (uint64_t)ret_conv;
15252 int64_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
15253 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
15254 int64_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
15258 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
15259 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
15260 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15261 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
15262 return (uint64_t)ret_conv;
15265 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
15266 LDKRecoverableSignature o_ref;
15267 CHECK(o->arr_len == 68);
15268 memcpy(o_ref.serialized_form, o->elems, 68);
15269 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15270 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
15271 return (uint64_t)ret_conv;
15274 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
15275 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15276 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
15277 return (uint64_t)ret_conv;
15280 jboolean __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
15281 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
15282 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
15286 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
15287 if ((_res & 1) != 0) return;
15288 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15289 CHECK_ACCESS(_res_ptr);
15290 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
15292 CResult_RecoverableSignatureNoneZ_free(_res_conv);
15295 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
15296 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15297 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
15298 return (uint64_t)ret_conv;
15300 int64_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
15301 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
15302 int64_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
15306 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
15307 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
15308 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15309 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
15310 return (uint64_t)ret_conv;
15313 void __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
15314 LDKCVec_CVec_u8ZZ _res_constr;
15315 _res_constr.datalen = _res->arr_len;
15316 if (_res_constr.datalen > 0)
15317 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15319 _res_constr.data = NULL;
15320 int8_tArray* _res_vals = (void*) _res->elems;
15321 for (size_t m = 0; m < _res_constr.datalen; m++) {
15322 int8_tArray _res_conv_12 = _res_vals[m];
15323 LDKCVec_u8Z _res_conv_12_ref;
15324 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
15325 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15326 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen);
15327 _res_constr.data[m] = _res_conv_12_ref;
15329 CVec_CVec_u8ZZ_free(_res_constr);
15332 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
15333 LDKCVec_CVec_u8ZZ o_constr;
15334 o_constr.datalen = o->arr_len;
15335 if (o_constr.datalen > 0)
15336 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15338 o_constr.data = NULL;
15339 int8_tArray* o_vals = (void*) o->elems;
15340 for (size_t m = 0; m < o_constr.datalen; m++) {
15341 int8_tArray o_conv_12 = o_vals[m];
15342 LDKCVec_u8Z o_conv_12_ref;
15343 o_conv_12_ref.datalen = o_conv_12->arr_len;
15344 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15345 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen);
15346 o_constr.data[m] = o_conv_12_ref;
15348 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15349 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
15350 return (uint64_t)ret_conv;
15353 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
15354 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15355 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
15356 return (uint64_t)ret_conv;
15359 jboolean __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
15360 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
15361 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
15365 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
15366 if ((_res & 1) != 0) return;
15367 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15368 CHECK_ACCESS(_res_ptr);
15369 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
15371 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
15374 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
15375 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15376 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
15377 return (uint64_t)ret_conv;
15379 int64_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
15380 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
15381 int64_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
15385 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
15386 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
15387 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15388 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
15389 return (uint64_t)ret_conv;
15392 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
15393 LDKInMemorySigner o_conv;
15394 o_conv.inner = (void*)(o & (~1));
15395 o_conv.is_owned = (o & 1) || (o == 0);
15396 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15397 o_conv = InMemorySigner_clone(&o_conv);
15398 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15399 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
15400 return (uint64_t)ret_conv;
15403 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
15404 LDKDecodeError e_conv;
15405 e_conv.inner = (void*)(e & (~1));
15406 e_conv.is_owned = (e & 1) || (e == 0);
15407 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15408 e_conv = DecodeError_clone(&e_conv);
15409 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15410 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
15411 return (uint64_t)ret_conv;
15414 jboolean __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
15415 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
15416 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
15420 void __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
15421 if ((_res & 1) != 0) return;
15422 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15423 CHECK_ACCESS(_res_ptr);
15424 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
15426 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
15429 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
15430 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15431 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
15432 return (uint64_t)ret_conv;
15434 int64_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
15435 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
15436 int64_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
15440 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
15441 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
15442 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15443 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
15444 return (uint64_t)ret_conv;
15447 void __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
15448 LDKCVec_TxOutZ _res_constr;
15449 _res_constr.datalen = _res->arr_len;
15450 if (_res_constr.datalen > 0)
15451 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15453 _res_constr.data = NULL;
15454 uint32_t* _res_vals = _res->elems;
15455 for (size_t h = 0; h < _res_constr.datalen; h++) {
15456 uint32_t _res_conv_7 = _res_vals[h];
15457 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
15458 CHECK_ACCESS(_res_conv_7_ptr);
15459 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15460 FREE((void*)_res_conv_7);
15461 _res_constr.data[h] = _res_conv_7_conv;
15463 CVec_TxOutZ_free(_res_constr);
15466 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
15467 LDKTransaction o_ref;
15468 o_ref.datalen = o->arr_len;
15469 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
15470 memcpy(o_ref.data, o->elems, o_ref.datalen);
15471 o_ref.data_is_owned = true;
15472 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15473 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
15474 return (uint64_t)ret_conv;
15477 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
15478 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15479 *ret_conv = CResult_TransactionNoneZ_err();
15480 return (uint64_t)ret_conv;
15483 jboolean __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
15484 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
15485 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
15489 void __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
15490 if ((_res & 1) != 0) return;
15491 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15492 CHECK_ACCESS(_res_ptr);
15493 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
15495 CResult_TransactionNoneZ_free(_res_conv);
15498 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
15499 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15500 *ret_conv = CResult_TransactionNoneZ_clone(arg);
15501 return (uint64_t)ret_conv;
15503 int64_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
15504 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
15505 int64_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
15509 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
15510 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
15511 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15512 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
15513 return (uint64_t)ret_conv;
15516 uint32_t __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint32_t o) {
15517 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15518 CHECK_ACCESS(o_ptr);
15519 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
15520 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15521 *ret_copy = COption_FilterZ_some(o_conv);
15522 uint64_t ret_ref = (uint64_t)ret_copy;
15526 uint32_t __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
15527 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15528 *ret_copy = COption_FilterZ_none();
15529 uint64_t ret_ref = (uint64_t)ret_copy;
15533 void __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint32_t _res) {
15534 if ((_res & 1) != 0) return;
15535 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15536 CHECK_ACCESS(_res_ptr);
15537 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
15539 COption_FilterZ_free(_res_conv);
15542 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
15543 LDKLockedChannelMonitor o_conv;
15544 o_conv.inner = (void*)(o & (~1));
15545 o_conv.is_owned = (o & 1) || (o == 0);
15546 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15547 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
15548 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15549 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
15550 return (uint64_t)ret_conv;
15553 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
15554 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15555 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
15556 return (uint64_t)ret_conv;
15559 jboolean __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
15560 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
15561 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
15565 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
15566 if ((_res & 1) != 0) return;
15567 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15568 CHECK_ACCESS(_res_ptr);
15569 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
15571 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
15574 void __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
15575 LDKCVec_OutPointZ _res_constr;
15576 _res_constr.datalen = _res->arr_len;
15577 if (_res_constr.datalen > 0)
15578 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
15580 _res_constr.data = NULL;
15581 uint32_t* _res_vals = _res->elems;
15582 for (size_t k = 0; k < _res_constr.datalen; k++) {
15583 uint32_t _res_conv_10 = _res_vals[k];
15584 LDKOutPoint _res_conv_10_conv;
15585 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
15586 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
15587 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
15588 _res_constr.data[k] = _res_conv_10_conv;
15590 CVec_OutPointZ_free(_res_constr);
15593 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15594 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15595 *ret_conv = CResult_NoneAPIErrorZ_ok();
15596 return (uint64_t)ret_conv;
15599 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
15600 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15601 CHECK_ACCESS(e_ptr);
15602 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15603 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15604 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15605 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15606 return (uint64_t)ret_conv;
15609 jboolean __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
15610 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
15611 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
15615 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
15616 if ((_res & 1) != 0) return;
15617 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15618 CHECK_ACCESS(_res_ptr);
15619 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15621 CResult_NoneAPIErrorZ_free(_res_conv);
15624 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15625 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15626 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15627 return (uint64_t)ret_conv;
15629 int64_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
15630 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
15631 int64_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15635 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
15636 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
15637 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15638 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15639 return (uint64_t)ret_conv;
15642 uint32_t __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
15643 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15644 *ret_copy = COption_u16Z_some(o);
15645 uint64_t ret_ref = (uint64_t)ret_copy;
15649 uint32_t __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
15650 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15651 *ret_copy = COption_u16Z_none();
15652 uint64_t ret_ref = (uint64_t)ret_copy;
15656 void __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint32_t _res) {
15657 if ((_res & 1) != 0) return;
15658 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15659 CHECK_ACCESS(_res_ptr);
15660 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
15662 COption_u16Z_free(_res_conv);
15665 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
15666 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15667 *ret_copy = COption_u16Z_clone(arg);
15668 uint64_t ret_ref = (uint64_t)ret_copy;
15671 int64_t __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
15672 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
15673 int64_t ret_val = COption_u16Z_clone_ptr(arg_conv);
15677 uint32_t __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint32_t orig) {
15678 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
15679 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15680 *ret_copy = COption_u16Z_clone(orig_conv);
15681 uint64_t ret_ref = (uint64_t)ret_copy;
15685 void __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
15686 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15687 _res_constr.datalen = _res->arr_len;
15688 if (_res_constr.datalen > 0)
15689 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15691 _res_constr.data = NULL;
15692 uint32_t* _res_vals = _res->elems;
15693 for (size_t w = 0; w < _res_constr.datalen; w++) {
15694 uint32_t _res_conv_22 = _res_vals[w];
15695 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
15696 CHECK_ACCESS(_res_conv_22_ptr);
15697 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15698 FREE((void*)_res_conv_22);
15699 _res_constr.data[w] = _res_conv_22_conv;
15701 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15704 void __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
15705 LDKCVec_APIErrorZ _res_constr;
15706 _res_constr.datalen = _res->arr_len;
15707 if (_res_constr.datalen > 0)
15708 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15710 _res_constr.data = NULL;
15711 uint32_t* _res_vals = _res->elems;
15712 for (size_t k = 0; k < _res_constr.datalen; k++) {
15713 uint32_t _res_conv_10 = _res_vals[k];
15714 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
15715 CHECK_ACCESS(_res_conv_10_ptr);
15716 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15717 FREE((void*)_res_conv_10);
15718 _res_constr.data[k] = _res_conv_10_conv;
15720 CVec_APIErrorZ_free(_res_constr);
15723 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
15724 LDKThirtyTwoBytes o_ref;
15725 CHECK(o->arr_len == 32);
15726 memcpy(o_ref.data, o->elems, 32);
15727 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15728 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
15729 return (uint64_t)ret_conv;
15732 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
15733 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15734 CHECK_ACCESS(e_ptr);
15735 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15736 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15737 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15738 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
15739 return (uint64_t)ret_conv;
15742 jboolean __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
15743 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
15744 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
15748 void __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
15749 if ((_res & 1) != 0) return;
15750 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15751 CHECK_ACCESS(_res_ptr);
15752 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
15754 CResult__u832APIErrorZ_free(_res_conv);
15757 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
15758 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15759 *ret_conv = CResult__u832APIErrorZ_clone(arg);
15760 return (uint64_t)ret_conv;
15762 int64_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
15763 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
15764 int64_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
15768 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
15769 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
15770 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15771 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
15772 return (uint64_t)ret_conv;
15775 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
15776 LDKThirtyTwoBytes o_ref;
15777 CHECK(o->arr_len == 32);
15778 memcpy(o_ref.data, o->elems, 32);
15779 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15780 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
15781 return (uint64_t)ret_conv;
15784 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
15785 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15786 CHECK_ACCESS(e_ptr);
15787 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15788 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
15789 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15790 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
15791 return (uint64_t)ret_conv;
15794 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
15795 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
15796 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
15800 void __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
15801 if ((_res & 1) != 0) return;
15802 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15803 CHECK_ACCESS(_res_ptr);
15804 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
15806 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
15809 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
15810 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15811 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
15812 return (uint64_t)ret_conv;
15814 int64_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15815 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
15816 int64_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
15820 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
15821 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
15822 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15823 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
15824 return (uint64_t)ret_conv;
15827 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
15828 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15829 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
15830 return (uint64_t)ret_conv;
15833 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
15834 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15835 CHECK_ACCESS(e_ptr);
15836 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15837 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
15838 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15839 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
15840 return (uint64_t)ret_conv;
15843 jboolean __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
15844 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
15845 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
15849 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
15850 if ((_res & 1) != 0) return;
15851 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15852 CHECK_ACCESS(_res_ptr);
15853 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
15855 CResult_NonePaymentSendFailureZ_free(_res_conv);
15858 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
15859 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15860 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
15861 return (uint64_t)ret_conv;
15863 int64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
15864 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
15865 int64_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
15869 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
15870 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
15871 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15872 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
15873 return (uint64_t)ret_conv;
15876 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
15877 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15878 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
15879 return ((uint64_t)ret_conv);
15881 int64_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
15882 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
15883 int64_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
15887 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
15888 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
15889 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15890 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
15891 return ((uint64_t)ret_conv);
15894 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
15895 LDKThirtyTwoBytes a_ref;
15896 CHECK(a->arr_len == 32);
15897 memcpy(a_ref.data, a->elems, 32);
15898 LDKThirtyTwoBytes b_ref;
15899 CHECK(b->arr_len == 32);
15900 memcpy(b_ref.data, b->elems, 32);
15901 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15902 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
15903 return ((uint64_t)ret_conv);
15906 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
15907 if ((_res & 1) != 0) return;
15908 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15909 CHECK_ACCESS(_res_ptr);
15910 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
15912 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
15915 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
15916 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15917 CHECK_ACCESS(o_ptr);
15918 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
15919 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
15920 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15921 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
15922 return (uint64_t)ret_conv;
15925 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
15926 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15927 CHECK_ACCESS(e_ptr);
15928 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15929 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
15930 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15931 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
15932 return (uint64_t)ret_conv;
15935 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
15936 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
15937 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
15941 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
15942 if ((_res & 1) != 0) return;
15943 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15944 CHECK_ACCESS(_res_ptr);
15945 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
15947 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
15950 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
15951 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15952 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
15953 return (uint64_t)ret_conv;
15955 int64_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15956 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
15957 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
15961 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
15962 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
15963 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15964 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
15965 return (uint64_t)ret_conv;
15968 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
15969 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15970 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
15971 return ((uint64_t)ret_conv);
15973 int64_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
15974 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
15975 int64_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
15979 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
15980 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
15981 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15982 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
15983 return ((uint64_t)ret_conv);
15986 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
15987 LDKThirtyTwoBytes a_ref;
15988 CHECK(a->arr_len == 32);
15989 memcpy(a_ref.data, a->elems, 32);
15990 LDKThirtyTwoBytes b_ref;
15991 CHECK(b->arr_len == 32);
15992 memcpy(b_ref.data, b->elems, 32);
15993 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15994 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
15995 return ((uint64_t)ret_conv);
15998 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
15999 if ((_res & 1) != 0) return;
16000 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16001 CHECK_ACCESS(_res_ptr);
16002 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
16004 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
16007 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) {
16008 void* o_ptr = (void*)(((uint64_t)o) & ~1);
16009 CHECK_ACCESS(o_ptr);
16010 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16011 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1));
16012 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16013 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
16014 return (uint64_t)ret_conv;
16017 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
16018 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16019 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
16020 return (uint64_t)ret_conv;
16023 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) {
16024 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
16025 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
16029 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) {
16030 if ((_res & 1) != 0) return;
16031 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16032 CHECK_ACCESS(_res_ptr);
16033 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
16035 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
16038 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
16039 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16040 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
16041 return (uint64_t)ret_conv;
16043 int64_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) {
16044 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
16045 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
16049 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) {
16050 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
16051 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16052 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
16053 return (uint64_t)ret_conv;
16056 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) {
16057 void* o_ptr = (void*)(((uint64_t)o) & ~1);
16058 CHECK_ACCESS(o_ptr);
16059 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16060 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1));
16061 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16062 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
16063 return (uint64_t)ret_conv;
16066 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) {
16067 void* e_ptr = (void*)(((uint64_t)e) & ~1);
16068 CHECK_ACCESS(e_ptr);
16069 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16070 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
16071 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16072 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
16073 return (uint64_t)ret_conv;
16076 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) {
16077 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
16078 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
16082 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint32_t _res) {
16083 if ((_res & 1) != 0) return;
16084 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16085 CHECK_ACCESS(_res_ptr);
16086 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
16088 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
16091 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
16092 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16093 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
16094 return (uint64_t)ret_conv;
16096 int64_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) {
16097 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
16098 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
16102 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) {
16103 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
16104 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16105 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
16106 return (uint64_t)ret_conv;
16109 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
16110 LDKThirtyTwoBytes o_ref;
16111 CHECK(o->arr_len == 32);
16112 memcpy(o_ref.data, o->elems, 32);
16113 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16114 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
16115 return (uint64_t)ret_conv;
16118 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
16119 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16120 *ret_conv = CResult_PaymentSecretNoneZ_err();
16121 return (uint64_t)ret_conv;
16124 jboolean __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) {
16125 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
16126 jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv);
16130 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) {
16131 if ((_res & 1) != 0) return;
16132 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16133 CHECK_ACCESS(_res_ptr);
16134 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
16136 CResult_PaymentSecretNoneZ_free(_res_conv);
16139 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
16140 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16141 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
16142 return (uint64_t)ret_conv;
16144 int64_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) {
16145 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
16146 int64_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
16150 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) {
16151 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
16152 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16153 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
16154 return (uint64_t)ret_conv;
16157 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
16158 LDKThirtyTwoBytes o_ref;
16159 CHECK(o->arr_len == 32);
16160 memcpy(o_ref.data, o->elems, 32);
16161 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16162 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
16163 return (uint64_t)ret_conv;
16166 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
16167 void* e_ptr = (void*)(((uint64_t)e) & ~1);
16168 CHECK_ACCESS(e_ptr);
16169 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16170 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
16171 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16172 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
16173 return (uint64_t)ret_conv;
16176 jboolean __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
16177 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
16178 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
16182 void __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
16183 if ((_res & 1) != 0) return;
16184 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16185 CHECK_ACCESS(_res_ptr);
16186 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
16188 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
16191 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
16192 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16193 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
16194 return (uint64_t)ret_conv;
16196 int64_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
16197 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
16198 int64_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
16202 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
16203 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
16204 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16205 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
16206 return (uint64_t)ret_conv;
16209 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
16210 LDKThirtyTwoBytes o_ref;
16211 CHECK(o->arr_len == 32);
16212 memcpy(o_ref.data, o->elems, 32);
16213 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16214 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
16215 return (uint64_t)ret_conv;
16218 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) {
16219 void* e_ptr = (void*)(((uint64_t)e) & ~1);
16220 CHECK_ACCESS(e_ptr);
16221 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16222 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
16223 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16224 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
16225 return (uint64_t)ret_conv;
16228 jboolean __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) {
16229 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
16230 jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
16234 void __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) {
16235 if ((_res & 1) != 0) return;
16236 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16237 CHECK_ACCESS(_res_ptr);
16238 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
16240 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
16243 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
16244 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16245 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
16246 return (uint64_t)ret_conv;
16248 int64_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) {
16249 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
16250 int64_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
16254 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) {
16255 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
16256 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16257 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
16258 return (uint64_t)ret_conv;
16261 void __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
16262 LDKCVec_ChannelMonitorZ _res_constr;
16263 _res_constr.datalen = _res->arr_len;
16264 if (_res_constr.datalen > 0)
16265 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16267 _res_constr.data = NULL;
16268 uint32_t* _res_vals = _res->elems;
16269 for (size_t q = 0; q < _res_constr.datalen; q++) {
16270 uint32_t _res_conv_16 = _res_vals[q];
16271 LDKChannelMonitor _res_conv_16_conv;
16272 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
16273 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
16274 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16275 _res_constr.data[q] = _res_conv_16_conv;
16277 CVec_ChannelMonitorZ_free(_res_constr);
16280 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
16281 LDKThirtyTwoBytes a_ref;
16282 CHECK(a->arr_len == 32);
16283 memcpy(a_ref.data, a->elems, 32);
16284 LDKChannelManager b_conv;
16285 b_conv.inner = (void*)(b & (~1));
16286 b_conv.is_owned = (b & 1) || (b == 0);
16287 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16288 // Warning: we need a move here but no clone is available for LDKChannelManager
16289 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
16290 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
16291 return ((uint64_t)ret_conv);
16294 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
16295 if ((_res & 1) != 0) return;
16296 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16297 CHECK_ACCESS(_res_ptr);
16298 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
16300 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
16303 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
16304 void* o_ptr = (void*)(((uint64_t)o) & ~1);
16305 CHECK_ACCESS(o_ptr);
16306 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
16307 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
16308 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16309 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
16310 return (uint64_t)ret_conv;
16313 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
16314 LDKDecodeError e_conv;
16315 e_conv.inner = (void*)(e & (~1));
16316 e_conv.is_owned = (e & 1) || (e == 0);
16317 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16318 e_conv = DecodeError_clone(&e_conv);
16319 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16320 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16321 return (uint64_t)ret_conv;
16324 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
16325 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
16326 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16330 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
16331 if ((_res & 1) != 0) return;
16332 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16333 CHECK_ACCESS(_res_ptr);
16334 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16336 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16339 void __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
16340 if ((this_ptr & 1) != 0) return;
16341 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16342 CHECK_ACCESS(this_ptr_ptr);
16343 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
16344 FREE((void*)this_ptr);
16345 PaymentPurpose_free(this_ptr_conv);
16348 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
16349 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16350 *ret_copy = PaymentPurpose_clone(arg);
16351 uint64_t ret_ref = (uint64_t)ret_copy;
16354 int64_t __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
16355 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
16356 int64_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
16360 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint32_t orig) {
16361 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
16362 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16363 *ret_copy = PaymentPurpose_clone(orig_conv);
16364 uint64_t ret_ref = (uint64_t)ret_copy;
16368 uint32_t __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
16369 LDKThirtyTwoBytes payment_preimage_ref;
16370 CHECK(payment_preimage->arr_len == 32);
16371 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
16372 LDKThirtyTwoBytes payment_secret_ref;
16373 CHECK(payment_secret->arr_len == 32);
16374 memcpy(payment_secret_ref.data, payment_secret->elems, 32);
16375 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16376 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
16377 uint64_t ret_ref = (uint64_t)ret_copy;
16381 uint32_t __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
16382 LDKThirtyTwoBytes a_ref;
16383 CHECK(a->arr_len == 32);
16384 memcpy(a_ref.data, a->elems, 32);
16385 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16386 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
16387 uint64_t ret_ref = (uint64_t)ret_copy;
16391 void __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint32_t this_ptr) {
16392 if ((this_ptr & 1) != 0) return;
16393 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16394 CHECK_ACCESS(this_ptr_ptr);
16395 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
16396 FREE((void*)this_ptr);
16397 ClosureReason_free(this_ptr_conv);
16400 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
16401 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16402 *ret_copy = ClosureReason_clone(arg);
16403 uint64_t ret_ref = (uint64_t)ret_copy;
16406 int64_t __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
16407 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
16408 int64_t ret_val = ClosureReason_clone_ptr(arg_conv);
16412 uint32_t __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint32_t orig) {
16413 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
16414 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16415 *ret_copy = ClosureReason_clone(orig_conv);
16416 uint64_t ret_ref = (uint64_t)ret_copy;
16420 uint32_t __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
16421 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
16422 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16423 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
16424 uint64_t ret_ref = (uint64_t)ret_copy;
16428 uint32_t __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
16429 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16430 *ret_copy = ClosureReason_holder_force_closed();
16431 uint64_t ret_ref = (uint64_t)ret_copy;
16435 uint32_t __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
16436 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16437 *ret_copy = ClosureReason_cooperative_closure();
16438 uint64_t ret_ref = (uint64_t)ret_copy;
16442 uint32_t __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
16443 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16444 *ret_copy = ClosureReason_commitment_tx_confirmed();
16445 uint64_t ret_ref = (uint64_t)ret_copy;
16449 uint32_t __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
16450 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16451 *ret_copy = ClosureReason_funding_timed_out();
16452 uint64_t ret_ref = (uint64_t)ret_copy;
16456 uint32_t __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
16457 LDKStr err_conv = str_ref_to_owned_c(err);
16458 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16459 *ret_copy = ClosureReason_processing_error(err_conv);
16460 uint64_t ret_ref = (uint64_t)ret_copy;
16464 uint32_t __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
16465 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16466 *ret_copy = ClosureReason_disconnected_peer();
16467 uint64_t ret_ref = (uint64_t)ret_copy;
16471 uint32_t __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
16472 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16473 *ret_copy = ClosureReason_outdated_channel_manager();
16474 uint64_t ret_ref = (uint64_t)ret_copy;
16478 int8_tArray __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint32_t obj) {
16479 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
16480 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
16481 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
16482 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16483 CVec_u8Z_free(ret_var);
16487 uint32_t __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
16488 LDKu8slice ser_ref;
16489 ser_ref.datalen = ser->arr_len;
16490 ser_ref.data = ser->elems;
16491 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16492 *ret_conv = ClosureReason_read(ser_ref);
16493 return (uint64_t)ret_conv;
16496 void __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint32_t this_ptr) {
16497 if ((this_ptr & 1) != 0) return;
16498 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16499 CHECK_ACCESS(this_ptr_ptr);
16500 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
16501 FREE((void*)this_ptr);
16502 Event_free(this_ptr_conv);
16505 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
16506 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16507 *ret_copy = Event_clone(arg);
16508 uint64_t ret_ref = (uint64_t)ret_copy;
16511 int64_t __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint32_t arg) {
16512 LDKEvent* arg_conv = (LDKEvent*)arg;
16513 int64_t ret_val = Event_clone_ptr(arg_conv);
16517 uint32_t __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint32_t orig) {
16518 LDKEvent* orig_conv = (LDKEvent*)orig;
16519 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16520 *ret_copy = Event_clone(orig_conv);
16521 uint64_t ret_ref = (uint64_t)ret_copy;
16525 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) {
16526 LDKThirtyTwoBytes temporary_channel_id_ref;
16527 CHECK(temporary_channel_id->arr_len == 32);
16528 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32);
16529 LDKCVec_u8Z output_script_ref;
16530 output_script_ref.datalen = output_script->arr_len;
16531 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
16532 memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen);
16533 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16534 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
16535 uint64_t ret_ref = (uint64_t)ret_copy;
16539 uint32_t __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
16540 LDKThirtyTwoBytes payment_hash_ref;
16541 CHECK(payment_hash->arr_len == 32);
16542 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16543 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
16544 CHECK_ACCESS(purpose_ptr);
16545 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
16546 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
16547 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16548 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
16549 uint64_t ret_ref = (uint64_t)ret_copy;
16553 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) {
16554 LDKThirtyTwoBytes payment_id_ref;
16555 CHECK(payment_id->arr_len == 32);
16556 memcpy(payment_id_ref.data, payment_id->elems, 32);
16557 LDKThirtyTwoBytes payment_preimage_ref;
16558 CHECK(payment_preimage->arr_len == 32);
16559 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
16560 LDKThirtyTwoBytes payment_hash_ref;
16561 CHECK(payment_hash->arr_len == 32);
16562 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16563 void* fee_paid_msat_ptr = (void*)(((uint64_t)fee_paid_msat) & ~1);
16564 CHECK_ACCESS(fee_paid_msat_ptr);
16565 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
16566 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_paid_msat) & ~1));
16567 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16568 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
16569 uint64_t ret_ref = (uint64_t)ret_copy;
16573 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) {
16574 LDKThirtyTwoBytes payment_id_ref;
16575 CHECK(payment_id->arr_len == 32);
16576 memcpy(payment_id_ref.data, payment_id->elems, 32);
16577 LDKThirtyTwoBytes payment_hash_ref;
16578 CHECK(payment_hash->arr_len == 32);
16579 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16580 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
16581 CHECK_ACCESS(network_update_ptr);
16582 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
16583 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
16584 LDKCVec_RouteHopZ path_constr;
16585 path_constr.datalen = path->arr_len;
16586 if (path_constr.datalen > 0)
16587 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16589 path_constr.data = NULL;
16590 uint32_t* path_vals = path->elems;
16591 for (size_t k = 0; k < path_constr.datalen; k++) {
16592 uint32_t path_conv_10 = path_vals[k];
16593 LDKRouteHop path_conv_10_conv;
16594 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16595 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16596 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
16597 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16598 path_constr.data[k] = path_conv_10_conv;
16600 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
16601 CHECK_ACCESS(short_channel_id_ptr);
16602 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
16603 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
16604 LDKRouteParameters retry_conv;
16605 retry_conv.inner = (void*)(retry & (~1));
16606 retry_conv.is_owned = (retry & 1) || (retry == 0);
16607 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
16608 retry_conv = RouteParameters_clone(&retry_conv);
16609 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16610 *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);
16611 uint64_t ret_ref = (uint64_t)ret_copy;
16615 uint32_t __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
16616 LDKThirtyTwoBytes payment_id_ref;
16617 CHECK(payment_id->arr_len == 32);
16618 memcpy(payment_id_ref.data, payment_id->elems, 32);
16619 LDKThirtyTwoBytes payment_hash_ref;
16620 CHECK(payment_hash->arr_len == 32);
16621 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16622 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16623 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
16624 uint64_t ret_ref = (uint64_t)ret_copy;
16628 uint32_t __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
16629 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16630 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
16631 uint64_t ret_ref = (uint64_t)ret_copy;
16635 uint32_t __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
16636 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
16637 outputs_constr.datalen = outputs->arr_len;
16638 if (outputs_constr.datalen > 0)
16639 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16641 outputs_constr.data = NULL;
16642 uint32_t* outputs_vals = outputs->elems;
16643 for (size_t b = 0; b < outputs_constr.datalen; b++) {
16644 uint32_t outputs_conv_27 = outputs_vals[b];
16645 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
16646 CHECK_ACCESS(outputs_conv_27_ptr);
16647 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
16648 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
16649 outputs_constr.data[b] = outputs_conv_27_conv;
16651 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16652 *ret_copy = Event_spendable_outputs(outputs_constr);
16653 uint64_t ret_ref = (uint64_t)ret_copy;
16657 uint32_t __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
16658 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
16659 CHECK_ACCESS(fee_earned_msat_ptr);
16660 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
16661 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
16662 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16663 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
16664 uint64_t ret_ref = (uint64_t)ret_copy;
16668 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) {
16669 LDKThirtyTwoBytes channel_id_ref;
16670 CHECK(channel_id->arr_len == 32);
16671 memcpy(channel_id_ref.data, channel_id->elems, 32);
16672 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
16673 CHECK_ACCESS(reason_ptr);
16674 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
16675 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
16676 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16677 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
16678 uint64_t ret_ref = (uint64_t)ret_copy;
16682 uint32_t __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
16683 LDKThirtyTwoBytes channel_id_ref;
16684 CHECK(channel_id->arr_len == 32);
16685 memcpy(channel_id_ref.data, channel_id->elems, 32);
16686 LDKTransaction transaction_ref;
16687 transaction_ref.datalen = transaction->arr_len;
16688 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
16689 memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen);
16690 transaction_ref.data_is_owned = true;
16691 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16692 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
16693 uint64_t ret_ref = (uint64_t)ret_copy;
16697 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) {
16698 LDKThirtyTwoBytes payment_id_ref;
16699 CHECK(payment_id->arr_len == 32);
16700 memcpy(payment_id_ref.data, payment_id->elems, 32);
16701 LDKThirtyTwoBytes payment_hash_ref;
16702 CHECK(payment_hash->arr_len == 32);
16703 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16704 LDKCVec_RouteHopZ path_constr;
16705 path_constr.datalen = path->arr_len;
16706 if (path_constr.datalen > 0)
16707 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16709 path_constr.data = NULL;
16710 uint32_t* path_vals = path->elems;
16711 for (size_t k = 0; k < path_constr.datalen; k++) {
16712 uint32_t path_conv_10 = path_vals[k];
16713 LDKRouteHop path_conv_10_conv;
16714 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16715 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16716 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
16717 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16718 path_constr.data[k] = path_conv_10_conv;
16720 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16721 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
16722 uint64_t ret_ref = (uint64_t)ret_copy;
16726 int8_tArray __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint32_t obj) {
16727 LDKEvent* obj_conv = (LDKEvent*)obj;
16728 LDKCVec_u8Z ret_var = Event_write(obj_conv);
16729 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
16730 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16731 CVec_u8Z_free(ret_var);
16735 uint32_t __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
16736 LDKu8slice ser_ref;
16737 ser_ref.datalen = ser->arr_len;
16738 ser_ref.data = ser->elems;
16739 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16740 *ret_conv = Event_read(ser_ref);
16741 return (uint64_t)ret_conv;
16744 void __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
16745 if ((this_ptr & 1) != 0) return;
16746 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16747 CHECK_ACCESS(this_ptr_ptr);
16748 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
16749 FREE((void*)this_ptr);
16750 MessageSendEvent_free(this_ptr_conv);
16753 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
16754 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16755 *ret_copy = MessageSendEvent_clone(arg);
16756 uint64_t ret_ref = (uint64_t)ret_copy;
16759 int64_t __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
16760 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
16761 int64_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
16765 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint32_t orig) {
16766 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
16767 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16768 *ret_copy = MessageSendEvent_clone(orig_conv);
16769 uint64_t ret_ref = (uint64_t)ret_copy;
16773 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
16774 LDKPublicKey node_id_ref;
16775 CHECK(node_id->arr_len == 33);
16776 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16777 LDKAcceptChannel msg_conv;
16778 msg_conv.inner = (void*)(msg & (~1));
16779 msg_conv.is_owned = (msg & 1) || (msg == 0);
16780 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16781 msg_conv = AcceptChannel_clone(&msg_conv);
16782 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16783 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
16784 uint64_t ret_ref = (uint64_t)ret_copy;
16788 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
16789 LDKPublicKey node_id_ref;
16790 CHECK(node_id->arr_len == 33);
16791 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16792 LDKOpenChannel msg_conv;
16793 msg_conv.inner = (void*)(msg & (~1));
16794 msg_conv.is_owned = (msg & 1) || (msg == 0);
16795 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16796 msg_conv = OpenChannel_clone(&msg_conv);
16797 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16798 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
16799 uint64_t ret_ref = (uint64_t)ret_copy;
16803 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
16804 LDKPublicKey node_id_ref;
16805 CHECK(node_id->arr_len == 33);
16806 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16807 LDKFundingCreated msg_conv;
16808 msg_conv.inner = (void*)(msg & (~1));
16809 msg_conv.is_owned = (msg & 1) || (msg == 0);
16810 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16811 msg_conv = FundingCreated_clone(&msg_conv);
16812 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16813 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
16814 uint64_t ret_ref = (uint64_t)ret_copy;
16818 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
16819 LDKPublicKey node_id_ref;
16820 CHECK(node_id->arr_len == 33);
16821 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16822 LDKFundingSigned msg_conv;
16823 msg_conv.inner = (void*)(msg & (~1));
16824 msg_conv.is_owned = (msg & 1) || (msg == 0);
16825 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16826 msg_conv = FundingSigned_clone(&msg_conv);
16827 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16828 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
16829 uint64_t ret_ref = (uint64_t)ret_copy;
16833 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_locked"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
16834 LDKPublicKey node_id_ref;
16835 CHECK(node_id->arr_len == 33);
16836 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16837 LDKFundingLocked msg_conv;
16838 msg_conv.inner = (void*)(msg & (~1));
16839 msg_conv.is_owned = (msg & 1) || (msg == 0);
16840 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16841 msg_conv = FundingLocked_clone(&msg_conv);
16842 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16843 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
16844 uint64_t ret_ref = (uint64_t)ret_copy;
16848 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
16849 LDKPublicKey node_id_ref;
16850 CHECK(node_id->arr_len == 33);
16851 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16852 LDKAnnouncementSignatures msg_conv;
16853 msg_conv.inner = (void*)(msg & (~1));
16854 msg_conv.is_owned = (msg & 1) || (msg == 0);
16855 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16856 msg_conv = AnnouncementSignatures_clone(&msg_conv);
16857 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16858 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
16859 uint64_t ret_ref = (uint64_t)ret_copy;
16863 uint32_t __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
16864 LDKPublicKey node_id_ref;
16865 CHECK(node_id->arr_len == 33);
16866 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16867 LDKCommitmentUpdate updates_conv;
16868 updates_conv.inner = (void*)(updates & (~1));
16869 updates_conv.is_owned = (updates & 1) || (updates == 0);
16870 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
16871 updates_conv = CommitmentUpdate_clone(&updates_conv);
16872 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16873 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
16874 uint64_t ret_ref = (uint64_t)ret_copy;
16878 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
16879 LDKPublicKey node_id_ref;
16880 CHECK(node_id->arr_len == 33);
16881 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16882 LDKRevokeAndACK msg_conv;
16883 msg_conv.inner = (void*)(msg & (~1));
16884 msg_conv.is_owned = (msg & 1) || (msg == 0);
16885 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16886 msg_conv = RevokeAndACK_clone(&msg_conv);
16887 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16888 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
16889 uint64_t ret_ref = (uint64_t)ret_copy;
16893 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
16894 LDKPublicKey node_id_ref;
16895 CHECK(node_id->arr_len == 33);
16896 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16897 LDKClosingSigned msg_conv;
16898 msg_conv.inner = (void*)(msg & (~1));
16899 msg_conv.is_owned = (msg & 1) || (msg == 0);
16900 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16901 msg_conv = ClosingSigned_clone(&msg_conv);
16902 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16903 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
16904 uint64_t ret_ref = (uint64_t)ret_copy;
16908 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
16909 LDKPublicKey node_id_ref;
16910 CHECK(node_id->arr_len == 33);
16911 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16912 LDKShutdown msg_conv;
16913 msg_conv.inner = (void*)(msg & (~1));
16914 msg_conv.is_owned = (msg & 1) || (msg == 0);
16915 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16916 msg_conv = Shutdown_clone(&msg_conv);
16917 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16918 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
16919 uint64_t ret_ref = (uint64_t)ret_copy;
16923 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
16924 LDKPublicKey node_id_ref;
16925 CHECK(node_id->arr_len == 33);
16926 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16927 LDKChannelReestablish msg_conv;
16928 msg_conv.inner = (void*)(msg & (~1));
16929 msg_conv.is_owned = (msg & 1) || (msg == 0);
16930 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16931 msg_conv = ChannelReestablish_clone(&msg_conv);
16932 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16933 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
16934 uint64_t ret_ref = (uint64_t)ret_copy;
16938 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
16939 LDKChannelAnnouncement msg_conv;
16940 msg_conv.inner = (void*)(msg & (~1));
16941 msg_conv.is_owned = (msg & 1) || (msg == 0);
16942 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16943 msg_conv = ChannelAnnouncement_clone(&msg_conv);
16944 LDKChannelUpdate update_msg_conv;
16945 update_msg_conv.inner = (void*)(update_msg & (~1));
16946 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
16947 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
16948 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
16949 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16950 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
16951 uint64_t ret_ref = (uint64_t)ret_copy;
16955 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
16956 LDKNodeAnnouncement msg_conv;
16957 msg_conv.inner = (void*)(msg & (~1));
16958 msg_conv.is_owned = (msg & 1) || (msg == 0);
16959 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16960 msg_conv = NodeAnnouncement_clone(&msg_conv);
16961 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16962 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
16963 uint64_t ret_ref = (uint64_t)ret_copy;
16967 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
16968 LDKChannelUpdate msg_conv;
16969 msg_conv.inner = (void*)(msg & (~1));
16970 msg_conv.is_owned = (msg & 1) || (msg == 0);
16971 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16972 msg_conv = ChannelUpdate_clone(&msg_conv);
16973 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16974 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
16975 uint64_t ret_ref = (uint64_t)ret_copy;
16979 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
16980 LDKPublicKey node_id_ref;
16981 CHECK(node_id->arr_len == 33);
16982 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16983 LDKChannelUpdate msg_conv;
16984 msg_conv.inner = (void*)(msg & (~1));
16985 msg_conv.is_owned = (msg & 1) || (msg == 0);
16986 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16987 msg_conv = ChannelUpdate_clone(&msg_conv);
16988 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16989 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
16990 uint64_t ret_ref = (uint64_t)ret_copy;
16994 uint32_t __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
16995 LDKPublicKey node_id_ref;
16996 CHECK(node_id->arr_len == 33);
16997 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16998 void* action_ptr = (void*)(((uint64_t)action) & ~1);
16999 CHECK_ACCESS(action_ptr);
17000 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
17001 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
17002 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17003 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
17004 uint64_t ret_ref = (uint64_t)ret_copy;
17008 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
17009 LDKPublicKey node_id_ref;
17010 CHECK(node_id->arr_len == 33);
17011 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
17012 LDKQueryChannelRange msg_conv;
17013 msg_conv.inner = (void*)(msg & (~1));
17014 msg_conv.is_owned = (msg & 1) || (msg == 0);
17015 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17016 msg_conv = QueryChannelRange_clone(&msg_conv);
17017 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17018 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
17019 uint64_t ret_ref = (uint64_t)ret_copy;
17023 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
17024 LDKPublicKey node_id_ref;
17025 CHECK(node_id->arr_len == 33);
17026 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
17027 LDKQueryShortChannelIds msg_conv;
17028 msg_conv.inner = (void*)(msg & (~1));
17029 msg_conv.is_owned = (msg & 1) || (msg == 0);
17030 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17031 msg_conv = QueryShortChannelIds_clone(&msg_conv);
17032 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17033 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
17034 uint64_t ret_ref = (uint64_t)ret_copy;
17038 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
17039 LDKPublicKey node_id_ref;
17040 CHECK(node_id->arr_len == 33);
17041 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
17042 LDKReplyChannelRange msg_conv;
17043 msg_conv.inner = (void*)(msg & (~1));
17044 msg_conv.is_owned = (msg & 1) || (msg == 0);
17045 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17046 msg_conv = ReplyChannelRange_clone(&msg_conv);
17047 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17048 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
17049 uint64_t ret_ref = (uint64_t)ret_copy;
17053 void __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
17054 if ((this_ptr & 1) != 0) return;
17055 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17056 CHECK_ACCESS(this_ptr_ptr);
17057 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
17058 FREE((void*)this_ptr);
17059 MessageSendEventsProvider_free(this_ptr_conv);
17062 void __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint32_t this_ptr) {
17063 if ((this_ptr & 1) != 0) return;
17064 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17065 CHECK_ACCESS(this_ptr_ptr);
17066 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
17067 FREE((void*)this_ptr);
17068 EventsProvider_free(this_ptr_conv);
17071 void __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint32_t this_ptr) {
17072 if ((this_ptr & 1) != 0) return;
17073 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17074 CHECK_ACCESS(this_ptr_ptr);
17075 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
17076 FREE((void*)this_ptr);
17077 EventHandler_free(this_ptr_conv);
17080 void __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint32_t this_ptr) {
17081 if ((this_ptr & 1) != 0) return;
17082 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17083 CHECK_ACCESS(this_ptr_ptr);
17084 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
17085 FREE((void*)this_ptr);
17086 APIError_free(this_ptr_conv);
17089 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
17090 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17091 *ret_copy = APIError_clone(arg);
17092 uint64_t ret_ref = (uint64_t)ret_copy;
17095 int64_t __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint32_t arg) {
17096 LDKAPIError* arg_conv = (LDKAPIError*)arg;
17097 int64_t ret_val = APIError_clone_ptr(arg_conv);
17101 uint32_t __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint32_t orig) {
17102 LDKAPIError* orig_conv = (LDKAPIError*)orig;
17103 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17104 *ret_copy = APIError_clone(orig_conv);
17105 uint64_t ret_ref = (uint64_t)ret_copy;
17109 uint32_t __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
17110 LDKStr err_conv = str_ref_to_owned_c(err);
17111 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17112 *ret_copy = APIError_apimisuse_error(err_conv);
17113 uint64_t ret_ref = (uint64_t)ret_copy;
17117 uint32_t __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
17118 LDKStr err_conv = str_ref_to_owned_c(err);
17119 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17120 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
17121 uint64_t ret_ref = (uint64_t)ret_copy;
17125 uint32_t __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
17126 LDKStr err_conv = str_ref_to_owned_c(err);
17127 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17128 *ret_copy = APIError_route_error(err_conv);
17129 uint64_t ret_ref = (uint64_t)ret_copy;
17133 uint32_t __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
17134 LDKStr err_conv = str_ref_to_owned_c(err);
17135 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17136 *ret_copy = APIError_channel_unavailable(err_conv);
17137 uint64_t ret_ref = (uint64_t)ret_copy;
17141 uint32_t __attribute__((export_name("TS_APIError_monitor_update_failed"))) TS_APIError_monitor_update_failed() {
17142 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17143 *ret_copy = APIError_monitor_update_failed();
17144 uint64_t ret_ref = (uint64_t)ret_copy;
17148 uint32_t __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
17149 LDKShutdownScript script_conv;
17150 script_conv.inner = (void*)(script & (~1));
17151 script_conv.is_owned = (script & 1) || (script == 0);
17152 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
17153 script_conv = ShutdownScript_clone(&script_conv);
17154 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17155 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
17156 uint64_t ret_ref = (uint64_t)ret_copy;
17160 uint32_t __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
17161 LDKu8slice msg_ref;
17162 msg_ref.datalen = msg->arr_len;
17163 msg_ref.data = msg->elems;
17164 unsigned char sk_arr[32];
17165 CHECK(sk->arr_len == 32);
17166 memcpy(sk_arr, sk->elems, 32);
17167 unsigned char (*sk_ref)[32] = &sk_arr;
17168 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17169 *ret_conv = sign(msg_ref, sk_ref);
17170 return (uint64_t)ret_conv;
17173 uint32_t __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
17174 LDKu8slice msg_ref;
17175 msg_ref.datalen = msg->arr_len;
17176 msg_ref.data = msg->elems;
17177 LDKStr sig_conv = str_ref_to_owned_c(sig);
17178 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17179 *ret_conv = recover_pk(msg_ref, sig_conv);
17180 return (uint64_t)ret_conv;
17183 jboolean __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
17184 LDKu8slice msg_ref;
17185 msg_ref.datalen = msg->arr_len;
17186 msg_ref.data = msg->elems;
17187 LDKStr sig_conv = str_ref_to_owned_c(sig);
17188 LDKPublicKey pk_ref;
17189 CHECK(pk->arr_len == 33);
17190 memcpy(pk_ref.compressed_form, pk->elems, 33);
17191 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
17195 uint32_t __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint32_t orig) {
17196 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
17197 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
17201 uint32_t __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
17202 uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
17206 uint32_t __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
17207 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
17211 uint32_t __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
17212 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
17216 uint32_t __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
17217 uint32_t ret_conv = LDKLevel_to_js(Level_info());
17221 uint32_t __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
17222 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
17226 uint32_t __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
17227 uint32_t ret_conv = LDKLevel_to_js(Level_error());
17231 jboolean __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint32_t a, uint32_t b) {
17232 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
17233 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
17234 jboolean ret_val = Level_eq(a_conv, b_conv);
17238 int64_t __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint32_t o) {
17239 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
17240 int64_t ret_val = Level_hash(o_conv);
17244 uint32_t __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
17245 uint32_t ret_conv = LDKLevel_to_js(Level_max());
17249 void __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint32_t this_obj) {
17250 LDKRecord this_obj_conv;
17251 this_obj_conv.inner = (void*)(this_obj & (~1));
17252 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17254 Record_free(this_obj_conv);
17257 uint32_t __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint32_t this_ptr) {
17258 LDKRecord this_ptr_conv;
17259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17260 this_ptr_conv.is_owned = false;
17261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17262 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
17266 void __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
17267 LDKRecord this_ptr_conv;
17268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17269 this_ptr_conv.is_owned = false;
17270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17271 LDKLevel val_conv = LDKLevel_from_js(val);
17272 Record_set_level(&this_ptr_conv, val_conv);
17275 jstring __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint32_t this_ptr) {
17276 LDKRecord this_ptr_conv;
17277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17278 this_ptr_conv.is_owned = false;
17279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17280 LDKStr ret_str = Record_get_args(&this_ptr_conv);
17281 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17286 void __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
17287 LDKRecord this_ptr_conv;
17288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17289 this_ptr_conv.is_owned = false;
17290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17291 LDKStr val_conv = str_ref_to_owned_c(val);
17292 Record_set_args(&this_ptr_conv, val_conv);
17295 jstring __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint32_t this_ptr) {
17296 LDKRecord this_ptr_conv;
17297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17298 this_ptr_conv.is_owned = false;
17299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17300 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
17301 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17306 void __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
17307 LDKRecord this_ptr_conv;
17308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17309 this_ptr_conv.is_owned = false;
17310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17311 LDKStr val_conv = str_ref_to_owned_c(val);
17312 Record_set_module_path(&this_ptr_conv, val_conv);
17315 jstring __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint32_t this_ptr) {
17316 LDKRecord this_ptr_conv;
17317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17318 this_ptr_conv.is_owned = false;
17319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17320 LDKStr ret_str = Record_get_file(&this_ptr_conv);
17321 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17326 void __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
17327 LDKRecord this_ptr_conv;
17328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17329 this_ptr_conv.is_owned = false;
17330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17331 LDKStr val_conv = str_ref_to_owned_c(val);
17332 Record_set_file(&this_ptr_conv, val_conv);
17335 int32_t __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint32_t this_ptr) {
17336 LDKRecord this_ptr_conv;
17337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17338 this_ptr_conv.is_owned = false;
17339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17340 int32_t ret_val = Record_get_line(&this_ptr_conv);
17344 void __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
17345 LDKRecord this_ptr_conv;
17346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17347 this_ptr_conv.is_owned = false;
17348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17349 Record_set_line(&this_ptr_conv, val);
17352 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
17353 LDKRecord ret_var = Record_clone(arg);
17354 uint64_t ret_ref = 0;
17355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17357 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17358 ret_ref = (uint64_t)ret_var.inner;
17359 if (ret_var.is_owned) {
17364 int64_t __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint32_t arg) {
17365 LDKRecord arg_conv;
17366 arg_conv.inner = (void*)(arg & (~1));
17367 arg_conv.is_owned = false;
17368 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17369 int64_t ret_val = Record_clone_ptr(&arg_conv);
17373 uint32_t __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint32_t orig) {
17374 LDKRecord orig_conv;
17375 orig_conv.inner = (void*)(orig & (~1));
17376 orig_conv.is_owned = false;
17377 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17378 LDKRecord ret_var = Record_clone(&orig_conv);
17379 uint64_t ret_ref = 0;
17380 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17381 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17382 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17383 ret_ref = (uint64_t)ret_var.inner;
17384 if (ret_var.is_owned) {
17390 void __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint32_t this_ptr) {
17391 if ((this_ptr & 1) != 0) return;
17392 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17393 CHECK_ACCESS(this_ptr_ptr);
17394 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
17395 FREE((void*)this_ptr);
17396 Logger_free(this_ptr_conv);
17399 void __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
17400 LDKChannelHandshakeConfig this_obj_conv;
17401 this_obj_conv.inner = (void*)(this_obj & (~1));
17402 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17404 ChannelHandshakeConfig_free(this_obj_conv);
17407 int32_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
17408 LDKChannelHandshakeConfig this_ptr_conv;
17409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17410 this_ptr_conv.is_owned = false;
17411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17412 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
17416 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
17417 LDKChannelHandshakeConfig this_ptr_conv;
17418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17419 this_ptr_conv.is_owned = false;
17420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17421 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
17424 int16_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
17425 LDKChannelHandshakeConfig this_ptr_conv;
17426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17427 this_ptr_conv.is_owned = false;
17428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17429 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
17433 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) {
17434 LDKChannelHandshakeConfig this_ptr_conv;
17435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17436 this_ptr_conv.is_owned = false;
17437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17438 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
17441 int64_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
17442 LDKChannelHandshakeConfig this_ptr_conv;
17443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17444 this_ptr_conv.is_owned = false;
17445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17446 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
17450 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) {
17451 LDKChannelHandshakeConfig this_ptr_conv;
17452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17453 this_ptr_conv.is_owned = false;
17454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17455 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
17458 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) {
17459 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
17460 uint64_t ret_ref = 0;
17461 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17462 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17464 ret_ref = (uint64_t)ret_var.inner;
17465 if (ret_var.is_owned) {
17471 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
17472 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
17473 uint64_t ret_ref = 0;
17474 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17475 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17477 ret_ref = (uint64_t)ret_var.inner;
17478 if (ret_var.is_owned) {
17483 int64_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
17484 LDKChannelHandshakeConfig arg_conv;
17485 arg_conv.inner = (void*)(arg & (~1));
17486 arg_conv.is_owned = false;
17487 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17488 int64_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
17492 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
17493 LDKChannelHandshakeConfig orig_conv;
17494 orig_conv.inner = (void*)(orig & (~1));
17495 orig_conv.is_owned = false;
17496 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17497 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
17498 uint64_t ret_ref = 0;
17499 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17500 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17502 ret_ref = (uint64_t)ret_var.inner;
17503 if (ret_var.is_owned) {
17509 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
17510 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
17511 uint64_t ret_ref = 0;
17512 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17513 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17515 ret_ref = (uint64_t)ret_var.inner;
17516 if (ret_var.is_owned) {
17522 void __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
17523 LDKChannelHandshakeLimits this_obj_conv;
17524 this_obj_conv.inner = (void*)(this_obj & (~1));
17525 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17527 ChannelHandshakeLimits_free(this_obj_conv);
17530 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
17531 LDKChannelHandshakeLimits this_ptr_conv;
17532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17533 this_ptr_conv.is_owned = false;
17534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17535 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
17539 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
17540 LDKChannelHandshakeLimits this_ptr_conv;
17541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17542 this_ptr_conv.is_owned = false;
17543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17544 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
17547 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
17548 LDKChannelHandshakeLimits this_ptr_conv;
17549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17550 this_ptr_conv.is_owned = false;
17551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17552 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
17556 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) {
17557 LDKChannelHandshakeLimits this_ptr_conv;
17558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17559 this_ptr_conv.is_owned = false;
17560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17561 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
17564 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) {
17565 LDKChannelHandshakeLimits this_ptr_conv;
17566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17567 this_ptr_conv.is_owned = false;
17568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17569 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
17573 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) {
17574 LDKChannelHandshakeLimits this_ptr_conv;
17575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17576 this_ptr_conv.is_owned = false;
17577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17578 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17581 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
17582 LDKChannelHandshakeLimits this_ptr_conv;
17583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17584 this_ptr_conv.is_owned = false;
17585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17586 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
17590 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) {
17591 LDKChannelHandshakeLimits this_ptr_conv;
17592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17593 this_ptr_conv.is_owned = false;
17594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17595 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
17598 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
17599 LDKChannelHandshakeLimits this_ptr_conv;
17600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17601 this_ptr_conv.is_owned = false;
17602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17603 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
17607 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) {
17608 LDKChannelHandshakeLimits this_ptr_conv;
17609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17610 this_ptr_conv.is_owned = false;
17611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17612 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
17615 int32_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
17616 LDKChannelHandshakeLimits this_ptr_conv;
17617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17618 this_ptr_conv.is_owned = false;
17619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17620 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
17624 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
17625 LDKChannelHandshakeLimits this_ptr_conv;
17626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17627 this_ptr_conv.is_owned = false;
17628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17629 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
17632 jboolean __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
17633 LDKChannelHandshakeLimits this_ptr_conv;
17634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17635 this_ptr_conv.is_owned = false;
17636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17637 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
17641 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
17642 LDKChannelHandshakeLimits this_ptr_conv;
17643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17644 this_ptr_conv.is_owned = false;
17645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17646 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
17649 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
17650 LDKChannelHandshakeLimits this_ptr_conv;
17651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17652 this_ptr_conv.is_owned = false;
17653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17654 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
17658 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) {
17659 LDKChannelHandshakeLimits this_ptr_conv;
17660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17661 this_ptr_conv.is_owned = false;
17662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17663 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
17666 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) {
17667 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);
17668 uint64_t ret_ref = 0;
17669 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17670 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17671 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17672 ret_ref = (uint64_t)ret_var.inner;
17673 if (ret_var.is_owned) {
17679 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
17680 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
17681 uint64_t ret_ref = 0;
17682 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17683 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17684 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17685 ret_ref = (uint64_t)ret_var.inner;
17686 if (ret_var.is_owned) {
17691 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
17692 LDKChannelHandshakeLimits arg_conv;
17693 arg_conv.inner = (void*)(arg & (~1));
17694 arg_conv.is_owned = false;
17695 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17696 int64_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
17700 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
17701 LDKChannelHandshakeLimits orig_conv;
17702 orig_conv.inner = (void*)(orig & (~1));
17703 orig_conv.is_owned = false;
17704 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17705 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
17706 uint64_t ret_ref = 0;
17707 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17708 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17709 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17710 ret_ref = (uint64_t)ret_var.inner;
17711 if (ret_var.is_owned) {
17717 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
17718 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
17719 uint64_t ret_ref = 0;
17720 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17721 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17723 ret_ref = (uint64_t)ret_var.inner;
17724 if (ret_var.is_owned) {
17730 void __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint32_t this_obj) {
17731 LDKChannelConfig this_obj_conv;
17732 this_obj_conv.inner = (void*)(this_obj & (~1));
17733 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17735 ChannelConfig_free(this_obj_conv);
17738 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
17739 LDKChannelConfig this_ptr_conv;
17740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17741 this_ptr_conv.is_owned = false;
17742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17743 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
17747 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) {
17748 LDKChannelConfig this_ptr_conv;
17749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17750 this_ptr_conv.is_owned = false;
17751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17752 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
17755 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
17756 LDKChannelConfig this_ptr_conv;
17757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17758 this_ptr_conv.is_owned = false;
17759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17760 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
17764 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) {
17765 LDKChannelConfig this_ptr_conv;
17766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17767 this_ptr_conv.is_owned = false;
17768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17769 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
17772 int16_t __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
17773 LDKChannelConfig this_ptr_conv;
17774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17775 this_ptr_conv.is_owned = false;
17776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17777 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
17781 void __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17782 LDKChannelConfig this_ptr_conv;
17783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17784 this_ptr_conv.is_owned = false;
17785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17786 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
17789 jboolean __attribute__((export_name("TS_ChannelConfig_get_announced_channel"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
17790 LDKChannelConfig this_ptr_conv;
17791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17792 this_ptr_conv.is_owned = false;
17793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17794 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
17798 void __attribute__((export_name("TS_ChannelConfig_set_announced_channel"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
17799 LDKChannelConfig this_ptr_conv;
17800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17801 this_ptr_conv.is_owned = false;
17802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17803 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
17806 jboolean __attribute__((export_name("TS_ChannelConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
17807 LDKChannelConfig this_ptr_conv;
17808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17809 this_ptr_conv.is_owned = false;
17810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17811 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
17815 void __attribute__((export_name("TS_ChannelConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
17816 LDKChannelConfig this_ptr_conv;
17817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17818 this_ptr_conv.is_owned = false;
17819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17820 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
17823 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) {
17824 LDKChannelConfig this_ptr_conv;
17825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17826 this_ptr_conv.is_owned = false;
17827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17828 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
17832 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) {
17833 LDKChannelConfig this_ptr_conv;
17834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17835 this_ptr_conv.is_owned = false;
17836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17837 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
17840 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) {
17841 LDKChannelConfig this_ptr_conv;
17842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17843 this_ptr_conv.is_owned = false;
17844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17845 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
17849 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) {
17850 LDKChannelConfig this_ptr_conv;
17851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17852 this_ptr_conv.is_owned = false;
17853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17854 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
17857 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) {
17858 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);
17859 uint64_t ret_ref = 0;
17860 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17861 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17862 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17863 ret_ref = (uint64_t)ret_var.inner;
17864 if (ret_var.is_owned) {
17870 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
17871 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
17872 uint64_t ret_ref = 0;
17873 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17874 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17875 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17876 ret_ref = (uint64_t)ret_var.inner;
17877 if (ret_var.is_owned) {
17882 int64_t __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
17883 LDKChannelConfig arg_conv;
17884 arg_conv.inner = (void*)(arg & (~1));
17885 arg_conv.is_owned = false;
17886 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17887 int64_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
17891 uint32_t __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint32_t orig) {
17892 LDKChannelConfig orig_conv;
17893 orig_conv.inner = (void*)(orig & (~1));
17894 orig_conv.is_owned = false;
17895 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17896 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
17897 uint64_t ret_ref = 0;
17898 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17899 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17900 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17901 ret_ref = (uint64_t)ret_var.inner;
17902 if (ret_var.is_owned) {
17908 uint32_t __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
17909 LDKChannelConfig ret_var = ChannelConfig_default();
17910 uint64_t ret_ref = 0;
17911 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17912 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17913 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17914 ret_ref = (uint64_t)ret_var.inner;
17915 if (ret_var.is_owned) {
17921 int8_tArray __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint32_t obj) {
17922 LDKChannelConfig obj_conv;
17923 obj_conv.inner = (void*)(obj & (~1));
17924 obj_conv.is_owned = false;
17925 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
17926 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
17927 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
17928 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17929 CVec_u8Z_free(ret_var);
17933 uint32_t __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
17934 LDKu8slice ser_ref;
17935 ser_ref.datalen = ser->arr_len;
17936 ser_ref.data = ser->elems;
17937 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17938 *ret_conv = ChannelConfig_read(ser_ref);
17939 return (uint64_t)ret_conv;
17942 void __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint32_t this_obj) {
17943 LDKUserConfig this_obj_conv;
17944 this_obj_conv.inner = (void*)(this_obj & (~1));
17945 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17947 UserConfig_free(this_obj_conv);
17950 uint32_t __attribute__((export_name("TS_UserConfig_get_own_channel_config"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
17951 LDKUserConfig this_ptr_conv;
17952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17953 this_ptr_conv.is_owned = false;
17954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17955 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
17956 uint64_t ret_ref = 0;
17957 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17958 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17959 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17960 ret_ref = (uint64_t)ret_var.inner;
17961 if (ret_var.is_owned) {
17967 void __attribute__((export_name("TS_UserConfig_set_own_channel_config"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
17968 LDKUserConfig this_ptr_conv;
17969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17970 this_ptr_conv.is_owned = false;
17971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17972 LDKChannelHandshakeConfig val_conv;
17973 val_conv.inner = (void*)(val & (~1));
17974 val_conv.is_owned = (val & 1) || (val == 0);
17975 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17976 val_conv = ChannelHandshakeConfig_clone(&val_conv);
17977 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
17980 uint32_t __attribute__((export_name("TS_UserConfig_get_peer_channel_config_limits"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
17981 LDKUserConfig this_ptr_conv;
17982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17983 this_ptr_conv.is_owned = false;
17984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17985 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
17986 uint64_t ret_ref = 0;
17987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17990 ret_ref = (uint64_t)ret_var.inner;
17991 if (ret_var.is_owned) {
17997 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) {
17998 LDKUserConfig this_ptr_conv;
17999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18000 this_ptr_conv.is_owned = false;
18001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18002 LDKChannelHandshakeLimits val_conv;
18003 val_conv.inner = (void*)(val & (~1));
18004 val_conv.is_owned = (val & 1) || (val == 0);
18005 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
18006 val_conv = ChannelHandshakeLimits_clone(&val_conv);
18007 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
18010 uint32_t __attribute__((export_name("TS_UserConfig_get_channel_options"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
18011 LDKUserConfig this_ptr_conv;
18012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18013 this_ptr_conv.is_owned = false;
18014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18015 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
18016 uint64_t ret_ref = 0;
18017 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18018 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18020 ret_ref = (uint64_t)ret_var.inner;
18021 if (ret_var.is_owned) {
18027 void __attribute__((export_name("TS_UserConfig_set_channel_options"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
18028 LDKUserConfig this_ptr_conv;
18029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18030 this_ptr_conv.is_owned = false;
18031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18032 LDKChannelConfig val_conv;
18033 val_conv.inner = (void*)(val & (~1));
18034 val_conv.is_owned = (val & 1) || (val == 0);
18035 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
18036 val_conv = ChannelConfig_clone(&val_conv);
18037 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
18040 jboolean __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
18041 LDKUserConfig this_ptr_conv;
18042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18043 this_ptr_conv.is_owned = false;
18044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18045 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
18049 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) {
18050 LDKUserConfig this_ptr_conv;
18051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18052 this_ptr_conv.is_owned = false;
18053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18054 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
18057 jboolean __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) {
18058 LDKUserConfig this_ptr_conv;
18059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18060 this_ptr_conv.is_owned = false;
18061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18062 jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
18066 void __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
18067 LDKUserConfig this_ptr_conv;
18068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18069 this_ptr_conv.is_owned = false;
18070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18071 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
18074 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) {
18075 LDKChannelHandshakeConfig own_channel_config_arg_conv;
18076 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
18077 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
18078 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
18079 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
18080 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
18081 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
18082 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
18083 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
18084 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
18085 LDKChannelConfig channel_options_arg_conv;
18086 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
18087 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
18088 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
18089 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
18090 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);
18091 uint64_t ret_ref = 0;
18092 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18093 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18095 ret_ref = (uint64_t)ret_var.inner;
18096 if (ret_var.is_owned) {
18102 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
18103 LDKUserConfig ret_var = UserConfig_clone(arg);
18104 uint64_t ret_ref = 0;
18105 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18106 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18108 ret_ref = (uint64_t)ret_var.inner;
18109 if (ret_var.is_owned) {
18114 int64_t __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint32_t arg) {
18115 LDKUserConfig arg_conv;
18116 arg_conv.inner = (void*)(arg & (~1));
18117 arg_conv.is_owned = false;
18118 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18119 int64_t ret_val = UserConfig_clone_ptr(&arg_conv);
18123 uint32_t __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint32_t orig) {
18124 LDKUserConfig orig_conv;
18125 orig_conv.inner = (void*)(orig & (~1));
18126 orig_conv.is_owned = false;
18127 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18128 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
18129 uint64_t ret_ref = 0;
18130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18133 ret_ref = (uint64_t)ret_var.inner;
18134 if (ret_var.is_owned) {
18140 uint32_t __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
18141 LDKUserConfig ret_var = UserConfig_default();
18142 uint64_t ret_ref = 0;
18143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18146 ret_ref = (uint64_t)ret_var.inner;
18147 if (ret_var.is_owned) {
18153 void __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint32_t this_obj) {
18154 LDKBestBlock this_obj_conv;
18155 this_obj_conv.inner = (void*)(this_obj & (~1));
18156 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18158 BestBlock_free(this_obj_conv);
18161 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
18162 LDKBestBlock ret_var = BestBlock_clone(arg);
18163 uint64_t ret_ref = 0;
18164 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18165 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18167 ret_ref = (uint64_t)ret_var.inner;
18168 if (ret_var.is_owned) {
18173 int64_t __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint32_t arg) {
18174 LDKBestBlock arg_conv;
18175 arg_conv.inner = (void*)(arg & (~1));
18176 arg_conv.is_owned = false;
18177 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18178 int64_t ret_val = BestBlock_clone_ptr(&arg_conv);
18182 uint32_t __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint32_t orig) {
18183 LDKBestBlock orig_conv;
18184 orig_conv.inner = (void*)(orig & (~1));
18185 orig_conv.is_owned = false;
18186 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18187 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
18188 uint64_t ret_ref = 0;
18189 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18190 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18192 ret_ref = (uint64_t)ret_var.inner;
18193 if (ret_var.is_owned) {
18199 uint32_t __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
18200 LDKNetwork network_conv = LDKNetwork_from_js(network);
18201 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
18202 uint64_t ret_ref = 0;
18203 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18204 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18206 ret_ref = (uint64_t)ret_var.inner;
18207 if (ret_var.is_owned) {
18213 uint32_t __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
18214 LDKThirtyTwoBytes block_hash_ref;
18215 CHECK(block_hash->arr_len == 32);
18216 memcpy(block_hash_ref.data, block_hash->elems, 32);
18217 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
18218 uint64_t ret_ref = 0;
18219 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18220 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18222 ret_ref = (uint64_t)ret_var.inner;
18223 if (ret_var.is_owned) {
18229 int8_tArray __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint32_t this_arg) {
18230 LDKBestBlock this_arg_conv;
18231 this_arg_conv.inner = (void*)(this_arg & (~1));
18232 this_arg_conv.is_owned = false;
18233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18234 int8_tArray ret_arr = init_int8_tArray(32);
18235 memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
18239 int32_t __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint32_t this_arg) {
18240 LDKBestBlock this_arg_conv;
18241 this_arg_conv.inner = (void*)(this_arg & (~1));
18242 this_arg_conv.is_owned = false;
18243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18244 int32_t ret_val = BestBlock_height(&this_arg_conv);
18248 uint32_t __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint32_t orig) {
18249 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
18250 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
18254 uint32_t __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
18255 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
18259 uint32_t __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
18260 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
18264 void __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint32_t this_ptr) {
18265 if ((this_ptr & 1) != 0) return;
18266 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18267 CHECK_ACCESS(this_ptr_ptr);
18268 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
18269 FREE((void*)this_ptr);
18270 Access_free(this_ptr_conv);
18273 void __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint32_t this_ptr) {
18274 if ((this_ptr & 1) != 0) return;
18275 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18276 CHECK_ACCESS(this_ptr_ptr);
18277 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
18278 FREE((void*)this_ptr);
18279 Listen_free(this_ptr_conv);
18282 void __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint32_t this_ptr) {
18283 if ((this_ptr & 1) != 0) return;
18284 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18285 CHECK_ACCESS(this_ptr_ptr);
18286 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
18287 FREE((void*)this_ptr);
18288 Confirm_free(this_ptr_conv);
18291 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_clone"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
18292 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
18293 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
18297 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_temporary_failure"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
18298 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
18302 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_permanent_failure"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
18303 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
18307 void __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint32_t this_ptr) {
18308 if ((this_ptr & 1) != 0) return;
18309 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18310 CHECK_ACCESS(this_ptr_ptr);
18311 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
18312 FREE((void*)this_ptr);
18313 Watch_free(this_ptr_conv);
18316 void __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint32_t this_ptr) {
18317 if ((this_ptr & 1) != 0) return;
18318 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18319 CHECK_ACCESS(this_ptr_ptr);
18320 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
18321 FREE((void*)this_ptr);
18322 Filter_free(this_ptr_conv);
18325 void __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint32_t this_obj) {
18326 LDKWatchedOutput this_obj_conv;
18327 this_obj_conv.inner = (void*)(this_obj & (~1));
18328 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18330 WatchedOutput_free(this_obj_conv);
18333 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
18334 LDKWatchedOutput this_ptr_conv;
18335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18336 this_ptr_conv.is_owned = false;
18337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18338 int8_tArray ret_arr = init_int8_tArray(32);
18339 memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
18343 void __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
18344 LDKWatchedOutput this_ptr_conv;
18345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18346 this_ptr_conv.is_owned = false;
18347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18348 LDKThirtyTwoBytes val_ref;
18349 CHECK(val->arr_len == 32);
18350 memcpy(val_ref.data, val->elems, 32);
18351 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
18354 uint32_t __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
18355 LDKWatchedOutput this_ptr_conv;
18356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18357 this_ptr_conv.is_owned = false;
18358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18359 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
18360 uint64_t ret_ref = 0;
18361 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18362 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18363 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18364 ret_ref = (uint64_t)ret_var.inner;
18365 if (ret_var.is_owned) {
18371 void __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
18372 LDKWatchedOutput this_ptr_conv;
18373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18374 this_ptr_conv.is_owned = false;
18375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18376 LDKOutPoint val_conv;
18377 val_conv.inner = (void*)(val & (~1));
18378 val_conv.is_owned = (val & 1) || (val == 0);
18379 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
18380 val_conv = OutPoint_clone(&val_conv);
18381 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
18384 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
18385 LDKWatchedOutput this_ptr_conv;
18386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18387 this_ptr_conv.is_owned = false;
18388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18389 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
18390 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18391 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18395 void __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
18396 LDKWatchedOutput this_ptr_conv;
18397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18398 this_ptr_conv.is_owned = false;
18399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18400 LDKCVec_u8Z val_ref;
18401 val_ref.datalen = val->arr_len;
18402 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
18403 memcpy(val_ref.data, val->elems, val_ref.datalen);
18404 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
18407 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) {
18408 LDKThirtyTwoBytes block_hash_arg_ref;
18409 CHECK(block_hash_arg->arr_len == 32);
18410 memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32);
18411 LDKOutPoint outpoint_arg_conv;
18412 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
18413 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
18414 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
18415 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
18416 LDKCVec_u8Z script_pubkey_arg_ref;
18417 script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
18418 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
18419 memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen);
18420 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
18421 uint64_t ret_ref = 0;
18422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18425 ret_ref = (uint64_t)ret_var.inner;
18426 if (ret_var.is_owned) {
18432 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
18433 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
18434 uint64_t ret_ref = 0;
18435 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18436 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18438 ret_ref = (uint64_t)ret_var.inner;
18439 if (ret_var.is_owned) {
18444 int64_t __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
18445 LDKWatchedOutput arg_conv;
18446 arg_conv.inner = (void*)(arg & (~1));
18447 arg_conv.is_owned = false;
18448 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18449 int64_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
18453 uint32_t __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint32_t orig) {
18454 LDKWatchedOutput orig_conv;
18455 orig_conv.inner = (void*)(orig & (~1));
18456 orig_conv.is_owned = false;
18457 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18458 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
18459 uint64_t ret_ref = 0;
18460 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18461 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18463 ret_ref = (uint64_t)ret_var.inner;
18464 if (ret_var.is_owned) {
18470 int64_t __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint32_t o) {
18471 LDKWatchedOutput o_conv;
18472 o_conv.inner = (void*)(o & (~1));
18473 o_conv.is_owned = false;
18474 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18475 int64_t ret_val = WatchedOutput_hash(&o_conv);
18479 void __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
18480 if ((this_ptr & 1) != 0) return;
18481 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18482 CHECK_ACCESS(this_ptr_ptr);
18483 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
18484 FREE((void*)this_ptr);
18485 BroadcasterInterface_free(this_ptr_conv);
18488 uint32_t __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint32_t orig) {
18489 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
18490 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
18494 uint32_t __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
18495 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
18499 uint32_t __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
18500 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
18504 uint32_t __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
18505 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
18509 jboolean __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
18510 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
18511 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
18512 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
18516 void __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint32_t this_ptr) {
18517 if ((this_ptr & 1) != 0) return;
18518 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18519 CHECK_ACCESS(this_ptr_ptr);
18520 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
18521 FREE((void*)this_ptr);
18522 FeeEstimator_free(this_ptr_conv);
18525 void __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
18526 LDKMonitorUpdateId this_obj_conv;
18527 this_obj_conv.inner = (void*)(this_obj & (~1));
18528 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18530 MonitorUpdateId_free(this_obj_conv);
18533 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
18534 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
18535 uint64_t ret_ref = 0;
18536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18539 ret_ref = (uint64_t)ret_var.inner;
18540 if (ret_var.is_owned) {
18545 int64_t __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
18546 LDKMonitorUpdateId arg_conv;
18547 arg_conv.inner = (void*)(arg & (~1));
18548 arg_conv.is_owned = false;
18549 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18550 int64_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
18554 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint32_t orig) {
18555 LDKMonitorUpdateId orig_conv;
18556 orig_conv.inner = (void*)(orig & (~1));
18557 orig_conv.is_owned = false;
18558 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18559 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
18560 uint64_t ret_ref = 0;
18561 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18562 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18564 ret_ref = (uint64_t)ret_var.inner;
18565 if (ret_var.is_owned) {
18571 int64_t __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint32_t o) {
18572 LDKMonitorUpdateId o_conv;
18573 o_conv.inner = (void*)(o & (~1));
18574 o_conv.is_owned = false;
18575 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18576 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
18580 jboolean __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
18581 LDKMonitorUpdateId a_conv;
18582 a_conv.inner = (void*)(a & (~1));
18583 a_conv.is_owned = false;
18584 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18585 LDKMonitorUpdateId b_conv;
18586 b_conv.inner = (void*)(b & (~1));
18587 b_conv.is_owned = false;
18588 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18589 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
18593 void __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint32_t this_ptr) {
18594 if ((this_ptr & 1) != 0) return;
18595 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18596 CHECK_ACCESS(this_ptr_ptr);
18597 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
18598 FREE((void*)this_ptr);
18599 Persist_free(this_ptr_conv);
18602 void __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
18603 LDKLockedChannelMonitor this_obj_conv;
18604 this_obj_conv.inner = (void*)(this_obj & (~1));
18605 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18607 LockedChannelMonitor_free(this_obj_conv);
18610 void __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint32_t this_obj) {
18611 LDKChainMonitor this_obj_conv;
18612 this_obj_conv.inner = (void*)(this_obj & (~1));
18613 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18615 ChainMonitor_free(this_obj_conv);
18618 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) {
18619 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
18620 CHECK_ACCESS(chain_source_ptr);
18621 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
18622 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
18623 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
18624 // Manually implement clone for Java trait instances
18626 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18627 CHECK_ACCESS(broadcaster_ptr);
18628 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18629 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18630 CHECK_ACCESS(logger_ptr);
18631 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18632 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
18633 CHECK_ACCESS(feeest_ptr);
18634 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
18635 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
18636 CHECK_ACCESS(persister_ptr);
18637 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
18638 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
18639 uint64_t ret_ref = 0;
18640 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18641 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18643 ret_ref = (uint64_t)ret_var.inner;
18644 if (ret_var.is_owned) {
18650 uint32_tArray __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
18651 LDKChainMonitor this_arg_conv;
18652 this_arg_conv.inner = (void*)(this_arg & (~1));
18653 this_arg_conv.is_owned = false;
18654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18655 LDKCVec_ChannelDetailsZ ignored_channels_constr;
18656 ignored_channels_constr.datalen = ignored_channels->arr_len;
18657 if (ignored_channels_constr.datalen > 0)
18658 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18660 ignored_channels_constr.data = NULL;
18661 uint32_t* ignored_channels_vals = ignored_channels->elems;
18662 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
18663 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
18664 LDKChannelDetails ignored_channels_conv_16_conv;
18665 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
18666 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
18667 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
18668 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
18669 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
18671 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
18672 uint32_tArray ret_arr = NULL;
18673 ret_arr = init_uint32_tArray(ret_var.datalen);
18674 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
18675 for (size_t j = 0; j < ret_var.datalen; j++) {
18676 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18677 *ret_conv_9_copy = ret_var.data[j];
18678 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
18679 ret_arr_ptr[j] = ret_conv_9_ref;
18682 FREE(ret_var.data);
18686 uint32_t __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
18687 LDKChainMonitor this_arg_conv;
18688 this_arg_conv.inner = (void*)(this_arg & (~1));
18689 this_arg_conv.is_owned = false;
18690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18691 LDKOutPoint funding_txo_conv;
18692 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18693 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18694 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18695 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18696 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
18697 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
18698 return (uint64_t)ret_conv;
18701 uint32_tArray __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
18702 LDKChainMonitor this_arg_conv;
18703 this_arg_conv.inner = (void*)(this_arg & (~1));
18704 this_arg_conv.is_owned = false;
18705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18706 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
18707 uint32_tArray ret_arr = NULL;
18708 ret_arr = init_uint32_tArray(ret_var.datalen);
18709 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
18710 for (size_t k = 0; k < ret_var.datalen; k++) {
18711 LDKOutPoint ret_conv_10_var = ret_var.data[k];
18712 uint64_t ret_conv_10_ref = 0;
18713 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18714 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18715 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
18716 ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
18717 if (ret_conv_10_var.is_owned) {
18718 ret_conv_10_ref |= 1;
18720 ret_arr_ptr[k] = ret_conv_10_ref;
18723 FREE(ret_var.data);
18727 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) {
18728 LDKChainMonitor this_arg_conv;
18729 this_arg_conv.inner = (void*)(this_arg & (~1));
18730 this_arg_conv.is_owned = false;
18731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18732 LDKOutPoint funding_txo_conv;
18733 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18734 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18735 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18736 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18737 LDKMonitorUpdateId completed_update_id_conv;
18738 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
18739 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
18740 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
18741 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
18742 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18743 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
18744 return (uint64_t)ret_conv;
18747 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
18748 LDKChainMonitor this_arg_conv;
18749 this_arg_conv.inner = (void*)(this_arg & (~1));
18750 this_arg_conv.is_owned = false;
18751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18752 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
18753 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
18754 return (uint64_t)ret_ret;
18757 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
18758 LDKChainMonitor this_arg_conv;
18759 this_arg_conv.inner = (void*)(this_arg & (~1));
18760 this_arg_conv.is_owned = false;
18761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18762 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18763 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
18764 return (uint64_t)ret_ret;
18767 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
18768 LDKChainMonitor this_arg_conv;
18769 this_arg_conv.inner = (void*)(this_arg & (~1));
18770 this_arg_conv.is_owned = false;
18771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18772 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
18773 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
18774 return (uint64_t)ret_ret;
18777 uint32_t __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
18778 LDKChainMonitor this_arg_conv;
18779 this_arg_conv.inner = (void*)(this_arg & (~1));
18780 this_arg_conv.is_owned = false;
18781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18782 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18783 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
18784 return (uint64_t)ret_ret;
18787 void __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
18788 LDKChannelMonitorUpdate this_obj_conv;
18789 this_obj_conv.inner = (void*)(this_obj & (~1));
18790 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18792 ChannelMonitorUpdate_free(this_obj_conv);
18795 int64_t __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
18796 LDKChannelMonitorUpdate this_ptr_conv;
18797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18798 this_ptr_conv.is_owned = false;
18799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18800 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
18804 void __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
18805 LDKChannelMonitorUpdate this_ptr_conv;
18806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18807 this_ptr_conv.is_owned = false;
18808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18809 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
18812 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
18813 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
18814 uint64_t ret_ref = 0;
18815 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18816 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18817 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18818 ret_ref = (uint64_t)ret_var.inner;
18819 if (ret_var.is_owned) {
18824 int64_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
18825 LDKChannelMonitorUpdate arg_conv;
18826 arg_conv.inner = (void*)(arg & (~1));
18827 arg_conv.is_owned = false;
18828 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18829 int64_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
18833 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
18834 LDKChannelMonitorUpdate orig_conv;
18835 orig_conv.inner = (void*)(orig & (~1));
18836 orig_conv.is_owned = false;
18837 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18838 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
18839 uint64_t ret_ref = 0;
18840 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18841 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18843 ret_ref = (uint64_t)ret_var.inner;
18844 if (ret_var.is_owned) {
18850 int8_tArray __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
18851 LDKChannelMonitorUpdate obj_conv;
18852 obj_conv.inner = (void*)(obj & (~1));
18853 obj_conv.is_owned = false;
18854 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18855 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
18856 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18857 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18858 CVec_u8Z_free(ret_var);
18862 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
18863 LDKu8slice ser_ref;
18864 ser_ref.datalen = ser->arr_len;
18865 ser_ref.data = ser->elems;
18866 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18867 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
18868 return (uint64_t)ret_conv;
18871 void __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint32_t this_ptr) {
18872 if ((this_ptr & 1) != 0) return;
18873 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18874 CHECK_ACCESS(this_ptr_ptr);
18875 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
18876 FREE((void*)this_ptr);
18877 MonitorEvent_free(this_ptr_conv);
18880 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
18881 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18882 *ret_copy = MonitorEvent_clone(arg);
18883 uint64_t ret_ref = (uint64_t)ret_copy;
18886 int64_t __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
18887 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
18888 int64_t ret_val = MonitorEvent_clone_ptr(arg_conv);
18892 uint32_t __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint32_t orig) {
18893 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
18894 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18895 *ret_copy = MonitorEvent_clone(orig_conv);
18896 uint64_t ret_ref = (uint64_t)ret_copy;
18900 uint32_t __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint32_t a) {
18901 LDKHTLCUpdate a_conv;
18902 a_conv.inner = (void*)(a & (~1));
18903 a_conv.is_owned = (a & 1) || (a == 0);
18904 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18905 a_conv = HTLCUpdate_clone(&a_conv);
18906 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18907 *ret_copy = MonitorEvent_htlcevent(a_conv);
18908 uint64_t ret_ref = (uint64_t)ret_copy;
18912 uint32_t __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
18913 LDKOutPoint a_conv;
18914 a_conv.inner = (void*)(a & (~1));
18915 a_conv.is_owned = (a & 1) || (a == 0);
18916 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18917 a_conv = OutPoint_clone(&a_conv);
18918 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18919 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
18920 uint64_t ret_ref = (uint64_t)ret_copy;
18924 uint32_t __attribute__((export_name("TS_MonitorEvent_update_completed"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
18925 LDKOutPoint funding_txo_conv;
18926 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18927 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18928 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18929 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18930 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18931 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
18932 uint64_t ret_ref = (uint64_t)ret_copy;
18936 uint32_t __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint32_t a) {
18937 LDKOutPoint a_conv;
18938 a_conv.inner = (void*)(a & (~1));
18939 a_conv.is_owned = (a & 1) || (a == 0);
18940 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18941 a_conv = OutPoint_clone(&a_conv);
18942 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18943 *ret_copy = MonitorEvent_update_failed(a_conv);
18944 uint64_t ret_ref = (uint64_t)ret_copy;
18948 int8_tArray __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint32_t obj) {
18949 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
18950 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
18951 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18952 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18953 CVec_u8Z_free(ret_var);
18957 uint32_t __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
18958 LDKu8slice ser_ref;
18959 ser_ref.datalen = ser->arr_len;
18960 ser_ref.data = ser->elems;
18961 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18962 *ret_conv = MonitorEvent_read(ser_ref);
18963 return (uint64_t)ret_conv;
18966 void __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint32_t this_obj) {
18967 LDKHTLCUpdate this_obj_conv;
18968 this_obj_conv.inner = (void*)(this_obj & (~1));
18969 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18971 HTLCUpdate_free(this_obj_conv);
18974 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
18975 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
18976 uint64_t ret_ref = 0;
18977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18980 ret_ref = (uint64_t)ret_var.inner;
18981 if (ret_var.is_owned) {
18986 int64_t __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
18987 LDKHTLCUpdate arg_conv;
18988 arg_conv.inner = (void*)(arg & (~1));
18989 arg_conv.is_owned = false;
18990 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18991 int64_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
18995 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint32_t orig) {
18996 LDKHTLCUpdate orig_conv;
18997 orig_conv.inner = (void*)(orig & (~1));
18998 orig_conv.is_owned = false;
18999 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19000 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
19001 uint64_t ret_ref = 0;
19002 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19003 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19004 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19005 ret_ref = (uint64_t)ret_var.inner;
19006 if (ret_var.is_owned) {
19012 int8_tArray __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint32_t obj) {
19013 LDKHTLCUpdate obj_conv;
19014 obj_conv.inner = (void*)(obj & (~1));
19015 obj_conv.is_owned = false;
19016 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19017 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
19018 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19019 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19020 CVec_u8Z_free(ret_var);
19024 uint32_t __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
19025 LDKu8slice ser_ref;
19026 ser_ref.datalen = ser->arr_len;
19027 ser_ref.data = ser->elems;
19028 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19029 *ret_conv = HTLCUpdate_read(ser_ref);
19030 return (uint64_t)ret_conv;
19033 void __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint32_t this_ptr) {
19034 if ((this_ptr & 1) != 0) return;
19035 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19036 CHECK_ACCESS(this_ptr_ptr);
19037 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
19038 FREE((void*)this_ptr);
19039 Balance_free(this_ptr_conv);
19042 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
19043 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19044 *ret_copy = Balance_clone(arg);
19045 uint64_t ret_ref = (uint64_t)ret_copy;
19048 int64_t __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint32_t arg) {
19049 LDKBalance* arg_conv = (LDKBalance*)arg;
19050 int64_t ret_val = Balance_clone_ptr(arg_conv);
19054 uint32_t __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint32_t orig) {
19055 LDKBalance* orig_conv = (LDKBalance*)orig;
19056 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19057 *ret_copy = Balance_clone(orig_conv);
19058 uint64_t ret_ref = (uint64_t)ret_copy;
19062 uint32_t __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
19063 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19064 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
19065 uint64_t ret_ref = (uint64_t)ret_copy;
19069 uint32_t __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
19070 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19071 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
19072 uint64_t ret_ref = (uint64_t)ret_copy;
19076 uint32_t __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
19077 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19078 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
19079 uint64_t ret_ref = (uint64_t)ret_copy;
19083 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) {
19084 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19085 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
19086 uint64_t ret_ref = (uint64_t)ret_copy;
19090 jboolean __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint32_t a, uint32_t b) {
19091 LDKBalance* a_conv = (LDKBalance*)a;
19092 LDKBalance* b_conv = (LDKBalance*)b;
19093 jboolean ret_val = Balance_eq(a_conv, b_conv);
19097 void __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint32_t this_obj) {
19098 LDKChannelMonitor this_obj_conv;
19099 this_obj_conv.inner = (void*)(this_obj & (~1));
19100 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19102 ChannelMonitor_free(this_obj_conv);
19105 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
19106 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
19107 uint64_t ret_ref = 0;
19108 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19109 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19110 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19111 ret_ref = (uint64_t)ret_var.inner;
19112 if (ret_var.is_owned) {
19117 int64_t __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
19118 LDKChannelMonitor arg_conv;
19119 arg_conv.inner = (void*)(arg & (~1));
19120 arg_conv.is_owned = false;
19121 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19122 int64_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
19126 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint32_t orig) {
19127 LDKChannelMonitor orig_conv;
19128 orig_conv.inner = (void*)(orig & (~1));
19129 orig_conv.is_owned = false;
19130 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19131 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
19132 uint64_t ret_ref = 0;
19133 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19134 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19136 ret_ref = (uint64_t)ret_var.inner;
19137 if (ret_var.is_owned) {
19143 int8_tArray __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint32_t obj) {
19144 LDKChannelMonitor obj_conv;
19145 obj_conv.inner = (void*)(obj & (~1));
19146 obj_conv.is_owned = false;
19147 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19148 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
19149 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19150 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19151 CVec_u8Z_free(ret_var);
19155 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) {
19156 LDKChannelMonitor this_arg_conv;
19157 this_arg_conv.inner = (void*)(this_arg & (~1));
19158 this_arg_conv.is_owned = false;
19159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19160 LDKChannelMonitorUpdate updates_conv;
19161 updates_conv.inner = (void*)(updates & (~1));
19162 updates_conv.is_owned = false;
19163 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
19164 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19165 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
19166 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
19167 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19168 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
19169 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
19170 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19171 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
19172 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
19173 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19174 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
19175 return (uint64_t)ret_conv;
19178 int64_t __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
19179 LDKChannelMonitor this_arg_conv;
19180 this_arg_conv.inner = (void*)(this_arg & (~1));
19181 this_arg_conv.is_owned = false;
19182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19183 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
19187 uint32_t __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
19188 LDKChannelMonitor this_arg_conv;
19189 this_arg_conv.inner = (void*)(this_arg & (~1));
19190 this_arg_conv.is_owned = false;
19191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19192 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19193 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
19194 return ((uint64_t)ret_conv);
19197 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
19198 LDKChannelMonitor this_arg_conv;
19199 this_arg_conv.inner = (void*)(this_arg & (~1));
19200 this_arg_conv.is_owned = false;
19201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19202 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
19203 uint32_tArray ret_arr = NULL;
19204 ret_arr = init_uint32_tArray(ret_var.datalen);
19205 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19206 for (size_t o = 0; o < ret_var.datalen; o++) {
19207 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19208 *ret_conv_40_conv = ret_var.data[o];
19209 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
19212 FREE(ret_var.data);
19216 void __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
19217 LDKChannelMonitor this_arg_conv;
19218 this_arg_conv.inner = (void*)(this_arg & (~1));
19219 this_arg_conv.is_owned = false;
19220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19221 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
19222 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
19223 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
19224 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
19227 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) {
19228 LDKChannelMonitor this_arg_conv;
19229 this_arg_conv.inner = (void*)(this_arg & (~1));
19230 this_arg_conv.is_owned = false;
19231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19232 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
19233 uint32_tArray ret_arr = NULL;
19234 ret_arr = init_uint32_tArray(ret_var.datalen);
19235 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19236 for (size_t o = 0; o < ret_var.datalen; o++) {
19237 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19238 *ret_conv_14_copy = ret_var.data[o];
19239 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
19240 ret_arr_ptr[o] = ret_conv_14_ref;
19243 FREE(ret_var.data);
19247 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
19248 LDKChannelMonitor this_arg_conv;
19249 this_arg_conv.inner = (void*)(this_arg & (~1));
19250 this_arg_conv.is_owned = false;
19251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19252 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
19253 uint32_tArray ret_arr = NULL;
19254 ret_arr = init_uint32_tArray(ret_var.datalen);
19255 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19256 for (size_t h = 0; h < ret_var.datalen; h++) {
19257 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19258 *ret_conv_7_copy = ret_var.data[h];
19259 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
19260 ret_arr_ptr[h] = ret_conv_7_ref;
19263 FREE(ret_var.data);
19267 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) {
19268 LDKChannelMonitor this_arg_conv;
19269 this_arg_conv.inner = (void*)(this_arg & (~1));
19270 this_arg_conv.is_owned = false;
19271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19272 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19273 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
19274 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
19275 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
19276 ptrArray ret_arr = NULL;
19277 ret_arr = init_ptrArray(ret_var.datalen);
19278 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
19279 for (size_t m = 0; m < ret_var.datalen; m++) {
19280 LDKTransaction ret_conv_12_var = ret_var.data[m];
19281 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen);
19282 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
19283 Transaction_free(ret_conv_12_var);
19284 ret_arr_ptr[m] = ret_conv_12_arr;
19287 FREE(ret_var.data);
19291 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) {
19292 LDKChannelMonitor this_arg_conv;
19293 this_arg_conv.inner = (void*)(this_arg & (~1));
19294 this_arg_conv.is_owned = false;
19295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19296 unsigned char header_arr[80];
19297 CHECK(header->arr_len == 80);
19298 memcpy(header_arr, header->elems, 80);
19299 unsigned char (*header_ref)[80] = &header_arr;
19300 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
19301 txdata_constr.datalen = txdata->arr_len;
19302 if (txdata_constr.datalen > 0)
19303 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19305 txdata_constr.data = NULL;
19306 uint32_t* txdata_vals = txdata->elems;
19307 for (size_t c = 0; c < txdata_constr.datalen; c++) {
19308 uint32_t txdata_conv_28 = txdata_vals[c];
19309 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19310 CHECK_ACCESS(txdata_conv_28_ptr);
19311 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19312 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19313 txdata_constr.data[c] = txdata_conv_28_conv;
19315 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19316 CHECK_ACCESS(broadcaster_ptr);
19317 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19318 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19319 CHECK_ACCESS(fee_estimator_ptr);
19320 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19321 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19322 CHECK_ACCESS(logger_ptr);
19323 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19324 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);
19325 uint32_tArray ret_arr = NULL;
19326 ret_arr = init_uint32_tArray(ret_var.datalen);
19327 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19328 for (size_t n = 0; n < ret_var.datalen; n++) {
19329 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19330 *ret_conv_39_conv = ret_var.data[n];
19331 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19334 FREE(ret_var.data);
19338 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) {
19339 LDKChannelMonitor this_arg_conv;
19340 this_arg_conv.inner = (void*)(this_arg & (~1));
19341 this_arg_conv.is_owned = false;
19342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19343 unsigned char header_arr[80];
19344 CHECK(header->arr_len == 80);
19345 memcpy(header_arr, header->elems, 80);
19346 unsigned char (*header_ref)[80] = &header_arr;
19347 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19348 CHECK_ACCESS(broadcaster_ptr);
19349 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19350 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19351 CHECK_ACCESS(fee_estimator_ptr);
19352 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19353 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19354 CHECK_ACCESS(logger_ptr);
19355 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19356 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19359 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) {
19360 LDKChannelMonitor this_arg_conv;
19361 this_arg_conv.inner = (void*)(this_arg & (~1));
19362 this_arg_conv.is_owned = false;
19363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19364 unsigned char header_arr[80];
19365 CHECK(header->arr_len == 80);
19366 memcpy(header_arr, header->elems, 80);
19367 unsigned char (*header_ref)[80] = &header_arr;
19368 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
19369 txdata_constr.datalen = txdata->arr_len;
19370 if (txdata_constr.datalen > 0)
19371 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19373 txdata_constr.data = NULL;
19374 uint32_t* txdata_vals = txdata->elems;
19375 for (size_t c = 0; c < txdata_constr.datalen; c++) {
19376 uint32_t txdata_conv_28 = txdata_vals[c];
19377 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19378 CHECK_ACCESS(txdata_conv_28_ptr);
19379 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19380 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19381 txdata_constr.data[c] = txdata_conv_28_conv;
19383 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19384 CHECK_ACCESS(broadcaster_ptr);
19385 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19386 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19387 CHECK_ACCESS(fee_estimator_ptr);
19388 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19389 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19390 CHECK_ACCESS(logger_ptr);
19391 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19392 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);
19393 uint32_tArray ret_arr = NULL;
19394 ret_arr = init_uint32_tArray(ret_var.datalen);
19395 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19396 for (size_t n = 0; n < ret_var.datalen; n++) {
19397 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19398 *ret_conv_39_conv = ret_var.data[n];
19399 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19402 FREE(ret_var.data);
19406 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) {
19407 LDKChannelMonitor this_arg_conv;
19408 this_arg_conv.inner = (void*)(this_arg & (~1));
19409 this_arg_conv.is_owned = false;
19410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19411 unsigned char txid_arr[32];
19412 CHECK(txid->arr_len == 32);
19413 memcpy(txid_arr, txid->elems, 32);
19414 unsigned char (*txid_ref)[32] = &txid_arr;
19415 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19416 CHECK_ACCESS(broadcaster_ptr);
19417 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19418 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19419 CHECK_ACCESS(fee_estimator_ptr);
19420 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19421 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19422 CHECK_ACCESS(logger_ptr);
19423 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19424 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
19427 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) {
19428 LDKChannelMonitor this_arg_conv;
19429 this_arg_conv.inner = (void*)(this_arg & (~1));
19430 this_arg_conv.is_owned = false;
19431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19432 unsigned char header_arr[80];
19433 CHECK(header->arr_len == 80);
19434 memcpy(header_arr, header->elems, 80);
19435 unsigned char (*header_ref)[80] = &header_arr;
19436 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19437 CHECK_ACCESS(broadcaster_ptr);
19438 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19439 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19440 CHECK_ACCESS(fee_estimator_ptr);
19441 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19442 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19443 CHECK_ACCESS(logger_ptr);
19444 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19445 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19446 uint32_tArray ret_arr = NULL;
19447 ret_arr = init_uint32_tArray(ret_var.datalen);
19448 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19449 for (size_t n = 0; n < ret_var.datalen; n++) {
19450 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19451 *ret_conv_39_conv = ret_var.data[n];
19452 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19455 FREE(ret_var.data);
19459 ptrArray __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
19460 LDKChannelMonitor this_arg_conv;
19461 this_arg_conv.inner = (void*)(this_arg & (~1));
19462 this_arg_conv.is_owned = false;
19463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19464 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
19465 ptrArray ret_arr = NULL;
19466 ret_arr = init_ptrArray(ret_var.datalen);
19467 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
19468 for (size_t m = 0; m < ret_var.datalen; m++) {
19469 int8_tArray ret_conv_12_arr = init_int8_tArray(32);
19470 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
19471 ret_arr_ptr[m] = ret_conv_12_arr;
19474 FREE(ret_var.data);
19478 uint32_t __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
19479 LDKChannelMonitor this_arg_conv;
19480 this_arg_conv.inner = (void*)(this_arg & (~1));
19481 this_arg_conv.is_owned = false;
19482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19483 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
19484 uint64_t ret_ref = 0;
19485 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19486 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19488 ret_ref = (uint64_t)ret_var.inner;
19489 if (ret_var.is_owned) {
19495 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
19496 LDKChannelMonitor this_arg_conv;
19497 this_arg_conv.inner = (void*)(this_arg & (~1));
19498 this_arg_conv.is_owned = false;
19499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19500 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
19501 uint32_tArray ret_arr = NULL;
19502 ret_arr = init_uint32_tArray(ret_var.datalen);
19503 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
19504 for (size_t j = 0; j < ret_var.datalen; j++) {
19505 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19506 *ret_conv_9_copy = ret_var.data[j];
19507 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
19508 ret_arr_ptr[j] = ret_conv_9_ref;
19511 FREE(ret_var.data);
19515 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
19516 LDKu8slice ser_ref;
19517 ser_ref.datalen = ser->arr_len;
19518 ser_ref.data = ser->elems;
19519 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
19520 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
19521 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
19522 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19523 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
19524 return (uint64_t)ret_conv;
19527 void __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint32_t this_obj) {
19528 LDKOutPoint this_obj_conv;
19529 this_obj_conv.inner = (void*)(this_obj & (~1));
19530 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19532 OutPoint_free(this_obj_conv);
19535 int8_tArray __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
19536 LDKOutPoint this_ptr_conv;
19537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19538 this_ptr_conv.is_owned = false;
19539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19540 int8_tArray ret_arr = init_int8_tArray(32);
19541 memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
19545 void __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
19546 LDKOutPoint this_ptr_conv;
19547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19548 this_ptr_conv.is_owned = false;
19549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19550 LDKThirtyTwoBytes val_ref;
19551 CHECK(val->arr_len == 32);
19552 memcpy(val_ref.data, val->elems, 32);
19553 OutPoint_set_txid(&this_ptr_conv, val_ref);
19556 int16_t __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint32_t this_ptr) {
19557 LDKOutPoint this_ptr_conv;
19558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19559 this_ptr_conv.is_owned = false;
19560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19561 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
19565 void __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
19566 LDKOutPoint this_ptr_conv;
19567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19568 this_ptr_conv.is_owned = false;
19569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19570 OutPoint_set_index(&this_ptr_conv, val);
19573 uint32_t __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
19574 LDKThirtyTwoBytes txid_arg_ref;
19575 CHECK(txid_arg->arr_len == 32);
19576 memcpy(txid_arg_ref.data, txid_arg->elems, 32);
19577 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
19578 uint64_t ret_ref = 0;
19579 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19580 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19581 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19582 ret_ref = (uint64_t)ret_var.inner;
19583 if (ret_var.is_owned) {
19589 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
19590 LDKOutPoint ret_var = OutPoint_clone(arg);
19591 uint64_t ret_ref = 0;
19592 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19593 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19594 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19595 ret_ref = (uint64_t)ret_var.inner;
19596 if (ret_var.is_owned) {
19601 int64_t __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint32_t arg) {
19602 LDKOutPoint arg_conv;
19603 arg_conv.inner = (void*)(arg & (~1));
19604 arg_conv.is_owned = false;
19605 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19606 int64_t ret_val = OutPoint_clone_ptr(&arg_conv);
19610 uint32_t __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint32_t orig) {
19611 LDKOutPoint orig_conv;
19612 orig_conv.inner = (void*)(orig & (~1));
19613 orig_conv.is_owned = false;
19614 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19615 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
19616 uint64_t ret_ref = 0;
19617 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19618 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19619 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19620 ret_ref = (uint64_t)ret_var.inner;
19621 if (ret_var.is_owned) {
19627 jboolean __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
19628 LDKOutPoint a_conv;
19629 a_conv.inner = (void*)(a & (~1));
19630 a_conv.is_owned = false;
19631 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19632 LDKOutPoint b_conv;
19633 b_conv.inner = (void*)(b & (~1));
19634 b_conv.is_owned = false;
19635 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19636 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
19640 int64_t __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint32_t o) {
19641 LDKOutPoint o_conv;
19642 o_conv.inner = (void*)(o & (~1));
19643 o_conv.is_owned = false;
19644 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19645 int64_t ret_val = OutPoint_hash(&o_conv);
19649 int8_tArray __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
19650 LDKOutPoint this_arg_conv;
19651 this_arg_conv.inner = (void*)(this_arg & (~1));
19652 this_arg_conv.is_owned = false;
19653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19654 int8_tArray ret_arr = init_int8_tArray(32);
19655 memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
19659 int8_tArray __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint32_t obj) {
19660 LDKOutPoint obj_conv;
19661 obj_conv.inner = (void*)(obj & (~1));
19662 obj_conv.is_owned = false;
19663 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19664 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
19665 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19666 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19667 CVec_u8Z_free(ret_var);
19671 uint32_t __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
19672 LDKu8slice ser_ref;
19673 ser_ref.datalen = ser->arr_len;
19674 ser_ref.data = ser->elems;
19675 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19676 *ret_conv = OutPoint_read(ser_ref);
19677 return (uint64_t)ret_conv;
19680 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
19681 LDKDelayedPaymentOutputDescriptor this_obj_conv;
19682 this_obj_conv.inner = (void*)(this_obj & (~1));
19683 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19685 DelayedPaymentOutputDescriptor_free(this_obj_conv);
19688 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19689 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19691 this_ptr_conv.is_owned = false;
19692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19693 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19694 uint64_t ret_ref = 0;
19695 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19696 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19698 ret_ref = (uint64_t)ret_var.inner;
19699 if (ret_var.is_owned) {
19705 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19706 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19708 this_ptr_conv.is_owned = false;
19709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19710 LDKOutPoint val_conv;
19711 val_conv.inner = (void*)(val & (~1));
19712 val_conv.is_owned = (val & 1) || (val == 0);
19713 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19714 val_conv = OutPoint_clone(&val_conv);
19715 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19718 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
19719 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19721 this_ptr_conv.is_owned = false;
19722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19723 int8_tArray ret_arr = init_int8_tArray(33);
19724 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19728 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19729 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19731 this_ptr_conv.is_owned = false;
19732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19733 LDKPublicKey val_ref;
19734 CHECK(val->arr_len == 33);
19735 memcpy(val_ref.compressed_form, val->elems, 33);
19736 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
19739 int16_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
19740 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19742 this_ptr_conv.is_owned = false;
19743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19744 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
19748 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
19749 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19751 this_ptr_conv.is_owned = false;
19752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19753 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
19756 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19757 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19759 this_ptr_conv.is_owned = false;
19760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19761 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19762 CHECK_ACCESS(val_ptr);
19763 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19764 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19765 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19768 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
19769 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19771 this_ptr_conv.is_owned = false;
19772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19773 int8_tArray ret_arr = init_int8_tArray(33);
19774 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
19778 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
19779 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19781 this_ptr_conv.is_owned = false;
19782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19783 LDKPublicKey val_ref;
19784 CHECK(val->arr_len == 33);
19785 memcpy(val_ref.compressed_form, val->elems, 33);
19786 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
19789 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19790 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19792 this_ptr_conv.is_owned = false;
19793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19794 int8_tArray ret_arr = init_int8_tArray(32);
19795 memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19799 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19800 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19802 this_ptr_conv.is_owned = false;
19803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19804 LDKThirtyTwoBytes val_ref;
19805 CHECK(val->arr_len == 32);
19806 memcpy(val_ref.data, val->elems, 32);
19807 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19810 int64_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19811 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19813 this_ptr_conv.is_owned = false;
19814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19815 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19819 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19820 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19822 this_ptr_conv.is_owned = false;
19823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19824 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
19827 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) {
19828 LDKOutPoint outpoint_arg_conv;
19829 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
19830 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
19831 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
19832 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
19833 LDKPublicKey per_commitment_point_arg_ref;
19834 CHECK(per_commitment_point_arg->arr_len == 33);
19835 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33);
19836 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
19837 CHECK_ACCESS(output_arg_ptr);
19838 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
19839 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
19840 LDKPublicKey revocation_pubkey_arg_ref;
19841 CHECK(revocation_pubkey_arg->arr_len == 33);
19842 memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33);
19843 LDKThirtyTwoBytes channel_keys_id_arg_ref;
19844 CHECK(channel_keys_id_arg->arr_len == 32);
19845 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32);
19846 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);
19847 uint64_t ret_ref = 0;
19848 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19849 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19850 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19851 ret_ref = (uint64_t)ret_var.inner;
19852 if (ret_var.is_owned) {
19858 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
19859 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
19860 uint64_t ret_ref = 0;
19861 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19862 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19863 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19864 ret_ref = (uint64_t)ret_var.inner;
19865 if (ret_var.is_owned) {
19870 int64_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
19871 LDKDelayedPaymentOutputDescriptor arg_conv;
19872 arg_conv.inner = (void*)(arg & (~1));
19873 arg_conv.is_owned = false;
19874 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19875 int64_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
19879 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
19880 LDKDelayedPaymentOutputDescriptor orig_conv;
19881 orig_conv.inner = (void*)(orig & (~1));
19882 orig_conv.is_owned = false;
19883 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19884 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
19885 uint64_t ret_ref = 0;
19886 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19887 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19888 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19889 ret_ref = (uint64_t)ret_var.inner;
19890 if (ret_var.is_owned) {
19896 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
19897 LDKDelayedPaymentOutputDescriptor obj_conv;
19898 obj_conv.inner = (void*)(obj & (~1));
19899 obj_conv.is_owned = false;
19900 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19901 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
19902 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19903 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19904 CVec_u8Z_free(ret_var);
19908 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
19909 LDKu8slice ser_ref;
19910 ser_ref.datalen = ser->arr_len;
19911 ser_ref.data = ser->elems;
19912 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19913 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
19914 return (uint64_t)ret_conv;
19917 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
19918 LDKStaticPaymentOutputDescriptor this_obj_conv;
19919 this_obj_conv.inner = (void*)(this_obj & (~1));
19920 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19922 StaticPaymentOutputDescriptor_free(this_obj_conv);
19925 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19926 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19928 this_ptr_conv.is_owned = false;
19929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19930 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19931 uint64_t ret_ref = 0;
19932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19934 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19935 ret_ref = (uint64_t)ret_var.inner;
19936 if (ret_var.is_owned) {
19942 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19943 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19945 this_ptr_conv.is_owned = false;
19946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19947 LDKOutPoint val_conv;
19948 val_conv.inner = (void*)(val & (~1));
19949 val_conv.is_owned = (val & 1) || (val == 0);
19950 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19951 val_conv = OutPoint_clone(&val_conv);
19952 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19955 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19956 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19958 this_ptr_conv.is_owned = false;
19959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19960 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19961 CHECK_ACCESS(val_ptr);
19962 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19963 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19964 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19967 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19968 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19970 this_ptr_conv.is_owned = false;
19971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19972 int8_tArray ret_arr = init_int8_tArray(32);
19973 memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19977 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19978 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19980 this_ptr_conv.is_owned = false;
19981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19982 LDKThirtyTwoBytes val_ref;
19983 CHECK(val->arr_len == 32);
19984 memcpy(val_ref.data, val->elems, 32);
19985 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19988 int64_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19989 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19991 this_ptr_conv.is_owned = false;
19992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19993 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19997 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19998 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20000 this_ptr_conv.is_owned = false;
20001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20002 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
20005 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) {
20006 LDKOutPoint outpoint_arg_conv;
20007 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
20008 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
20009 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
20010 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
20011 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
20012 CHECK_ACCESS(output_arg_ptr);
20013 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
20014 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
20015 LDKThirtyTwoBytes channel_keys_id_arg_ref;
20016 CHECK(channel_keys_id_arg->arr_len == 32);
20017 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32);
20018 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
20019 uint64_t ret_ref = 0;
20020 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20021 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20023 ret_ref = (uint64_t)ret_var.inner;
20024 if (ret_var.is_owned) {
20030 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
20031 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
20032 uint64_t ret_ref = 0;
20033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20036 ret_ref = (uint64_t)ret_var.inner;
20037 if (ret_var.is_owned) {
20042 int64_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
20043 LDKStaticPaymentOutputDescriptor arg_conv;
20044 arg_conv.inner = (void*)(arg & (~1));
20045 arg_conv.is_owned = false;
20046 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20047 int64_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
20051 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
20052 LDKStaticPaymentOutputDescriptor orig_conv;
20053 orig_conv.inner = (void*)(orig & (~1));
20054 orig_conv.is_owned = false;
20055 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20056 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
20057 uint64_t ret_ref = 0;
20058 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20059 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20061 ret_ref = (uint64_t)ret_var.inner;
20062 if (ret_var.is_owned) {
20068 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
20069 LDKStaticPaymentOutputDescriptor obj_conv;
20070 obj_conv.inner = (void*)(obj & (~1));
20071 obj_conv.is_owned = false;
20072 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20073 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
20074 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
20075 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20076 CVec_u8Z_free(ret_var);
20080 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
20081 LDKu8slice ser_ref;
20082 ser_ref.datalen = ser->arr_len;
20083 ser_ref.data = ser->elems;
20084 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
20085 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
20086 return (uint64_t)ret_conv;
20089 void __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
20090 if ((this_ptr & 1) != 0) return;
20091 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20092 CHECK_ACCESS(this_ptr_ptr);
20093 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
20094 FREE((void*)this_ptr);
20095 SpendableOutputDescriptor_free(this_ptr_conv);
20098 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
20099 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20100 *ret_copy = SpendableOutputDescriptor_clone(arg);
20101 uint64_t ret_ref = (uint64_t)ret_copy;
20104 int64_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
20105 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
20106 int64_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
20110 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
20111 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
20112 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20113 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
20114 uint64_t ret_ref = (uint64_t)ret_copy;
20118 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
20119 LDKOutPoint outpoint_conv;
20120 outpoint_conv.inner = (void*)(outpoint & (~1));
20121 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
20122 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
20123 outpoint_conv = OutPoint_clone(&outpoint_conv);
20124 void* output_ptr = (void*)(((uint64_t)output) & ~1);
20125 CHECK_ACCESS(output_ptr);
20126 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
20127 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
20128 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20129 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
20130 uint64_t ret_ref = (uint64_t)ret_copy;
20134 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
20135 LDKDelayedPaymentOutputDescriptor a_conv;
20136 a_conv.inner = (void*)(a & (~1));
20137 a_conv.is_owned = (a & 1) || (a == 0);
20138 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20139 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
20140 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20141 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
20142 uint64_t ret_ref = (uint64_t)ret_copy;
20146 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
20147 LDKStaticPaymentOutputDescriptor a_conv;
20148 a_conv.inner = (void*)(a & (~1));
20149 a_conv.is_owned = (a & 1) || (a == 0);
20150 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20151 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
20152 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20153 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
20154 uint64_t ret_ref = (uint64_t)ret_copy;
20158 int8_tArray __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
20159 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
20160 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
20161 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
20162 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20163 CVec_u8Z_free(ret_var);
20167 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
20168 LDKu8slice ser_ref;
20169 ser_ref.datalen = ser->arr_len;
20170 ser_ref.data = ser->elems;
20171 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
20172 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
20173 return (uint64_t)ret_conv;
20176 void __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint32_t this_ptr) {
20177 if ((this_ptr & 1) != 0) return;
20178 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20179 CHECK_ACCESS(this_ptr_ptr);
20180 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
20181 FREE((void*)this_ptr);
20182 BaseSign_free(this_ptr_conv);
20185 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
20186 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20187 *ret_ret = Sign_clone(arg);
20188 return (uint64_t)ret_ret;
20190 int64_t __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint32_t arg) {
20191 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
20192 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
20193 LDKSign* arg_conv = (LDKSign*)arg_ptr;
20194 int64_t ret_val = Sign_clone_ptr(arg_conv);
20198 uint32_t __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint32_t orig) {
20199 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
20200 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
20201 LDKSign* orig_conv = (LDKSign*)orig_ptr;
20202 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20203 *ret_ret = Sign_clone(orig_conv);
20204 return (uint64_t)ret_ret;
20207 void __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint32_t this_ptr) {
20208 if ((this_ptr & 1) != 0) return;
20209 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20210 CHECK_ACCESS(this_ptr_ptr);
20211 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
20212 FREE((void*)this_ptr);
20213 Sign_free(this_ptr_conv);
20216 void __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint32_t this_ptr) {
20217 if ((this_ptr & 1) != 0) return;
20218 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20219 CHECK_ACCESS(this_ptr_ptr);
20220 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
20221 FREE((void*)this_ptr);
20222 KeysInterface_free(this_ptr_conv);
20225 void __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint32_t this_obj) {
20226 LDKInMemorySigner this_obj_conv;
20227 this_obj_conv.inner = (void*)(this_obj & (~1));
20228 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20230 InMemorySigner_free(this_obj_conv);
20233 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
20234 LDKInMemorySigner this_ptr_conv;
20235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20236 this_ptr_conv.is_owned = false;
20237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20238 int8_tArray ret_arr = init_int8_tArray(32);
20239 memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
20243 void __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
20244 LDKInMemorySigner this_ptr_conv;
20245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20246 this_ptr_conv.is_owned = false;
20247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20248 LDKSecretKey val_ref;
20249 CHECK(val->arr_len == 32);
20250 memcpy(val_ref.bytes, val->elems, 32);
20251 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
20254 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
20255 LDKInMemorySigner this_ptr_conv;
20256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20257 this_ptr_conv.is_owned = false;
20258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20259 int8_tArray ret_arr = init_int8_tArray(32);
20260 memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
20264 void __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
20265 LDKInMemorySigner this_ptr_conv;
20266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20267 this_ptr_conv.is_owned = false;
20268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20269 LDKSecretKey val_ref;
20270 CHECK(val->arr_len == 32);
20271 memcpy(val_ref.bytes, val->elems, 32);
20272 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
20275 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
20276 LDKInMemorySigner this_ptr_conv;
20277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20278 this_ptr_conv.is_owned = false;
20279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20280 int8_tArray ret_arr = init_int8_tArray(32);
20281 memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
20285 void __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
20286 LDKInMemorySigner this_ptr_conv;
20287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20288 this_ptr_conv.is_owned = false;
20289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20290 LDKSecretKey val_ref;
20291 CHECK(val->arr_len == 32);
20292 memcpy(val_ref.bytes, val->elems, 32);
20293 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
20296 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
20297 LDKInMemorySigner this_ptr_conv;
20298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20299 this_ptr_conv.is_owned = false;
20300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20301 int8_tArray ret_arr = init_int8_tArray(32);
20302 memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
20306 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) {
20307 LDKInMemorySigner this_ptr_conv;
20308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20309 this_ptr_conv.is_owned = false;
20310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20311 LDKSecretKey val_ref;
20312 CHECK(val->arr_len == 32);
20313 memcpy(val_ref.bytes, val->elems, 32);
20314 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
20317 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
20318 LDKInMemorySigner this_ptr_conv;
20319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20320 this_ptr_conv.is_owned = false;
20321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20322 int8_tArray ret_arr = init_int8_tArray(32);
20323 memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
20327 void __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
20328 LDKInMemorySigner this_ptr_conv;
20329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20330 this_ptr_conv.is_owned = false;
20331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20332 LDKSecretKey val_ref;
20333 CHECK(val->arr_len == 32);
20334 memcpy(val_ref.bytes, val->elems, 32);
20335 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
20338 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
20339 LDKInMemorySigner this_ptr_conv;
20340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20341 this_ptr_conv.is_owned = false;
20342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20343 int8_tArray ret_arr = init_int8_tArray(32);
20344 memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
20348 void __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
20349 LDKInMemorySigner this_ptr_conv;
20350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20351 this_ptr_conv.is_owned = false;
20352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20353 LDKThirtyTwoBytes val_ref;
20354 CHECK(val->arr_len == 32);
20355 memcpy(val_ref.data, val->elems, 32);
20356 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
20359 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
20360 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
20361 uint64_t ret_ref = 0;
20362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20363 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20365 ret_ref = (uint64_t)ret_var.inner;
20366 if (ret_var.is_owned) {
20371 int64_t __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
20372 LDKInMemorySigner arg_conv;
20373 arg_conv.inner = (void*)(arg & (~1));
20374 arg_conv.is_owned = false;
20375 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20376 int64_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
20380 uint32_t __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint32_t orig) {
20381 LDKInMemorySigner orig_conv;
20382 orig_conv.inner = (void*)(orig & (~1));
20383 orig_conv.is_owned = false;
20384 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20385 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
20386 uint64_t ret_ref = 0;
20387 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20388 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20389 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20390 ret_ref = (uint64_t)ret_var.inner;
20391 if (ret_var.is_owned) {
20397 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) {
20398 LDKSecretKey funding_key_ref;
20399 CHECK(funding_key->arr_len == 32);
20400 memcpy(funding_key_ref.bytes, funding_key->elems, 32);
20401 LDKSecretKey revocation_base_key_ref;
20402 CHECK(revocation_base_key->arr_len == 32);
20403 memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32);
20404 LDKSecretKey payment_key_ref;
20405 CHECK(payment_key->arr_len == 32);
20406 memcpy(payment_key_ref.bytes, payment_key->elems, 32);
20407 LDKSecretKey delayed_payment_base_key_ref;
20408 CHECK(delayed_payment_base_key->arr_len == 32);
20409 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32);
20410 LDKSecretKey htlc_base_key_ref;
20411 CHECK(htlc_base_key->arr_len == 32);
20412 memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32);
20413 LDKThirtyTwoBytes commitment_seed_ref;
20414 CHECK(commitment_seed->arr_len == 32);
20415 memcpy(commitment_seed_ref.data, commitment_seed->elems, 32);
20416 LDKThirtyTwoBytes channel_keys_id_ref;
20417 CHECK(channel_keys_id->arr_len == 32);
20418 memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32);
20419 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);
20420 uint64_t ret_ref = 0;
20421 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20422 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20423 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20424 ret_ref = (uint64_t)ret_var.inner;
20425 if (ret_var.is_owned) {
20431 uint32_t __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
20432 LDKInMemorySigner this_arg_conv;
20433 this_arg_conv.inner = (void*)(this_arg & (~1));
20434 this_arg_conv.is_owned = false;
20435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20436 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
20437 uint64_t ret_ref = 0;
20438 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20439 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20441 ret_ref = (uint64_t)ret_var.inner;
20442 if (ret_var.is_owned) {
20448 int16_t __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
20449 LDKInMemorySigner this_arg_conv;
20450 this_arg_conv.inner = (void*)(this_arg & (~1));
20451 this_arg_conv.is_owned = false;
20452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20453 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
20457 int16_t __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
20458 LDKInMemorySigner this_arg_conv;
20459 this_arg_conv.inner = (void*)(this_arg & (~1));
20460 this_arg_conv.is_owned = false;
20461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20462 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
20466 jboolean __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
20467 LDKInMemorySigner this_arg_conv;
20468 this_arg_conv.inner = (void*)(this_arg & (~1));
20469 this_arg_conv.is_owned = false;
20470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20471 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
20475 uint32_t __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
20476 LDKInMemorySigner this_arg_conv;
20477 this_arg_conv.inner = (void*)(this_arg & (~1));
20478 this_arg_conv.is_owned = false;
20479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20480 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
20481 uint64_t ret_ref = 0;
20482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20484 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20485 ret_ref = (uint64_t)ret_var.inner;
20486 if (ret_var.is_owned) {
20492 uint32_t __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
20493 LDKInMemorySigner this_arg_conv;
20494 this_arg_conv.inner = (void*)(this_arg & (~1));
20495 this_arg_conv.is_owned = false;
20496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20497 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
20498 uint64_t ret_ref = 0;
20499 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20500 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20502 ret_ref = (uint64_t)ret_var.inner;
20503 if (ret_var.is_owned) {
20509 jboolean __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) {
20510 LDKInMemorySigner this_arg_conv;
20511 this_arg_conv.inner = (void*)(this_arg & (~1));
20512 this_arg_conv.is_owned = false;
20513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20514 jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv);
20518 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) {
20519 LDKInMemorySigner this_arg_conv;
20520 this_arg_conv.inner = (void*)(this_arg & (~1));
20521 this_arg_conv.is_owned = false;
20522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20523 LDKTransaction spend_tx_ref;
20524 spend_tx_ref.datalen = spend_tx->arr_len;
20525 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20526 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen);
20527 spend_tx_ref.data_is_owned = true;
20528 LDKStaticPaymentOutputDescriptor descriptor_conv;
20529 descriptor_conv.inner = (void*)(descriptor & (~1));
20530 descriptor_conv.is_owned = false;
20531 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20532 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20533 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20534 return (uint64_t)ret_conv;
20537 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) {
20538 LDKInMemorySigner this_arg_conv;
20539 this_arg_conv.inner = (void*)(this_arg & (~1));
20540 this_arg_conv.is_owned = false;
20541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20542 LDKTransaction spend_tx_ref;
20543 spend_tx_ref.datalen = spend_tx->arr_len;
20544 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20545 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen);
20546 spend_tx_ref.data_is_owned = true;
20547 LDKDelayedPaymentOutputDescriptor descriptor_conv;
20548 descriptor_conv.inner = (void*)(descriptor & (~1));
20549 descriptor_conv.is_owned = false;
20550 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20551 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20552 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20553 return (uint64_t)ret_conv;
20556 uint32_t __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
20557 LDKInMemorySigner this_arg_conv;
20558 this_arg_conv.inner = (void*)(this_arg & (~1));
20559 this_arg_conv.is_owned = false;
20560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20561 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
20562 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
20563 return (uint64_t)ret_ret;
20566 uint32_t __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
20567 LDKInMemorySigner this_arg_conv;
20568 this_arg_conv.inner = (void*)(this_arg & (~1));
20569 this_arg_conv.is_owned = false;
20570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20571 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20572 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
20573 return (uint64_t)ret_ret;
20576 int8_tArray __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint32_t obj) {
20577 LDKInMemorySigner obj_conv;
20578 obj_conv.inner = (void*)(obj & (~1));
20579 obj_conv.is_owned = false;
20580 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20581 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
20582 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
20583 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20584 CVec_u8Z_free(ret_var);
20588 uint32_t __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser) {
20589 LDKu8slice ser_ref;
20590 ser_ref.datalen = ser->arr_len;
20591 ser_ref.data = ser->elems;
20592 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20593 *ret_conv = InMemorySigner_read(ser_ref);
20594 return (uint64_t)ret_conv;
20597 void __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint32_t this_obj) {
20598 LDKKeysManager this_obj_conv;
20599 this_obj_conv.inner = (void*)(this_obj & (~1));
20600 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20602 KeysManager_free(this_obj_conv);
20605 uint32_t __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
20606 unsigned char seed_arr[32];
20607 CHECK(seed->arr_len == 32);
20608 memcpy(seed_arr, seed->elems, 32);
20609 unsigned char (*seed_ref)[32] = &seed_arr;
20610 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
20611 uint64_t ret_ref = 0;
20612 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20613 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20615 ret_ref = (uint64_t)ret_var.inner;
20616 if (ret_var.is_owned) {
20622 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) {
20623 LDKKeysManager this_arg_conv;
20624 this_arg_conv.inner = (void*)(this_arg & (~1));
20625 this_arg_conv.is_owned = false;
20626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20627 unsigned char params_arr[32];
20628 CHECK(params->arr_len == 32);
20629 memcpy(params_arr, params->elems, 32);
20630 unsigned char (*params_ref)[32] = ¶ms_arr;
20631 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
20632 uint64_t ret_ref = 0;
20633 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20634 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20635 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20636 ret_ref = (uint64_t)ret_var.inner;
20637 if (ret_var.is_owned) {
20643 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) {
20644 LDKKeysManager this_arg_conv;
20645 this_arg_conv.inner = (void*)(this_arg & (~1));
20646 this_arg_conv.is_owned = false;
20647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20648 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
20649 descriptors_constr.datalen = descriptors->arr_len;
20650 if (descriptors_constr.datalen > 0)
20651 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20653 descriptors_constr.data = NULL;
20654 uint32_t* descriptors_vals = descriptors->elems;
20655 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
20656 uint32_t descriptors_conv_27 = descriptors_vals[b];
20657 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
20658 CHECK_ACCESS(descriptors_conv_27_ptr);
20659 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
20660 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
20661 descriptors_constr.data[b] = descriptors_conv_27_conv;
20663 LDKCVec_TxOutZ outputs_constr;
20664 outputs_constr.datalen = outputs->arr_len;
20665 if (outputs_constr.datalen > 0)
20666 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
20668 outputs_constr.data = NULL;
20669 uint32_t* outputs_vals = outputs->elems;
20670 for (size_t h = 0; h < outputs_constr.datalen; h++) {
20671 uint32_t outputs_conv_7 = outputs_vals[h];
20672 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
20673 CHECK_ACCESS(outputs_conv_7_ptr);
20674 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
20675 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
20676 outputs_constr.data[h] = outputs_conv_7_conv;
20678 LDKCVec_u8Z change_destination_script_ref;
20679 change_destination_script_ref.datalen = change_destination_script->arr_len;
20680 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
20681 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen);
20682 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20683 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
20684 return (uint64_t)ret_conv;
20687 uint32_t __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
20688 LDKKeysManager this_arg_conv;
20689 this_arg_conv.inner = (void*)(this_arg & (~1));
20690 this_arg_conv.is_owned = false;
20691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20692 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
20693 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
20694 return (uint64_t)ret_ret;
20697 void __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint32_t this_obj) {
20698 LDKChannelManager this_obj_conv;
20699 this_obj_conv.inner = (void*)(this_obj & (~1));
20700 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20702 ChannelManager_free(this_obj_conv);
20705 void __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint32_t this_obj) {
20706 LDKChainParameters this_obj_conv;
20707 this_obj_conv.inner = (void*)(this_obj & (~1));
20708 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20710 ChainParameters_free(this_obj_conv);
20713 uint32_t __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
20714 LDKChainParameters this_ptr_conv;
20715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20716 this_ptr_conv.is_owned = false;
20717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20718 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
20722 void __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
20723 LDKChainParameters this_ptr_conv;
20724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20725 this_ptr_conv.is_owned = false;
20726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20727 LDKNetwork val_conv = LDKNetwork_from_js(val);
20728 ChainParameters_set_network(&this_ptr_conv, val_conv);
20731 uint32_t __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
20732 LDKChainParameters this_ptr_conv;
20733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20734 this_ptr_conv.is_owned = false;
20735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20736 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
20737 uint64_t ret_ref = 0;
20738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20740 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20741 ret_ref = (uint64_t)ret_var.inner;
20742 if (ret_var.is_owned) {
20748 void __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
20749 LDKChainParameters this_ptr_conv;
20750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20751 this_ptr_conv.is_owned = false;
20752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20753 LDKBestBlock val_conv;
20754 val_conv.inner = (void*)(val & (~1));
20755 val_conv.is_owned = (val & 1) || (val == 0);
20756 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20757 val_conv = BestBlock_clone(&val_conv);
20758 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
20761 uint32_t __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
20762 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
20763 LDKBestBlock best_block_arg_conv;
20764 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
20765 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
20766 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
20767 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
20768 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
20769 uint64_t ret_ref = 0;
20770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20773 ret_ref = (uint64_t)ret_var.inner;
20774 if (ret_var.is_owned) {
20780 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
20781 LDKChainParameters ret_var = ChainParameters_clone(arg);
20782 uint64_t ret_ref = 0;
20783 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20784 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20785 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20786 ret_ref = (uint64_t)ret_var.inner;
20787 if (ret_var.is_owned) {
20792 int64_t __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
20793 LDKChainParameters arg_conv;
20794 arg_conv.inner = (void*)(arg & (~1));
20795 arg_conv.is_owned = false;
20796 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20797 int64_t ret_val = ChainParameters_clone_ptr(&arg_conv);
20801 uint32_t __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint32_t orig) {
20802 LDKChainParameters orig_conv;
20803 orig_conv.inner = (void*)(orig & (~1));
20804 orig_conv.is_owned = false;
20805 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20806 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
20807 uint64_t ret_ref = 0;
20808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20810 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20811 ret_ref = (uint64_t)ret_var.inner;
20812 if (ret_var.is_owned) {
20818 void __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
20819 LDKCounterpartyForwardingInfo this_obj_conv;
20820 this_obj_conv.inner = (void*)(this_obj & (~1));
20821 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20823 CounterpartyForwardingInfo_free(this_obj_conv);
20826 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
20827 LDKCounterpartyForwardingInfo this_ptr_conv;
20828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20829 this_ptr_conv.is_owned = false;
20830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20831 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
20835 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
20836 LDKCounterpartyForwardingInfo this_ptr_conv;
20837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20838 this_ptr_conv.is_owned = false;
20839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20840 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
20843 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
20844 LDKCounterpartyForwardingInfo this_ptr_conv;
20845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20846 this_ptr_conv.is_owned = false;
20847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20848 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
20852 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
20853 LDKCounterpartyForwardingInfo this_ptr_conv;
20854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20855 this_ptr_conv.is_owned = false;
20856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20857 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
20860 int16_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
20861 LDKCounterpartyForwardingInfo this_ptr_conv;
20862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20863 this_ptr_conv.is_owned = false;
20864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20865 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
20869 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
20870 LDKCounterpartyForwardingInfo this_ptr_conv;
20871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20872 this_ptr_conv.is_owned = false;
20873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20874 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
20877 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) {
20878 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
20879 uint64_t ret_ref = 0;
20880 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20881 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20882 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20883 ret_ref = (uint64_t)ret_var.inner;
20884 if (ret_var.is_owned) {
20890 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
20891 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
20892 uint64_t ret_ref = 0;
20893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20895 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20896 ret_ref = (uint64_t)ret_var.inner;
20897 if (ret_var.is_owned) {
20902 int64_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
20903 LDKCounterpartyForwardingInfo arg_conv;
20904 arg_conv.inner = (void*)(arg & (~1));
20905 arg_conv.is_owned = false;
20906 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20907 int64_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
20911 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
20912 LDKCounterpartyForwardingInfo orig_conv;
20913 orig_conv.inner = (void*)(orig & (~1));
20914 orig_conv.is_owned = false;
20915 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20916 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
20917 uint64_t ret_ref = 0;
20918 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20919 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20921 ret_ref = (uint64_t)ret_var.inner;
20922 if (ret_var.is_owned) {
20928 void __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
20929 LDKChannelCounterparty this_obj_conv;
20930 this_obj_conv.inner = (void*)(this_obj & (~1));
20931 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20933 ChannelCounterparty_free(this_obj_conv);
20936 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
20937 LDKChannelCounterparty this_ptr_conv;
20938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20939 this_ptr_conv.is_owned = false;
20940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20941 int8_tArray ret_arr = init_int8_tArray(33);
20942 memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
20946 void __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
20947 LDKChannelCounterparty this_ptr_conv;
20948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20949 this_ptr_conv.is_owned = false;
20950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20951 LDKPublicKey val_ref;
20952 CHECK(val->arr_len == 33);
20953 memcpy(val_ref.compressed_form, val->elems, 33);
20954 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
20957 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
20958 LDKChannelCounterparty this_ptr_conv;
20959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20960 this_ptr_conv.is_owned = false;
20961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20962 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
20963 uint64_t ret_ref = 0;
20964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20967 ret_ref = (uint64_t)ret_var.inner;
20968 if (ret_var.is_owned) {
20974 void __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
20975 LDKChannelCounterparty this_ptr_conv;
20976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20977 this_ptr_conv.is_owned = false;
20978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20979 LDKInitFeatures val_conv;
20980 val_conv.inner = (void*)(val & (~1));
20981 val_conv.is_owned = (val & 1) || (val == 0);
20982 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20983 val_conv = InitFeatures_clone(&val_conv);
20984 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
20987 int64_t __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
20988 LDKChannelCounterparty this_ptr_conv;
20989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20990 this_ptr_conv.is_owned = false;
20991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20992 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
20996 void __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
20997 LDKChannelCounterparty this_ptr_conv;
20998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20999 this_ptr_conv.is_owned = false;
21000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21001 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
21004 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
21005 LDKChannelCounterparty this_ptr_conv;
21006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21007 this_ptr_conv.is_owned = false;
21008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21009 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
21010 uint64_t ret_ref = 0;
21011 if ((uint64_t)ret_var.inner > 4096) {
21012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21015 ret_ref = (uint64_t)ret_var.inner;
21016 if (ret_var.is_owned) {
21023 void __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
21024 LDKChannelCounterparty this_ptr_conv;
21025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21026 this_ptr_conv.is_owned = false;
21027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21028 LDKCounterpartyForwardingInfo val_conv;
21029 val_conv.inner = (void*)(val & (~1));
21030 val_conv.is_owned = (val & 1) || (val == 0);
21031 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21032 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
21033 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
21036 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) {
21037 LDKPublicKey node_id_arg_ref;
21038 CHECK(node_id_arg->arr_len == 33);
21039 memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33);
21040 LDKInitFeatures features_arg_conv;
21041 features_arg_conv.inner = (void*)(features_arg & (~1));
21042 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
21043 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
21044 features_arg_conv = InitFeatures_clone(&features_arg_conv);
21045 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
21046 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
21047 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
21048 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
21049 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
21050 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
21051 uint64_t ret_ref = 0;
21052 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21053 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21055 ret_ref = (uint64_t)ret_var.inner;
21056 if (ret_var.is_owned) {
21062 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
21063 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
21064 uint64_t ret_ref = 0;
21065 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21066 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21067 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21068 ret_ref = (uint64_t)ret_var.inner;
21069 if (ret_var.is_owned) {
21074 int64_t __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
21075 LDKChannelCounterparty arg_conv;
21076 arg_conv.inner = (void*)(arg & (~1));
21077 arg_conv.is_owned = false;
21078 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21079 int64_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
21083 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint32_t orig) {
21084 LDKChannelCounterparty orig_conv;
21085 orig_conv.inner = (void*)(orig & (~1));
21086 orig_conv.is_owned = false;
21087 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21088 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
21089 uint64_t ret_ref = 0;
21090 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21091 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21092 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21093 ret_ref = (uint64_t)ret_var.inner;
21094 if (ret_var.is_owned) {
21100 void __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint32_t this_obj) {
21101 LDKChannelDetails this_obj_conv;
21102 this_obj_conv.inner = (void*)(this_obj & (~1));
21103 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21105 ChannelDetails_free(this_obj_conv);
21108 int8_tArray __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
21109 LDKChannelDetails this_ptr_conv;
21110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21111 this_ptr_conv.is_owned = false;
21112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21113 int8_tArray ret_arr = init_int8_tArray(32);
21114 memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
21118 void __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
21119 LDKChannelDetails this_ptr_conv;
21120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21121 this_ptr_conv.is_owned = false;
21122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21123 LDKThirtyTwoBytes val_ref;
21124 CHECK(val->arr_len == 32);
21125 memcpy(val_ref.data, val->elems, 32);
21126 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
21129 uint32_t __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
21130 LDKChannelDetails this_ptr_conv;
21131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21132 this_ptr_conv.is_owned = false;
21133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21134 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
21135 uint64_t ret_ref = 0;
21136 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21137 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21139 ret_ref = (uint64_t)ret_var.inner;
21140 if (ret_var.is_owned) {
21146 void __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
21147 LDKChannelDetails this_ptr_conv;
21148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21149 this_ptr_conv.is_owned = false;
21150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21151 LDKChannelCounterparty val_conv;
21152 val_conv.inner = (void*)(val & (~1));
21153 val_conv.is_owned = (val & 1) || (val == 0);
21154 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21155 val_conv = ChannelCounterparty_clone(&val_conv);
21156 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
21159 uint32_t __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
21160 LDKChannelDetails this_ptr_conv;
21161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21162 this_ptr_conv.is_owned = false;
21163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21164 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
21165 uint64_t ret_ref = 0;
21166 if ((uint64_t)ret_var.inner > 4096) {
21167 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21168 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21169 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21170 ret_ref = (uint64_t)ret_var.inner;
21171 if (ret_var.is_owned) {
21178 void __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
21179 LDKChannelDetails this_ptr_conv;
21180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21181 this_ptr_conv.is_owned = false;
21182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21183 LDKOutPoint val_conv;
21184 val_conv.inner = (void*)(val & (~1));
21185 val_conv.is_owned = (val & 1) || (val == 0);
21186 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21187 val_conv = OutPoint_clone(&val_conv);
21188 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
21191 uint32_t __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
21192 LDKChannelDetails this_ptr_conv;
21193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21194 this_ptr_conv.is_owned = false;
21195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21196 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21197 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
21198 uint64_t ret_ref = (uint64_t)ret_copy;
21202 void __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
21203 LDKChannelDetails this_ptr_conv;
21204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21205 this_ptr_conv.is_owned = false;
21206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21207 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21208 CHECK_ACCESS(val_ptr);
21209 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
21210 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
21211 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
21214 int64_t __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
21215 LDKChannelDetails this_ptr_conv;
21216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21217 this_ptr_conv.is_owned = false;
21218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21219 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
21223 void __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
21224 LDKChannelDetails this_ptr_conv;
21225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21226 this_ptr_conv.is_owned = false;
21227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21228 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
21231 uint32_t __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
21232 LDKChannelDetails this_ptr_conv;
21233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21234 this_ptr_conv.is_owned = false;
21235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21236 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21237 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
21238 uint64_t ret_ref = (uint64_t)ret_copy;
21242 void __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
21243 LDKChannelDetails this_ptr_conv;
21244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21245 this_ptr_conv.is_owned = false;
21246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21247 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21248 CHECK_ACCESS(val_ptr);
21249 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
21250 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
21251 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
21254 int64_t __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
21255 LDKChannelDetails this_ptr_conv;
21256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21257 this_ptr_conv.is_owned = false;
21258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21259 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
21263 void __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
21264 LDKChannelDetails this_ptr_conv;
21265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21266 this_ptr_conv.is_owned = false;
21267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21268 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
21271 int64_t __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) {
21272 LDKChannelDetails this_ptr_conv;
21273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21274 this_ptr_conv.is_owned = false;
21275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21276 int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv);
21280 void __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_t val) {
21281 LDKChannelDetails this_ptr_conv;
21282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21283 this_ptr_conv.is_owned = false;
21284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21285 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
21288 int64_t __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
21289 LDKChannelDetails this_ptr_conv;
21290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21291 this_ptr_conv.is_owned = false;
21292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21293 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
21297 void __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
21298 LDKChannelDetails this_ptr_conv;
21299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21300 this_ptr_conv.is_owned = false;
21301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21302 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
21305 int64_t __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
21306 LDKChannelDetails this_ptr_conv;
21307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21308 this_ptr_conv.is_owned = false;
21309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21310 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
21314 void __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
21315 LDKChannelDetails this_ptr_conv;
21316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21317 this_ptr_conv.is_owned = false;
21318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21319 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
21322 uint32_t __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
21323 LDKChannelDetails this_ptr_conv;
21324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21325 this_ptr_conv.is_owned = false;
21326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21327 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21328 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
21329 uint64_t ret_ref = (uint64_t)ret_copy;
21333 void __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
21334 LDKChannelDetails this_ptr_conv;
21335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21336 this_ptr_conv.is_owned = false;
21337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21338 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21339 CHECK_ACCESS(val_ptr);
21340 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
21341 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
21342 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
21345 uint32_t __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
21346 LDKChannelDetails this_ptr_conv;
21347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21348 this_ptr_conv.is_owned = false;
21349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21350 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
21351 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
21352 uint64_t ret_ref = (uint64_t)ret_copy;
21356 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) {
21357 LDKChannelDetails this_ptr_conv;
21358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21359 this_ptr_conv.is_owned = false;
21360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21361 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21362 CHECK_ACCESS(val_ptr);
21363 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
21364 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
21365 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
21368 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
21369 LDKChannelDetails this_ptr_conv;
21370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21371 this_ptr_conv.is_owned = false;
21372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21373 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
21377 void __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
21378 LDKChannelDetails this_ptr_conv;
21379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21380 this_ptr_conv.is_owned = false;
21381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21382 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
21385 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_funding_locked"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
21386 LDKChannelDetails this_ptr_conv;
21387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21388 this_ptr_conv.is_owned = false;
21389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21390 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
21394 void __attribute__((export_name("TS_ChannelDetails_set_is_funding_locked"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
21395 LDKChannelDetails this_ptr_conv;
21396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21397 this_ptr_conv.is_owned = false;
21398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21399 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
21402 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
21403 LDKChannelDetails this_ptr_conv;
21404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21405 this_ptr_conv.is_owned = false;
21406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21407 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
21411 void __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
21412 LDKChannelDetails this_ptr_conv;
21413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21414 this_ptr_conv.is_owned = false;
21415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21416 ChannelDetails_set_is_usable(&this_ptr_conv, val);
21419 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
21420 LDKChannelDetails this_ptr_conv;
21421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21422 this_ptr_conv.is_owned = false;
21423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21424 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
21428 void __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
21429 LDKChannelDetails this_ptr_conv;
21430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21431 this_ptr_conv.is_owned = false;
21432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21433 ChannelDetails_set_is_public(&this_ptr_conv, val);
21436 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) {
21437 LDKThirtyTwoBytes channel_id_arg_ref;
21438 CHECK(channel_id_arg->arr_len == 32);
21439 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
21440 LDKChannelCounterparty counterparty_arg_conv;
21441 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
21442 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
21443 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
21444 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
21445 LDKOutPoint funding_txo_arg_conv;
21446 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
21447 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
21448 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
21449 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
21450 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
21451 CHECK_ACCESS(short_channel_id_arg_ptr);
21452 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
21453 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
21454 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
21455 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
21456 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
21457 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
21458 CHECK_ACCESS(confirmations_required_arg_ptr);
21459 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
21460 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
21461 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
21462 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
21463 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
21464 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
21465 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);
21466 uint64_t ret_ref = 0;
21467 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21468 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21469 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21470 ret_ref = (uint64_t)ret_var.inner;
21471 if (ret_var.is_owned) {
21477 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
21478 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
21479 uint64_t ret_ref = 0;
21480 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21481 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21482 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21483 ret_ref = (uint64_t)ret_var.inner;
21484 if (ret_var.is_owned) {
21489 int64_t __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
21490 LDKChannelDetails arg_conv;
21491 arg_conv.inner = (void*)(arg & (~1));
21492 arg_conv.is_owned = false;
21493 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21494 int64_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
21498 uint32_t __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint32_t orig) {
21499 LDKChannelDetails orig_conv;
21500 orig_conv.inner = (void*)(orig & (~1));
21501 orig_conv.is_owned = false;
21502 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21503 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
21504 uint64_t ret_ref = 0;
21505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21508 ret_ref = (uint64_t)ret_var.inner;
21509 if (ret_var.is_owned) {
21515 void __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
21516 if ((this_ptr & 1) != 0) return;
21517 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21518 CHECK_ACCESS(this_ptr_ptr);
21519 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
21520 FREE((void*)this_ptr);
21521 PaymentSendFailure_free(this_ptr_conv);
21524 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
21525 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21526 *ret_copy = PaymentSendFailure_clone(arg);
21527 uint64_t ret_ref = (uint64_t)ret_copy;
21530 int64_t __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
21531 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
21532 int64_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
21536 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint32_t orig) {
21537 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
21538 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21539 *ret_copy = PaymentSendFailure_clone(orig_conv);
21540 uint64_t ret_ref = (uint64_t)ret_copy;
21544 uint32_t __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
21545 void* a_ptr = (void*)(((uint64_t)a) & ~1);
21546 CHECK_ACCESS(a_ptr);
21547 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
21548 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
21549 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21550 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
21551 uint64_t ret_ref = (uint64_t)ret_copy;
21555 uint32_t __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
21556 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
21557 a_constr.datalen = a->arr_len;
21558 if (a_constr.datalen > 0)
21559 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21561 a_constr.data = NULL;
21562 uint32_t* a_vals = a->elems;
21563 for (size_t w = 0; w < a_constr.datalen; w++) {
21564 uint32_t a_conv_22 = a_vals[w];
21565 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
21566 CHECK_ACCESS(a_conv_22_ptr);
21567 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
21568 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
21569 a_constr.data[w] = a_conv_22_conv;
21571 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21572 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
21573 uint64_t ret_ref = (uint64_t)ret_copy;
21577 uint32_t __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
21578 LDKCVec_APIErrorZ a_constr;
21579 a_constr.datalen = a->arr_len;
21580 if (a_constr.datalen > 0)
21581 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
21583 a_constr.data = NULL;
21584 uint32_t* a_vals = a->elems;
21585 for (size_t k = 0; k < a_constr.datalen; k++) {
21586 uint32_t a_conv_10 = a_vals[k];
21587 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
21588 CHECK_ACCESS(a_conv_10_ptr);
21589 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
21590 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
21591 a_constr.data[k] = a_conv_10_conv;
21593 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21594 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
21595 uint64_t ret_ref = (uint64_t)ret_copy;
21599 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) {
21600 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
21601 results_constr.datalen = results->arr_len;
21602 if (results_constr.datalen > 0)
21603 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21605 results_constr.data = NULL;
21606 uint32_t* results_vals = results->elems;
21607 for (size_t w = 0; w < results_constr.datalen; w++) {
21608 uint32_t results_conv_22 = results_vals[w];
21609 void* results_conv_22_ptr = (void*)(((uint64_t)results_conv_22) & ~1);
21610 CHECK_ACCESS(results_conv_22_ptr);
21611 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
21612 results_constr.data[w] = results_conv_22_conv;
21614 LDKRouteParameters failed_paths_retry_conv;
21615 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
21616 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
21617 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
21618 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
21619 LDKThirtyTwoBytes payment_id_ref;
21620 CHECK(payment_id->arr_len == 32);
21621 memcpy(payment_id_ref.data, payment_id->elems, 32);
21622 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21623 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
21624 uint64_t ret_ref = (uint64_t)ret_copy;
21628 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) {
21629 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
21630 CHECK_ACCESS(fee_est_ptr);
21631 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
21632 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21633 CHECK_ACCESS(chain_monitor_ptr);
21634 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21635 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21636 CHECK_ACCESS(tx_broadcaster_ptr);
21637 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21638 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21639 CHECK_ACCESS(logger_ptr);
21640 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21641 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21642 CHECK_ACCESS(keys_manager_ptr);
21643 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21644 LDKUserConfig config_conv;
21645 config_conv.inner = (void*)(config & (~1));
21646 config_conv.is_owned = (config & 1) || (config == 0);
21647 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
21648 config_conv = UserConfig_clone(&config_conv);
21649 LDKChainParameters params_conv;
21650 params_conv.inner = (void*)(params & (~1));
21651 params_conv.is_owned = (params & 1) || (params == 0);
21652 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
21653 params_conv = ChainParameters_clone(¶ms_conv);
21654 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
21655 uint64_t ret_ref = 0;
21656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21659 ret_ref = (uint64_t)ret_var.inner;
21660 if (ret_var.is_owned) {
21666 uint32_t __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
21667 LDKChannelManager this_arg_conv;
21668 this_arg_conv.inner = (void*)(this_arg & (~1));
21669 this_arg_conv.is_owned = false;
21670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21671 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
21672 uint64_t ret_ref = 0;
21673 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21674 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21675 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21676 ret_ref = (uint64_t)ret_var.inner;
21677 if (ret_var.is_owned) {
21683 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) {
21684 LDKChannelManager this_arg_conv;
21685 this_arg_conv.inner = (void*)(this_arg & (~1));
21686 this_arg_conv.is_owned = false;
21687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21688 LDKPublicKey their_network_key_ref;
21689 CHECK(their_network_key->arr_len == 33);
21690 memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33);
21691 LDKUserConfig override_config_conv;
21692 override_config_conv.inner = (void*)(override_config & (~1));
21693 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
21694 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
21695 override_config_conv = UserConfig_clone(&override_config_conv);
21696 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
21697 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
21698 return (uint64_t)ret_conv;
21701 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
21702 LDKChannelManager this_arg_conv;
21703 this_arg_conv.inner = (void*)(this_arg & (~1));
21704 this_arg_conv.is_owned = false;
21705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21706 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
21707 uint32_tArray ret_arr = NULL;
21708 ret_arr = init_uint32_tArray(ret_var.datalen);
21709 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
21710 for (size_t q = 0; q < ret_var.datalen; q++) {
21711 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21712 uint64_t ret_conv_16_ref = 0;
21713 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21714 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21715 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21716 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21717 if (ret_conv_16_var.is_owned) {
21718 ret_conv_16_ref |= 1;
21720 ret_arr_ptr[q] = ret_conv_16_ref;
21723 FREE(ret_var.data);
21727 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
21728 LDKChannelManager this_arg_conv;
21729 this_arg_conv.inner = (void*)(this_arg & (~1));
21730 this_arg_conv.is_owned = false;
21731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21732 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
21733 uint32_tArray ret_arr = NULL;
21734 ret_arr = init_uint32_tArray(ret_var.datalen);
21735 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
21736 for (size_t q = 0; q < ret_var.datalen; q++) {
21737 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21738 uint64_t ret_conv_16_ref = 0;
21739 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21740 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21741 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21742 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21743 if (ret_conv_16_var.is_owned) {
21744 ret_conv_16_ref |= 1;
21746 ret_arr_ptr[q] = ret_conv_16_ref;
21749 FREE(ret_var.data);
21753 uint32_t __attribute__((export_name("TS_ChannelManager_close_channel"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21754 LDKChannelManager this_arg_conv;
21755 this_arg_conv.inner = (void*)(this_arg & (~1));
21756 this_arg_conv.is_owned = false;
21757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21758 unsigned char channel_id_arr[32];
21759 CHECK(channel_id->arr_len == 32);
21760 memcpy(channel_id_arr, channel_id->elems, 32);
21761 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21762 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21763 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
21764 return (uint64_t)ret_conv;
21767 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) {
21768 LDKChannelManager this_arg_conv;
21769 this_arg_conv.inner = (void*)(this_arg & (~1));
21770 this_arg_conv.is_owned = false;
21771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21772 unsigned char channel_id_arr[32];
21773 CHECK(channel_id->arr_len == 32);
21774 memcpy(channel_id_arr, channel_id->elems, 32);
21775 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21776 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21777 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
21778 return (uint64_t)ret_conv;
21781 uint32_t __attribute__((export_name("TS_ChannelManager_force_close_channel"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21782 LDKChannelManager this_arg_conv;
21783 this_arg_conv.inner = (void*)(this_arg & (~1));
21784 this_arg_conv.is_owned = false;
21785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21786 unsigned char channel_id_arr[32];
21787 CHECK(channel_id->arr_len == 32);
21788 memcpy(channel_id_arr, channel_id->elems, 32);
21789 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21790 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21791 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
21792 return (uint64_t)ret_conv;
21795 void __attribute__((export_name("TS_ChannelManager_force_close_all_channels"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
21796 LDKChannelManager this_arg_conv;
21797 this_arg_conv.inner = (void*)(this_arg & (~1));
21798 this_arg_conv.is_owned = false;
21799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21800 ChannelManager_force_close_all_channels(&this_arg_conv);
21803 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) {
21804 LDKChannelManager this_arg_conv;
21805 this_arg_conv.inner = (void*)(this_arg & (~1));
21806 this_arg_conv.is_owned = false;
21807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21808 LDKRoute route_conv;
21809 route_conv.inner = (void*)(route & (~1));
21810 route_conv.is_owned = false;
21811 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21812 LDKThirtyTwoBytes payment_hash_ref;
21813 CHECK(payment_hash->arr_len == 32);
21814 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
21815 LDKThirtyTwoBytes payment_secret_ref;
21816 CHECK(payment_secret->arr_len == 32);
21817 memcpy(payment_secret_ref.data, payment_secret->elems, 32);
21818 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
21819 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
21820 return (uint64_t)ret_conv;
21823 uint32_t __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
21824 LDKChannelManager this_arg_conv;
21825 this_arg_conv.inner = (void*)(this_arg & (~1));
21826 this_arg_conv.is_owned = false;
21827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21828 LDKRoute route_conv;
21829 route_conv.inner = (void*)(route & (~1));
21830 route_conv.is_owned = false;
21831 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21832 LDKThirtyTwoBytes payment_id_ref;
21833 CHECK(payment_id->arr_len == 32);
21834 memcpy(payment_id_ref.data, payment_id->elems, 32);
21835 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21836 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
21837 return (uint64_t)ret_conv;
21840 void __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
21841 LDKChannelManager this_arg_conv;
21842 this_arg_conv.inner = (void*)(this_arg & (~1));
21843 this_arg_conv.is_owned = false;
21844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21845 LDKThirtyTwoBytes payment_id_ref;
21846 CHECK(payment_id->arr_len == 32);
21847 memcpy(payment_id_ref.data, payment_id->elems, 32);
21848 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
21851 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) {
21852 LDKChannelManager this_arg_conv;
21853 this_arg_conv.inner = (void*)(this_arg & (~1));
21854 this_arg_conv.is_owned = false;
21855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21856 LDKRoute route_conv;
21857 route_conv.inner = (void*)(route & (~1));
21858 route_conv.is_owned = false;
21859 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21860 LDKThirtyTwoBytes payment_preimage_ref;
21861 CHECK(payment_preimage->arr_len == 32);
21862 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
21863 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
21864 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
21865 return (uint64_t)ret_conv;
21868 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) {
21869 LDKChannelManager this_arg_conv;
21870 this_arg_conv.inner = (void*)(this_arg & (~1));
21871 this_arg_conv.is_owned = false;
21872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21873 unsigned char temporary_channel_id_arr[32];
21874 CHECK(temporary_channel_id->arr_len == 32);
21875 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32);
21876 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
21877 LDKTransaction funding_transaction_ref;
21878 funding_transaction_ref.datalen = funding_transaction->arr_len;
21879 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
21880 memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen);
21881 funding_transaction_ref.data_is_owned = true;
21882 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21883 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
21884 return (uint64_t)ret_conv;
21887 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) {
21888 LDKChannelManager this_arg_conv;
21889 this_arg_conv.inner = (void*)(this_arg & (~1));
21890 this_arg_conv.is_owned = false;
21891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21892 LDKThreeBytes rgb_ref;
21893 CHECK(rgb->arr_len == 3);
21894 memcpy(rgb_ref.data, rgb->elems, 3);
21895 LDKThirtyTwoBytes alias_ref;
21896 CHECK(alias->arr_len == 32);
21897 memcpy(alias_ref.data, alias->elems, 32);
21898 LDKCVec_NetAddressZ addresses_constr;
21899 addresses_constr.datalen = addresses->arr_len;
21900 if (addresses_constr.datalen > 0)
21901 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
21903 addresses_constr.data = NULL;
21904 uint32_t* addresses_vals = addresses->elems;
21905 for (size_t m = 0; m < addresses_constr.datalen; m++) {
21906 uint32_t addresses_conv_12 = addresses_vals[m];
21907 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
21908 CHECK_ACCESS(addresses_conv_12_ptr);
21909 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
21910 addresses_constr.data[m] = addresses_conv_12_conv;
21912 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
21915 void __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
21916 LDKChannelManager this_arg_conv;
21917 this_arg_conv.inner = (void*)(this_arg & (~1));
21918 this_arg_conv.is_owned = false;
21919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21920 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
21923 void __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
21924 LDKChannelManager this_arg_conv;
21925 this_arg_conv.inner = (void*)(this_arg & (~1));
21926 this_arg_conv.is_owned = false;
21927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21928 ChannelManager_timer_tick_occurred(&this_arg_conv);
21931 jboolean __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
21932 LDKChannelManager this_arg_conv;
21933 this_arg_conv.inner = (void*)(this_arg & (~1));
21934 this_arg_conv.is_owned = false;
21935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21936 unsigned char payment_hash_arr[32];
21937 CHECK(payment_hash->arr_len == 32);
21938 memcpy(payment_hash_arr, payment_hash->elems, 32);
21939 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
21940 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
21944 jboolean __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
21945 LDKChannelManager this_arg_conv;
21946 this_arg_conv.inner = (void*)(this_arg & (~1));
21947 this_arg_conv.is_owned = false;
21948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21949 LDKThirtyTwoBytes payment_preimage_ref;
21950 CHECK(payment_preimage->arr_len == 32);
21951 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
21952 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
21956 int8_tArray __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
21957 LDKChannelManager this_arg_conv;
21958 this_arg_conv.inner = (void*)(this_arg & (~1));
21959 this_arg_conv.is_owned = false;
21960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21961 int8_tArray ret_arr = init_int8_tArray(33);
21962 memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
21966 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) {
21967 LDKChannelManager this_arg_conv;
21968 this_arg_conv.inner = (void*)(this_arg & (~1));
21969 this_arg_conv.is_owned = false;
21970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21971 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21972 CHECK_ACCESS(min_value_msat_ptr);
21973 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21974 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21975 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
21976 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
21977 return (uint64_t)ret_conv;
21980 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) {
21981 LDKChannelManager this_arg_conv;
21982 this_arg_conv.inner = (void*)(this_arg & (~1));
21983 this_arg_conv.is_owned = false;
21984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21985 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21986 CHECK_ACCESS(min_value_msat_ptr);
21987 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21988 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21989 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
21990 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
21991 return (uint64_t)ret_conv;
21994 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) {
21995 LDKChannelManager this_arg_conv;
21996 this_arg_conv.inner = (void*)(this_arg & (~1));
21997 this_arg_conv.is_owned = false;
21998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21999 LDKThirtyTwoBytes payment_hash_ref;
22000 CHECK(payment_hash->arr_len == 32);
22001 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
22002 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
22003 CHECK_ACCESS(min_value_msat_ptr);
22004 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
22005 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
22006 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
22007 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
22008 return (uint64_t)ret_conv;
22011 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) {
22012 LDKChannelManager this_arg_conv;
22013 this_arg_conv.inner = (void*)(this_arg & (~1));
22014 this_arg_conv.is_owned = false;
22015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22016 LDKThirtyTwoBytes payment_hash_ref;
22017 CHECK(payment_hash->arr_len == 32);
22018 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
22019 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
22020 CHECK_ACCESS(min_value_msat_ptr);
22021 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
22022 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
22023 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
22024 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
22025 return (uint64_t)ret_conv;
22028 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) {
22029 LDKChannelManager this_arg_conv;
22030 this_arg_conv.inner = (void*)(this_arg & (~1));
22031 this_arg_conv.is_owned = false;
22032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22033 LDKThirtyTwoBytes payment_hash_ref;
22034 CHECK(payment_hash->arr_len == 32);
22035 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
22036 LDKThirtyTwoBytes payment_secret_ref;
22037 CHECK(payment_secret->arr_len == 32);
22038 memcpy(payment_secret_ref.data, payment_secret->elems, 32);
22039 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
22040 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
22041 return (uint64_t)ret_conv;
22044 uint32_t __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
22045 LDKChannelManager this_arg_conv;
22046 this_arg_conv.inner = (void*)(this_arg & (~1));
22047 this_arg_conv.is_owned = false;
22048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22049 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
22050 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
22051 return (uint64_t)ret_ret;
22054 uint32_t __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
22055 LDKChannelManager this_arg_conv;
22056 this_arg_conv.inner = (void*)(this_arg & (~1));
22057 this_arg_conv.is_owned = false;
22058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22059 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
22060 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
22061 return (uint64_t)ret_ret;
22064 uint32_t __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
22065 LDKChannelManager this_arg_conv;
22066 this_arg_conv.inner = (void*)(this_arg & (~1));
22067 this_arg_conv.is_owned = false;
22068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22069 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
22070 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
22071 return (uint64_t)ret_ret;
22074 uint32_t __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
22075 LDKChannelManager this_arg_conv;
22076 this_arg_conv.inner = (void*)(this_arg & (~1));
22077 this_arg_conv.is_owned = false;
22078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22079 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
22080 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
22081 return (uint64_t)ret_ret;
22084 void __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
22085 LDKChannelManager this_arg_conv;
22086 this_arg_conv.inner = (void*)(this_arg & (~1));
22087 this_arg_conv.is_owned = false;
22088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22089 ChannelManager_await_persistable_update(&this_arg_conv);
22092 uint32_t __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
22093 LDKChannelManager this_arg_conv;
22094 this_arg_conv.inner = (void*)(this_arg & (~1));
22095 this_arg_conv.is_owned = false;
22096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22097 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
22098 uint64_t ret_ref = 0;
22099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22101 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22102 ret_ref = (uint64_t)ret_var.inner;
22103 if (ret_var.is_owned) {
22109 uint32_t __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
22110 LDKChannelManager this_arg_conv;
22111 this_arg_conv.inner = (void*)(this_arg & (~1));
22112 this_arg_conv.is_owned = false;
22113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22114 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
22115 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
22116 return (uint64_t)ret_ret;
22119 int8_tArray __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint32_t obj) {
22120 LDKChannelManager obj_conv;
22121 obj_conv.inner = (void*)(obj & (~1));
22122 obj_conv.is_owned = false;
22123 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22124 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
22125 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
22126 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22127 CVec_u8Z_free(ret_var);
22131 void __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
22132 LDKChannelManagerReadArgs this_obj_conv;
22133 this_obj_conv.inner = (void*)(this_obj & (~1));
22134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22136 ChannelManagerReadArgs_free(this_obj_conv);
22139 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
22140 LDKChannelManagerReadArgs this_ptr_conv;
22141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22142 this_ptr_conv.is_owned = false;
22143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22144 // WARNING: This object doesn't live past this scope, needs clone!
22145 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
22149 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
22150 LDKChannelManagerReadArgs this_ptr_conv;
22151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22152 this_ptr_conv.is_owned = false;
22153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22154 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22155 CHECK_ACCESS(val_ptr);
22156 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
22157 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
22160 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
22161 LDKChannelManagerReadArgs this_ptr_conv;
22162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22163 this_ptr_conv.is_owned = false;
22164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22165 // WARNING: This object doesn't live past this scope, needs clone!
22166 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
22170 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
22171 LDKChannelManagerReadArgs this_ptr_conv;
22172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22173 this_ptr_conv.is_owned = false;
22174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22175 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22176 CHECK_ACCESS(val_ptr);
22177 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
22178 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
22181 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
22182 LDKChannelManagerReadArgs this_ptr_conv;
22183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22184 this_ptr_conv.is_owned = false;
22185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22186 // WARNING: This object doesn't live past this scope, needs clone!
22187 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
22191 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
22192 LDKChannelManagerReadArgs this_ptr_conv;
22193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22194 this_ptr_conv.is_owned = false;
22195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22196 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22197 CHECK_ACCESS(val_ptr);
22198 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
22199 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
22202 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
22203 LDKChannelManagerReadArgs this_ptr_conv;
22204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22205 this_ptr_conv.is_owned = false;
22206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22207 // WARNING: This object doesn't live past this scope, needs clone!
22208 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
22212 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
22213 LDKChannelManagerReadArgs this_ptr_conv;
22214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22215 this_ptr_conv.is_owned = false;
22216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22217 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22218 CHECK_ACCESS(val_ptr);
22219 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
22220 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
22223 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
22224 LDKChannelManagerReadArgs this_ptr_conv;
22225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22226 this_ptr_conv.is_owned = false;
22227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22228 // WARNING: This object doesn't live past this scope, needs clone!
22229 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
22233 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
22234 LDKChannelManagerReadArgs this_ptr_conv;
22235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22236 this_ptr_conv.is_owned = false;
22237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22238 void* val_ptr = (void*)(((uint64_t)val) & ~1);
22239 CHECK_ACCESS(val_ptr);
22240 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
22241 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
22244 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
22245 LDKChannelManagerReadArgs this_ptr_conv;
22246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22247 this_ptr_conv.is_owned = false;
22248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22249 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
22250 uint64_t ret_ref = 0;
22251 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22252 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22254 ret_ref = (uint64_t)ret_var.inner;
22255 if (ret_var.is_owned) {
22261 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
22262 LDKChannelManagerReadArgs this_ptr_conv;
22263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22264 this_ptr_conv.is_owned = false;
22265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22266 LDKUserConfig val_conv;
22267 val_conv.inner = (void*)(val & (~1));
22268 val_conv.is_owned = (val & 1) || (val == 0);
22269 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22270 val_conv = UserConfig_clone(&val_conv);
22271 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
22274 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) {
22275 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
22276 CHECK_ACCESS(keys_manager_ptr);
22277 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
22278 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
22279 CHECK_ACCESS(fee_estimator_ptr);
22280 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22281 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
22282 CHECK_ACCESS(chain_monitor_ptr);
22283 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
22284 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
22285 CHECK_ACCESS(tx_broadcaster_ptr);
22286 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
22287 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
22288 CHECK_ACCESS(logger_ptr);
22289 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22290 LDKUserConfig default_config_conv;
22291 default_config_conv.inner = (void*)(default_config & (~1));
22292 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
22293 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
22294 default_config_conv = UserConfig_clone(&default_config_conv);
22295 LDKCVec_ChannelMonitorZ channel_monitors_constr;
22296 channel_monitors_constr.datalen = channel_monitors->arr_len;
22297 if (channel_monitors_constr.datalen > 0)
22298 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
22300 channel_monitors_constr.data = NULL;
22301 uint32_t* channel_monitors_vals = channel_monitors->elems;
22302 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
22303 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
22304 LDKChannelMonitor channel_monitors_conv_16_conv;
22305 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
22306 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
22307 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
22308 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
22310 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);
22311 uint64_t ret_ref = 0;
22312 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22313 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22314 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22315 ret_ref = (uint64_t)ret_var.inner;
22316 if (ret_var.is_owned) {
22322 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
22323 LDKu8slice ser_ref;
22324 ser_ref.datalen = ser->arr_len;
22325 ser_ref.data = ser->elems;
22326 LDKChannelManagerReadArgs arg_conv;
22327 arg_conv.inner = (void*)(arg & (~1));
22328 arg_conv.is_owned = (arg & 1) || (arg == 0);
22329 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22330 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
22331 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
22332 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
22333 return (uint64_t)ret_conv;
22336 void __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint32_t this_obj) {
22337 LDKDecodeError this_obj_conv;
22338 this_obj_conv.inner = (void*)(this_obj & (~1));
22339 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22341 DecodeError_free(this_obj_conv);
22344 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
22345 LDKDecodeError ret_var = DecodeError_clone(arg);
22346 uint64_t ret_ref = 0;
22347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22350 ret_ref = (uint64_t)ret_var.inner;
22351 if (ret_var.is_owned) {
22356 int64_t __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint32_t arg) {
22357 LDKDecodeError arg_conv;
22358 arg_conv.inner = (void*)(arg & (~1));
22359 arg_conv.is_owned = false;
22360 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22361 int64_t ret_val = DecodeError_clone_ptr(&arg_conv);
22365 uint32_t __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint32_t orig) {
22366 LDKDecodeError orig_conv;
22367 orig_conv.inner = (void*)(orig & (~1));
22368 orig_conv.is_owned = false;
22369 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22370 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
22371 uint64_t ret_ref = 0;
22372 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22373 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22374 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22375 ret_ref = (uint64_t)ret_var.inner;
22376 if (ret_var.is_owned) {
22382 void __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint32_t this_obj) {
22383 LDKInit this_obj_conv;
22384 this_obj_conv.inner = (void*)(this_obj & (~1));
22385 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22387 Init_free(this_obj_conv);
22390 uint32_t __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint32_t this_ptr) {
22391 LDKInit this_ptr_conv;
22392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22393 this_ptr_conv.is_owned = false;
22394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22395 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
22396 uint64_t ret_ref = 0;
22397 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22398 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22400 ret_ref = (uint64_t)ret_var.inner;
22401 if (ret_var.is_owned) {
22407 void __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
22408 LDKInit this_ptr_conv;
22409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22410 this_ptr_conv.is_owned = false;
22411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22412 LDKInitFeatures val_conv;
22413 val_conv.inner = (void*)(val & (~1));
22414 val_conv.is_owned = (val & 1) || (val == 0);
22415 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22416 val_conv = InitFeatures_clone(&val_conv);
22417 Init_set_features(&this_ptr_conv, val_conv);
22420 uint32_t __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint32_t features_arg) {
22421 LDKInitFeatures features_arg_conv;
22422 features_arg_conv.inner = (void*)(features_arg & (~1));
22423 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
22424 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
22425 features_arg_conv = InitFeatures_clone(&features_arg_conv);
22426 LDKInit ret_var = Init_new(features_arg_conv);
22427 uint64_t ret_ref = 0;
22428 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22429 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22431 ret_ref = (uint64_t)ret_var.inner;
22432 if (ret_var.is_owned) {
22438 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
22439 LDKInit ret_var = Init_clone(arg);
22440 uint64_t ret_ref = 0;
22441 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22442 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22444 ret_ref = (uint64_t)ret_var.inner;
22445 if (ret_var.is_owned) {
22450 int64_t __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint32_t arg) {
22452 arg_conv.inner = (void*)(arg & (~1));
22453 arg_conv.is_owned = false;
22454 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22455 int64_t ret_val = Init_clone_ptr(&arg_conv);
22459 uint32_t __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint32_t orig) {
22461 orig_conv.inner = (void*)(orig & (~1));
22462 orig_conv.is_owned = false;
22463 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22464 LDKInit ret_var = Init_clone(&orig_conv);
22465 uint64_t ret_ref = 0;
22466 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22467 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22468 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22469 ret_ref = (uint64_t)ret_var.inner;
22470 if (ret_var.is_owned) {
22476 void __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint32_t this_obj) {
22477 LDKErrorMessage this_obj_conv;
22478 this_obj_conv.inner = (void*)(this_obj & (~1));
22479 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22481 ErrorMessage_free(this_obj_conv);
22484 int8_tArray __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
22485 LDKErrorMessage this_ptr_conv;
22486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22487 this_ptr_conv.is_owned = false;
22488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22489 int8_tArray ret_arr = init_int8_tArray(32);
22490 memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
22494 void __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
22495 LDKErrorMessage this_ptr_conv;
22496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22497 this_ptr_conv.is_owned = false;
22498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22499 LDKThirtyTwoBytes val_ref;
22500 CHECK(val->arr_len == 32);
22501 memcpy(val_ref.data, val->elems, 32);
22502 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
22505 jstring __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
22506 LDKErrorMessage this_ptr_conv;
22507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22508 this_ptr_conv.is_owned = false;
22509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22510 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
22511 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22516 void __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
22517 LDKErrorMessage this_ptr_conv;
22518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22519 this_ptr_conv.is_owned = false;
22520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22521 LDKStr val_conv = str_ref_to_owned_c(val);
22522 ErrorMessage_set_data(&this_ptr_conv, val_conv);
22525 uint32_t __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
22526 LDKThirtyTwoBytes channel_id_arg_ref;
22527 CHECK(channel_id_arg->arr_len == 32);
22528 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
22529 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
22530 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
22531 uint64_t ret_ref = 0;
22532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22534 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22535 ret_ref = (uint64_t)ret_var.inner;
22536 if (ret_var.is_owned) {
22542 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
22543 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
22544 uint64_t ret_ref = 0;
22545 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22546 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22547 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22548 ret_ref = (uint64_t)ret_var.inner;
22549 if (ret_var.is_owned) {
22554 int64_t __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
22555 LDKErrorMessage arg_conv;
22556 arg_conv.inner = (void*)(arg & (~1));
22557 arg_conv.is_owned = false;
22558 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22559 int64_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
22563 uint32_t __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint32_t orig) {
22564 LDKErrorMessage orig_conv;
22565 orig_conv.inner = (void*)(orig & (~1));
22566 orig_conv.is_owned = false;
22567 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22568 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
22569 uint64_t ret_ref = 0;
22570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22573 ret_ref = (uint64_t)ret_var.inner;
22574 if (ret_var.is_owned) {
22580 void __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint32_t this_obj) {
22581 LDKPing this_obj_conv;
22582 this_obj_conv.inner = (void*)(this_obj & (~1));
22583 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22585 Ping_free(this_obj_conv);
22588 int16_t __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
22589 LDKPing this_ptr_conv;
22590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22591 this_ptr_conv.is_owned = false;
22592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22593 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
22597 void __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
22598 LDKPing this_ptr_conv;
22599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22600 this_ptr_conv.is_owned = false;
22601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22602 Ping_set_ponglen(&this_ptr_conv, val);
22605 int16_t __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
22606 LDKPing this_ptr_conv;
22607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22608 this_ptr_conv.is_owned = false;
22609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22610 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
22614 void __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
22615 LDKPing this_ptr_conv;
22616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22617 this_ptr_conv.is_owned = false;
22618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22619 Ping_set_byteslen(&this_ptr_conv, val);
22622 uint32_t __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
22623 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
22624 uint64_t ret_ref = 0;
22625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22627 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22628 ret_ref = (uint64_t)ret_var.inner;
22629 if (ret_var.is_owned) {
22635 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
22636 LDKPing ret_var = Ping_clone(arg);
22637 uint64_t ret_ref = 0;
22638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22641 ret_ref = (uint64_t)ret_var.inner;
22642 if (ret_var.is_owned) {
22647 int64_t __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint32_t arg) {
22649 arg_conv.inner = (void*)(arg & (~1));
22650 arg_conv.is_owned = false;
22651 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22652 int64_t ret_val = Ping_clone_ptr(&arg_conv);
22656 uint32_t __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint32_t orig) {
22658 orig_conv.inner = (void*)(orig & (~1));
22659 orig_conv.is_owned = false;
22660 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22661 LDKPing ret_var = Ping_clone(&orig_conv);
22662 uint64_t ret_ref = 0;
22663 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22664 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22666 ret_ref = (uint64_t)ret_var.inner;
22667 if (ret_var.is_owned) {
22673 void __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint32_t this_obj) {
22674 LDKPong this_obj_conv;
22675 this_obj_conv.inner = (void*)(this_obj & (~1));
22676 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22678 Pong_free(this_obj_conv);
22681 int16_t __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
22682 LDKPong this_ptr_conv;
22683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22684 this_ptr_conv.is_owned = false;
22685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22686 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
22690 void __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
22691 LDKPong this_ptr_conv;
22692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22693 this_ptr_conv.is_owned = false;
22694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22695 Pong_set_byteslen(&this_ptr_conv, val);
22698 uint32_t __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
22699 LDKPong ret_var = Pong_new(byteslen_arg);
22700 uint64_t ret_ref = 0;
22701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22704 ret_ref = (uint64_t)ret_var.inner;
22705 if (ret_var.is_owned) {
22711 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
22712 LDKPong ret_var = Pong_clone(arg);
22713 uint64_t ret_ref = 0;
22714 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22715 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22716 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22717 ret_ref = (uint64_t)ret_var.inner;
22718 if (ret_var.is_owned) {
22723 int64_t __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint32_t arg) {
22725 arg_conv.inner = (void*)(arg & (~1));
22726 arg_conv.is_owned = false;
22727 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22728 int64_t ret_val = Pong_clone_ptr(&arg_conv);
22732 uint32_t __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint32_t orig) {
22734 orig_conv.inner = (void*)(orig & (~1));
22735 orig_conv.is_owned = false;
22736 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22737 LDKPong ret_var = Pong_clone(&orig_conv);
22738 uint64_t ret_ref = 0;
22739 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22740 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22741 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22742 ret_ref = (uint64_t)ret_var.inner;
22743 if (ret_var.is_owned) {
22749 void __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint32_t this_obj) {
22750 LDKOpenChannel this_obj_conv;
22751 this_obj_conv.inner = (void*)(this_obj & (~1));
22752 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22754 OpenChannel_free(this_obj_conv);
22757 int8_tArray __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
22758 LDKOpenChannel this_ptr_conv;
22759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22760 this_ptr_conv.is_owned = false;
22761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22762 int8_tArray ret_arr = init_int8_tArray(32);
22763 memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
22767 void __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
22768 LDKOpenChannel this_ptr_conv;
22769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22770 this_ptr_conv.is_owned = false;
22771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22772 LDKThirtyTwoBytes val_ref;
22773 CHECK(val->arr_len == 32);
22774 memcpy(val_ref.data, val->elems, 32);
22775 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
22778 int8_tArray __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
22779 LDKOpenChannel this_ptr_conv;
22780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22781 this_ptr_conv.is_owned = false;
22782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22783 int8_tArray ret_arr = init_int8_tArray(32);
22784 memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
22788 void __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
22789 LDKOpenChannel this_ptr_conv;
22790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22791 this_ptr_conv.is_owned = false;
22792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22793 LDKThirtyTwoBytes val_ref;
22794 CHECK(val->arr_len == 32);
22795 memcpy(val_ref.data, val->elems, 32);
22796 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22799 int64_t __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
22800 LDKOpenChannel this_ptr_conv;
22801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22802 this_ptr_conv.is_owned = false;
22803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22804 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
22808 void __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
22809 LDKOpenChannel this_ptr_conv;
22810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22811 this_ptr_conv.is_owned = false;
22812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22813 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
22816 int64_t __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
22817 LDKOpenChannel this_ptr_conv;
22818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22819 this_ptr_conv.is_owned = false;
22820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22821 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
22825 void __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
22826 LDKOpenChannel this_ptr_conv;
22827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22828 this_ptr_conv.is_owned = false;
22829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22830 OpenChannel_set_push_msat(&this_ptr_conv, val);
22833 int64_t __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
22834 LDKOpenChannel this_ptr_conv;
22835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22836 this_ptr_conv.is_owned = false;
22837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22838 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
22842 void __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
22843 LDKOpenChannel this_ptr_conv;
22844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22845 this_ptr_conv.is_owned = false;
22846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22847 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22850 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) {
22851 LDKOpenChannel this_ptr_conv;
22852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22853 this_ptr_conv.is_owned = false;
22854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22855 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22859 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) {
22860 LDKOpenChannel this_ptr_conv;
22861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22862 this_ptr_conv.is_owned = false;
22863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22864 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22867 int64_t __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
22868 LDKOpenChannel this_ptr_conv;
22869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22870 this_ptr_conv.is_owned = false;
22871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22872 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
22876 void __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
22877 LDKOpenChannel this_ptr_conv;
22878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22879 this_ptr_conv.is_owned = false;
22880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22881 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
22884 int64_t __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
22885 LDKOpenChannel this_ptr_conv;
22886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22887 this_ptr_conv.is_owned = false;
22888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22889 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
22893 void __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
22894 LDKOpenChannel this_ptr_conv;
22895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22896 this_ptr_conv.is_owned = false;
22897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22898 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
22901 int32_t __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
22902 LDKOpenChannel this_ptr_conv;
22903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22904 this_ptr_conv.is_owned = false;
22905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22906 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
22910 void __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
22911 LDKOpenChannel this_ptr_conv;
22912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22913 this_ptr_conv.is_owned = false;
22914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22915 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
22918 int16_t __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
22919 LDKOpenChannel this_ptr_conv;
22920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22921 this_ptr_conv.is_owned = false;
22922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22923 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
22927 void __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
22928 LDKOpenChannel this_ptr_conv;
22929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22930 this_ptr_conv.is_owned = false;
22931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22932 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
22935 int16_t __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
22936 LDKOpenChannel this_ptr_conv;
22937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22938 this_ptr_conv.is_owned = false;
22939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22940 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
22944 void __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
22945 LDKOpenChannel this_ptr_conv;
22946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22947 this_ptr_conv.is_owned = false;
22948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22949 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
22952 int8_tArray __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
22953 LDKOpenChannel this_ptr_conv;
22954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22955 this_ptr_conv.is_owned = false;
22956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22957 int8_tArray ret_arr = init_int8_tArray(33);
22958 memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
22962 void __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
22963 LDKOpenChannel this_ptr_conv;
22964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22965 this_ptr_conv.is_owned = false;
22966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22967 LDKPublicKey val_ref;
22968 CHECK(val->arr_len == 33);
22969 memcpy(val_ref.compressed_form, val->elems, 33);
22970 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
22973 int8_tArray __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
22974 LDKOpenChannel this_ptr_conv;
22975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22976 this_ptr_conv.is_owned = false;
22977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22978 int8_tArray ret_arr = init_int8_tArray(33);
22979 memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
22983 void __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
22984 LDKOpenChannel this_ptr_conv;
22985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22986 this_ptr_conv.is_owned = false;
22987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22988 LDKPublicKey val_ref;
22989 CHECK(val->arr_len == 33);
22990 memcpy(val_ref.compressed_form, val->elems, 33);
22991 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
22994 int8_tArray __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
22995 LDKOpenChannel this_ptr_conv;
22996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22997 this_ptr_conv.is_owned = false;
22998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22999 int8_tArray ret_arr = init_int8_tArray(33);
23000 memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
23004 void __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
23005 LDKOpenChannel this_ptr_conv;
23006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23007 this_ptr_conv.is_owned = false;
23008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23009 LDKPublicKey val_ref;
23010 CHECK(val->arr_len == 33);
23011 memcpy(val_ref.compressed_form, val->elems, 33);
23012 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
23015 int8_tArray __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
23016 LDKOpenChannel this_ptr_conv;
23017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23018 this_ptr_conv.is_owned = false;
23019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23020 int8_tArray ret_arr = init_int8_tArray(33);
23021 memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
23025 void __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
23026 LDKOpenChannel this_ptr_conv;
23027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23028 this_ptr_conv.is_owned = false;
23029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23030 LDKPublicKey val_ref;
23031 CHECK(val->arr_len == 33);
23032 memcpy(val_ref.compressed_form, val->elems, 33);
23033 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
23036 int8_tArray __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
23037 LDKOpenChannel this_ptr_conv;
23038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23039 this_ptr_conv.is_owned = false;
23040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23041 int8_tArray ret_arr = init_int8_tArray(33);
23042 memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
23046 void __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
23047 LDKOpenChannel this_ptr_conv;
23048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23049 this_ptr_conv.is_owned = false;
23050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23051 LDKPublicKey val_ref;
23052 CHECK(val->arr_len == 33);
23053 memcpy(val_ref.compressed_form, val->elems, 33);
23054 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
23057 int8_tArray __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
23058 LDKOpenChannel this_ptr_conv;
23059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23060 this_ptr_conv.is_owned = false;
23061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23062 int8_tArray ret_arr = init_int8_tArray(33);
23063 memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23067 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) {
23068 LDKOpenChannel this_ptr_conv;
23069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23070 this_ptr_conv.is_owned = false;
23071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23072 LDKPublicKey val_ref;
23073 CHECK(val->arr_len == 33);
23074 memcpy(val_ref.compressed_form, val->elems, 33);
23075 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
23078 int8_t __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
23079 LDKOpenChannel this_ptr_conv;
23080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23081 this_ptr_conv.is_owned = false;
23082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23083 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
23087 void __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
23088 LDKOpenChannel this_ptr_conv;
23089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23090 this_ptr_conv.is_owned = false;
23091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23092 OpenChannel_set_channel_flags(&this_ptr_conv, val);
23095 uint32_t __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) {
23096 LDKOpenChannel this_ptr_conv;
23097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23098 this_ptr_conv.is_owned = false;
23099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23100 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
23101 uint64_t ret_ref = 0;
23102 if ((uint64_t)ret_var.inner > 4096) {
23103 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23104 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23105 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23106 ret_ref = (uint64_t)ret_var.inner;
23107 if (ret_var.is_owned) {
23114 void __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
23115 LDKOpenChannel this_ptr_conv;
23116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23117 this_ptr_conv.is_owned = false;
23118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23119 LDKChannelTypeFeatures val_conv;
23120 val_conv.inner = (void*)(val & (~1));
23121 val_conv.is_owned = (val & 1) || (val == 0);
23122 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23123 val_conv = ChannelTypeFeatures_clone(&val_conv);
23124 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
23127 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
23128 LDKOpenChannel ret_var = OpenChannel_clone(arg);
23129 uint64_t ret_ref = 0;
23130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23133 ret_ref = (uint64_t)ret_var.inner;
23134 if (ret_var.is_owned) {
23139 int64_t __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
23140 LDKOpenChannel arg_conv;
23141 arg_conv.inner = (void*)(arg & (~1));
23142 arg_conv.is_owned = false;
23143 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23144 int64_t ret_val = OpenChannel_clone_ptr(&arg_conv);
23148 uint32_t __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint32_t orig) {
23149 LDKOpenChannel orig_conv;
23150 orig_conv.inner = (void*)(orig & (~1));
23151 orig_conv.is_owned = false;
23152 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23153 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
23154 uint64_t ret_ref = 0;
23155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23157 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23158 ret_ref = (uint64_t)ret_var.inner;
23159 if (ret_var.is_owned) {
23165 void __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint32_t this_obj) {
23166 LDKAcceptChannel this_obj_conv;
23167 this_obj_conv.inner = (void*)(this_obj & (~1));
23168 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23170 AcceptChannel_free(this_obj_conv);
23173 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
23174 LDKAcceptChannel this_ptr_conv;
23175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23176 this_ptr_conv.is_owned = false;
23177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23178 int8_tArray ret_arr = init_int8_tArray(32);
23179 memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
23183 void __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
23184 LDKAcceptChannel this_ptr_conv;
23185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23186 this_ptr_conv.is_owned = false;
23187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23188 LDKThirtyTwoBytes val_ref;
23189 CHECK(val->arr_len == 32);
23190 memcpy(val_ref.data, val->elems, 32);
23191 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
23194 int64_t __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
23195 LDKAcceptChannel this_ptr_conv;
23196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23197 this_ptr_conv.is_owned = false;
23198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23199 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
23203 void __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
23204 LDKAcceptChannel this_ptr_conv;
23205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23206 this_ptr_conv.is_owned = false;
23207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23208 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
23211 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) {
23212 LDKAcceptChannel this_ptr_conv;
23213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23214 this_ptr_conv.is_owned = false;
23215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23216 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
23220 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) {
23221 LDKAcceptChannel this_ptr_conv;
23222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23223 this_ptr_conv.is_owned = false;
23224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23225 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23228 int64_t __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
23229 LDKAcceptChannel this_ptr_conv;
23230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23231 this_ptr_conv.is_owned = false;
23232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23233 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
23237 void __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
23238 LDKAcceptChannel this_ptr_conv;
23239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23240 this_ptr_conv.is_owned = false;
23241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23242 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
23245 int64_t __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
23246 LDKAcceptChannel this_ptr_conv;
23247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23248 this_ptr_conv.is_owned = false;
23249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23250 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
23254 void __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
23255 LDKAcceptChannel this_ptr_conv;
23256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23257 this_ptr_conv.is_owned = false;
23258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23259 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
23262 int32_t __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
23263 LDKAcceptChannel this_ptr_conv;
23264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23265 this_ptr_conv.is_owned = false;
23266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23267 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
23271 void __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
23272 LDKAcceptChannel this_ptr_conv;
23273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23274 this_ptr_conv.is_owned = false;
23275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23276 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
23279 int16_t __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
23280 LDKAcceptChannel this_ptr_conv;
23281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23282 this_ptr_conv.is_owned = false;
23283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23284 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
23288 void __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
23289 LDKAcceptChannel this_ptr_conv;
23290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23291 this_ptr_conv.is_owned = false;
23292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23293 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
23296 int16_t __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
23297 LDKAcceptChannel this_ptr_conv;
23298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23299 this_ptr_conv.is_owned = false;
23300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23301 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
23305 void __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
23306 LDKAcceptChannel this_ptr_conv;
23307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23308 this_ptr_conv.is_owned = false;
23309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23310 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
23313 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
23314 LDKAcceptChannel this_ptr_conv;
23315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23316 this_ptr_conv.is_owned = false;
23317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23318 int8_tArray ret_arr = init_int8_tArray(33);
23319 memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
23323 void __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
23324 LDKAcceptChannel this_ptr_conv;
23325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23326 this_ptr_conv.is_owned = false;
23327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23328 LDKPublicKey val_ref;
23329 CHECK(val->arr_len == 33);
23330 memcpy(val_ref.compressed_form, val->elems, 33);
23331 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
23334 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
23335 LDKAcceptChannel this_ptr_conv;
23336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23337 this_ptr_conv.is_owned = false;
23338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23339 int8_tArray ret_arr = init_int8_tArray(33);
23340 memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
23344 void __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
23345 LDKAcceptChannel this_ptr_conv;
23346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23347 this_ptr_conv.is_owned = false;
23348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23349 LDKPublicKey val_ref;
23350 CHECK(val->arr_len == 33);
23351 memcpy(val_ref.compressed_form, val->elems, 33);
23352 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
23355 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
23356 LDKAcceptChannel this_ptr_conv;
23357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23358 this_ptr_conv.is_owned = false;
23359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23360 int8_tArray ret_arr = init_int8_tArray(33);
23361 memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
23365 void __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
23366 LDKAcceptChannel this_ptr_conv;
23367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23368 this_ptr_conv.is_owned = false;
23369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23370 LDKPublicKey val_ref;
23371 CHECK(val->arr_len == 33);
23372 memcpy(val_ref.compressed_form, val->elems, 33);
23373 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
23376 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
23377 LDKAcceptChannel this_ptr_conv;
23378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23379 this_ptr_conv.is_owned = false;
23380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23381 int8_tArray ret_arr = init_int8_tArray(33);
23382 memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
23386 void __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
23387 LDKAcceptChannel this_ptr_conv;
23388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23389 this_ptr_conv.is_owned = false;
23390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23391 LDKPublicKey val_ref;
23392 CHECK(val->arr_len == 33);
23393 memcpy(val_ref.compressed_form, val->elems, 33);
23394 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
23397 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
23398 LDKAcceptChannel this_ptr_conv;
23399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23400 this_ptr_conv.is_owned = false;
23401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23402 int8_tArray ret_arr = init_int8_tArray(33);
23403 memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
23407 void __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
23408 LDKAcceptChannel this_ptr_conv;
23409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23410 this_ptr_conv.is_owned = false;
23411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23412 LDKPublicKey val_ref;
23413 CHECK(val->arr_len == 33);
23414 memcpy(val_ref.compressed_form, val->elems, 33);
23415 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
23418 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
23419 LDKAcceptChannel this_ptr_conv;
23420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23421 this_ptr_conv.is_owned = false;
23422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23423 int8_tArray ret_arr = init_int8_tArray(33);
23424 memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23428 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) {
23429 LDKAcceptChannel this_ptr_conv;
23430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23431 this_ptr_conv.is_owned = false;
23432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23433 LDKPublicKey val_ref;
23434 CHECK(val->arr_len == 33);
23435 memcpy(val_ref.compressed_form, val->elems, 33);
23436 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
23439 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
23440 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
23441 uint64_t ret_ref = 0;
23442 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23443 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23444 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23445 ret_ref = (uint64_t)ret_var.inner;
23446 if (ret_var.is_owned) {
23451 int64_t __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
23452 LDKAcceptChannel arg_conv;
23453 arg_conv.inner = (void*)(arg & (~1));
23454 arg_conv.is_owned = false;
23455 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23456 int64_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
23460 uint32_t __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint32_t orig) {
23461 LDKAcceptChannel orig_conv;
23462 orig_conv.inner = (void*)(orig & (~1));
23463 orig_conv.is_owned = false;
23464 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23465 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
23466 uint64_t ret_ref = 0;
23467 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23468 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23469 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23470 ret_ref = (uint64_t)ret_var.inner;
23471 if (ret_var.is_owned) {
23477 void __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint32_t this_obj) {
23478 LDKFundingCreated this_obj_conv;
23479 this_obj_conv.inner = (void*)(this_obj & (~1));
23480 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23482 FundingCreated_free(this_obj_conv);
23485 int8_tArray __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
23486 LDKFundingCreated this_ptr_conv;
23487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23488 this_ptr_conv.is_owned = false;
23489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23490 int8_tArray ret_arr = init_int8_tArray(32);
23491 memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
23495 void __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
23496 LDKFundingCreated this_ptr_conv;
23497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23498 this_ptr_conv.is_owned = false;
23499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23500 LDKThirtyTwoBytes val_ref;
23501 CHECK(val->arr_len == 32);
23502 memcpy(val_ref.data, val->elems, 32);
23503 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
23506 int8_tArray __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
23507 LDKFundingCreated this_ptr_conv;
23508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23509 this_ptr_conv.is_owned = false;
23510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23511 int8_tArray ret_arr = init_int8_tArray(32);
23512 memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
23516 void __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
23517 LDKFundingCreated this_ptr_conv;
23518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23519 this_ptr_conv.is_owned = false;
23520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23521 LDKThirtyTwoBytes val_ref;
23522 CHECK(val->arr_len == 32);
23523 memcpy(val_ref.data, val->elems, 32);
23524 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
23527 int16_t __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
23528 LDKFundingCreated this_ptr_conv;
23529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23530 this_ptr_conv.is_owned = false;
23531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23532 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
23536 void __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
23537 LDKFundingCreated this_ptr_conv;
23538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23539 this_ptr_conv.is_owned = false;
23540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23541 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
23544 int8_tArray __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
23545 LDKFundingCreated this_ptr_conv;
23546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23547 this_ptr_conv.is_owned = false;
23548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23549 int8_tArray ret_arr = init_int8_tArray(64);
23550 memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
23554 void __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
23555 LDKFundingCreated this_ptr_conv;
23556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23557 this_ptr_conv.is_owned = false;
23558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23559 LDKSignature val_ref;
23560 CHECK(val->arr_len == 64);
23561 memcpy(val_ref.compact_form, val->elems, 64);
23562 FundingCreated_set_signature(&this_ptr_conv, val_ref);
23565 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) {
23566 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
23567 CHECK(temporary_channel_id_arg->arr_len == 32);
23568 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32);
23569 LDKThirtyTwoBytes funding_txid_arg_ref;
23570 CHECK(funding_txid_arg->arr_len == 32);
23571 memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32);
23572 LDKSignature signature_arg_ref;
23573 CHECK(signature_arg->arr_len == 64);
23574 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
23575 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
23576 uint64_t ret_ref = 0;
23577 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23578 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23580 ret_ref = (uint64_t)ret_var.inner;
23581 if (ret_var.is_owned) {
23587 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
23588 LDKFundingCreated ret_var = FundingCreated_clone(arg);
23589 uint64_t ret_ref = 0;
23590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23593 ret_ref = (uint64_t)ret_var.inner;
23594 if (ret_var.is_owned) {
23599 int64_t __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
23600 LDKFundingCreated arg_conv;
23601 arg_conv.inner = (void*)(arg & (~1));
23602 arg_conv.is_owned = false;
23603 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23604 int64_t ret_val = FundingCreated_clone_ptr(&arg_conv);
23608 uint32_t __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint32_t orig) {
23609 LDKFundingCreated orig_conv;
23610 orig_conv.inner = (void*)(orig & (~1));
23611 orig_conv.is_owned = false;
23612 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23613 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
23614 uint64_t ret_ref = 0;
23615 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23616 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23618 ret_ref = (uint64_t)ret_var.inner;
23619 if (ret_var.is_owned) {
23625 void __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint32_t this_obj) {
23626 LDKFundingSigned this_obj_conv;
23627 this_obj_conv.inner = (void*)(this_obj & (~1));
23628 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23630 FundingSigned_free(this_obj_conv);
23633 int8_tArray __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
23634 LDKFundingSigned this_ptr_conv;
23635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23636 this_ptr_conv.is_owned = false;
23637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23638 int8_tArray ret_arr = init_int8_tArray(32);
23639 memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
23643 void __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23644 LDKFundingSigned this_ptr_conv;
23645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23646 this_ptr_conv.is_owned = false;
23647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23648 LDKThirtyTwoBytes val_ref;
23649 CHECK(val->arr_len == 32);
23650 memcpy(val_ref.data, val->elems, 32);
23651 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
23654 int8_tArray __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
23655 LDKFundingSigned this_ptr_conv;
23656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23657 this_ptr_conv.is_owned = false;
23658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23659 int8_tArray ret_arr = init_int8_tArray(64);
23660 memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
23664 void __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
23665 LDKFundingSigned this_ptr_conv;
23666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23667 this_ptr_conv.is_owned = false;
23668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23669 LDKSignature val_ref;
23670 CHECK(val->arr_len == 64);
23671 memcpy(val_ref.compact_form, val->elems, 64);
23672 FundingSigned_set_signature(&this_ptr_conv, val_ref);
23675 uint32_t __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
23676 LDKThirtyTwoBytes channel_id_arg_ref;
23677 CHECK(channel_id_arg->arr_len == 32);
23678 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23679 LDKSignature signature_arg_ref;
23680 CHECK(signature_arg->arr_len == 64);
23681 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
23682 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
23683 uint64_t ret_ref = 0;
23684 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23685 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23686 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23687 ret_ref = (uint64_t)ret_var.inner;
23688 if (ret_var.is_owned) {
23694 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
23695 LDKFundingSigned ret_var = FundingSigned_clone(arg);
23696 uint64_t ret_ref = 0;
23697 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23698 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23700 ret_ref = (uint64_t)ret_var.inner;
23701 if (ret_var.is_owned) {
23706 int64_t __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
23707 LDKFundingSigned arg_conv;
23708 arg_conv.inner = (void*)(arg & (~1));
23709 arg_conv.is_owned = false;
23710 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23711 int64_t ret_val = FundingSigned_clone_ptr(&arg_conv);
23715 uint32_t __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint32_t orig) {
23716 LDKFundingSigned orig_conv;
23717 orig_conv.inner = (void*)(orig & (~1));
23718 orig_conv.is_owned = false;
23719 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23720 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
23721 uint64_t ret_ref = 0;
23722 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23723 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23725 ret_ref = (uint64_t)ret_var.inner;
23726 if (ret_var.is_owned) {
23732 void __attribute__((export_name("TS_FundingLocked_free"))) TS_FundingLocked_free(uint32_t this_obj) {
23733 LDKFundingLocked this_obj_conv;
23734 this_obj_conv.inner = (void*)(this_obj & (~1));
23735 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23737 FundingLocked_free(this_obj_conv);
23740 int8_tArray __attribute__((export_name("TS_FundingLocked_get_channel_id"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
23741 LDKFundingLocked this_ptr_conv;
23742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23743 this_ptr_conv.is_owned = false;
23744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23745 int8_tArray ret_arr = init_int8_tArray(32);
23746 memcpy(ret_arr->elems, *FundingLocked_get_channel_id(&this_ptr_conv), 32);
23750 void __attribute__((export_name("TS_FundingLocked_set_channel_id"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23751 LDKFundingLocked this_ptr_conv;
23752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23753 this_ptr_conv.is_owned = false;
23754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23755 LDKThirtyTwoBytes val_ref;
23756 CHECK(val->arr_len == 32);
23757 memcpy(val_ref.data, val->elems, 32);
23758 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
23761 int8_tArray __attribute__((export_name("TS_FundingLocked_get_next_per_commitment_point"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
23762 LDKFundingLocked this_ptr_conv;
23763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23764 this_ptr_conv.is_owned = false;
23765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23766 int8_tArray ret_arr = init_int8_tArray(33);
23767 memcpy(ret_arr->elems, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23771 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) {
23772 LDKFundingLocked this_ptr_conv;
23773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23774 this_ptr_conv.is_owned = false;
23775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23776 LDKPublicKey val_ref;
23777 CHECK(val->arr_len == 33);
23778 memcpy(val_ref.compressed_form, val->elems, 33);
23779 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
23782 uint32_t __attribute__((export_name("TS_FundingLocked_new"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
23783 LDKThirtyTwoBytes channel_id_arg_ref;
23784 CHECK(channel_id_arg->arr_len == 32);
23785 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23786 LDKPublicKey next_per_commitment_point_arg_ref;
23787 CHECK(next_per_commitment_point_arg->arr_len == 33);
23788 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33);
23789 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
23790 uint64_t ret_ref = 0;
23791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23794 ret_ref = (uint64_t)ret_var.inner;
23795 if (ret_var.is_owned) {
23801 static inline uintptr_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
23802 LDKFundingLocked ret_var = FundingLocked_clone(arg);
23803 uint64_t ret_ref = 0;
23804 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23805 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23807 ret_ref = (uint64_t)ret_var.inner;
23808 if (ret_var.is_owned) {
23813 int64_t __attribute__((export_name("TS_FundingLocked_clone_ptr"))) TS_FundingLocked_clone_ptr(uint32_t arg) {
23814 LDKFundingLocked arg_conv;
23815 arg_conv.inner = (void*)(arg & (~1));
23816 arg_conv.is_owned = false;
23817 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23818 int64_t ret_val = FundingLocked_clone_ptr(&arg_conv);
23822 uint32_t __attribute__((export_name("TS_FundingLocked_clone"))) TS_FundingLocked_clone(uint32_t orig) {
23823 LDKFundingLocked orig_conv;
23824 orig_conv.inner = (void*)(orig & (~1));
23825 orig_conv.is_owned = false;
23826 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23827 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
23828 uint64_t ret_ref = 0;
23829 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23830 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23832 ret_ref = (uint64_t)ret_var.inner;
23833 if (ret_var.is_owned) {
23839 void __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint32_t this_obj) {
23840 LDKShutdown this_obj_conv;
23841 this_obj_conv.inner = (void*)(this_obj & (~1));
23842 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23844 Shutdown_free(this_obj_conv);
23847 int8_tArray __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
23848 LDKShutdown this_ptr_conv;
23849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23850 this_ptr_conv.is_owned = false;
23851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23852 int8_tArray ret_arr = init_int8_tArray(32);
23853 memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
23857 void __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23858 LDKShutdown this_ptr_conv;
23859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23860 this_ptr_conv.is_owned = false;
23861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23862 LDKThirtyTwoBytes val_ref;
23863 CHECK(val->arr_len == 32);
23864 memcpy(val_ref.data, val->elems, 32);
23865 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
23868 int8_tArray __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
23869 LDKShutdown this_ptr_conv;
23870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23871 this_ptr_conv.is_owned = false;
23872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23873 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
23874 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
23875 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23879 void __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
23880 LDKShutdown this_ptr_conv;
23881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23882 this_ptr_conv.is_owned = false;
23883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23884 LDKCVec_u8Z val_ref;
23885 val_ref.datalen = val->arr_len;
23886 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23887 memcpy(val_ref.data, val->elems, val_ref.datalen);
23888 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
23891 uint32_t __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
23892 LDKThirtyTwoBytes channel_id_arg_ref;
23893 CHECK(channel_id_arg->arr_len == 32);
23894 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23895 LDKCVec_u8Z scriptpubkey_arg_ref;
23896 scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
23897 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23898 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen);
23899 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
23900 uint64_t ret_ref = 0;
23901 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23902 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23904 ret_ref = (uint64_t)ret_var.inner;
23905 if (ret_var.is_owned) {
23911 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
23912 LDKShutdown ret_var = Shutdown_clone(arg);
23913 uint64_t ret_ref = 0;
23914 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23915 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23916 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23917 ret_ref = (uint64_t)ret_var.inner;
23918 if (ret_var.is_owned) {
23923 int64_t __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint32_t arg) {
23924 LDKShutdown arg_conv;
23925 arg_conv.inner = (void*)(arg & (~1));
23926 arg_conv.is_owned = false;
23927 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23928 int64_t ret_val = Shutdown_clone_ptr(&arg_conv);
23932 uint32_t __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint32_t orig) {
23933 LDKShutdown orig_conv;
23934 orig_conv.inner = (void*)(orig & (~1));
23935 orig_conv.is_owned = false;
23936 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23937 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
23938 uint64_t ret_ref = 0;
23939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23941 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23942 ret_ref = (uint64_t)ret_var.inner;
23943 if (ret_var.is_owned) {
23949 void __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
23950 LDKClosingSignedFeeRange this_obj_conv;
23951 this_obj_conv.inner = (void*)(this_obj & (~1));
23952 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23954 ClosingSignedFeeRange_free(this_obj_conv);
23957 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
23958 LDKClosingSignedFeeRange this_ptr_conv;
23959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23960 this_ptr_conv.is_owned = false;
23961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23962 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
23966 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
23967 LDKClosingSignedFeeRange this_ptr_conv;
23968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23969 this_ptr_conv.is_owned = false;
23970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23971 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
23974 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
23975 LDKClosingSignedFeeRange this_ptr_conv;
23976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23977 this_ptr_conv.is_owned = false;
23978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23979 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
23983 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
23984 LDKClosingSignedFeeRange this_ptr_conv;
23985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23986 this_ptr_conv.is_owned = false;
23987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23988 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
23991 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
23992 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
23993 uint64_t ret_ref = 0;
23994 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23995 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23996 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23997 ret_ref = (uint64_t)ret_var.inner;
23998 if (ret_var.is_owned) {
24004 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
24005 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
24006 uint64_t ret_ref = 0;
24007 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24008 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24010 ret_ref = (uint64_t)ret_var.inner;
24011 if (ret_var.is_owned) {
24016 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
24017 LDKClosingSignedFeeRange arg_conv;
24018 arg_conv.inner = (void*)(arg & (~1));
24019 arg_conv.is_owned = false;
24020 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24021 int64_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
24025 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
24026 LDKClosingSignedFeeRange orig_conv;
24027 orig_conv.inner = (void*)(orig & (~1));
24028 orig_conv.is_owned = false;
24029 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24030 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
24031 uint64_t ret_ref = 0;
24032 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24033 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24035 ret_ref = (uint64_t)ret_var.inner;
24036 if (ret_var.is_owned) {
24042 void __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint32_t this_obj) {
24043 LDKClosingSigned this_obj_conv;
24044 this_obj_conv.inner = (void*)(this_obj & (~1));
24045 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24047 ClosingSigned_free(this_obj_conv);
24050 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
24051 LDKClosingSigned this_ptr_conv;
24052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24053 this_ptr_conv.is_owned = false;
24054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24055 int8_tArray ret_arr = init_int8_tArray(32);
24056 memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
24060 void __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24061 LDKClosingSigned this_ptr_conv;
24062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24063 this_ptr_conv.is_owned = false;
24064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24065 LDKThirtyTwoBytes val_ref;
24066 CHECK(val->arr_len == 32);
24067 memcpy(val_ref.data, val->elems, 32);
24068 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
24071 int64_t __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
24072 LDKClosingSigned this_ptr_conv;
24073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24074 this_ptr_conv.is_owned = false;
24075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24076 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
24080 void __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
24081 LDKClosingSigned this_ptr_conv;
24082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24083 this_ptr_conv.is_owned = false;
24084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24085 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
24088 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
24089 LDKClosingSigned this_ptr_conv;
24090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24091 this_ptr_conv.is_owned = false;
24092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24093 int8_tArray ret_arr = init_int8_tArray(64);
24094 memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
24098 void __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
24099 LDKClosingSigned this_ptr_conv;
24100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24101 this_ptr_conv.is_owned = false;
24102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24103 LDKSignature val_ref;
24104 CHECK(val->arr_len == 64);
24105 memcpy(val_ref.compact_form, val->elems, 64);
24106 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
24109 uint32_t __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
24110 LDKClosingSigned this_ptr_conv;
24111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24112 this_ptr_conv.is_owned = false;
24113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24114 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
24115 uint64_t ret_ref = 0;
24116 if ((uint64_t)ret_var.inner > 4096) {
24117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24120 ret_ref = (uint64_t)ret_var.inner;
24121 if (ret_var.is_owned) {
24128 void __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
24129 LDKClosingSigned this_ptr_conv;
24130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24131 this_ptr_conv.is_owned = false;
24132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24133 LDKClosingSignedFeeRange val_conv;
24134 val_conv.inner = (void*)(val & (~1));
24135 val_conv.is_owned = (val & 1) || (val == 0);
24136 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24137 val_conv = ClosingSignedFeeRange_clone(&val_conv);
24138 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
24141 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) {
24142 LDKThirtyTwoBytes channel_id_arg_ref;
24143 CHECK(channel_id_arg->arr_len == 32);
24144 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24145 LDKSignature signature_arg_ref;
24146 CHECK(signature_arg->arr_len == 64);
24147 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
24148 LDKClosingSignedFeeRange fee_range_arg_conv;
24149 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
24150 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
24151 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
24152 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
24153 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
24154 uint64_t ret_ref = 0;
24155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24157 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24158 ret_ref = (uint64_t)ret_var.inner;
24159 if (ret_var.is_owned) {
24165 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
24166 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
24167 uint64_t ret_ref = 0;
24168 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24169 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24171 ret_ref = (uint64_t)ret_var.inner;
24172 if (ret_var.is_owned) {
24177 int64_t __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
24178 LDKClosingSigned arg_conv;
24179 arg_conv.inner = (void*)(arg & (~1));
24180 arg_conv.is_owned = false;
24181 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24182 int64_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
24186 uint32_t __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint32_t orig) {
24187 LDKClosingSigned orig_conv;
24188 orig_conv.inner = (void*)(orig & (~1));
24189 orig_conv.is_owned = false;
24190 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24191 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
24192 uint64_t ret_ref = 0;
24193 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24194 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24195 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24196 ret_ref = (uint64_t)ret_var.inner;
24197 if (ret_var.is_owned) {
24203 void __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
24204 LDKUpdateAddHTLC this_obj_conv;
24205 this_obj_conv.inner = (void*)(this_obj & (~1));
24206 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24208 UpdateAddHTLC_free(this_obj_conv);
24211 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
24212 LDKUpdateAddHTLC this_ptr_conv;
24213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24214 this_ptr_conv.is_owned = false;
24215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24216 int8_tArray ret_arr = init_int8_tArray(32);
24217 memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
24221 void __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24222 LDKUpdateAddHTLC this_ptr_conv;
24223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24224 this_ptr_conv.is_owned = false;
24225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24226 LDKThirtyTwoBytes val_ref;
24227 CHECK(val->arr_len == 32);
24228 memcpy(val_ref.data, val->elems, 32);
24229 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
24232 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
24233 LDKUpdateAddHTLC this_ptr_conv;
24234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24235 this_ptr_conv.is_owned = false;
24236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24237 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
24241 void __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24242 LDKUpdateAddHTLC this_ptr_conv;
24243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24244 this_ptr_conv.is_owned = false;
24245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24246 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
24249 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
24250 LDKUpdateAddHTLC this_ptr_conv;
24251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24252 this_ptr_conv.is_owned = false;
24253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24254 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
24258 void __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
24259 LDKUpdateAddHTLC this_ptr_conv;
24260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24261 this_ptr_conv.is_owned = false;
24262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24263 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
24266 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
24267 LDKUpdateAddHTLC this_ptr_conv;
24268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24269 this_ptr_conv.is_owned = false;
24270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24271 int8_tArray ret_arr = init_int8_tArray(32);
24272 memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
24276 void __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
24277 LDKUpdateAddHTLC this_ptr_conv;
24278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24279 this_ptr_conv.is_owned = false;
24280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24281 LDKThirtyTwoBytes val_ref;
24282 CHECK(val->arr_len == 32);
24283 memcpy(val_ref.data, val->elems, 32);
24284 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
24287 int32_t __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
24288 LDKUpdateAddHTLC this_ptr_conv;
24289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24290 this_ptr_conv.is_owned = false;
24291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24292 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
24296 void __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
24297 LDKUpdateAddHTLC this_ptr_conv;
24298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24299 this_ptr_conv.is_owned = false;
24300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24301 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
24304 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
24305 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
24306 uint64_t ret_ref = 0;
24307 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24308 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24310 ret_ref = (uint64_t)ret_var.inner;
24311 if (ret_var.is_owned) {
24316 int64_t __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
24317 LDKUpdateAddHTLC arg_conv;
24318 arg_conv.inner = (void*)(arg & (~1));
24319 arg_conv.is_owned = false;
24320 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24321 int64_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
24325 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
24326 LDKUpdateAddHTLC orig_conv;
24327 orig_conv.inner = (void*)(orig & (~1));
24328 orig_conv.is_owned = false;
24329 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24330 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
24331 uint64_t ret_ref = 0;
24332 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24333 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24335 ret_ref = (uint64_t)ret_var.inner;
24336 if (ret_var.is_owned) {
24342 void __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
24343 LDKUpdateFulfillHTLC this_obj_conv;
24344 this_obj_conv.inner = (void*)(this_obj & (~1));
24345 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24347 UpdateFulfillHTLC_free(this_obj_conv);
24350 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
24351 LDKUpdateFulfillHTLC this_ptr_conv;
24352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24353 this_ptr_conv.is_owned = false;
24354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24355 int8_tArray ret_arr = init_int8_tArray(32);
24356 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
24360 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24361 LDKUpdateFulfillHTLC this_ptr_conv;
24362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24363 this_ptr_conv.is_owned = false;
24364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24365 LDKThirtyTwoBytes val_ref;
24366 CHECK(val->arr_len == 32);
24367 memcpy(val_ref.data, val->elems, 32);
24368 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
24371 int64_t __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
24372 LDKUpdateFulfillHTLC this_ptr_conv;
24373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24374 this_ptr_conv.is_owned = false;
24375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24376 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
24380 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24381 LDKUpdateFulfillHTLC this_ptr_conv;
24382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24383 this_ptr_conv.is_owned = false;
24384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24385 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
24388 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
24389 LDKUpdateFulfillHTLC this_ptr_conv;
24390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24391 this_ptr_conv.is_owned = false;
24392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24393 int8_tArray ret_arr = init_int8_tArray(32);
24394 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
24398 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
24399 LDKUpdateFulfillHTLC this_ptr_conv;
24400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24401 this_ptr_conv.is_owned = false;
24402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24403 LDKThirtyTwoBytes val_ref;
24404 CHECK(val->arr_len == 32);
24405 memcpy(val_ref.data, val->elems, 32);
24406 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
24409 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) {
24410 LDKThirtyTwoBytes channel_id_arg_ref;
24411 CHECK(channel_id_arg->arr_len == 32);
24412 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24413 LDKThirtyTwoBytes payment_preimage_arg_ref;
24414 CHECK(payment_preimage_arg->arr_len == 32);
24415 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32);
24416 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
24417 uint64_t ret_ref = 0;
24418 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24419 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24421 ret_ref = (uint64_t)ret_var.inner;
24422 if (ret_var.is_owned) {
24428 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
24429 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
24430 uint64_t ret_ref = 0;
24431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24433 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24434 ret_ref = (uint64_t)ret_var.inner;
24435 if (ret_var.is_owned) {
24440 int64_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
24441 LDKUpdateFulfillHTLC arg_conv;
24442 arg_conv.inner = (void*)(arg & (~1));
24443 arg_conv.is_owned = false;
24444 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24445 int64_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
24449 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
24450 LDKUpdateFulfillHTLC orig_conv;
24451 orig_conv.inner = (void*)(orig & (~1));
24452 orig_conv.is_owned = false;
24453 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24454 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
24455 uint64_t ret_ref = 0;
24456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24459 ret_ref = (uint64_t)ret_var.inner;
24460 if (ret_var.is_owned) {
24466 void __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
24467 LDKUpdateFailHTLC this_obj_conv;
24468 this_obj_conv.inner = (void*)(this_obj & (~1));
24469 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24471 UpdateFailHTLC_free(this_obj_conv);
24474 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
24475 LDKUpdateFailHTLC this_ptr_conv;
24476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24477 this_ptr_conv.is_owned = false;
24478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24479 int8_tArray ret_arr = init_int8_tArray(32);
24480 memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
24484 void __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24485 LDKUpdateFailHTLC this_ptr_conv;
24486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24487 this_ptr_conv.is_owned = false;
24488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24489 LDKThirtyTwoBytes val_ref;
24490 CHECK(val->arr_len == 32);
24491 memcpy(val_ref.data, val->elems, 32);
24492 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
24495 int64_t __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
24496 LDKUpdateFailHTLC this_ptr_conv;
24497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24498 this_ptr_conv.is_owned = false;
24499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24500 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
24504 void __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24505 LDKUpdateFailHTLC this_ptr_conv;
24506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24507 this_ptr_conv.is_owned = false;
24508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24509 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
24512 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
24513 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
24514 uint64_t ret_ref = 0;
24515 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24516 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24517 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24518 ret_ref = (uint64_t)ret_var.inner;
24519 if (ret_var.is_owned) {
24524 int64_t __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
24525 LDKUpdateFailHTLC arg_conv;
24526 arg_conv.inner = (void*)(arg & (~1));
24527 arg_conv.is_owned = false;
24528 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24529 int64_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
24533 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
24534 LDKUpdateFailHTLC orig_conv;
24535 orig_conv.inner = (void*)(orig & (~1));
24536 orig_conv.is_owned = false;
24537 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24538 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
24539 uint64_t ret_ref = 0;
24540 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24541 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24543 ret_ref = (uint64_t)ret_var.inner;
24544 if (ret_var.is_owned) {
24550 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
24551 LDKUpdateFailMalformedHTLC this_obj_conv;
24552 this_obj_conv.inner = (void*)(this_obj & (~1));
24553 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24555 UpdateFailMalformedHTLC_free(this_obj_conv);
24558 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
24559 LDKUpdateFailMalformedHTLC this_ptr_conv;
24560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24561 this_ptr_conv.is_owned = false;
24562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24563 int8_tArray ret_arr = init_int8_tArray(32);
24564 memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
24568 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24569 LDKUpdateFailMalformedHTLC this_ptr_conv;
24570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24571 this_ptr_conv.is_owned = false;
24572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24573 LDKThirtyTwoBytes val_ref;
24574 CHECK(val->arr_len == 32);
24575 memcpy(val_ref.data, val->elems, 32);
24576 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
24579 int64_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
24580 LDKUpdateFailMalformedHTLC this_ptr_conv;
24581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24582 this_ptr_conv.is_owned = false;
24583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24584 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
24588 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24589 LDKUpdateFailMalformedHTLC this_ptr_conv;
24590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24591 this_ptr_conv.is_owned = false;
24592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24593 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
24596 int16_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
24597 LDKUpdateFailMalformedHTLC this_ptr_conv;
24598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24599 this_ptr_conv.is_owned = false;
24600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24601 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
24605 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
24606 LDKUpdateFailMalformedHTLC this_ptr_conv;
24607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24608 this_ptr_conv.is_owned = false;
24609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24610 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
24613 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
24614 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
24615 uint64_t ret_ref = 0;
24616 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24617 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24618 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24619 ret_ref = (uint64_t)ret_var.inner;
24620 if (ret_var.is_owned) {
24625 int64_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
24626 LDKUpdateFailMalformedHTLC arg_conv;
24627 arg_conv.inner = (void*)(arg & (~1));
24628 arg_conv.is_owned = false;
24629 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24630 int64_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
24634 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
24635 LDKUpdateFailMalformedHTLC orig_conv;
24636 orig_conv.inner = (void*)(orig & (~1));
24637 orig_conv.is_owned = false;
24638 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24639 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
24640 uint64_t ret_ref = 0;
24641 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24642 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24643 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24644 ret_ref = (uint64_t)ret_var.inner;
24645 if (ret_var.is_owned) {
24651 void __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint32_t this_obj) {
24652 LDKCommitmentSigned this_obj_conv;
24653 this_obj_conv.inner = (void*)(this_obj & (~1));
24654 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24656 CommitmentSigned_free(this_obj_conv);
24659 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
24660 LDKCommitmentSigned this_ptr_conv;
24661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24662 this_ptr_conv.is_owned = false;
24663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24664 int8_tArray ret_arr = init_int8_tArray(32);
24665 memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
24669 void __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24670 LDKCommitmentSigned this_ptr_conv;
24671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24672 this_ptr_conv.is_owned = false;
24673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24674 LDKThirtyTwoBytes val_ref;
24675 CHECK(val->arr_len == 32);
24676 memcpy(val_ref.data, val->elems, 32);
24677 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
24680 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
24681 LDKCommitmentSigned this_ptr_conv;
24682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24683 this_ptr_conv.is_owned = false;
24684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24685 int8_tArray ret_arr = init_int8_tArray(64);
24686 memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
24690 void __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
24691 LDKCommitmentSigned this_ptr_conv;
24692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24693 this_ptr_conv.is_owned = false;
24694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24695 LDKSignature val_ref;
24696 CHECK(val->arr_len == 64);
24697 memcpy(val_ref.compact_form, val->elems, 64);
24698 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
24701 void __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
24702 LDKCommitmentSigned this_ptr_conv;
24703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24704 this_ptr_conv.is_owned = false;
24705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24706 LDKCVec_SignatureZ val_constr;
24707 val_constr.datalen = val->arr_len;
24708 if (val_constr.datalen > 0)
24709 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24711 val_constr.data = NULL;
24712 int8_tArray* val_vals = (void*) val->elems;
24713 for (size_t m = 0; m < val_constr.datalen; m++) {
24714 int8_tArray val_conv_12 = val_vals[m];
24715 LDKSignature val_conv_12_ref;
24716 CHECK(val_conv_12->arr_len == 64);
24717 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64);
24718 val_constr.data[m] = val_conv_12_ref;
24720 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
24723 uint32_t __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
24724 LDKThirtyTwoBytes channel_id_arg_ref;
24725 CHECK(channel_id_arg->arr_len == 32);
24726 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24727 LDKSignature signature_arg_ref;
24728 CHECK(signature_arg->arr_len == 64);
24729 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
24730 LDKCVec_SignatureZ htlc_signatures_arg_constr;
24731 htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
24732 if (htlc_signatures_arg_constr.datalen > 0)
24733 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24735 htlc_signatures_arg_constr.data = NULL;
24736 int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
24737 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
24738 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
24739 LDKSignature htlc_signatures_arg_conv_12_ref;
24740 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
24741 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64);
24742 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
24744 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
24745 uint64_t ret_ref = 0;
24746 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24747 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24749 ret_ref = (uint64_t)ret_var.inner;
24750 if (ret_var.is_owned) {
24756 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
24757 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
24758 uint64_t ret_ref = 0;
24759 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24760 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24762 ret_ref = (uint64_t)ret_var.inner;
24763 if (ret_var.is_owned) {
24768 int64_t __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
24769 LDKCommitmentSigned arg_conv;
24770 arg_conv.inner = (void*)(arg & (~1));
24771 arg_conv.is_owned = false;
24772 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24773 int64_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
24777 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint32_t orig) {
24778 LDKCommitmentSigned orig_conv;
24779 orig_conv.inner = (void*)(orig & (~1));
24780 orig_conv.is_owned = false;
24781 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24782 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
24783 uint64_t ret_ref = 0;
24784 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24785 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24786 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24787 ret_ref = (uint64_t)ret_var.inner;
24788 if (ret_var.is_owned) {
24794 void __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint32_t this_obj) {
24795 LDKRevokeAndACK this_obj_conv;
24796 this_obj_conv.inner = (void*)(this_obj & (~1));
24797 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24799 RevokeAndACK_free(this_obj_conv);
24802 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
24803 LDKRevokeAndACK this_ptr_conv;
24804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24805 this_ptr_conv.is_owned = false;
24806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24807 int8_tArray ret_arr = init_int8_tArray(32);
24808 memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
24812 void __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24813 LDKRevokeAndACK this_ptr_conv;
24814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24815 this_ptr_conv.is_owned = false;
24816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24817 LDKThirtyTwoBytes val_ref;
24818 CHECK(val->arr_len == 32);
24819 memcpy(val_ref.data, val->elems, 32);
24820 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
24823 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
24824 LDKRevokeAndACK this_ptr_conv;
24825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24826 this_ptr_conv.is_owned = false;
24827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24828 int8_tArray ret_arr = init_int8_tArray(32);
24829 memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
24833 void __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
24834 LDKRevokeAndACK this_ptr_conv;
24835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24836 this_ptr_conv.is_owned = false;
24837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24838 LDKThirtyTwoBytes val_ref;
24839 CHECK(val->arr_len == 32);
24840 memcpy(val_ref.data, val->elems, 32);
24841 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
24844 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
24845 LDKRevokeAndACK this_ptr_conv;
24846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24847 this_ptr_conv.is_owned = false;
24848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24849 int8_tArray ret_arr = init_int8_tArray(33);
24850 memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24854 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) {
24855 LDKRevokeAndACK this_ptr_conv;
24856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24857 this_ptr_conv.is_owned = false;
24858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24859 LDKPublicKey val_ref;
24860 CHECK(val->arr_len == 33);
24861 memcpy(val_ref.compressed_form, val->elems, 33);
24862 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
24865 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) {
24866 LDKThirtyTwoBytes channel_id_arg_ref;
24867 CHECK(channel_id_arg->arr_len == 32);
24868 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24869 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
24870 CHECK(per_commitment_secret_arg->arr_len == 32);
24871 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32);
24872 LDKPublicKey next_per_commitment_point_arg_ref;
24873 CHECK(next_per_commitment_point_arg->arr_len == 33);
24874 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33);
24875 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
24876 uint64_t ret_ref = 0;
24877 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24878 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24880 ret_ref = (uint64_t)ret_var.inner;
24881 if (ret_var.is_owned) {
24887 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
24888 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
24889 uint64_t ret_ref = 0;
24890 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24891 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24893 ret_ref = (uint64_t)ret_var.inner;
24894 if (ret_var.is_owned) {
24899 int64_t __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
24900 LDKRevokeAndACK arg_conv;
24901 arg_conv.inner = (void*)(arg & (~1));
24902 arg_conv.is_owned = false;
24903 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24904 int64_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
24908 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint32_t orig) {
24909 LDKRevokeAndACK orig_conv;
24910 orig_conv.inner = (void*)(orig & (~1));
24911 orig_conv.is_owned = false;
24912 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24913 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
24914 uint64_t ret_ref = 0;
24915 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24916 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24917 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24918 ret_ref = (uint64_t)ret_var.inner;
24919 if (ret_var.is_owned) {
24925 void __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint32_t this_obj) {
24926 LDKUpdateFee this_obj_conv;
24927 this_obj_conv.inner = (void*)(this_obj & (~1));
24928 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24930 UpdateFee_free(this_obj_conv);
24933 int8_tArray __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
24934 LDKUpdateFee this_ptr_conv;
24935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24936 this_ptr_conv.is_owned = false;
24937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24938 int8_tArray ret_arr = init_int8_tArray(32);
24939 memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
24943 void __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24944 LDKUpdateFee this_ptr_conv;
24945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24946 this_ptr_conv.is_owned = false;
24947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24948 LDKThirtyTwoBytes val_ref;
24949 CHECK(val->arr_len == 32);
24950 memcpy(val_ref.data, val->elems, 32);
24951 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
24954 int32_t __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
24955 LDKUpdateFee this_ptr_conv;
24956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24957 this_ptr_conv.is_owned = false;
24958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24959 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
24963 void __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
24964 LDKUpdateFee this_ptr_conv;
24965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24966 this_ptr_conv.is_owned = false;
24967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24968 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
24971 uint32_t __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
24972 LDKThirtyTwoBytes channel_id_arg_ref;
24973 CHECK(channel_id_arg->arr_len == 32);
24974 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24975 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
24976 uint64_t ret_ref = 0;
24977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24980 ret_ref = (uint64_t)ret_var.inner;
24981 if (ret_var.is_owned) {
24987 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
24988 LDKUpdateFee ret_var = UpdateFee_clone(arg);
24989 uint64_t ret_ref = 0;
24990 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24991 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24992 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24993 ret_ref = (uint64_t)ret_var.inner;
24994 if (ret_var.is_owned) {
24999 int64_t __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
25000 LDKUpdateFee arg_conv;
25001 arg_conv.inner = (void*)(arg & (~1));
25002 arg_conv.is_owned = false;
25003 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25004 int64_t ret_val = UpdateFee_clone_ptr(&arg_conv);
25008 uint32_t __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint32_t orig) {
25009 LDKUpdateFee orig_conv;
25010 orig_conv.inner = (void*)(orig & (~1));
25011 orig_conv.is_owned = false;
25012 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25013 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
25014 uint64_t ret_ref = 0;
25015 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25016 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25017 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25018 ret_ref = (uint64_t)ret_var.inner;
25019 if (ret_var.is_owned) {
25025 void __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint32_t this_obj) {
25026 LDKDataLossProtect this_obj_conv;
25027 this_obj_conv.inner = (void*)(this_obj & (~1));
25028 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25030 DataLossProtect_free(this_obj_conv);
25033 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) {
25034 LDKDataLossProtect this_ptr_conv;
25035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25036 this_ptr_conv.is_owned = false;
25037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25038 int8_tArray ret_arr = init_int8_tArray(32);
25039 memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
25043 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) {
25044 LDKDataLossProtect this_ptr_conv;
25045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25046 this_ptr_conv.is_owned = false;
25047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25048 LDKThirtyTwoBytes val_ref;
25049 CHECK(val->arr_len == 32);
25050 memcpy(val_ref.data, val->elems, 32);
25051 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
25054 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) {
25055 LDKDataLossProtect this_ptr_conv;
25056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25057 this_ptr_conv.is_owned = false;
25058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25059 int8_tArray ret_arr = init_int8_tArray(33);
25060 memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
25064 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) {
25065 LDKDataLossProtect this_ptr_conv;
25066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25067 this_ptr_conv.is_owned = false;
25068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25069 LDKPublicKey val_ref;
25070 CHECK(val->arr_len == 33);
25071 memcpy(val_ref.compressed_form, val->elems, 33);
25072 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
25075 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) {
25076 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
25077 CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
25078 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32);
25079 LDKPublicKey my_current_per_commitment_point_arg_ref;
25080 CHECK(my_current_per_commitment_point_arg->arr_len == 33);
25081 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg->elems, 33);
25082 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
25083 uint64_t ret_ref = 0;
25084 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25085 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25087 ret_ref = (uint64_t)ret_var.inner;
25088 if (ret_var.is_owned) {
25094 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
25095 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
25096 uint64_t ret_ref = 0;
25097 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25098 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25099 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25100 ret_ref = (uint64_t)ret_var.inner;
25101 if (ret_var.is_owned) {
25106 int64_t __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
25107 LDKDataLossProtect arg_conv;
25108 arg_conv.inner = (void*)(arg & (~1));
25109 arg_conv.is_owned = false;
25110 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25111 int64_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
25115 uint32_t __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint32_t orig) {
25116 LDKDataLossProtect orig_conv;
25117 orig_conv.inner = (void*)(orig & (~1));
25118 orig_conv.is_owned = false;
25119 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25120 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
25121 uint64_t ret_ref = 0;
25122 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25123 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25124 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25125 ret_ref = (uint64_t)ret_var.inner;
25126 if (ret_var.is_owned) {
25132 void __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint32_t this_obj) {
25133 LDKChannelReestablish this_obj_conv;
25134 this_obj_conv.inner = (void*)(this_obj & (~1));
25135 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25137 ChannelReestablish_free(this_obj_conv);
25140 int8_tArray __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
25141 LDKChannelReestablish this_ptr_conv;
25142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25143 this_ptr_conv.is_owned = false;
25144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25145 int8_tArray ret_arr = init_int8_tArray(32);
25146 memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
25150 void __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25151 LDKChannelReestablish this_ptr_conv;
25152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25153 this_ptr_conv.is_owned = false;
25154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25155 LDKThirtyTwoBytes val_ref;
25156 CHECK(val->arr_len == 32);
25157 memcpy(val_ref.data, val->elems, 32);
25158 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
25161 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
25162 LDKChannelReestablish this_ptr_conv;
25163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25164 this_ptr_conv.is_owned = false;
25165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25166 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
25170 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) {
25171 LDKChannelReestablish this_ptr_conv;
25172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25173 this_ptr_conv.is_owned = false;
25174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25175 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
25178 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
25179 LDKChannelReestablish this_ptr_conv;
25180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25181 this_ptr_conv.is_owned = false;
25182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25183 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
25187 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) {
25188 LDKChannelReestablish this_ptr_conv;
25189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25190 this_ptr_conv.is_owned = false;
25191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25192 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
25195 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
25196 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
25197 uint64_t ret_ref = 0;
25198 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25199 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25200 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25201 ret_ref = (uint64_t)ret_var.inner;
25202 if (ret_var.is_owned) {
25207 int64_t __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
25208 LDKChannelReestablish arg_conv;
25209 arg_conv.inner = (void*)(arg & (~1));
25210 arg_conv.is_owned = false;
25211 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25212 int64_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
25216 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint32_t orig) {
25217 LDKChannelReestablish orig_conv;
25218 orig_conv.inner = (void*)(orig & (~1));
25219 orig_conv.is_owned = false;
25220 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25221 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
25222 uint64_t ret_ref = 0;
25223 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25224 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25226 ret_ref = (uint64_t)ret_var.inner;
25227 if (ret_var.is_owned) {
25233 void __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
25234 LDKAnnouncementSignatures this_obj_conv;
25235 this_obj_conv.inner = (void*)(this_obj & (~1));
25236 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25238 AnnouncementSignatures_free(this_obj_conv);
25241 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
25242 LDKAnnouncementSignatures this_ptr_conv;
25243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25244 this_ptr_conv.is_owned = false;
25245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25246 int8_tArray ret_arr = init_int8_tArray(32);
25247 memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
25251 void __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25252 LDKAnnouncementSignatures this_ptr_conv;
25253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25254 this_ptr_conv.is_owned = false;
25255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25256 LDKThirtyTwoBytes val_ref;
25257 CHECK(val->arr_len == 32);
25258 memcpy(val_ref.data, val->elems, 32);
25259 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
25262 int64_t __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
25263 LDKAnnouncementSignatures this_ptr_conv;
25264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25265 this_ptr_conv.is_owned = false;
25266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25267 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
25271 void __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25272 LDKAnnouncementSignatures this_ptr_conv;
25273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25274 this_ptr_conv.is_owned = false;
25275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25276 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
25279 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
25280 LDKAnnouncementSignatures this_ptr_conv;
25281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25282 this_ptr_conv.is_owned = false;
25283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25284 int8_tArray ret_arr = init_int8_tArray(64);
25285 memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
25289 void __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
25290 LDKAnnouncementSignatures this_ptr_conv;
25291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25292 this_ptr_conv.is_owned = false;
25293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25294 LDKSignature val_ref;
25295 CHECK(val->arr_len == 64);
25296 memcpy(val_ref.compact_form, val->elems, 64);
25297 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
25300 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
25301 LDKAnnouncementSignatures this_ptr_conv;
25302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25303 this_ptr_conv.is_owned = false;
25304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25305 int8_tArray ret_arr = init_int8_tArray(64);
25306 memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
25310 void __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
25311 LDKAnnouncementSignatures this_ptr_conv;
25312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25313 this_ptr_conv.is_owned = false;
25314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25315 LDKSignature val_ref;
25316 CHECK(val->arr_len == 64);
25317 memcpy(val_ref.compact_form, val->elems, 64);
25318 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
25321 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) {
25322 LDKThirtyTwoBytes channel_id_arg_ref;
25323 CHECK(channel_id_arg->arr_len == 32);
25324 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
25325 LDKSignature node_signature_arg_ref;
25326 CHECK(node_signature_arg->arr_len == 64);
25327 memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64);
25328 LDKSignature bitcoin_signature_arg_ref;
25329 CHECK(bitcoin_signature_arg->arr_len == 64);
25330 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64);
25331 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
25332 uint64_t ret_ref = 0;
25333 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25334 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25335 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25336 ret_ref = (uint64_t)ret_var.inner;
25337 if (ret_var.is_owned) {
25343 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
25344 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
25345 uint64_t ret_ref = 0;
25346 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25347 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25349 ret_ref = (uint64_t)ret_var.inner;
25350 if (ret_var.is_owned) {
25355 int64_t __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
25356 LDKAnnouncementSignatures arg_conv;
25357 arg_conv.inner = (void*)(arg & (~1));
25358 arg_conv.is_owned = false;
25359 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25360 int64_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
25364 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
25365 LDKAnnouncementSignatures orig_conv;
25366 orig_conv.inner = (void*)(orig & (~1));
25367 orig_conv.is_owned = false;
25368 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25369 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
25370 uint64_t ret_ref = 0;
25371 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25372 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25374 ret_ref = (uint64_t)ret_var.inner;
25375 if (ret_var.is_owned) {
25381 void __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint32_t this_ptr) {
25382 if ((this_ptr & 1) != 0) return;
25383 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
25384 CHECK_ACCESS(this_ptr_ptr);
25385 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
25386 FREE((void*)this_ptr);
25387 NetAddress_free(this_ptr_conv);
25390 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
25391 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25392 *ret_copy = NetAddress_clone(arg);
25393 uint64_t ret_ref = (uint64_t)ret_copy;
25396 int64_t __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint32_t arg) {
25397 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
25398 int64_t ret_val = NetAddress_clone_ptr(arg_conv);
25402 uint32_t __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint32_t orig) {
25403 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
25404 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25405 *ret_copy = NetAddress_clone(orig_conv);
25406 uint64_t ret_ref = (uint64_t)ret_copy;
25410 uint32_t __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
25411 LDKFourBytes addr_ref;
25412 CHECK(addr->arr_len == 4);
25413 memcpy(addr_ref.data, addr->elems, 4);
25414 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25415 *ret_copy = NetAddress_ipv4(addr_ref, port);
25416 uint64_t ret_ref = (uint64_t)ret_copy;
25420 uint32_t __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
25421 LDKSixteenBytes addr_ref;
25422 CHECK(addr->arr_len == 16);
25423 memcpy(addr_ref.data, addr->elems, 16);
25424 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25425 *ret_copy = NetAddress_ipv6(addr_ref, port);
25426 uint64_t ret_ref = (uint64_t)ret_copy;
25430 uint32_t __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
25431 LDKTwelveBytes a_ref;
25432 CHECK(a->arr_len == 12);
25433 memcpy(a_ref.data, a->elems, 12);
25434 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25435 *ret_copy = NetAddress_onion_v2(a_ref);
25436 uint64_t ret_ref = (uint64_t)ret_copy;
25440 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) {
25441 LDKThirtyTwoBytes ed25519_pubkey_ref;
25442 CHECK(ed25519_pubkey->arr_len == 32);
25443 memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32);
25444 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25445 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
25446 uint64_t ret_ref = (uint64_t)ret_copy;
25450 int8_tArray __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint32_t obj) {
25451 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
25452 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
25453 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
25454 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25455 CVec_u8Z_free(ret_var);
25459 uint32_t __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
25460 LDKu8slice ser_ref;
25461 ser_ref.datalen = ser->arr_len;
25462 ser_ref.data = ser->elems;
25463 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
25464 *ret_conv = NetAddress_read(ser_ref);
25465 return (uint64_t)ret_conv;
25468 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
25469 LDKUnsignedNodeAnnouncement this_obj_conv;
25470 this_obj_conv.inner = (void*)(this_obj & (~1));
25471 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25473 UnsignedNodeAnnouncement_free(this_obj_conv);
25476 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
25477 LDKUnsignedNodeAnnouncement this_ptr_conv;
25478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25479 this_ptr_conv.is_owned = false;
25480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25481 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
25482 uint64_t ret_ref = 0;
25483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25486 ret_ref = (uint64_t)ret_var.inner;
25487 if (ret_var.is_owned) {
25493 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25494 LDKUnsignedNodeAnnouncement this_ptr_conv;
25495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25496 this_ptr_conv.is_owned = false;
25497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25498 LDKNodeFeatures val_conv;
25499 val_conv.inner = (void*)(val & (~1));
25500 val_conv.is_owned = (val & 1) || (val == 0);
25501 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25502 val_conv = NodeFeatures_clone(&val_conv);
25503 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
25506 int32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
25507 LDKUnsignedNodeAnnouncement this_ptr_conv;
25508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25509 this_ptr_conv.is_owned = false;
25510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25511 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
25515 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
25516 LDKUnsignedNodeAnnouncement this_ptr_conv;
25517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25518 this_ptr_conv.is_owned = false;
25519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25520 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
25523 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
25524 LDKUnsignedNodeAnnouncement this_ptr_conv;
25525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25526 this_ptr_conv.is_owned = false;
25527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25528 int8_tArray ret_arr = init_int8_tArray(33);
25529 memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
25533 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
25534 LDKUnsignedNodeAnnouncement this_ptr_conv;
25535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25536 this_ptr_conv.is_owned = false;
25537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25538 LDKPublicKey val_ref;
25539 CHECK(val->arr_len == 33);
25540 memcpy(val_ref.compressed_form, val->elems, 33);
25541 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
25544 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
25545 LDKUnsignedNodeAnnouncement this_ptr_conv;
25546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25547 this_ptr_conv.is_owned = false;
25548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25549 int8_tArray ret_arr = init_int8_tArray(3);
25550 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
25554 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
25555 LDKUnsignedNodeAnnouncement this_ptr_conv;
25556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25557 this_ptr_conv.is_owned = false;
25558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25559 LDKThreeBytes val_ref;
25560 CHECK(val->arr_len == 3);
25561 memcpy(val_ref.data, val->elems, 3);
25562 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
25565 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
25566 LDKUnsignedNodeAnnouncement this_ptr_conv;
25567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25568 this_ptr_conv.is_owned = false;
25569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25570 int8_tArray ret_arr = init_int8_tArray(32);
25571 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
25575 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
25576 LDKUnsignedNodeAnnouncement this_ptr_conv;
25577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25578 this_ptr_conv.is_owned = false;
25579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25580 LDKThirtyTwoBytes val_ref;
25581 CHECK(val->arr_len == 32);
25582 memcpy(val_ref.data, val->elems, 32);
25583 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
25586 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
25587 LDKUnsignedNodeAnnouncement this_ptr_conv;
25588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25589 this_ptr_conv.is_owned = false;
25590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25591 LDKCVec_NetAddressZ val_constr;
25592 val_constr.datalen = val->arr_len;
25593 if (val_constr.datalen > 0)
25594 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25596 val_constr.data = NULL;
25597 uint32_t* val_vals = val->elems;
25598 for (size_t m = 0; m < val_constr.datalen; m++) {
25599 uint32_t val_conv_12 = val_vals[m];
25600 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
25601 CHECK_ACCESS(val_conv_12_ptr);
25602 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
25603 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
25604 val_constr.data[m] = val_conv_12_conv;
25606 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
25609 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
25610 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
25611 uint64_t ret_ref = 0;
25612 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25613 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25615 ret_ref = (uint64_t)ret_var.inner;
25616 if (ret_var.is_owned) {
25621 int64_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
25622 LDKUnsignedNodeAnnouncement arg_conv;
25623 arg_conv.inner = (void*)(arg & (~1));
25624 arg_conv.is_owned = false;
25625 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25626 int64_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
25630 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
25631 LDKUnsignedNodeAnnouncement orig_conv;
25632 orig_conv.inner = (void*)(orig & (~1));
25633 orig_conv.is_owned = false;
25634 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25635 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
25636 uint64_t ret_ref = 0;
25637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25640 ret_ref = (uint64_t)ret_var.inner;
25641 if (ret_var.is_owned) {
25647 void __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
25648 LDKNodeAnnouncement this_obj_conv;
25649 this_obj_conv.inner = (void*)(this_obj & (~1));
25650 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25652 NodeAnnouncement_free(this_obj_conv);
25655 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
25656 LDKNodeAnnouncement this_ptr_conv;
25657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25658 this_ptr_conv.is_owned = false;
25659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25660 int8_tArray ret_arr = init_int8_tArray(64);
25661 memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
25665 void __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
25666 LDKNodeAnnouncement this_ptr_conv;
25667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25668 this_ptr_conv.is_owned = false;
25669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25670 LDKSignature val_ref;
25671 CHECK(val->arr_len == 64);
25672 memcpy(val_ref.compact_form, val->elems, 64);
25673 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
25676 uint32_t __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
25677 LDKNodeAnnouncement this_ptr_conv;
25678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25679 this_ptr_conv.is_owned = false;
25680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25681 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
25682 uint64_t ret_ref = 0;
25683 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25684 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25686 ret_ref = (uint64_t)ret_var.inner;
25687 if (ret_var.is_owned) {
25693 void __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
25694 LDKNodeAnnouncement this_ptr_conv;
25695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25696 this_ptr_conv.is_owned = false;
25697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25698 LDKUnsignedNodeAnnouncement val_conv;
25699 val_conv.inner = (void*)(val & (~1));
25700 val_conv.is_owned = (val & 1) || (val == 0);
25701 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25702 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
25703 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
25706 uint32_t __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
25707 LDKSignature signature_arg_ref;
25708 CHECK(signature_arg->arr_len == 64);
25709 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
25710 LDKUnsignedNodeAnnouncement contents_arg_conv;
25711 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25712 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25713 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25714 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
25715 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
25716 uint64_t ret_ref = 0;
25717 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25718 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25719 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25720 ret_ref = (uint64_t)ret_var.inner;
25721 if (ret_var.is_owned) {
25727 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
25728 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
25729 uint64_t ret_ref = 0;
25730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25732 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25733 ret_ref = (uint64_t)ret_var.inner;
25734 if (ret_var.is_owned) {
25739 int64_t __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
25740 LDKNodeAnnouncement arg_conv;
25741 arg_conv.inner = (void*)(arg & (~1));
25742 arg_conv.is_owned = false;
25743 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25744 int64_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
25748 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint32_t orig) {
25749 LDKNodeAnnouncement orig_conv;
25750 orig_conv.inner = (void*)(orig & (~1));
25751 orig_conv.is_owned = false;
25752 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25753 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
25754 uint64_t ret_ref = 0;
25755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25758 ret_ref = (uint64_t)ret_var.inner;
25759 if (ret_var.is_owned) {
25765 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
25766 LDKUnsignedChannelAnnouncement this_obj_conv;
25767 this_obj_conv.inner = (void*)(this_obj & (~1));
25768 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25770 UnsignedChannelAnnouncement_free(this_obj_conv);
25773 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
25774 LDKUnsignedChannelAnnouncement this_ptr_conv;
25775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25776 this_ptr_conv.is_owned = false;
25777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25778 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
25779 uint64_t ret_ref = 0;
25780 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25781 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25783 ret_ref = (uint64_t)ret_var.inner;
25784 if (ret_var.is_owned) {
25790 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25791 LDKUnsignedChannelAnnouncement this_ptr_conv;
25792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25793 this_ptr_conv.is_owned = false;
25794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25795 LDKChannelFeatures val_conv;
25796 val_conv.inner = (void*)(val & (~1));
25797 val_conv.is_owned = (val & 1) || (val == 0);
25798 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25799 val_conv = ChannelFeatures_clone(&val_conv);
25800 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
25803 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
25804 LDKUnsignedChannelAnnouncement this_ptr_conv;
25805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25806 this_ptr_conv.is_owned = false;
25807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25808 int8_tArray ret_arr = init_int8_tArray(32);
25809 memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
25813 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
25814 LDKUnsignedChannelAnnouncement this_ptr_conv;
25815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25816 this_ptr_conv.is_owned = false;
25817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25818 LDKThirtyTwoBytes val_ref;
25819 CHECK(val->arr_len == 32);
25820 memcpy(val_ref.data, val->elems, 32);
25821 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
25824 int64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
25825 LDKUnsignedChannelAnnouncement this_ptr_conv;
25826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25827 this_ptr_conv.is_owned = false;
25828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25829 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
25833 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25834 LDKUnsignedChannelAnnouncement this_ptr_conv;
25835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25836 this_ptr_conv.is_owned = false;
25837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25838 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
25841 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
25842 LDKUnsignedChannelAnnouncement this_ptr_conv;
25843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25844 this_ptr_conv.is_owned = false;
25845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25846 int8_tArray ret_arr = init_int8_tArray(33);
25847 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
25851 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
25852 LDKUnsignedChannelAnnouncement this_ptr_conv;
25853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25854 this_ptr_conv.is_owned = false;
25855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25856 LDKPublicKey val_ref;
25857 CHECK(val->arr_len == 33);
25858 memcpy(val_ref.compressed_form, val->elems, 33);
25859 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
25862 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
25863 LDKUnsignedChannelAnnouncement this_ptr_conv;
25864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25865 this_ptr_conv.is_owned = false;
25866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25867 int8_tArray ret_arr = init_int8_tArray(33);
25868 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
25872 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
25873 LDKUnsignedChannelAnnouncement this_ptr_conv;
25874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25875 this_ptr_conv.is_owned = false;
25876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25877 LDKPublicKey val_ref;
25878 CHECK(val->arr_len == 33);
25879 memcpy(val_ref.compressed_form, val->elems, 33);
25880 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
25883 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
25884 LDKUnsignedChannelAnnouncement this_ptr_conv;
25885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25886 this_ptr_conv.is_owned = false;
25887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25888 int8_tArray ret_arr = init_int8_tArray(33);
25889 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
25893 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
25894 LDKUnsignedChannelAnnouncement this_ptr_conv;
25895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25896 this_ptr_conv.is_owned = false;
25897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25898 LDKPublicKey val_ref;
25899 CHECK(val->arr_len == 33);
25900 memcpy(val_ref.compressed_form, val->elems, 33);
25901 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
25904 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
25905 LDKUnsignedChannelAnnouncement this_ptr_conv;
25906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25907 this_ptr_conv.is_owned = false;
25908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25909 int8_tArray ret_arr = init_int8_tArray(33);
25910 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
25914 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
25915 LDKUnsignedChannelAnnouncement this_ptr_conv;
25916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25917 this_ptr_conv.is_owned = false;
25918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25919 LDKPublicKey val_ref;
25920 CHECK(val->arr_len == 33);
25921 memcpy(val_ref.compressed_form, val->elems, 33);
25922 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
25925 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
25926 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
25927 uint64_t ret_ref = 0;
25928 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25929 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25930 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25931 ret_ref = (uint64_t)ret_var.inner;
25932 if (ret_var.is_owned) {
25937 int64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
25938 LDKUnsignedChannelAnnouncement arg_conv;
25939 arg_conv.inner = (void*)(arg & (~1));
25940 arg_conv.is_owned = false;
25941 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25942 int64_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
25946 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
25947 LDKUnsignedChannelAnnouncement orig_conv;
25948 orig_conv.inner = (void*)(orig & (~1));
25949 orig_conv.is_owned = false;
25950 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25951 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
25952 uint64_t ret_ref = 0;
25953 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25954 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25955 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25956 ret_ref = (uint64_t)ret_var.inner;
25957 if (ret_var.is_owned) {
25963 void __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
25964 LDKChannelAnnouncement this_obj_conv;
25965 this_obj_conv.inner = (void*)(this_obj & (~1));
25966 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25968 ChannelAnnouncement_free(this_obj_conv);
25971 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
25972 LDKChannelAnnouncement this_ptr_conv;
25973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25974 this_ptr_conv.is_owned = false;
25975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25976 int8_tArray ret_arr = init_int8_tArray(64);
25977 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
25981 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
25982 LDKChannelAnnouncement this_ptr_conv;
25983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25984 this_ptr_conv.is_owned = false;
25985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25986 LDKSignature val_ref;
25987 CHECK(val->arr_len == 64);
25988 memcpy(val_ref.compact_form, val->elems, 64);
25989 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
25992 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
25993 LDKChannelAnnouncement this_ptr_conv;
25994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25995 this_ptr_conv.is_owned = false;
25996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25997 int8_tArray ret_arr = init_int8_tArray(64);
25998 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
26002 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
26003 LDKChannelAnnouncement this_ptr_conv;
26004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26005 this_ptr_conv.is_owned = false;
26006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26007 LDKSignature val_ref;
26008 CHECK(val->arr_len == 64);
26009 memcpy(val_ref.compact_form, val->elems, 64);
26010 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
26013 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
26014 LDKChannelAnnouncement this_ptr_conv;
26015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26016 this_ptr_conv.is_owned = false;
26017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26018 int8_tArray ret_arr = init_int8_tArray(64);
26019 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
26023 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
26024 LDKChannelAnnouncement this_ptr_conv;
26025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26026 this_ptr_conv.is_owned = false;
26027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26028 LDKSignature val_ref;
26029 CHECK(val->arr_len == 64);
26030 memcpy(val_ref.compact_form, val->elems, 64);
26031 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
26034 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
26035 LDKChannelAnnouncement this_ptr_conv;
26036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26037 this_ptr_conv.is_owned = false;
26038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26039 int8_tArray ret_arr = init_int8_tArray(64);
26040 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
26044 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
26045 LDKChannelAnnouncement this_ptr_conv;
26046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26047 this_ptr_conv.is_owned = false;
26048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26049 LDKSignature val_ref;
26050 CHECK(val->arr_len == 64);
26051 memcpy(val_ref.compact_form, val->elems, 64);
26052 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
26055 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
26056 LDKChannelAnnouncement this_ptr_conv;
26057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26058 this_ptr_conv.is_owned = false;
26059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26060 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
26061 uint64_t ret_ref = 0;
26062 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26063 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26065 ret_ref = (uint64_t)ret_var.inner;
26066 if (ret_var.is_owned) {
26072 void __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
26073 LDKChannelAnnouncement this_ptr_conv;
26074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26075 this_ptr_conv.is_owned = false;
26076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26077 LDKUnsignedChannelAnnouncement val_conv;
26078 val_conv.inner = (void*)(val & (~1));
26079 val_conv.is_owned = (val & 1) || (val == 0);
26080 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26081 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
26082 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
26085 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) {
26086 LDKSignature node_signature_1_arg_ref;
26087 CHECK(node_signature_1_arg->arr_len == 64);
26088 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64);
26089 LDKSignature node_signature_2_arg_ref;
26090 CHECK(node_signature_2_arg->arr_len == 64);
26091 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64);
26092 LDKSignature bitcoin_signature_1_arg_ref;
26093 CHECK(bitcoin_signature_1_arg->arr_len == 64);
26094 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64);
26095 LDKSignature bitcoin_signature_2_arg_ref;
26096 CHECK(bitcoin_signature_2_arg->arr_len == 64);
26097 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64);
26098 LDKUnsignedChannelAnnouncement contents_arg_conv;
26099 contents_arg_conv.inner = (void*)(contents_arg & (~1));
26100 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
26101 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
26102 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
26103 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);
26104 uint64_t ret_ref = 0;
26105 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26106 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26108 ret_ref = (uint64_t)ret_var.inner;
26109 if (ret_var.is_owned) {
26115 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
26116 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
26117 uint64_t ret_ref = 0;
26118 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26119 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26121 ret_ref = (uint64_t)ret_var.inner;
26122 if (ret_var.is_owned) {
26127 int64_t __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
26128 LDKChannelAnnouncement arg_conv;
26129 arg_conv.inner = (void*)(arg & (~1));
26130 arg_conv.is_owned = false;
26131 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26132 int64_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
26136 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
26137 LDKChannelAnnouncement orig_conv;
26138 orig_conv.inner = (void*)(orig & (~1));
26139 orig_conv.is_owned = false;
26140 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26141 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
26142 uint64_t ret_ref = 0;
26143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26146 ret_ref = (uint64_t)ret_var.inner;
26147 if (ret_var.is_owned) {
26153 void __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
26154 LDKUnsignedChannelUpdate this_obj_conv;
26155 this_obj_conv.inner = (void*)(this_obj & (~1));
26156 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26158 UnsignedChannelUpdate_free(this_obj_conv);
26161 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
26162 LDKUnsignedChannelUpdate this_ptr_conv;
26163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26164 this_ptr_conv.is_owned = false;
26165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26166 int8_tArray ret_arr = init_int8_tArray(32);
26167 memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
26171 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26172 LDKUnsignedChannelUpdate this_ptr_conv;
26173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26174 this_ptr_conv.is_owned = false;
26175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26176 LDKThirtyTwoBytes val_ref;
26177 CHECK(val->arr_len == 32);
26178 memcpy(val_ref.data, val->elems, 32);
26179 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
26182 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
26183 LDKUnsignedChannelUpdate this_ptr_conv;
26184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26185 this_ptr_conv.is_owned = false;
26186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26187 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
26191 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
26192 LDKUnsignedChannelUpdate this_ptr_conv;
26193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26194 this_ptr_conv.is_owned = false;
26195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26196 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
26199 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
26200 LDKUnsignedChannelUpdate this_ptr_conv;
26201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26202 this_ptr_conv.is_owned = false;
26203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26204 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
26208 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
26209 LDKUnsignedChannelUpdate this_ptr_conv;
26210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26211 this_ptr_conv.is_owned = false;
26212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26213 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
26216 int8_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
26217 LDKUnsignedChannelUpdate this_ptr_conv;
26218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26219 this_ptr_conv.is_owned = false;
26220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26221 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
26225 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
26226 LDKUnsignedChannelUpdate this_ptr_conv;
26227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26228 this_ptr_conv.is_owned = false;
26229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26230 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
26233 int16_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
26234 LDKUnsignedChannelUpdate this_ptr_conv;
26235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26236 this_ptr_conv.is_owned = false;
26237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26238 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
26242 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
26243 LDKUnsignedChannelUpdate this_ptr_conv;
26244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26245 this_ptr_conv.is_owned = false;
26246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26247 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
26250 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
26251 LDKUnsignedChannelUpdate this_ptr_conv;
26252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26253 this_ptr_conv.is_owned = false;
26254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26255 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
26259 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
26260 LDKUnsignedChannelUpdate this_ptr_conv;
26261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26262 this_ptr_conv.is_owned = false;
26263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26264 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
26267 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
26268 LDKUnsignedChannelUpdate this_ptr_conv;
26269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26270 this_ptr_conv.is_owned = false;
26271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26272 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
26276 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
26277 LDKUnsignedChannelUpdate this_ptr_conv;
26278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26279 this_ptr_conv.is_owned = false;
26280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26281 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
26284 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
26285 LDKUnsignedChannelUpdate this_ptr_conv;
26286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26287 this_ptr_conv.is_owned = false;
26288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26289 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
26293 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
26294 LDKUnsignedChannelUpdate this_ptr_conv;
26295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26296 this_ptr_conv.is_owned = false;
26297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26298 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
26301 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
26302 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
26303 uint64_t ret_ref = 0;
26304 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26305 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26306 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26307 ret_ref = (uint64_t)ret_var.inner;
26308 if (ret_var.is_owned) {
26313 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
26314 LDKUnsignedChannelUpdate arg_conv;
26315 arg_conv.inner = (void*)(arg & (~1));
26316 arg_conv.is_owned = false;
26317 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26318 int64_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
26322 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
26323 LDKUnsignedChannelUpdate orig_conv;
26324 orig_conv.inner = (void*)(orig & (~1));
26325 orig_conv.is_owned = false;
26326 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26327 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
26328 uint64_t ret_ref = 0;
26329 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26330 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26332 ret_ref = (uint64_t)ret_var.inner;
26333 if (ret_var.is_owned) {
26339 void __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint32_t this_obj) {
26340 LDKChannelUpdate this_obj_conv;
26341 this_obj_conv.inner = (void*)(this_obj & (~1));
26342 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26344 ChannelUpdate_free(this_obj_conv);
26347 int8_tArray __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
26348 LDKChannelUpdate this_ptr_conv;
26349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26350 this_ptr_conv.is_owned = false;
26351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26352 int8_tArray ret_arr = init_int8_tArray(64);
26353 memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
26357 void __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
26358 LDKChannelUpdate this_ptr_conv;
26359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26360 this_ptr_conv.is_owned = false;
26361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26362 LDKSignature val_ref;
26363 CHECK(val->arr_len == 64);
26364 memcpy(val_ref.compact_form, val->elems, 64);
26365 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
26368 uint32_t __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
26369 LDKChannelUpdate this_ptr_conv;
26370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26371 this_ptr_conv.is_owned = false;
26372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26373 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
26374 uint64_t ret_ref = 0;
26375 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26376 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26377 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26378 ret_ref = (uint64_t)ret_var.inner;
26379 if (ret_var.is_owned) {
26385 void __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
26386 LDKChannelUpdate this_ptr_conv;
26387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26388 this_ptr_conv.is_owned = false;
26389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26390 LDKUnsignedChannelUpdate val_conv;
26391 val_conv.inner = (void*)(val & (~1));
26392 val_conv.is_owned = (val & 1) || (val == 0);
26393 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26394 val_conv = UnsignedChannelUpdate_clone(&val_conv);
26395 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
26398 uint32_t __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
26399 LDKSignature signature_arg_ref;
26400 CHECK(signature_arg->arr_len == 64);
26401 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
26402 LDKUnsignedChannelUpdate contents_arg_conv;
26403 contents_arg_conv.inner = (void*)(contents_arg & (~1));
26404 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
26405 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
26406 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
26407 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
26408 uint64_t ret_ref = 0;
26409 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26410 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26412 ret_ref = (uint64_t)ret_var.inner;
26413 if (ret_var.is_owned) {
26419 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
26420 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
26421 uint64_t ret_ref = 0;
26422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26425 ret_ref = (uint64_t)ret_var.inner;
26426 if (ret_var.is_owned) {
26431 int64_t __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
26432 LDKChannelUpdate arg_conv;
26433 arg_conv.inner = (void*)(arg & (~1));
26434 arg_conv.is_owned = false;
26435 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26436 int64_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
26440 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint32_t orig) {
26441 LDKChannelUpdate orig_conv;
26442 orig_conv.inner = (void*)(orig & (~1));
26443 orig_conv.is_owned = false;
26444 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26445 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
26446 uint64_t ret_ref = 0;
26447 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26448 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26450 ret_ref = (uint64_t)ret_var.inner;
26451 if (ret_var.is_owned) {
26457 void __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint32_t this_obj) {
26458 LDKQueryChannelRange this_obj_conv;
26459 this_obj_conv.inner = (void*)(this_obj & (~1));
26460 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26462 QueryChannelRange_free(this_obj_conv);
26465 int8_tArray __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
26466 LDKQueryChannelRange this_ptr_conv;
26467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26468 this_ptr_conv.is_owned = false;
26469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26470 int8_tArray ret_arr = init_int8_tArray(32);
26471 memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
26475 void __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26476 LDKQueryChannelRange this_ptr_conv;
26477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26478 this_ptr_conv.is_owned = false;
26479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26480 LDKThirtyTwoBytes val_ref;
26481 CHECK(val->arr_len == 32);
26482 memcpy(val_ref.data, val->elems, 32);
26483 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26486 int32_t __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
26487 LDKQueryChannelRange this_ptr_conv;
26488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26489 this_ptr_conv.is_owned = false;
26490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26491 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
26495 void __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26496 LDKQueryChannelRange this_ptr_conv;
26497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26498 this_ptr_conv.is_owned = false;
26499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26500 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
26503 int32_t __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26504 LDKQueryChannelRange this_ptr_conv;
26505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26506 this_ptr_conv.is_owned = false;
26507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26508 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
26512 void __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26513 LDKQueryChannelRange this_ptr_conv;
26514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26515 this_ptr_conv.is_owned = false;
26516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26517 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26520 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) {
26521 LDKThirtyTwoBytes chain_hash_arg_ref;
26522 CHECK(chain_hash_arg->arr_len == 32);
26523 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26524 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
26525 uint64_t ret_ref = 0;
26526 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26527 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26528 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26529 ret_ref = (uint64_t)ret_var.inner;
26530 if (ret_var.is_owned) {
26536 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
26537 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
26538 uint64_t ret_ref = 0;
26539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26541 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26542 ret_ref = (uint64_t)ret_var.inner;
26543 if (ret_var.is_owned) {
26548 int64_t __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint32_t arg) {
26549 LDKQueryChannelRange arg_conv;
26550 arg_conv.inner = (void*)(arg & (~1));
26551 arg_conv.is_owned = false;
26552 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26553 int64_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
26557 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint32_t orig) {
26558 LDKQueryChannelRange orig_conv;
26559 orig_conv.inner = (void*)(orig & (~1));
26560 orig_conv.is_owned = false;
26561 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26562 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
26563 uint64_t ret_ref = 0;
26564 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26565 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26566 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26567 ret_ref = (uint64_t)ret_var.inner;
26568 if (ret_var.is_owned) {
26574 void __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
26575 LDKReplyChannelRange this_obj_conv;
26576 this_obj_conv.inner = (void*)(this_obj & (~1));
26577 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26579 ReplyChannelRange_free(this_obj_conv);
26582 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
26583 LDKReplyChannelRange this_ptr_conv;
26584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26585 this_ptr_conv.is_owned = false;
26586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26587 int8_tArray ret_arr = init_int8_tArray(32);
26588 memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
26592 void __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26593 LDKReplyChannelRange this_ptr_conv;
26594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26595 this_ptr_conv.is_owned = false;
26596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26597 LDKThirtyTwoBytes val_ref;
26598 CHECK(val->arr_len == 32);
26599 memcpy(val_ref.data, val->elems, 32);
26600 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26603 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
26604 LDKReplyChannelRange this_ptr_conv;
26605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26606 this_ptr_conv.is_owned = false;
26607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26608 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
26612 void __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26613 LDKReplyChannelRange this_ptr_conv;
26614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26615 this_ptr_conv.is_owned = false;
26616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26617 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
26620 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26621 LDKReplyChannelRange this_ptr_conv;
26622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26623 this_ptr_conv.is_owned = false;
26624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26625 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
26629 void __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26630 LDKReplyChannelRange this_ptr_conv;
26631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26632 this_ptr_conv.is_owned = false;
26633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26634 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26637 jboolean __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
26638 LDKReplyChannelRange this_ptr_conv;
26639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26640 this_ptr_conv.is_owned = false;
26641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26642 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
26646 void __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
26647 LDKReplyChannelRange this_ptr_conv;
26648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26649 this_ptr_conv.is_owned = false;
26650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26651 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
26654 void __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26655 LDKReplyChannelRange this_ptr_conv;
26656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26657 this_ptr_conv.is_owned = false;
26658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26659 LDKCVec_u64Z val_constr;
26660 val_constr.datalen = val->arr_len;
26661 if (val_constr.datalen > 0)
26662 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26664 val_constr.data = NULL;
26665 int64_t* val_vals = val->elems;
26666 for (size_t i = 0; i < val_constr.datalen; i++) {
26667 int64_t val_conv_8 = val_vals[i];
26668 val_constr.data[i] = val_conv_8;
26670 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
26673 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) {
26674 LDKThirtyTwoBytes chain_hash_arg_ref;
26675 CHECK(chain_hash_arg->arr_len == 32);
26676 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26677 LDKCVec_u64Z short_channel_ids_arg_constr;
26678 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
26679 if (short_channel_ids_arg_constr.datalen > 0)
26680 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26682 short_channel_ids_arg_constr.data = NULL;
26683 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
26684 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26685 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26686 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26688 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
26689 uint64_t ret_ref = 0;
26690 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26691 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26693 ret_ref = (uint64_t)ret_var.inner;
26694 if (ret_var.is_owned) {
26700 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
26701 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
26702 uint64_t ret_ref = 0;
26703 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26704 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26706 ret_ref = (uint64_t)ret_var.inner;
26707 if (ret_var.is_owned) {
26712 int64_t __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
26713 LDKReplyChannelRange arg_conv;
26714 arg_conv.inner = (void*)(arg & (~1));
26715 arg_conv.is_owned = false;
26716 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26717 int64_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
26721 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint32_t orig) {
26722 LDKReplyChannelRange orig_conv;
26723 orig_conv.inner = (void*)(orig & (~1));
26724 orig_conv.is_owned = false;
26725 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26726 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
26727 uint64_t ret_ref = 0;
26728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26731 ret_ref = (uint64_t)ret_var.inner;
26732 if (ret_var.is_owned) {
26738 void __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
26739 LDKQueryShortChannelIds this_obj_conv;
26740 this_obj_conv.inner = (void*)(this_obj & (~1));
26741 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26743 QueryShortChannelIds_free(this_obj_conv);
26746 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
26747 LDKQueryShortChannelIds this_ptr_conv;
26748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26749 this_ptr_conv.is_owned = false;
26750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26751 int8_tArray ret_arr = init_int8_tArray(32);
26752 memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
26756 void __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26757 LDKQueryShortChannelIds this_ptr_conv;
26758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26759 this_ptr_conv.is_owned = false;
26760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26761 LDKThirtyTwoBytes val_ref;
26762 CHECK(val->arr_len == 32);
26763 memcpy(val_ref.data, val->elems, 32);
26764 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
26767 void __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26768 LDKQueryShortChannelIds this_ptr_conv;
26769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26770 this_ptr_conv.is_owned = false;
26771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26772 LDKCVec_u64Z val_constr;
26773 val_constr.datalen = val->arr_len;
26774 if (val_constr.datalen > 0)
26775 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26777 val_constr.data = NULL;
26778 int64_t* val_vals = val->elems;
26779 for (size_t i = 0; i < val_constr.datalen; i++) {
26780 int64_t val_conv_8 = val_vals[i];
26781 val_constr.data[i] = val_conv_8;
26783 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
26786 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
26787 LDKThirtyTwoBytes chain_hash_arg_ref;
26788 CHECK(chain_hash_arg->arr_len == 32);
26789 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26790 LDKCVec_u64Z short_channel_ids_arg_constr;
26791 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
26792 if (short_channel_ids_arg_constr.datalen > 0)
26793 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26795 short_channel_ids_arg_constr.data = NULL;
26796 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
26797 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26798 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26799 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26801 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
26802 uint64_t ret_ref = 0;
26803 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26804 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26805 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26806 ret_ref = (uint64_t)ret_var.inner;
26807 if (ret_var.is_owned) {
26813 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
26814 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
26815 uint64_t ret_ref = 0;
26816 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26817 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26819 ret_ref = (uint64_t)ret_var.inner;
26820 if (ret_var.is_owned) {
26825 int64_t __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
26826 LDKQueryShortChannelIds arg_conv;
26827 arg_conv.inner = (void*)(arg & (~1));
26828 arg_conv.is_owned = false;
26829 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26830 int64_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
26834 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
26835 LDKQueryShortChannelIds orig_conv;
26836 orig_conv.inner = (void*)(orig & (~1));
26837 orig_conv.is_owned = false;
26838 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26839 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
26840 uint64_t ret_ref = 0;
26841 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26842 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26844 ret_ref = (uint64_t)ret_var.inner;
26845 if (ret_var.is_owned) {
26851 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
26852 LDKReplyShortChannelIdsEnd this_obj_conv;
26853 this_obj_conv.inner = (void*)(this_obj & (~1));
26854 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26856 ReplyShortChannelIdsEnd_free(this_obj_conv);
26859 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
26860 LDKReplyShortChannelIdsEnd this_ptr_conv;
26861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26862 this_ptr_conv.is_owned = false;
26863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26864 int8_tArray ret_arr = init_int8_tArray(32);
26865 memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
26869 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26870 LDKReplyShortChannelIdsEnd this_ptr_conv;
26871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26872 this_ptr_conv.is_owned = false;
26873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26874 LDKThirtyTwoBytes val_ref;
26875 CHECK(val->arr_len == 32);
26876 memcpy(val_ref.data, val->elems, 32);
26877 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
26880 jboolean __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
26881 LDKReplyShortChannelIdsEnd this_ptr_conv;
26882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26883 this_ptr_conv.is_owned = false;
26884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26885 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
26889 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
26890 LDKReplyShortChannelIdsEnd this_ptr_conv;
26891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26892 this_ptr_conv.is_owned = false;
26893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26894 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
26897 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
26898 LDKThirtyTwoBytes chain_hash_arg_ref;
26899 CHECK(chain_hash_arg->arr_len == 32);
26900 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26901 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
26902 uint64_t ret_ref = 0;
26903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26906 ret_ref = (uint64_t)ret_var.inner;
26907 if (ret_var.is_owned) {
26913 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
26914 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
26915 uint64_t ret_ref = 0;
26916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26919 ret_ref = (uint64_t)ret_var.inner;
26920 if (ret_var.is_owned) {
26925 int64_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
26926 LDKReplyShortChannelIdsEnd arg_conv;
26927 arg_conv.inner = (void*)(arg & (~1));
26928 arg_conv.is_owned = false;
26929 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26930 int64_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
26934 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
26935 LDKReplyShortChannelIdsEnd orig_conv;
26936 orig_conv.inner = (void*)(orig & (~1));
26937 orig_conv.is_owned = false;
26938 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26939 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
26940 uint64_t ret_ref = 0;
26941 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26942 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26943 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26944 ret_ref = (uint64_t)ret_var.inner;
26945 if (ret_var.is_owned) {
26951 void __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
26952 LDKGossipTimestampFilter this_obj_conv;
26953 this_obj_conv.inner = (void*)(this_obj & (~1));
26954 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26956 GossipTimestampFilter_free(this_obj_conv);
26959 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
26960 LDKGossipTimestampFilter this_ptr_conv;
26961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26962 this_ptr_conv.is_owned = false;
26963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26964 int8_tArray ret_arr = init_int8_tArray(32);
26965 memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
26969 void __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26970 LDKGossipTimestampFilter this_ptr_conv;
26971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26972 this_ptr_conv.is_owned = false;
26973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26974 LDKThirtyTwoBytes val_ref;
26975 CHECK(val->arr_len == 32);
26976 memcpy(val_ref.data, val->elems, 32);
26977 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
26980 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
26981 LDKGossipTimestampFilter this_ptr_conv;
26982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26983 this_ptr_conv.is_owned = false;
26984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26985 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
26989 void __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
26990 LDKGossipTimestampFilter this_ptr_conv;
26991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26992 this_ptr_conv.is_owned = false;
26993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26994 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
26997 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
26998 LDKGossipTimestampFilter this_ptr_conv;
26999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27000 this_ptr_conv.is_owned = false;
27001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27002 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
27006 void __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
27007 LDKGossipTimestampFilter this_ptr_conv;
27008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27009 this_ptr_conv.is_owned = false;
27010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27011 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
27014 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) {
27015 LDKThirtyTwoBytes chain_hash_arg_ref;
27016 CHECK(chain_hash_arg->arr_len == 32);
27017 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
27018 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
27019 uint64_t ret_ref = 0;
27020 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27021 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27023 ret_ref = (uint64_t)ret_var.inner;
27024 if (ret_var.is_owned) {
27030 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
27031 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
27032 uint64_t ret_ref = 0;
27033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27036 ret_ref = (uint64_t)ret_var.inner;
27037 if (ret_var.is_owned) {
27042 int64_t __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint32_t arg) {
27043 LDKGossipTimestampFilter arg_conv;
27044 arg_conv.inner = (void*)(arg & (~1));
27045 arg_conv.is_owned = false;
27046 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27047 int64_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
27051 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
27052 LDKGossipTimestampFilter orig_conv;
27053 orig_conv.inner = (void*)(orig & (~1));
27054 orig_conv.is_owned = false;
27055 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27056 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
27057 uint64_t ret_ref = 0;
27058 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27059 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27061 ret_ref = (uint64_t)ret_var.inner;
27062 if (ret_var.is_owned) {
27068 void __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint32_t this_ptr) {
27069 if ((this_ptr & 1) != 0) return;
27070 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27071 CHECK_ACCESS(this_ptr_ptr);
27072 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
27073 FREE((void*)this_ptr);
27074 ErrorAction_free(this_ptr_conv);
27077 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
27078 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27079 *ret_copy = ErrorAction_clone(arg);
27080 uint64_t ret_ref = (uint64_t)ret_copy;
27083 int64_t __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
27084 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
27085 int64_t ret_val = ErrorAction_clone_ptr(arg_conv);
27089 uint32_t __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint32_t orig) {
27090 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
27091 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27092 *ret_copy = ErrorAction_clone(orig_conv);
27093 uint64_t ret_ref = (uint64_t)ret_copy;
27097 uint32_t __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
27098 LDKErrorMessage msg_conv;
27099 msg_conv.inner = (void*)(msg & (~1));
27100 msg_conv.is_owned = (msg & 1) || (msg == 0);
27101 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27102 msg_conv = ErrorMessage_clone(&msg_conv);
27103 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27104 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
27105 uint64_t ret_ref = (uint64_t)ret_copy;
27109 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
27110 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27111 *ret_copy = ErrorAction_ignore_error();
27112 uint64_t ret_ref = (uint64_t)ret_copy;
27116 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
27117 LDKLevel a_conv = LDKLevel_from_js(a);
27118 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27119 *ret_copy = ErrorAction_ignore_and_log(a_conv);
27120 uint64_t ret_ref = (uint64_t)ret_copy;
27124 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
27125 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27126 *ret_copy = ErrorAction_ignore_duplicate_gossip();
27127 uint64_t ret_ref = (uint64_t)ret_copy;
27131 uint32_t __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint32_t msg) {
27132 LDKErrorMessage msg_conv;
27133 msg_conv.inner = (void*)(msg & (~1));
27134 msg_conv.is_owned = (msg & 1) || (msg == 0);
27135 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27136 msg_conv = ErrorMessage_clone(&msg_conv);
27137 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27138 *ret_copy = ErrorAction_send_error_message(msg_conv);
27139 uint64_t ret_ref = (uint64_t)ret_copy;
27143 void __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint32_t this_obj) {
27144 LDKLightningError this_obj_conv;
27145 this_obj_conv.inner = (void*)(this_obj & (~1));
27146 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27148 LightningError_free(this_obj_conv);
27151 jstring __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint32_t this_ptr) {
27152 LDKLightningError this_ptr_conv;
27153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27154 this_ptr_conv.is_owned = false;
27155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27156 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
27157 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27162 void __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
27163 LDKLightningError this_ptr_conv;
27164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27165 this_ptr_conv.is_owned = false;
27166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27167 LDKStr val_conv = str_ref_to_owned_c(val);
27168 LightningError_set_err(&this_ptr_conv, val_conv);
27171 uint32_t __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint32_t this_ptr) {
27172 LDKLightningError this_ptr_conv;
27173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27174 this_ptr_conv.is_owned = false;
27175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27176 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
27177 *ret_copy = LightningError_get_action(&this_ptr_conv);
27178 uint64_t ret_ref = (uint64_t)ret_copy;
27182 void __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
27183 LDKLightningError this_ptr_conv;
27184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27185 this_ptr_conv.is_owned = false;
27186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27187 void* val_ptr = (void*)(((uint64_t)val) & ~1);
27188 CHECK_ACCESS(val_ptr);
27189 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
27190 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
27191 LightningError_set_action(&this_ptr_conv, val_conv);
27194 uint32_t __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
27195 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
27196 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
27197 CHECK_ACCESS(action_arg_ptr);
27198 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
27199 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
27200 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
27201 uint64_t ret_ref = 0;
27202 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27203 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27204 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27205 ret_ref = (uint64_t)ret_var.inner;
27206 if (ret_var.is_owned) {
27212 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
27213 LDKLightningError ret_var = LightningError_clone(arg);
27214 uint64_t ret_ref = 0;
27215 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27216 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27217 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27218 ret_ref = (uint64_t)ret_var.inner;
27219 if (ret_var.is_owned) {
27224 int64_t __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint32_t arg) {
27225 LDKLightningError arg_conv;
27226 arg_conv.inner = (void*)(arg & (~1));
27227 arg_conv.is_owned = false;
27228 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27229 int64_t ret_val = LightningError_clone_ptr(&arg_conv);
27233 uint32_t __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint32_t orig) {
27234 LDKLightningError orig_conv;
27235 orig_conv.inner = (void*)(orig & (~1));
27236 orig_conv.is_owned = false;
27237 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27238 LDKLightningError ret_var = LightningError_clone(&orig_conv);
27239 uint64_t ret_ref = 0;
27240 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27241 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27243 ret_ref = (uint64_t)ret_var.inner;
27244 if (ret_var.is_owned) {
27250 void __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
27251 LDKCommitmentUpdate this_obj_conv;
27252 this_obj_conv.inner = (void*)(this_obj & (~1));
27253 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27255 CommitmentUpdate_free(this_obj_conv);
27258 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
27259 LDKCommitmentUpdate this_ptr_conv;
27260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27261 this_ptr_conv.is_owned = false;
27262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27263 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
27264 uint32_tArray ret_arr = NULL;
27265 ret_arr = init_uint32_tArray(ret_var.datalen);
27266 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
27267 for (size_t p = 0; p < ret_var.datalen; p++) {
27268 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
27269 uint64_t ret_conv_15_ref = 0;
27270 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27271 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
27273 ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
27274 if (ret_conv_15_var.is_owned) {
27275 ret_conv_15_ref |= 1;
27277 ret_arr_ptr[p] = ret_conv_15_ref;
27280 FREE(ret_var.data);
27284 void __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
27285 LDKCommitmentUpdate this_ptr_conv;
27286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27287 this_ptr_conv.is_owned = false;
27288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27289 LDKCVec_UpdateAddHTLCZ val_constr;
27290 val_constr.datalen = val->arr_len;
27291 if (val_constr.datalen > 0)
27292 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27294 val_constr.data = NULL;
27295 uint32_t* val_vals = val->elems;
27296 for (size_t p = 0; p < val_constr.datalen; p++) {
27297 uint32_t val_conv_15 = val_vals[p];
27298 LDKUpdateAddHTLC val_conv_15_conv;
27299 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
27300 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
27301 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
27302 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
27303 val_constr.data[p] = val_conv_15_conv;
27305 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
27308 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
27309 LDKCommitmentUpdate this_ptr_conv;
27310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27311 this_ptr_conv.is_owned = false;
27312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27313 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
27314 uint32_tArray ret_arr = NULL;
27315 ret_arr = init_uint32_tArray(ret_var.datalen);
27316 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
27317 for (size_t t = 0; t < ret_var.datalen; t++) {
27318 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
27319 uint64_t ret_conv_19_ref = 0;
27320 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27321 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27322 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
27323 ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
27324 if (ret_conv_19_var.is_owned) {
27325 ret_conv_19_ref |= 1;
27327 ret_arr_ptr[t] = ret_conv_19_ref;
27330 FREE(ret_var.data);
27334 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
27335 LDKCommitmentUpdate this_ptr_conv;
27336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27337 this_ptr_conv.is_owned = false;
27338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27339 LDKCVec_UpdateFulfillHTLCZ val_constr;
27340 val_constr.datalen = val->arr_len;
27341 if (val_constr.datalen > 0)
27342 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27344 val_constr.data = NULL;
27345 uint32_t* val_vals = val->elems;
27346 for (size_t t = 0; t < val_constr.datalen; t++) {
27347 uint32_t val_conv_19 = val_vals[t];
27348 LDKUpdateFulfillHTLC val_conv_19_conv;
27349 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
27350 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
27351 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
27352 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
27353 val_constr.data[t] = val_conv_19_conv;
27355 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
27358 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
27359 LDKCommitmentUpdate this_ptr_conv;
27360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27361 this_ptr_conv.is_owned = false;
27362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27363 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
27364 uint32_tArray ret_arr = NULL;
27365 ret_arr = init_uint32_tArray(ret_var.datalen);
27366 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
27367 for (size_t q = 0; q < ret_var.datalen; q++) {
27368 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
27369 uint64_t ret_conv_16_ref = 0;
27370 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27371 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27373 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
27374 if (ret_conv_16_var.is_owned) {
27375 ret_conv_16_ref |= 1;
27377 ret_arr_ptr[q] = ret_conv_16_ref;
27380 FREE(ret_var.data);
27384 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
27385 LDKCommitmentUpdate this_ptr_conv;
27386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27387 this_ptr_conv.is_owned = false;
27388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27389 LDKCVec_UpdateFailHTLCZ val_constr;
27390 val_constr.datalen = val->arr_len;
27391 if (val_constr.datalen > 0)
27392 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27394 val_constr.data = NULL;
27395 uint32_t* val_vals = val->elems;
27396 for (size_t q = 0; q < val_constr.datalen; q++) {
27397 uint32_t val_conv_16 = val_vals[q];
27398 LDKUpdateFailHTLC val_conv_16_conv;
27399 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
27400 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
27401 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
27402 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
27403 val_constr.data[q] = val_conv_16_conv;
27405 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
27408 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
27409 LDKCommitmentUpdate this_ptr_conv;
27410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27411 this_ptr_conv.is_owned = false;
27412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27413 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
27414 uint32_tArray ret_arr = NULL;
27415 ret_arr = init_uint32_tArray(ret_var.datalen);
27416 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
27417 for (size_t z = 0; z < ret_var.datalen; z++) {
27418 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
27419 uint64_t ret_conv_25_ref = 0;
27420 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27421 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
27423 ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
27424 if (ret_conv_25_var.is_owned) {
27425 ret_conv_25_ref |= 1;
27427 ret_arr_ptr[z] = ret_conv_25_ref;
27430 FREE(ret_var.data);
27434 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) {
27435 LDKCommitmentUpdate this_ptr_conv;
27436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27437 this_ptr_conv.is_owned = false;
27438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27439 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
27440 val_constr.datalen = val->arr_len;
27441 if (val_constr.datalen > 0)
27442 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27444 val_constr.data = NULL;
27445 uint32_t* val_vals = val->elems;
27446 for (size_t z = 0; z < val_constr.datalen; z++) {
27447 uint32_t val_conv_25 = val_vals[z];
27448 LDKUpdateFailMalformedHTLC val_conv_25_conv;
27449 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
27450 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
27451 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
27452 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
27453 val_constr.data[z] = val_conv_25_conv;
27455 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
27458 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
27459 LDKCommitmentUpdate this_ptr_conv;
27460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27461 this_ptr_conv.is_owned = false;
27462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27463 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
27464 uint64_t ret_ref = 0;
27465 if ((uint64_t)ret_var.inner > 4096) {
27466 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27467 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27468 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27469 ret_ref = (uint64_t)ret_var.inner;
27470 if (ret_var.is_owned) {
27477 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
27478 LDKCommitmentUpdate this_ptr_conv;
27479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27480 this_ptr_conv.is_owned = false;
27481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27482 LDKUpdateFee val_conv;
27483 val_conv.inner = (void*)(val & (~1));
27484 val_conv.is_owned = (val & 1) || (val == 0);
27485 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27486 val_conv = UpdateFee_clone(&val_conv);
27487 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
27490 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
27491 LDKCommitmentUpdate this_ptr_conv;
27492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27493 this_ptr_conv.is_owned = false;
27494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27495 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
27496 uint64_t ret_ref = 0;
27497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27500 ret_ref = (uint64_t)ret_var.inner;
27501 if (ret_var.is_owned) {
27507 void __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
27508 LDKCommitmentUpdate this_ptr_conv;
27509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27510 this_ptr_conv.is_owned = false;
27511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27512 LDKCommitmentSigned val_conv;
27513 val_conv.inner = (void*)(val & (~1));
27514 val_conv.is_owned = (val & 1) || (val == 0);
27515 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27516 val_conv = CommitmentSigned_clone(&val_conv);
27517 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
27520 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) {
27521 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
27522 update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
27523 if (update_add_htlcs_arg_constr.datalen > 0)
27524 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27526 update_add_htlcs_arg_constr.data = NULL;
27527 uint32_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
27528 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
27529 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
27530 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
27531 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
27532 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
27533 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
27534 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
27535 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
27537 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
27538 update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
27539 if (update_fulfill_htlcs_arg_constr.datalen > 0)
27540 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27542 update_fulfill_htlcs_arg_constr.data = NULL;
27543 uint32_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
27544 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
27545 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
27546 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
27547 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
27548 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
27549 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
27550 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
27551 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
27553 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
27554 update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
27555 if (update_fail_htlcs_arg_constr.datalen > 0)
27556 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27558 update_fail_htlcs_arg_constr.data = NULL;
27559 uint32_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
27560 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
27561 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
27562 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
27563 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
27564 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
27565 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
27566 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
27567 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
27569 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
27570 update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
27571 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
27572 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27574 update_fail_malformed_htlcs_arg_constr.data = NULL;
27575 uint32_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
27576 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
27577 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
27578 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
27579 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
27580 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);
27581 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
27582 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
27583 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
27585 LDKUpdateFee update_fee_arg_conv;
27586 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
27587 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
27588 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
27589 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
27590 LDKCommitmentSigned commitment_signed_arg_conv;
27591 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
27592 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
27593 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
27594 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
27595 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);
27596 uint64_t ret_ref = 0;
27597 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27598 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27600 ret_ref = (uint64_t)ret_var.inner;
27601 if (ret_var.is_owned) {
27607 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
27608 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
27609 uint64_t ret_ref = 0;
27610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27613 ret_ref = (uint64_t)ret_var.inner;
27614 if (ret_var.is_owned) {
27619 int64_t __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
27620 LDKCommitmentUpdate arg_conv;
27621 arg_conv.inner = (void*)(arg & (~1));
27622 arg_conv.is_owned = false;
27623 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27624 int64_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
27628 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint32_t orig) {
27629 LDKCommitmentUpdate orig_conv;
27630 orig_conv.inner = (void*)(orig & (~1));
27631 orig_conv.is_owned = false;
27632 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27633 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
27634 uint64_t ret_ref = 0;
27635 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27636 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27638 ret_ref = (uint64_t)ret_var.inner;
27639 if (ret_var.is_owned) {
27645 void __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
27646 if ((this_ptr & 1) != 0) return;
27647 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27648 CHECK_ACCESS(this_ptr_ptr);
27649 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
27650 FREE((void*)this_ptr);
27651 ChannelMessageHandler_free(this_ptr_conv);
27654 void __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
27655 if ((this_ptr & 1) != 0) return;
27656 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27657 CHECK_ACCESS(this_ptr_ptr);
27658 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
27659 FREE((void*)this_ptr);
27660 RoutingMessageHandler_free(this_ptr_conv);
27663 int8_tArray __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint32_t obj) {
27664 LDKAcceptChannel obj_conv;
27665 obj_conv.inner = (void*)(obj & (~1));
27666 obj_conv.is_owned = false;
27667 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27668 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
27669 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27670 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27671 CVec_u8Z_free(ret_var);
27675 uint32_t __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
27676 LDKu8slice ser_ref;
27677 ser_ref.datalen = ser->arr_len;
27678 ser_ref.data = ser->elems;
27679 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27680 *ret_conv = AcceptChannel_read(ser_ref);
27681 return (uint64_t)ret_conv;
27684 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint32_t obj) {
27685 LDKAnnouncementSignatures obj_conv;
27686 obj_conv.inner = (void*)(obj & (~1));
27687 obj_conv.is_owned = false;
27688 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27689 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
27690 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27691 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27692 CVec_u8Z_free(ret_var);
27696 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
27697 LDKu8slice ser_ref;
27698 ser_ref.datalen = ser->arr_len;
27699 ser_ref.data = ser->elems;
27700 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27701 *ret_conv = AnnouncementSignatures_read(ser_ref);
27702 return (uint64_t)ret_conv;
27705 int8_tArray __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint32_t obj) {
27706 LDKChannelReestablish obj_conv;
27707 obj_conv.inner = (void*)(obj & (~1));
27708 obj_conv.is_owned = false;
27709 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27710 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
27711 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27712 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27713 CVec_u8Z_free(ret_var);
27717 uint32_t __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
27718 LDKu8slice ser_ref;
27719 ser_ref.datalen = ser->arr_len;
27720 ser_ref.data = ser->elems;
27721 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27722 *ret_conv = ChannelReestablish_read(ser_ref);
27723 return (uint64_t)ret_conv;
27726 int8_tArray __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint32_t obj) {
27727 LDKClosingSigned obj_conv;
27728 obj_conv.inner = (void*)(obj & (~1));
27729 obj_conv.is_owned = false;
27730 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27731 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
27732 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27733 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27734 CVec_u8Z_free(ret_var);
27738 uint32_t __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
27739 LDKu8slice ser_ref;
27740 ser_ref.datalen = ser->arr_len;
27741 ser_ref.data = ser->elems;
27742 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27743 *ret_conv = ClosingSigned_read(ser_ref);
27744 return (uint64_t)ret_conv;
27747 int8_tArray __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
27748 LDKClosingSignedFeeRange obj_conv;
27749 obj_conv.inner = (void*)(obj & (~1));
27750 obj_conv.is_owned = false;
27751 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27752 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
27753 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27754 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27755 CVec_u8Z_free(ret_var);
27759 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
27760 LDKu8slice ser_ref;
27761 ser_ref.datalen = ser->arr_len;
27762 ser_ref.data = ser->elems;
27763 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27764 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
27765 return (uint64_t)ret_conv;
27768 int8_tArray __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint32_t obj) {
27769 LDKCommitmentSigned obj_conv;
27770 obj_conv.inner = (void*)(obj & (~1));
27771 obj_conv.is_owned = false;
27772 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27773 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
27774 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27775 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27776 CVec_u8Z_free(ret_var);
27780 uint32_t __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
27781 LDKu8slice ser_ref;
27782 ser_ref.datalen = ser->arr_len;
27783 ser_ref.data = ser->elems;
27784 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27785 *ret_conv = CommitmentSigned_read(ser_ref);
27786 return (uint64_t)ret_conv;
27789 int8_tArray __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint32_t obj) {
27790 LDKFundingCreated obj_conv;
27791 obj_conv.inner = (void*)(obj & (~1));
27792 obj_conv.is_owned = false;
27793 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27794 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
27795 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27796 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27797 CVec_u8Z_free(ret_var);
27801 uint32_t __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
27802 LDKu8slice ser_ref;
27803 ser_ref.datalen = ser->arr_len;
27804 ser_ref.data = ser->elems;
27805 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27806 *ret_conv = FundingCreated_read(ser_ref);
27807 return (uint64_t)ret_conv;
27810 int8_tArray __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint32_t obj) {
27811 LDKFundingSigned obj_conv;
27812 obj_conv.inner = (void*)(obj & (~1));
27813 obj_conv.is_owned = false;
27814 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27815 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
27816 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27817 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27818 CVec_u8Z_free(ret_var);
27822 uint32_t __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
27823 LDKu8slice ser_ref;
27824 ser_ref.datalen = ser->arr_len;
27825 ser_ref.data = ser->elems;
27826 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27827 *ret_conv = FundingSigned_read(ser_ref);
27828 return (uint64_t)ret_conv;
27831 int8_tArray __attribute__((export_name("TS_FundingLocked_write"))) TS_FundingLocked_write(uint32_t obj) {
27832 LDKFundingLocked obj_conv;
27833 obj_conv.inner = (void*)(obj & (~1));
27834 obj_conv.is_owned = false;
27835 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27836 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
27837 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27838 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27839 CVec_u8Z_free(ret_var);
27843 uint32_t __attribute__((export_name("TS_FundingLocked_read"))) TS_FundingLocked_read(int8_tArray ser) {
27844 LDKu8slice ser_ref;
27845 ser_ref.datalen = ser->arr_len;
27846 ser_ref.data = ser->elems;
27847 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
27848 *ret_conv = FundingLocked_read(ser_ref);
27849 return (uint64_t)ret_conv;
27852 int8_tArray __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint32_t obj) {
27854 obj_conv.inner = (void*)(obj & (~1));
27855 obj_conv.is_owned = false;
27856 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27857 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
27858 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27859 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27860 CVec_u8Z_free(ret_var);
27864 uint32_t __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
27865 LDKu8slice ser_ref;
27866 ser_ref.datalen = ser->arr_len;
27867 ser_ref.data = ser->elems;
27868 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
27869 *ret_conv = Init_read(ser_ref);
27870 return (uint64_t)ret_conv;
27873 int8_tArray __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint32_t obj) {
27874 LDKOpenChannel obj_conv;
27875 obj_conv.inner = (void*)(obj & (~1));
27876 obj_conv.is_owned = false;
27877 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27878 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
27879 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27880 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27881 CVec_u8Z_free(ret_var);
27885 uint32_t __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
27886 LDKu8slice ser_ref;
27887 ser_ref.datalen = ser->arr_len;
27888 ser_ref.data = ser->elems;
27889 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
27890 *ret_conv = OpenChannel_read(ser_ref);
27891 return (uint64_t)ret_conv;
27894 int8_tArray __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint32_t obj) {
27895 LDKRevokeAndACK obj_conv;
27896 obj_conv.inner = (void*)(obj & (~1));
27897 obj_conv.is_owned = false;
27898 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27899 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
27900 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27901 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27902 CVec_u8Z_free(ret_var);
27906 uint32_t __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
27907 LDKu8slice ser_ref;
27908 ser_ref.datalen = ser->arr_len;
27909 ser_ref.data = ser->elems;
27910 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
27911 *ret_conv = RevokeAndACK_read(ser_ref);
27912 return (uint64_t)ret_conv;
27915 int8_tArray __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint32_t obj) {
27916 LDKShutdown obj_conv;
27917 obj_conv.inner = (void*)(obj & (~1));
27918 obj_conv.is_owned = false;
27919 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27920 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
27921 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27922 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27923 CVec_u8Z_free(ret_var);
27927 uint32_t __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
27928 LDKu8slice ser_ref;
27929 ser_ref.datalen = ser->arr_len;
27930 ser_ref.data = ser->elems;
27931 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27932 *ret_conv = Shutdown_read(ser_ref);
27933 return (uint64_t)ret_conv;
27936 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint32_t obj) {
27937 LDKUpdateFailHTLC obj_conv;
27938 obj_conv.inner = (void*)(obj & (~1));
27939 obj_conv.is_owned = false;
27940 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27941 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
27942 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27943 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27944 CVec_u8Z_free(ret_var);
27948 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
27949 LDKu8slice ser_ref;
27950 ser_ref.datalen = ser->arr_len;
27951 ser_ref.data = ser->elems;
27952 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27953 *ret_conv = UpdateFailHTLC_read(ser_ref);
27954 return (uint64_t)ret_conv;
27957 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
27958 LDKUpdateFailMalformedHTLC obj_conv;
27959 obj_conv.inner = (void*)(obj & (~1));
27960 obj_conv.is_owned = false;
27961 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27962 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
27963 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27964 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27965 CVec_u8Z_free(ret_var);
27969 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
27970 LDKu8slice ser_ref;
27971 ser_ref.datalen = ser->arr_len;
27972 ser_ref.data = ser->elems;
27973 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27974 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
27975 return (uint64_t)ret_conv;
27978 int8_tArray __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint32_t obj) {
27979 LDKUpdateFee obj_conv;
27980 obj_conv.inner = (void*)(obj & (~1));
27981 obj_conv.is_owned = false;
27982 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27983 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
27984 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27985 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27986 CVec_u8Z_free(ret_var);
27990 uint32_t __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
27991 LDKu8slice ser_ref;
27992 ser_ref.datalen = ser->arr_len;
27993 ser_ref.data = ser->elems;
27994 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27995 *ret_conv = UpdateFee_read(ser_ref);
27996 return (uint64_t)ret_conv;
27999 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
28000 LDKUpdateFulfillHTLC obj_conv;
28001 obj_conv.inner = (void*)(obj & (~1));
28002 obj_conv.is_owned = false;
28003 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28004 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
28005 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28006 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28007 CVec_u8Z_free(ret_var);
28011 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
28012 LDKu8slice ser_ref;
28013 ser_ref.datalen = ser->arr_len;
28014 ser_ref.data = ser->elems;
28015 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
28016 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
28017 return (uint64_t)ret_conv;
28020 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint32_t obj) {
28021 LDKUpdateAddHTLC obj_conv;
28022 obj_conv.inner = (void*)(obj & (~1));
28023 obj_conv.is_owned = false;
28024 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28025 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
28026 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28027 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28028 CVec_u8Z_free(ret_var);
28032 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
28033 LDKu8slice ser_ref;
28034 ser_ref.datalen = ser->arr_len;
28035 ser_ref.data = ser->elems;
28036 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
28037 *ret_conv = UpdateAddHTLC_read(ser_ref);
28038 return (uint64_t)ret_conv;
28041 int8_tArray __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint32_t obj) {
28043 obj_conv.inner = (void*)(obj & (~1));
28044 obj_conv.is_owned = false;
28045 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28046 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
28047 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28048 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28049 CVec_u8Z_free(ret_var);
28053 uint32_t __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
28054 LDKu8slice ser_ref;
28055 ser_ref.datalen = ser->arr_len;
28056 ser_ref.data = ser->elems;
28057 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
28058 *ret_conv = Ping_read(ser_ref);
28059 return (uint64_t)ret_conv;
28062 int8_tArray __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint32_t obj) {
28064 obj_conv.inner = (void*)(obj & (~1));
28065 obj_conv.is_owned = false;
28066 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28067 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
28068 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28069 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28070 CVec_u8Z_free(ret_var);
28074 uint32_t __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
28075 LDKu8slice ser_ref;
28076 ser_ref.datalen = ser->arr_len;
28077 ser_ref.data = ser->elems;
28078 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
28079 *ret_conv = Pong_read(ser_ref);
28080 return (uint64_t)ret_conv;
28083 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
28084 LDKUnsignedChannelAnnouncement obj_conv;
28085 obj_conv.inner = (void*)(obj & (~1));
28086 obj_conv.is_owned = false;
28087 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28088 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
28089 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28090 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28091 CVec_u8Z_free(ret_var);
28095 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
28096 LDKu8slice ser_ref;
28097 ser_ref.datalen = ser->arr_len;
28098 ser_ref.data = ser->elems;
28099 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
28100 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
28101 return (uint64_t)ret_conv;
28104 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint32_t obj) {
28105 LDKChannelAnnouncement obj_conv;
28106 obj_conv.inner = (void*)(obj & (~1));
28107 obj_conv.is_owned = false;
28108 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28109 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
28110 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28111 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28112 CVec_u8Z_free(ret_var);
28116 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
28117 LDKu8slice ser_ref;
28118 ser_ref.datalen = ser->arr_len;
28119 ser_ref.data = ser->elems;
28120 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
28121 *ret_conv = ChannelAnnouncement_read(ser_ref);
28122 return (uint64_t)ret_conv;
28125 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
28126 LDKUnsignedChannelUpdate obj_conv;
28127 obj_conv.inner = (void*)(obj & (~1));
28128 obj_conv.is_owned = false;
28129 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28130 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
28131 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28132 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28133 CVec_u8Z_free(ret_var);
28137 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
28138 LDKu8slice ser_ref;
28139 ser_ref.datalen = ser->arr_len;
28140 ser_ref.data = ser->elems;
28141 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
28142 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
28143 return (uint64_t)ret_conv;
28146 int8_tArray __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint32_t obj) {
28147 LDKChannelUpdate obj_conv;
28148 obj_conv.inner = (void*)(obj & (~1));
28149 obj_conv.is_owned = false;
28150 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28151 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
28152 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28153 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28154 CVec_u8Z_free(ret_var);
28158 uint32_t __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
28159 LDKu8slice ser_ref;
28160 ser_ref.datalen = ser->arr_len;
28161 ser_ref.data = ser->elems;
28162 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
28163 *ret_conv = ChannelUpdate_read(ser_ref);
28164 return (uint64_t)ret_conv;
28167 int8_tArray __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint32_t obj) {
28168 LDKErrorMessage obj_conv;
28169 obj_conv.inner = (void*)(obj & (~1));
28170 obj_conv.is_owned = false;
28171 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28172 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
28173 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28174 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28175 CVec_u8Z_free(ret_var);
28179 uint32_t __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
28180 LDKu8slice ser_ref;
28181 ser_ref.datalen = ser->arr_len;
28182 ser_ref.data = ser->elems;
28183 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
28184 *ret_conv = ErrorMessage_read(ser_ref);
28185 return (uint64_t)ret_conv;
28188 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
28189 LDKUnsignedNodeAnnouncement obj_conv;
28190 obj_conv.inner = (void*)(obj & (~1));
28191 obj_conv.is_owned = false;
28192 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28193 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
28194 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28195 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28196 CVec_u8Z_free(ret_var);
28200 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
28201 LDKu8slice ser_ref;
28202 ser_ref.datalen = ser->arr_len;
28203 ser_ref.data = ser->elems;
28204 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
28205 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
28206 return (uint64_t)ret_conv;
28209 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint32_t obj) {
28210 LDKNodeAnnouncement obj_conv;
28211 obj_conv.inner = (void*)(obj & (~1));
28212 obj_conv.is_owned = false;
28213 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28214 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
28215 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28216 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28217 CVec_u8Z_free(ret_var);
28221 uint32_t __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
28222 LDKu8slice ser_ref;
28223 ser_ref.datalen = ser->arr_len;
28224 ser_ref.data = ser->elems;
28225 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
28226 *ret_conv = NodeAnnouncement_read(ser_ref);
28227 return (uint64_t)ret_conv;
28230 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
28231 LDKu8slice ser_ref;
28232 ser_ref.datalen = ser->arr_len;
28233 ser_ref.data = ser->elems;
28234 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
28235 *ret_conv = QueryShortChannelIds_read(ser_ref);
28236 return (uint64_t)ret_conv;
28239 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint32_t obj) {
28240 LDKQueryShortChannelIds obj_conv;
28241 obj_conv.inner = (void*)(obj & (~1));
28242 obj_conv.is_owned = false;
28243 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28244 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
28245 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28246 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28247 CVec_u8Z_free(ret_var);
28251 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
28252 LDKReplyShortChannelIdsEnd obj_conv;
28253 obj_conv.inner = (void*)(obj & (~1));
28254 obj_conv.is_owned = false;
28255 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28256 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
28257 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28258 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28259 CVec_u8Z_free(ret_var);
28263 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
28264 LDKu8slice ser_ref;
28265 ser_ref.datalen = ser->arr_len;
28266 ser_ref.data = ser->elems;
28267 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
28268 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
28269 return (uint64_t)ret_conv;
28272 int32_t __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
28273 LDKQueryChannelRange this_arg_conv;
28274 this_arg_conv.inner = (void*)(this_arg & (~1));
28275 this_arg_conv.is_owned = false;
28276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28277 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
28281 int8_tArray __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint32_t obj) {
28282 LDKQueryChannelRange obj_conv;
28283 obj_conv.inner = (void*)(obj & (~1));
28284 obj_conv.is_owned = false;
28285 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28286 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
28287 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28288 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28289 CVec_u8Z_free(ret_var);
28293 uint32_t __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
28294 LDKu8slice ser_ref;
28295 ser_ref.datalen = ser->arr_len;
28296 ser_ref.data = ser->elems;
28297 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
28298 *ret_conv = QueryChannelRange_read(ser_ref);
28299 return (uint64_t)ret_conv;
28302 uint32_t __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
28303 LDKu8slice ser_ref;
28304 ser_ref.datalen = ser->arr_len;
28305 ser_ref.data = ser->elems;
28306 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
28307 *ret_conv = ReplyChannelRange_read(ser_ref);
28308 return (uint64_t)ret_conv;
28311 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint32_t obj) {
28312 LDKReplyChannelRange obj_conv;
28313 obj_conv.inner = (void*)(obj & (~1));
28314 obj_conv.is_owned = false;
28315 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28316 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
28317 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28318 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28319 CVec_u8Z_free(ret_var);
28323 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint32_t obj) {
28324 LDKGossipTimestampFilter obj_conv;
28325 obj_conv.inner = (void*)(obj & (~1));
28326 obj_conv.is_owned = false;
28327 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28328 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
28329 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28330 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28331 CVec_u8Z_free(ret_var);
28335 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
28336 LDKu8slice ser_ref;
28337 ser_ref.datalen = ser->arr_len;
28338 ser_ref.data = ser->elems;
28339 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28340 *ret_conv = GossipTimestampFilter_read(ser_ref);
28341 return (uint64_t)ret_conv;
28344 void __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
28345 if ((this_ptr & 1) != 0) return;
28346 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28347 CHECK_ACCESS(this_ptr_ptr);
28348 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
28349 FREE((void*)this_ptr);
28350 CustomMessageHandler_free(this_ptr_conv);
28353 void __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
28354 LDKIgnoringMessageHandler this_obj_conv;
28355 this_obj_conv.inner = (void*)(this_obj & (~1));
28356 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28358 IgnoringMessageHandler_free(this_obj_conv);
28361 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
28362 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
28363 uint64_t ret_ref = 0;
28364 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28365 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28367 ret_ref = (uint64_t)ret_var.inner;
28368 if (ret_var.is_owned) {
28374 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
28375 LDKIgnoringMessageHandler this_arg_conv;
28376 this_arg_conv.inner = (void*)(this_arg & (~1));
28377 this_arg_conv.is_owned = false;
28378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28379 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28380 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
28381 return (uint64_t)ret_ret;
28384 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
28385 LDKIgnoringMessageHandler this_arg_conv;
28386 this_arg_conv.inner = (void*)(this_arg & (~1));
28387 this_arg_conv.is_owned = false;
28388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28389 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
28390 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
28391 return (uint64_t)ret_ret;
28394 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
28395 LDKIgnoringMessageHandler this_arg_conv;
28396 this_arg_conv.inner = (void*)(this_arg & (~1));
28397 this_arg_conv.is_owned = false;
28398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28399 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
28400 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
28401 return (uint64_t)ret_ret;
28404 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
28405 LDKIgnoringMessageHandler this_arg_conv;
28406 this_arg_conv.inner = (void*)(this_arg & (~1));
28407 this_arg_conv.is_owned = false;
28408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28409 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
28410 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
28411 return (uint64_t)ret_ret;
28414 void __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
28415 LDKErroringMessageHandler this_obj_conv;
28416 this_obj_conv.inner = (void*)(this_obj & (~1));
28417 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28419 ErroringMessageHandler_free(this_obj_conv);
28422 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
28423 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
28424 uint64_t ret_ref = 0;
28425 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28426 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28428 ret_ref = (uint64_t)ret_var.inner;
28429 if (ret_var.is_owned) {
28435 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
28436 LDKErroringMessageHandler this_arg_conv;
28437 this_arg_conv.inner = (void*)(this_arg & (~1));
28438 this_arg_conv.is_owned = false;
28439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28440 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28441 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
28442 return (uint64_t)ret_ret;
28445 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
28446 LDKErroringMessageHandler this_arg_conv;
28447 this_arg_conv.inner = (void*)(this_arg & (~1));
28448 this_arg_conv.is_owned = false;
28449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28450 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
28451 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
28452 return (uint64_t)ret_ret;
28455 void __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint32_t this_obj) {
28456 LDKMessageHandler this_obj_conv;
28457 this_obj_conv.inner = (void*)(this_obj & (~1));
28458 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28460 MessageHandler_free(this_obj_conv);
28463 uint32_t __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
28464 LDKMessageHandler this_ptr_conv;
28465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28466 this_ptr_conv.is_owned = false;
28467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28468 // WARNING: This object doesn't live past this scope, needs clone!
28469 uint64_t ret_ret = ((uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
28473 void __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
28474 LDKMessageHandler this_ptr_conv;
28475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28476 this_ptr_conv.is_owned = false;
28477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28478 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28479 CHECK_ACCESS(val_ptr);
28480 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
28481 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
28484 uint32_t __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
28485 LDKMessageHandler this_ptr_conv;
28486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28487 this_ptr_conv.is_owned = false;
28488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28489 // WARNING: This object doesn't live past this scope, needs clone!
28490 uint64_t ret_ret = ((uint64_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
28494 void __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
28495 LDKMessageHandler this_ptr_conv;
28496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28497 this_ptr_conv.is_owned = false;
28498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28499 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28500 CHECK_ACCESS(val_ptr);
28501 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
28502 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
28505 uint32_t __attribute__((export_name("TS_MessageHandler_new"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
28506 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
28507 CHECK_ACCESS(chan_handler_arg_ptr);
28508 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
28509 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
28510 CHECK_ACCESS(route_handler_arg_ptr);
28511 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
28512 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
28513 uint64_t ret_ref = 0;
28514 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28515 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28516 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28517 ret_ref = (uint64_t)ret_var.inner;
28518 if (ret_var.is_owned) {
28524 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
28525 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28526 *ret_ret = SocketDescriptor_clone(arg);
28527 return (uint64_t)ret_ret;
28529 int64_t __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
28530 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
28531 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
28532 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
28533 int64_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
28537 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint32_t orig) {
28538 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
28539 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
28540 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
28541 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28542 *ret_ret = SocketDescriptor_clone(orig_conv);
28543 return (uint64_t)ret_ret;
28546 void __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
28547 if ((this_ptr & 1) != 0) return;
28548 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28549 CHECK_ACCESS(this_ptr_ptr);
28550 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
28551 FREE((void*)this_ptr);
28552 SocketDescriptor_free(this_ptr_conv);
28555 void __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint32_t this_obj) {
28556 LDKPeerHandleError this_obj_conv;
28557 this_obj_conv.inner = (void*)(this_obj & (~1));
28558 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28560 PeerHandleError_free(this_obj_conv);
28563 jboolean __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
28564 LDKPeerHandleError this_ptr_conv;
28565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28566 this_ptr_conv.is_owned = false;
28567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28568 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
28572 void __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
28573 LDKPeerHandleError this_ptr_conv;
28574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28575 this_ptr_conv.is_owned = false;
28576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28577 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
28580 uint32_t __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
28581 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
28582 uint64_t ret_ref = 0;
28583 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28584 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28586 ret_ref = (uint64_t)ret_var.inner;
28587 if (ret_var.is_owned) {
28593 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
28594 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
28595 uint64_t ret_ref = 0;
28596 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28597 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28598 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28599 ret_ref = (uint64_t)ret_var.inner;
28600 if (ret_var.is_owned) {
28605 int64_t __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
28606 LDKPeerHandleError arg_conv;
28607 arg_conv.inner = (void*)(arg & (~1));
28608 arg_conv.is_owned = false;
28609 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28610 int64_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
28614 uint32_t __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint32_t orig) {
28615 LDKPeerHandleError orig_conv;
28616 orig_conv.inner = (void*)(orig & (~1));
28617 orig_conv.is_owned = false;
28618 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28619 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
28620 uint64_t ret_ref = 0;
28621 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28622 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28623 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28624 ret_ref = (uint64_t)ret_var.inner;
28625 if (ret_var.is_owned) {
28631 void __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint32_t this_obj) {
28632 LDKPeerManager this_obj_conv;
28633 this_obj_conv.inner = (void*)(this_obj & (~1));
28634 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28636 PeerManager_free(this_obj_conv);
28639 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) {
28640 LDKMessageHandler message_handler_conv;
28641 message_handler_conv.inner = (void*)(message_handler & (~1));
28642 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
28643 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
28644 // Warning: we need a move here but no clone is available for LDKMessageHandler
28645 LDKSecretKey our_node_secret_ref;
28646 CHECK(our_node_secret->arr_len == 32);
28647 memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32);
28648 unsigned char ephemeral_random_data_arr[32];
28649 CHECK(ephemeral_random_data->arr_len == 32);
28650 memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32);
28651 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
28652 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
28653 CHECK_ACCESS(logger_ptr);
28654 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28655 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
28656 CHECK_ACCESS(custom_message_handler_ptr);
28657 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
28658 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
28659 uint64_t ret_ref = 0;
28660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28662 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28663 ret_ref = (uint64_t)ret_var.inner;
28664 if (ret_var.is_owned) {
28670 ptrArray __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
28671 LDKPeerManager this_arg_conv;
28672 this_arg_conv.inner = (void*)(this_arg & (~1));
28673 this_arg_conv.is_owned = false;
28674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28675 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
28676 ptrArray ret_arr = NULL;
28677 ret_arr = init_ptrArray(ret_var.datalen);
28678 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
28679 for (size_t m = 0; m < ret_var.datalen; m++) {
28680 int8_tArray ret_conv_12_arr = init_int8_tArray(33);
28681 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
28682 ret_arr_ptr[m] = ret_conv_12_arr;
28685 FREE(ret_var.data);
28689 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) {
28690 LDKPeerManager this_arg_conv;
28691 this_arg_conv.inner = (void*)(this_arg & (~1));
28692 this_arg_conv.is_owned = false;
28693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28694 LDKPublicKey their_node_id_ref;
28695 CHECK(their_node_id->arr_len == 33);
28696 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
28697 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28698 CHECK_ACCESS(descriptor_ptr);
28699 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28700 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28701 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
28702 return (uint64_t)ret_conv;
28705 uint32_t __attribute__((export_name("TS_PeerManager_new_inbound_connection"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
28706 LDKPeerManager this_arg_conv;
28707 this_arg_conv.inner = (void*)(this_arg & (~1));
28708 this_arg_conv.is_owned = false;
28709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28710 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28711 CHECK_ACCESS(descriptor_ptr);
28712 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28713 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28714 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
28715 return (uint64_t)ret_conv;
28718 uint32_t __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
28719 LDKPeerManager this_arg_conv;
28720 this_arg_conv.inner = (void*)(this_arg & (~1));
28721 this_arg_conv.is_owned = false;
28722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28723 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28724 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28725 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28726 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28727 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
28728 return (uint64_t)ret_conv;
28731 uint32_t __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
28732 LDKPeerManager this_arg_conv;
28733 this_arg_conv.inner = (void*)(this_arg & (~1));
28734 this_arg_conv.is_owned = false;
28735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28736 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
28737 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
28738 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
28739 LDKu8slice data_ref;
28740 data_ref.datalen = data->arr_len;
28741 data_ref.data = data->elems;
28742 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28743 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
28744 return (uint64_t)ret_conv;
28747 void __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint32_t this_arg) {
28748 LDKPeerManager this_arg_conv;
28749 this_arg_conv.inner = (void*)(this_arg & (~1));
28750 this_arg_conv.is_owned = false;
28751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28752 PeerManager_process_events(&this_arg_conv);
28755 void __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
28756 LDKPeerManager this_arg_conv;
28757 this_arg_conv.inner = (void*)(this_arg & (~1));
28758 this_arg_conv.is_owned = false;
28759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28760 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28761 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28762 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28763 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
28766 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) {
28767 LDKPeerManager this_arg_conv;
28768 this_arg_conv.inner = (void*)(this_arg & (~1));
28769 this_arg_conv.is_owned = false;
28770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28771 LDKPublicKey node_id_ref;
28772 CHECK(node_id->arr_len == 33);
28773 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
28774 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
28777 void __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
28778 LDKPeerManager this_arg_conv;
28779 this_arg_conv.inner = (void*)(this_arg & (~1));
28780 this_arg_conv.is_owned = false;
28781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28782 PeerManager_disconnect_all_peers(&this_arg_conv);
28785 void __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
28786 LDKPeerManager this_arg_conv;
28787 this_arg_conv.inner = (void*)(this_arg & (~1));
28788 this_arg_conv.is_owned = false;
28789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28790 PeerManager_timer_tick_occurred(&this_arg_conv);
28793 int64_t __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
28794 int64_t ret_val = htlc_success_tx_weight(opt_anchors);
28798 int64_t __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
28799 int64_t ret_val = htlc_timeout_tx_weight(opt_anchors);
28803 int8_tArray __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
28804 unsigned char commitment_seed_arr[32];
28805 CHECK(commitment_seed->arr_len == 32);
28806 memcpy(commitment_seed_arr, commitment_seed->elems, 32);
28807 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
28808 int8_tArray ret_arr = init_int8_tArray(32);
28809 memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
28813 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) {
28814 LDKCVec_u8Z to_holder_script_ref;
28815 to_holder_script_ref.datalen = to_holder_script->arr_len;
28816 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
28817 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen);
28818 LDKCVec_u8Z to_counterparty_script_ref;
28819 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
28820 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
28821 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen);
28822 LDKOutPoint funding_outpoint_conv;
28823 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
28824 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
28825 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
28826 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
28827 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);
28828 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28829 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28830 Transaction_free(ret_var);
28834 uint32_t __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
28835 LDKPublicKey per_commitment_point_ref;
28836 CHECK(per_commitment_point->arr_len == 33);
28837 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28838 unsigned char base_secret_arr[32];
28839 CHECK(base_secret->arr_len == 32);
28840 memcpy(base_secret_arr, base_secret->elems, 32);
28841 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
28842 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28843 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
28844 return (uint64_t)ret_conv;
28847 uint32_t __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
28848 LDKPublicKey per_commitment_point_ref;
28849 CHECK(per_commitment_point->arr_len == 33);
28850 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28851 LDKPublicKey base_point_ref;
28852 CHECK(base_point->arr_len == 33);
28853 memcpy(base_point_ref.compressed_form, base_point->elems, 33);
28854 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28855 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
28856 return (uint64_t)ret_conv;
28859 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) {
28860 unsigned char per_commitment_secret_arr[32];
28861 CHECK(per_commitment_secret->arr_len == 32);
28862 memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32);
28863 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
28864 unsigned char countersignatory_revocation_base_secret_arr[32];
28865 CHECK(countersignatory_revocation_base_secret->arr_len == 32);
28866 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32);
28867 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
28868 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28869 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
28870 return (uint64_t)ret_conv;
28873 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) {
28874 LDKPublicKey per_commitment_point_ref;
28875 CHECK(per_commitment_point->arr_len == 33);
28876 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28877 LDKPublicKey countersignatory_revocation_base_point_ref;
28878 CHECK(countersignatory_revocation_base_point->arr_len == 33);
28879 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33);
28880 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28881 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
28882 return (uint64_t)ret_conv;
28885 void __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint32_t this_obj) {
28886 LDKTxCreationKeys this_obj_conv;
28887 this_obj_conv.inner = (void*)(this_obj & (~1));
28888 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28890 TxCreationKeys_free(this_obj_conv);
28893 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
28894 LDKTxCreationKeys this_ptr_conv;
28895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28896 this_ptr_conv.is_owned = false;
28897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28898 int8_tArray ret_arr = init_int8_tArray(33);
28899 memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28903 void __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
28904 LDKTxCreationKeys this_ptr_conv;
28905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28906 this_ptr_conv.is_owned = false;
28907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28908 LDKPublicKey val_ref;
28909 CHECK(val->arr_len == 33);
28910 memcpy(val_ref.compressed_form, val->elems, 33);
28911 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
28914 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
28915 LDKTxCreationKeys this_ptr_conv;
28916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28917 this_ptr_conv.is_owned = false;
28918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28919 int8_tArray ret_arr = init_int8_tArray(33);
28920 memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
28924 void __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
28925 LDKTxCreationKeys this_ptr_conv;
28926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28927 this_ptr_conv.is_owned = false;
28928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28929 LDKPublicKey val_ref;
28930 CHECK(val->arr_len == 33);
28931 memcpy(val_ref.compressed_form, val->elems, 33);
28932 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
28935 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
28936 LDKTxCreationKeys this_ptr_conv;
28937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28938 this_ptr_conv.is_owned = false;
28939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28940 int8_tArray ret_arr = init_int8_tArray(33);
28941 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
28945 void __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
28946 LDKTxCreationKeys this_ptr_conv;
28947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28948 this_ptr_conv.is_owned = false;
28949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28950 LDKPublicKey val_ref;
28951 CHECK(val->arr_len == 33);
28952 memcpy(val_ref.compressed_form, val->elems, 33);
28953 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
28956 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
28957 LDKTxCreationKeys this_ptr_conv;
28958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28959 this_ptr_conv.is_owned = false;
28960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28961 int8_tArray ret_arr = init_int8_tArray(33);
28962 memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
28966 void __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
28967 LDKTxCreationKeys this_ptr_conv;
28968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28969 this_ptr_conv.is_owned = false;
28970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28971 LDKPublicKey val_ref;
28972 CHECK(val->arr_len == 33);
28973 memcpy(val_ref.compressed_form, val->elems, 33);
28974 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
28977 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
28978 LDKTxCreationKeys this_ptr_conv;
28979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28980 this_ptr_conv.is_owned = false;
28981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28982 int8_tArray ret_arr = init_int8_tArray(33);
28983 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
28987 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) {
28988 LDKTxCreationKeys this_ptr_conv;
28989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28990 this_ptr_conv.is_owned = false;
28991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28992 LDKPublicKey val_ref;
28993 CHECK(val->arr_len == 33);
28994 memcpy(val_ref.compressed_form, val->elems, 33);
28995 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
28998 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) {
28999 LDKPublicKey per_commitment_point_arg_ref;
29000 CHECK(per_commitment_point_arg->arr_len == 33);
29001 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33);
29002 LDKPublicKey revocation_key_arg_ref;
29003 CHECK(revocation_key_arg->arr_len == 33);
29004 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33);
29005 LDKPublicKey broadcaster_htlc_key_arg_ref;
29006 CHECK(broadcaster_htlc_key_arg->arr_len == 33);
29007 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33);
29008 LDKPublicKey countersignatory_htlc_key_arg_ref;
29009 CHECK(countersignatory_htlc_key_arg->arr_len == 33);
29010 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33);
29011 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
29012 CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
29013 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33);
29014 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);
29015 uint64_t ret_ref = 0;
29016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29019 ret_ref = (uint64_t)ret_var.inner;
29020 if (ret_var.is_owned) {
29026 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
29027 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
29028 uint64_t ret_ref = 0;
29029 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29030 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29031 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29032 ret_ref = (uint64_t)ret_var.inner;
29033 if (ret_var.is_owned) {
29038 int64_t __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
29039 LDKTxCreationKeys arg_conv;
29040 arg_conv.inner = (void*)(arg & (~1));
29041 arg_conv.is_owned = false;
29042 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29043 int64_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
29047 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint32_t orig) {
29048 LDKTxCreationKeys orig_conv;
29049 orig_conv.inner = (void*)(orig & (~1));
29050 orig_conv.is_owned = false;
29051 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29052 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
29053 uint64_t ret_ref = 0;
29054 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29055 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29056 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29057 ret_ref = (uint64_t)ret_var.inner;
29058 if (ret_var.is_owned) {
29064 int8_tArray __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint32_t obj) {
29065 LDKTxCreationKeys obj_conv;
29066 obj_conv.inner = (void*)(obj & (~1));
29067 obj_conv.is_owned = false;
29068 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29069 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
29070 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29071 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29072 CVec_u8Z_free(ret_var);
29076 uint32_t __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
29077 LDKu8slice ser_ref;
29078 ser_ref.datalen = ser->arr_len;
29079 ser_ref.data = ser->elems;
29080 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
29081 *ret_conv = TxCreationKeys_read(ser_ref);
29082 return (uint64_t)ret_conv;
29085 void __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
29086 LDKChannelPublicKeys this_obj_conv;
29087 this_obj_conv.inner = (void*)(this_obj & (~1));
29088 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29090 ChannelPublicKeys_free(this_obj_conv);
29093 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
29094 LDKChannelPublicKeys this_ptr_conv;
29095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29096 this_ptr_conv.is_owned = false;
29097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29098 int8_tArray ret_arr = init_int8_tArray(33);
29099 memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
29103 void __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
29104 LDKChannelPublicKeys this_ptr_conv;
29105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29106 this_ptr_conv.is_owned = false;
29107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29108 LDKPublicKey val_ref;
29109 CHECK(val->arr_len == 33);
29110 memcpy(val_ref.compressed_form, val->elems, 33);
29111 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
29114 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
29115 LDKChannelPublicKeys this_ptr_conv;
29116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29117 this_ptr_conv.is_owned = false;
29118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29119 int8_tArray ret_arr = init_int8_tArray(33);
29120 memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
29124 void __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
29125 LDKChannelPublicKeys this_ptr_conv;
29126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29127 this_ptr_conv.is_owned = false;
29128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29129 LDKPublicKey val_ref;
29130 CHECK(val->arr_len == 33);
29131 memcpy(val_ref.compressed_form, val->elems, 33);
29132 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
29135 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
29136 LDKChannelPublicKeys this_ptr_conv;
29137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29138 this_ptr_conv.is_owned = false;
29139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29140 int8_tArray ret_arr = init_int8_tArray(33);
29141 memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
29145 void __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
29146 LDKChannelPublicKeys this_ptr_conv;
29147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29148 this_ptr_conv.is_owned = false;
29149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29150 LDKPublicKey val_ref;
29151 CHECK(val->arr_len == 33);
29152 memcpy(val_ref.compressed_form, val->elems, 33);
29153 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
29156 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
29157 LDKChannelPublicKeys this_ptr_conv;
29158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29159 this_ptr_conv.is_owned = false;
29160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29161 int8_tArray ret_arr = init_int8_tArray(33);
29162 memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
29166 void __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
29167 LDKChannelPublicKeys this_ptr_conv;
29168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29169 this_ptr_conv.is_owned = false;
29170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29171 LDKPublicKey val_ref;
29172 CHECK(val->arr_len == 33);
29173 memcpy(val_ref.compressed_form, val->elems, 33);
29174 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
29177 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
29178 LDKChannelPublicKeys this_ptr_conv;
29179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29180 this_ptr_conv.is_owned = false;
29181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29182 int8_tArray ret_arr = init_int8_tArray(33);
29183 memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
29187 void __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
29188 LDKChannelPublicKeys this_ptr_conv;
29189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29190 this_ptr_conv.is_owned = false;
29191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29192 LDKPublicKey val_ref;
29193 CHECK(val->arr_len == 33);
29194 memcpy(val_ref.compressed_form, val->elems, 33);
29195 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
29198 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) {
29199 LDKPublicKey funding_pubkey_arg_ref;
29200 CHECK(funding_pubkey_arg->arr_len == 33);
29201 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33);
29202 LDKPublicKey revocation_basepoint_arg_ref;
29203 CHECK(revocation_basepoint_arg->arr_len == 33);
29204 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33);
29205 LDKPublicKey payment_point_arg_ref;
29206 CHECK(payment_point_arg->arr_len == 33);
29207 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33);
29208 LDKPublicKey delayed_payment_basepoint_arg_ref;
29209 CHECK(delayed_payment_basepoint_arg->arr_len == 33);
29210 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33);
29211 LDKPublicKey htlc_basepoint_arg_ref;
29212 CHECK(htlc_basepoint_arg->arr_len == 33);
29213 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33);
29214 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);
29215 uint64_t ret_ref = 0;
29216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29219 ret_ref = (uint64_t)ret_var.inner;
29220 if (ret_var.is_owned) {
29226 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
29227 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
29228 uint64_t ret_ref = 0;
29229 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29230 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29231 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29232 ret_ref = (uint64_t)ret_var.inner;
29233 if (ret_var.is_owned) {
29238 int64_t __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
29239 LDKChannelPublicKeys arg_conv;
29240 arg_conv.inner = (void*)(arg & (~1));
29241 arg_conv.is_owned = false;
29242 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29243 int64_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
29247 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
29248 LDKChannelPublicKeys orig_conv;
29249 orig_conv.inner = (void*)(orig & (~1));
29250 orig_conv.is_owned = false;
29251 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29252 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
29253 uint64_t ret_ref = 0;
29254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29257 ret_ref = (uint64_t)ret_var.inner;
29258 if (ret_var.is_owned) {
29264 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint32_t obj) {
29265 LDKChannelPublicKeys obj_conv;
29266 obj_conv.inner = (void*)(obj & (~1));
29267 obj_conv.is_owned = false;
29268 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29269 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
29270 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29271 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29272 CVec_u8Z_free(ret_var);
29276 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
29277 LDKu8slice ser_ref;
29278 ser_ref.datalen = ser->arr_len;
29279 ser_ref.data = ser->elems;
29280 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
29281 *ret_conv = ChannelPublicKeys_read(ser_ref);
29282 return (uint64_t)ret_conv;
29285 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) {
29286 LDKPublicKey per_commitment_point_ref;
29287 CHECK(per_commitment_point->arr_len == 33);
29288 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
29289 LDKPublicKey broadcaster_delayed_payment_base_ref;
29290 CHECK(broadcaster_delayed_payment_base->arr_len == 33);
29291 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33);
29292 LDKPublicKey broadcaster_htlc_base_ref;
29293 CHECK(broadcaster_htlc_base->arr_len == 33);
29294 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33);
29295 LDKPublicKey countersignatory_revocation_base_ref;
29296 CHECK(countersignatory_revocation_base->arr_len == 33);
29297 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33);
29298 LDKPublicKey countersignatory_htlc_base_ref;
29299 CHECK(countersignatory_htlc_base->arr_len == 33);
29300 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33);
29301 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
29302 *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);
29303 return (uint64_t)ret_conv;
29306 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) {
29307 LDKPublicKey per_commitment_point_ref;
29308 CHECK(per_commitment_point->arr_len == 33);
29309 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
29310 LDKChannelPublicKeys broadcaster_keys_conv;
29311 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
29312 broadcaster_keys_conv.is_owned = false;
29313 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
29314 LDKChannelPublicKeys countersignatory_keys_conv;
29315 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
29316 countersignatory_keys_conv.is_owned = false;
29317 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
29318 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
29319 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
29320 return (uint64_t)ret_conv;
29323 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) {
29324 LDKPublicKey revocation_key_ref;
29325 CHECK(revocation_key->arr_len == 33);
29326 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33);
29327 LDKPublicKey broadcaster_delayed_payment_key_ref;
29328 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
29329 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33);
29330 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
29331 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29332 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29333 CVec_u8Z_free(ret_var);
29337 void __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
29338 LDKHTLCOutputInCommitment this_obj_conv;
29339 this_obj_conv.inner = (void*)(this_obj & (~1));
29340 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29342 HTLCOutputInCommitment_free(this_obj_conv);
29345 jboolean __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
29346 LDKHTLCOutputInCommitment this_ptr_conv;
29347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29348 this_ptr_conv.is_owned = false;
29349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29350 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
29354 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
29355 LDKHTLCOutputInCommitment this_ptr_conv;
29356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29357 this_ptr_conv.is_owned = false;
29358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29359 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
29362 int64_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
29363 LDKHTLCOutputInCommitment this_ptr_conv;
29364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29365 this_ptr_conv.is_owned = false;
29366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29367 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
29371 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
29372 LDKHTLCOutputInCommitment this_ptr_conv;
29373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29374 this_ptr_conv.is_owned = false;
29375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29376 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
29379 int32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
29380 LDKHTLCOutputInCommitment this_ptr_conv;
29381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29382 this_ptr_conv.is_owned = false;
29383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29384 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
29388 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
29389 LDKHTLCOutputInCommitment this_ptr_conv;
29390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29391 this_ptr_conv.is_owned = false;
29392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29393 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
29396 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
29397 LDKHTLCOutputInCommitment this_ptr_conv;
29398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29399 this_ptr_conv.is_owned = false;
29400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29401 int8_tArray ret_arr = init_int8_tArray(32);
29402 memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
29406 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
29407 LDKHTLCOutputInCommitment this_ptr_conv;
29408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29409 this_ptr_conv.is_owned = false;
29410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29411 LDKThirtyTwoBytes val_ref;
29412 CHECK(val->arr_len == 32);
29413 memcpy(val_ref.data, val->elems, 32);
29414 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
29417 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
29418 LDKHTLCOutputInCommitment this_ptr_conv;
29419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29420 this_ptr_conv.is_owned = false;
29421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29422 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
29423 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
29424 uint64_t ret_ref = (uint64_t)ret_copy;
29428 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
29429 LDKHTLCOutputInCommitment this_ptr_conv;
29430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29431 this_ptr_conv.is_owned = false;
29432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29433 void* val_ptr = (void*)(((uint64_t)val) & ~1);
29434 CHECK_ACCESS(val_ptr);
29435 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
29436 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
29437 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
29440 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) {
29441 LDKThirtyTwoBytes payment_hash_arg_ref;
29442 CHECK(payment_hash_arg->arr_len == 32);
29443 memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32);
29444 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
29445 CHECK_ACCESS(transaction_output_index_arg_ptr);
29446 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
29447 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
29448 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
29449 uint64_t ret_ref = 0;
29450 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29451 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29453 ret_ref = (uint64_t)ret_var.inner;
29454 if (ret_var.is_owned) {
29460 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
29461 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
29462 uint64_t ret_ref = 0;
29463 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29464 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29466 ret_ref = (uint64_t)ret_var.inner;
29467 if (ret_var.is_owned) {
29472 int64_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
29473 LDKHTLCOutputInCommitment arg_conv;
29474 arg_conv.inner = (void*)(arg & (~1));
29475 arg_conv.is_owned = false;
29476 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29477 int64_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
29481 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
29482 LDKHTLCOutputInCommitment orig_conv;
29483 orig_conv.inner = (void*)(orig & (~1));
29484 orig_conv.is_owned = false;
29485 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29486 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
29487 uint64_t ret_ref = 0;
29488 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29489 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29491 ret_ref = (uint64_t)ret_var.inner;
29492 if (ret_var.is_owned) {
29498 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
29499 LDKHTLCOutputInCommitment obj_conv;
29500 obj_conv.inner = (void*)(obj & (~1));
29501 obj_conv.is_owned = false;
29502 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29503 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
29504 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29505 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29506 CVec_u8Z_free(ret_var);
29510 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
29511 LDKu8slice ser_ref;
29512 ser_ref.datalen = ser->arr_len;
29513 ser_ref.data = ser->elems;
29514 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29515 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
29516 return (uint64_t)ret_conv;
29519 int8_tArray __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) {
29520 LDKHTLCOutputInCommitment htlc_conv;
29521 htlc_conv.inner = (void*)(htlc & (~1));
29522 htlc_conv.is_owned = false;
29523 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29524 LDKTxCreationKeys keys_conv;
29525 keys_conv.inner = (void*)(keys & (~1));
29526 keys_conv.is_owned = false;
29527 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
29528 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
29529 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29530 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29531 CVec_u8Z_free(ret_var);
29535 int8_tArray __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
29536 LDKPublicKey broadcaster_ref;
29537 CHECK(broadcaster->arr_len == 33);
29538 memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33);
29539 LDKPublicKey countersignatory_ref;
29540 CHECK(countersignatory->arr_len == 33);
29541 memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33);
29542 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
29543 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29544 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29545 CVec_u8Z_free(ret_var);
29549 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) {
29550 unsigned char commitment_txid_arr[32];
29551 CHECK(commitment_txid->arr_len == 32);
29552 memcpy(commitment_txid_arr, commitment_txid->elems, 32);
29553 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
29554 LDKHTLCOutputInCommitment htlc_conv;
29555 htlc_conv.inner = (void*)(htlc & (~1));
29556 htlc_conv.is_owned = false;
29557 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29558 LDKPublicKey broadcaster_delayed_payment_key_ref;
29559 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
29560 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33);
29561 LDKPublicKey revocation_key_ref;
29562 CHECK(revocation_key->arr_len == 33);
29563 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33);
29564 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);
29565 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29566 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29567 Transaction_free(ret_var);
29571 int8_tArray __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
29572 LDKPublicKey funding_pubkey_ref;
29573 CHECK(funding_pubkey->arr_len == 33);
29574 memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33);
29575 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
29576 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29577 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29578 CVec_u8Z_free(ret_var);
29582 void __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
29583 LDKChannelTransactionParameters this_obj_conv;
29584 this_obj_conv.inner = (void*)(this_obj & (~1));
29585 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29587 ChannelTransactionParameters_free(this_obj_conv);
29590 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
29591 LDKChannelTransactionParameters this_ptr_conv;
29592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29593 this_ptr_conv.is_owned = false;
29594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29595 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
29596 uint64_t ret_ref = 0;
29597 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29598 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29600 ret_ref = (uint64_t)ret_var.inner;
29601 if (ret_var.is_owned) {
29607 void __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
29608 LDKChannelTransactionParameters this_ptr_conv;
29609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29610 this_ptr_conv.is_owned = false;
29611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29612 LDKChannelPublicKeys val_conv;
29613 val_conv.inner = (void*)(val & (~1));
29614 val_conv.is_owned = (val & 1) || (val == 0);
29615 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29616 val_conv = ChannelPublicKeys_clone(&val_conv);
29617 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
29620 int16_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
29621 LDKChannelTransactionParameters this_ptr_conv;
29622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29623 this_ptr_conv.is_owned = false;
29624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29625 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
29629 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) {
29630 LDKChannelTransactionParameters this_ptr_conv;
29631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29632 this_ptr_conv.is_owned = false;
29633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29634 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
29637 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
29638 LDKChannelTransactionParameters this_ptr_conv;
29639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29640 this_ptr_conv.is_owned = false;
29641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29642 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
29646 void __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
29647 LDKChannelTransactionParameters this_ptr_conv;
29648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29649 this_ptr_conv.is_owned = false;
29650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29651 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
29654 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
29655 LDKChannelTransactionParameters this_ptr_conv;
29656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29657 this_ptr_conv.is_owned = false;
29658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29659 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
29660 uint64_t ret_ref = 0;
29661 if ((uint64_t)ret_var.inner > 4096) {
29662 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29663 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29665 ret_ref = (uint64_t)ret_var.inner;
29666 if (ret_var.is_owned) {
29673 void __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
29674 LDKChannelTransactionParameters this_ptr_conv;
29675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29676 this_ptr_conv.is_owned = false;
29677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29678 LDKCounterpartyChannelTransactionParameters val_conv;
29679 val_conv.inner = (void*)(val & (~1));
29680 val_conv.is_owned = (val & 1) || (val == 0);
29681 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29682 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
29683 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
29686 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
29687 LDKChannelTransactionParameters this_ptr_conv;
29688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29689 this_ptr_conv.is_owned = false;
29690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29691 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
29692 uint64_t ret_ref = 0;
29693 if ((uint64_t)ret_var.inner > 4096) {
29694 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29695 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29697 ret_ref = (uint64_t)ret_var.inner;
29698 if (ret_var.is_owned) {
29705 void __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
29706 LDKChannelTransactionParameters this_ptr_conv;
29707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29708 this_ptr_conv.is_owned = false;
29709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29710 LDKOutPoint val_conv;
29711 val_conv.inner = (void*)(val & (~1));
29712 val_conv.is_owned = (val & 1) || (val == 0);
29713 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29714 val_conv = OutPoint_clone(&val_conv);
29715 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
29718 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) {
29719 LDKChannelTransactionParameters this_ptr_conv;
29720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29721 this_ptr_conv.is_owned = false;
29722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29723 uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
29727 void __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) {
29728 LDKChannelTransactionParameters this_ptr_conv;
29729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29730 this_ptr_conv.is_owned = false;
29731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29732 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
29733 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
29736 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) {
29737 LDKChannelPublicKeys holder_pubkeys_arg_conv;
29738 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
29739 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
29740 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
29741 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
29742 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
29743 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
29744 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
29745 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
29746 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
29747 LDKOutPoint funding_outpoint_arg_conv;
29748 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
29749 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
29750 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
29751 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
29752 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
29753 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);
29754 uint64_t ret_ref = 0;
29755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29758 ret_ref = (uint64_t)ret_var.inner;
29759 if (ret_var.is_owned) {
29765 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
29766 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
29767 uint64_t ret_ref = 0;
29768 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29769 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29771 ret_ref = (uint64_t)ret_var.inner;
29772 if (ret_var.is_owned) {
29777 int64_t __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
29778 LDKChannelTransactionParameters arg_conv;
29779 arg_conv.inner = (void*)(arg & (~1));
29780 arg_conv.is_owned = false;
29781 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29782 int64_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
29786 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
29787 LDKChannelTransactionParameters orig_conv;
29788 orig_conv.inner = (void*)(orig & (~1));
29789 orig_conv.is_owned = false;
29790 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29791 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
29792 uint64_t ret_ref = 0;
29793 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29794 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29796 ret_ref = (uint64_t)ret_var.inner;
29797 if (ret_var.is_owned) {
29803 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
29804 LDKCounterpartyChannelTransactionParameters this_obj_conv;
29805 this_obj_conv.inner = (void*)(this_obj & (~1));
29806 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29808 CounterpartyChannelTransactionParameters_free(this_obj_conv);
29811 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
29812 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29814 this_ptr_conv.is_owned = false;
29815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29816 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
29817 uint64_t ret_ref = 0;
29818 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29819 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29821 ret_ref = (uint64_t)ret_var.inner;
29822 if (ret_var.is_owned) {
29828 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
29829 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29831 this_ptr_conv.is_owned = false;
29832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29833 LDKChannelPublicKeys val_conv;
29834 val_conv.inner = (void*)(val & (~1));
29835 val_conv.is_owned = (val & 1) || (val == 0);
29836 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29837 val_conv = ChannelPublicKeys_clone(&val_conv);
29838 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
29841 int16_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
29842 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29844 this_ptr_conv.is_owned = false;
29845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29846 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
29850 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29851 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29853 this_ptr_conv.is_owned = false;
29854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29855 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
29858 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
29859 LDKChannelPublicKeys pubkeys_arg_conv;
29860 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
29861 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
29862 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
29863 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
29864 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
29865 uint64_t ret_ref = 0;
29866 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29867 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29869 ret_ref = (uint64_t)ret_var.inner;
29870 if (ret_var.is_owned) {
29876 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
29877 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
29878 uint64_t ret_ref = 0;
29879 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29880 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29882 ret_ref = (uint64_t)ret_var.inner;
29883 if (ret_var.is_owned) {
29888 int64_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
29889 LDKCounterpartyChannelTransactionParameters arg_conv;
29890 arg_conv.inner = (void*)(arg & (~1));
29891 arg_conv.is_owned = false;
29892 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29893 int64_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
29897 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
29898 LDKCounterpartyChannelTransactionParameters orig_conv;
29899 orig_conv.inner = (void*)(orig & (~1));
29900 orig_conv.is_owned = false;
29901 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29902 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
29903 uint64_t ret_ref = 0;
29904 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29905 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29906 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29907 ret_ref = (uint64_t)ret_var.inner;
29908 if (ret_var.is_owned) {
29914 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
29915 LDKChannelTransactionParameters this_arg_conv;
29916 this_arg_conv.inner = (void*)(this_arg & (~1));
29917 this_arg_conv.is_owned = false;
29918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29919 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
29923 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
29924 LDKChannelTransactionParameters this_arg_conv;
29925 this_arg_conv.inner = (void*)(this_arg & (~1));
29926 this_arg_conv.is_owned = false;
29927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29928 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
29929 uint64_t ret_ref = 0;
29930 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29931 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29932 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29933 ret_ref = (uint64_t)ret_var.inner;
29934 if (ret_var.is_owned) {
29940 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
29941 LDKChannelTransactionParameters this_arg_conv;
29942 this_arg_conv.inner = (void*)(this_arg & (~1));
29943 this_arg_conv.is_owned = false;
29944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29945 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
29946 uint64_t ret_ref = 0;
29947 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29948 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29949 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29950 ret_ref = (uint64_t)ret_var.inner;
29951 if (ret_var.is_owned) {
29957 int8_tArray __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
29958 LDKCounterpartyChannelTransactionParameters obj_conv;
29959 obj_conv.inner = (void*)(obj & (~1));
29960 obj_conv.is_owned = false;
29961 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29962 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
29963 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29964 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29965 CVec_u8Z_free(ret_var);
29969 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
29970 LDKu8slice ser_ref;
29971 ser_ref.datalen = ser->arr_len;
29972 ser_ref.data = ser->elems;
29973 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29974 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
29975 return (uint64_t)ret_conv;
29978 int8_tArray __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
29979 LDKChannelTransactionParameters obj_conv;
29980 obj_conv.inner = (void*)(obj & (~1));
29981 obj_conv.is_owned = false;
29982 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29983 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
29984 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29985 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29986 CVec_u8Z_free(ret_var);
29990 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
29991 LDKu8slice ser_ref;
29992 ser_ref.datalen = ser->arr_len;
29993 ser_ref.data = ser->elems;
29994 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29995 *ret_conv = ChannelTransactionParameters_read(ser_ref);
29996 return (uint64_t)ret_conv;
29999 void __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
30000 LDKDirectedChannelTransactionParameters this_obj_conv;
30001 this_obj_conv.inner = (void*)(this_obj & (~1));
30002 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30004 DirectedChannelTransactionParameters_free(this_obj_conv);
30007 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
30008 LDKDirectedChannelTransactionParameters this_arg_conv;
30009 this_arg_conv.inner = (void*)(this_arg & (~1));
30010 this_arg_conv.is_owned = false;
30011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30012 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
30013 uint64_t ret_ref = 0;
30014 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30015 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30016 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30017 ret_ref = (uint64_t)ret_var.inner;
30018 if (ret_var.is_owned) {
30024 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
30025 LDKDirectedChannelTransactionParameters this_arg_conv;
30026 this_arg_conv.inner = (void*)(this_arg & (~1));
30027 this_arg_conv.is_owned = false;
30028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30029 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
30030 uint64_t ret_ref = 0;
30031 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30032 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30034 ret_ref = (uint64_t)ret_var.inner;
30035 if (ret_var.is_owned) {
30041 int16_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
30042 LDKDirectedChannelTransactionParameters this_arg_conv;
30043 this_arg_conv.inner = (void*)(this_arg & (~1));
30044 this_arg_conv.is_owned = false;
30045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30046 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
30050 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
30051 LDKDirectedChannelTransactionParameters this_arg_conv;
30052 this_arg_conv.inner = (void*)(this_arg & (~1));
30053 this_arg_conv.is_owned = false;
30054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30055 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
30059 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
30060 LDKDirectedChannelTransactionParameters this_arg_conv;
30061 this_arg_conv.inner = (void*)(this_arg & (~1));
30062 this_arg_conv.is_owned = false;
30063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30064 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
30065 uint64_t ret_ref = 0;
30066 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30067 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30068 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30069 ret_ref = (uint64_t)ret_var.inner;
30070 if (ret_var.is_owned) {
30076 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) {
30077 LDKDirectedChannelTransactionParameters this_arg_conv;
30078 this_arg_conv.inner = (void*)(this_arg & (~1));
30079 this_arg_conv.is_owned = false;
30080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30081 jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
30085 void __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
30086 LDKHolderCommitmentTransaction this_obj_conv;
30087 this_obj_conv.inner = (void*)(this_obj & (~1));
30088 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30090 HolderCommitmentTransaction_free(this_obj_conv);
30093 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
30094 LDKHolderCommitmentTransaction this_ptr_conv;
30095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30096 this_ptr_conv.is_owned = false;
30097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30098 int8_tArray ret_arr = init_int8_tArray(64);
30099 memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
30103 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
30104 LDKHolderCommitmentTransaction this_ptr_conv;
30105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30106 this_ptr_conv.is_owned = false;
30107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30108 LDKSignature val_ref;
30109 CHECK(val->arr_len == 64);
30110 memcpy(val_ref.compact_form, val->elems, 64);
30111 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
30114 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
30115 LDKHolderCommitmentTransaction this_ptr_conv;
30116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30117 this_ptr_conv.is_owned = false;
30118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30119 LDKCVec_SignatureZ val_constr;
30120 val_constr.datalen = val->arr_len;
30121 if (val_constr.datalen > 0)
30122 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30124 val_constr.data = NULL;
30125 int8_tArray* val_vals = (void*) val->elems;
30126 for (size_t m = 0; m < val_constr.datalen; m++) {
30127 int8_tArray val_conv_12 = val_vals[m];
30128 LDKSignature val_conv_12_ref;
30129 CHECK(val_conv_12->arr_len == 64);
30130 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64);
30131 val_constr.data[m] = val_conv_12_ref;
30133 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
30136 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
30137 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
30138 uint64_t ret_ref = 0;
30139 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30140 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30141 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30142 ret_ref = (uint64_t)ret_var.inner;
30143 if (ret_var.is_owned) {
30148 int64_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
30149 LDKHolderCommitmentTransaction arg_conv;
30150 arg_conv.inner = (void*)(arg & (~1));
30151 arg_conv.is_owned = false;
30152 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30153 int64_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
30157 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
30158 LDKHolderCommitmentTransaction orig_conv;
30159 orig_conv.inner = (void*)(orig & (~1));
30160 orig_conv.is_owned = false;
30161 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30162 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
30163 uint64_t ret_ref = 0;
30164 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30165 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30167 ret_ref = (uint64_t)ret_var.inner;
30168 if (ret_var.is_owned) {
30174 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
30175 LDKHolderCommitmentTransaction obj_conv;
30176 obj_conv.inner = (void*)(obj & (~1));
30177 obj_conv.is_owned = false;
30178 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30179 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
30180 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30181 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30182 CVec_u8Z_free(ret_var);
30186 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
30187 LDKu8slice ser_ref;
30188 ser_ref.datalen = ser->arr_len;
30189 ser_ref.data = ser->elems;
30190 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
30191 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
30192 return (uint64_t)ret_conv;
30195 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) {
30196 LDKCommitmentTransaction commitment_tx_conv;
30197 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
30198 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
30199 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
30200 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
30201 LDKSignature counterparty_sig_ref;
30202 CHECK(counterparty_sig->arr_len == 64);
30203 memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64);
30204 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
30205 counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
30206 if (counterparty_htlc_sigs_constr.datalen > 0)
30207 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30209 counterparty_htlc_sigs_constr.data = NULL;
30210 int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
30211 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
30212 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
30213 LDKSignature counterparty_htlc_sigs_conv_12_ref;
30214 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
30215 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64);
30216 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
30218 LDKPublicKey holder_funding_key_ref;
30219 CHECK(holder_funding_key->arr_len == 33);
30220 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33);
30221 LDKPublicKey counterparty_funding_key_ref;
30222 CHECK(counterparty_funding_key->arr_len == 33);
30223 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33);
30224 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
30225 uint64_t ret_ref = 0;
30226 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30227 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30228 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30229 ret_ref = (uint64_t)ret_var.inner;
30230 if (ret_var.is_owned) {
30236 void __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
30237 LDKBuiltCommitmentTransaction this_obj_conv;
30238 this_obj_conv.inner = (void*)(this_obj & (~1));
30239 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30241 BuiltCommitmentTransaction_free(this_obj_conv);
30244 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
30245 LDKBuiltCommitmentTransaction this_ptr_conv;
30246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30247 this_ptr_conv.is_owned = false;
30248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30249 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
30250 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30251 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30252 Transaction_free(ret_var);
30256 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
30257 LDKBuiltCommitmentTransaction this_ptr_conv;
30258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30259 this_ptr_conv.is_owned = false;
30260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30261 LDKTransaction val_ref;
30262 val_ref.datalen = val->arr_len;
30263 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
30264 memcpy(val_ref.data, val->elems, val_ref.datalen);
30265 val_ref.data_is_owned = true;
30266 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
30269 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
30270 LDKBuiltCommitmentTransaction this_ptr_conv;
30271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30272 this_ptr_conv.is_owned = false;
30273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30274 int8_tArray ret_arr = init_int8_tArray(32);
30275 memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
30279 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
30280 LDKBuiltCommitmentTransaction this_ptr_conv;
30281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30282 this_ptr_conv.is_owned = false;
30283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30284 LDKThirtyTwoBytes val_ref;
30285 CHECK(val->arr_len == 32);
30286 memcpy(val_ref.data, val->elems, 32);
30287 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
30290 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
30291 LDKTransaction transaction_arg_ref;
30292 transaction_arg_ref.datalen = transaction_arg->arr_len;
30293 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
30294 memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen);
30295 transaction_arg_ref.data_is_owned = true;
30296 LDKThirtyTwoBytes txid_arg_ref;
30297 CHECK(txid_arg->arr_len == 32);
30298 memcpy(txid_arg_ref.data, txid_arg->elems, 32);
30299 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
30300 uint64_t ret_ref = 0;
30301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30304 ret_ref = (uint64_t)ret_var.inner;
30305 if (ret_var.is_owned) {
30311 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
30312 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
30313 uint64_t ret_ref = 0;
30314 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30315 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30316 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30317 ret_ref = (uint64_t)ret_var.inner;
30318 if (ret_var.is_owned) {
30323 int64_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
30324 LDKBuiltCommitmentTransaction arg_conv;
30325 arg_conv.inner = (void*)(arg & (~1));
30326 arg_conv.is_owned = false;
30327 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30328 int64_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
30332 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
30333 LDKBuiltCommitmentTransaction orig_conv;
30334 orig_conv.inner = (void*)(orig & (~1));
30335 orig_conv.is_owned = false;
30336 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30337 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
30338 uint64_t ret_ref = 0;
30339 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30340 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30341 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30342 ret_ref = (uint64_t)ret_var.inner;
30343 if (ret_var.is_owned) {
30349 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
30350 LDKBuiltCommitmentTransaction obj_conv;
30351 obj_conv.inner = (void*)(obj & (~1));
30352 obj_conv.is_owned = false;
30353 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30354 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
30355 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30356 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30357 CVec_u8Z_free(ret_var);
30361 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
30362 LDKu8slice ser_ref;
30363 ser_ref.datalen = ser->arr_len;
30364 ser_ref.data = ser->elems;
30365 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
30366 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
30367 return (uint64_t)ret_conv;
30370 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) {
30371 LDKBuiltCommitmentTransaction this_arg_conv;
30372 this_arg_conv.inner = (void*)(this_arg & (~1));
30373 this_arg_conv.is_owned = false;
30374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30375 LDKu8slice funding_redeemscript_ref;
30376 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30377 funding_redeemscript_ref.data = funding_redeemscript->elems;
30378 int8_tArray ret_arr = init_int8_tArray(32);
30379 memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
30383 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) {
30384 LDKBuiltCommitmentTransaction this_arg_conv;
30385 this_arg_conv.inner = (void*)(this_arg & (~1));
30386 this_arg_conv.is_owned = false;
30387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30388 unsigned char funding_key_arr[32];
30389 CHECK(funding_key->arr_len == 32);
30390 memcpy(funding_key_arr, funding_key->elems, 32);
30391 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
30392 LDKu8slice funding_redeemscript_ref;
30393 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30394 funding_redeemscript_ref.data = funding_redeemscript->elems;
30395 int8_tArray ret_arr = init_int8_tArray(64);
30396 memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
30400 void __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint32_t this_obj) {
30401 LDKClosingTransaction this_obj_conv;
30402 this_obj_conv.inner = (void*)(this_obj & (~1));
30403 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30405 ClosingTransaction_free(this_obj_conv);
30408 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
30409 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
30410 uint64_t ret_ref = 0;
30411 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30412 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30414 ret_ref = (uint64_t)ret_var.inner;
30415 if (ret_var.is_owned) {
30420 int64_t __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
30421 LDKClosingTransaction arg_conv;
30422 arg_conv.inner = (void*)(arg & (~1));
30423 arg_conv.is_owned = false;
30424 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30425 int64_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
30429 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint32_t orig) {
30430 LDKClosingTransaction orig_conv;
30431 orig_conv.inner = (void*)(orig & (~1));
30432 orig_conv.is_owned = false;
30433 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30434 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
30435 uint64_t ret_ref = 0;
30436 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30437 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30439 ret_ref = (uint64_t)ret_var.inner;
30440 if (ret_var.is_owned) {
30446 int64_t __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint32_t o) {
30447 LDKClosingTransaction o_conv;
30448 o_conv.inner = (void*)(o & (~1));
30449 o_conv.is_owned = false;
30450 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30451 int64_t ret_val = ClosingTransaction_hash(&o_conv);
30455 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) {
30456 LDKCVec_u8Z to_holder_script_ref;
30457 to_holder_script_ref.datalen = to_holder_script->arr_len;
30458 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
30459 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen);
30460 LDKCVec_u8Z to_counterparty_script_ref;
30461 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
30462 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
30463 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen);
30464 LDKOutPoint funding_outpoint_conv;
30465 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
30466 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
30467 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
30468 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
30469 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
30470 uint64_t ret_ref = 0;
30471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30474 ret_ref = (uint64_t)ret_var.inner;
30475 if (ret_var.is_owned) {
30481 uint32_t __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
30482 LDKClosingTransaction this_arg_conv;
30483 this_arg_conv.inner = (void*)(this_arg & (~1));
30484 this_arg_conv.is_owned = false;
30485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30486 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
30487 uint64_t ret_ref = 0;
30488 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30489 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30491 ret_ref = (uint64_t)ret_var.inner;
30492 if (ret_var.is_owned) {
30498 uint32_t __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
30499 LDKClosingTransaction this_arg_conv;
30500 this_arg_conv.inner = (void*)(this_arg & (~1));
30501 this_arg_conv.is_owned = false;
30502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30503 LDKOutPoint funding_outpoint_conv;
30504 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
30505 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
30506 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
30507 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
30508 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
30509 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
30510 return (uint64_t)ret_conv;
30513 int64_t __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
30514 LDKClosingTransaction this_arg_conv;
30515 this_arg_conv.inner = (void*)(this_arg & (~1));
30516 this_arg_conv.is_owned = false;
30517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30518 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
30522 int64_t __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
30523 LDKClosingTransaction this_arg_conv;
30524 this_arg_conv.inner = (void*)(this_arg & (~1));
30525 this_arg_conv.is_owned = false;
30526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30527 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
30531 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
30532 LDKClosingTransaction this_arg_conv;
30533 this_arg_conv.inner = (void*)(this_arg & (~1));
30534 this_arg_conv.is_owned = false;
30535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30536 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
30537 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30538 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30542 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
30543 LDKClosingTransaction this_arg_conv;
30544 this_arg_conv.inner = (void*)(this_arg & (~1));
30545 this_arg_conv.is_owned = false;
30546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30547 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
30548 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30549 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30553 void __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
30554 LDKTrustedClosingTransaction this_obj_conv;
30555 this_obj_conv.inner = (void*)(this_obj & (~1));
30556 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30558 TrustedClosingTransaction_free(this_obj_conv);
30561 int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
30562 LDKTrustedClosingTransaction this_arg_conv;
30563 this_arg_conv.inner = (void*)(this_arg & (~1));
30564 this_arg_conv.is_owned = false;
30565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30566 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
30567 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30568 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30569 Transaction_free(ret_var);
30573 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) {
30574 LDKTrustedClosingTransaction this_arg_conv;
30575 this_arg_conv.inner = (void*)(this_arg & (~1));
30576 this_arg_conv.is_owned = false;
30577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30578 LDKu8slice funding_redeemscript_ref;
30579 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30580 funding_redeemscript_ref.data = funding_redeemscript->elems;
30581 int8_tArray ret_arr = init_int8_tArray(32);
30582 memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
30586 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) {
30587 LDKTrustedClosingTransaction this_arg_conv;
30588 this_arg_conv.inner = (void*)(this_arg & (~1));
30589 this_arg_conv.is_owned = false;
30590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30591 unsigned char funding_key_arr[32];
30592 CHECK(funding_key->arr_len == 32);
30593 memcpy(funding_key_arr, funding_key->elems, 32);
30594 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
30595 LDKu8slice funding_redeemscript_ref;
30596 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30597 funding_redeemscript_ref.data = funding_redeemscript->elems;
30598 int8_tArray ret_arr = init_int8_tArray(64);
30599 memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
30603 void __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
30604 LDKCommitmentTransaction this_obj_conv;
30605 this_obj_conv.inner = (void*)(this_obj & (~1));
30606 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30608 CommitmentTransaction_free(this_obj_conv);
30611 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
30612 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
30613 uint64_t ret_ref = 0;
30614 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30615 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30617 ret_ref = (uint64_t)ret_var.inner;
30618 if (ret_var.is_owned) {
30623 int64_t __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
30624 LDKCommitmentTransaction arg_conv;
30625 arg_conv.inner = (void*)(arg & (~1));
30626 arg_conv.is_owned = false;
30627 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30628 int64_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
30632 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint32_t orig) {
30633 LDKCommitmentTransaction orig_conv;
30634 orig_conv.inner = (void*)(orig & (~1));
30635 orig_conv.is_owned = false;
30636 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30637 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
30638 uint64_t ret_ref = 0;
30639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30641 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30642 ret_ref = (uint64_t)ret_var.inner;
30643 if (ret_var.is_owned) {
30649 int8_tArray __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint32_t obj) {
30650 LDKCommitmentTransaction obj_conv;
30651 obj_conv.inner = (void*)(obj & (~1));
30652 obj_conv.is_owned = false;
30653 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30654 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
30655 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30656 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30657 CVec_u8Z_free(ret_var);
30661 uint32_t __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
30662 LDKu8slice ser_ref;
30663 ser_ref.datalen = ser->arr_len;
30664 ser_ref.data = ser->elems;
30665 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30666 *ret_conv = CommitmentTransaction_read(ser_ref);
30667 return (uint64_t)ret_conv;
30670 int64_t __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
30671 LDKCommitmentTransaction this_arg_conv;
30672 this_arg_conv.inner = (void*)(this_arg & (~1));
30673 this_arg_conv.is_owned = false;
30674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30675 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
30679 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
30680 LDKCommitmentTransaction this_arg_conv;
30681 this_arg_conv.inner = (void*)(this_arg & (~1));
30682 this_arg_conv.is_owned = false;
30683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30684 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
30688 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
30689 LDKCommitmentTransaction this_arg_conv;
30690 this_arg_conv.inner = (void*)(this_arg & (~1));
30691 this_arg_conv.is_owned = false;
30692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30693 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
30697 int32_t __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
30698 LDKCommitmentTransaction this_arg_conv;
30699 this_arg_conv.inner = (void*)(this_arg & (~1));
30700 this_arg_conv.is_owned = false;
30701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30702 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
30706 uint32_t __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
30707 LDKCommitmentTransaction this_arg_conv;
30708 this_arg_conv.inner = (void*)(this_arg & (~1));
30709 this_arg_conv.is_owned = false;
30710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30711 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
30712 uint64_t ret_ref = 0;
30713 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30714 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30715 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30716 ret_ref = (uint64_t)ret_var.inner;
30717 if (ret_var.is_owned) {
30723 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) {
30724 LDKCommitmentTransaction this_arg_conv;
30725 this_arg_conv.inner = (void*)(this_arg & (~1));
30726 this_arg_conv.is_owned = false;
30727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30728 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30729 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30730 channel_parameters_conv.is_owned = false;
30731 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30732 LDKChannelPublicKeys broadcaster_keys_conv;
30733 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
30734 broadcaster_keys_conv.is_owned = false;
30735 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
30736 LDKChannelPublicKeys countersignatory_keys_conv;
30737 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
30738 countersignatory_keys_conv.is_owned = false;
30739 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
30740 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
30741 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
30742 return (uint64_t)ret_conv;
30745 void __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
30746 LDKTrustedCommitmentTransaction this_obj_conv;
30747 this_obj_conv.inner = (void*)(this_obj & (~1));
30748 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30750 TrustedCommitmentTransaction_free(this_obj_conv);
30753 int8_tArray __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
30754 LDKTrustedCommitmentTransaction this_arg_conv;
30755 this_arg_conv.inner = (void*)(this_arg & (~1));
30756 this_arg_conv.is_owned = false;
30757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30758 int8_tArray ret_arr = init_int8_tArray(32);
30759 memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
30763 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
30764 LDKTrustedCommitmentTransaction this_arg_conv;
30765 this_arg_conv.inner = (void*)(this_arg & (~1));
30766 this_arg_conv.is_owned = false;
30767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30768 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
30769 uint64_t ret_ref = 0;
30770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30773 ret_ref = (uint64_t)ret_var.inner;
30774 if (ret_var.is_owned) {
30780 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
30781 LDKTrustedCommitmentTransaction this_arg_conv;
30782 this_arg_conv.inner = (void*)(this_arg & (~1));
30783 this_arg_conv.is_owned = false;
30784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30785 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
30786 uint64_t ret_ref = 0;
30787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30789 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30790 ret_ref = (uint64_t)ret_var.inner;
30791 if (ret_var.is_owned) {
30797 jboolean __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) {
30798 LDKTrustedCommitmentTransaction this_arg_conv;
30799 this_arg_conv.inner = (void*)(this_arg & (~1));
30800 this_arg_conv.is_owned = false;
30801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30802 jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
30806 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) {
30807 LDKTrustedCommitmentTransaction this_arg_conv;
30808 this_arg_conv.inner = (void*)(this_arg & (~1));
30809 this_arg_conv.is_owned = false;
30810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30811 unsigned char htlc_base_key_arr[32];
30812 CHECK(htlc_base_key->arr_len == 32);
30813 memcpy(htlc_base_key_arr, htlc_base_key->elems, 32);
30814 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
30815 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30816 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30817 channel_parameters_conv.is_owned = false;
30818 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30819 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30820 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
30821 return (uint64_t)ret_conv;
30824 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) {
30825 LDKPublicKey broadcaster_payment_basepoint_ref;
30826 CHECK(broadcaster_payment_basepoint->arr_len == 33);
30827 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33);
30828 LDKPublicKey countersignatory_payment_basepoint_ref;
30829 CHECK(countersignatory_payment_basepoint->arr_len == 33);
30830 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33);
30831 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
30835 jboolean __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
30836 LDKInitFeatures a_conv;
30837 a_conv.inner = (void*)(a & (~1));
30838 a_conv.is_owned = false;
30839 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30840 LDKInitFeatures b_conv;
30841 b_conv.inner = (void*)(b & (~1));
30842 b_conv.is_owned = false;
30843 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30844 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
30848 jboolean __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
30849 LDKNodeFeatures a_conv;
30850 a_conv.inner = (void*)(a & (~1));
30851 a_conv.is_owned = false;
30852 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30853 LDKNodeFeatures b_conv;
30854 b_conv.inner = (void*)(b & (~1));
30855 b_conv.is_owned = false;
30856 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30857 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
30861 jboolean __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
30862 LDKChannelFeatures a_conv;
30863 a_conv.inner = (void*)(a & (~1));
30864 a_conv.is_owned = false;
30865 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30866 LDKChannelFeatures b_conv;
30867 b_conv.inner = (void*)(b & (~1));
30868 b_conv.is_owned = false;
30869 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30870 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
30874 jboolean __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
30875 LDKInvoiceFeatures a_conv;
30876 a_conv.inner = (void*)(a & (~1));
30877 a_conv.is_owned = false;
30878 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30879 LDKInvoiceFeatures b_conv;
30880 b_conv.inner = (void*)(b & (~1));
30881 b_conv.is_owned = false;
30882 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30883 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
30887 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) {
30888 LDKChannelTypeFeatures a_conv;
30889 a_conv.inner = (void*)(a & (~1));
30890 a_conv.is_owned = false;
30891 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30892 LDKChannelTypeFeatures b_conv;
30893 b_conv.inner = (void*)(b & (~1));
30894 b_conv.is_owned = false;
30895 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30896 jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv);
30900 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
30901 LDKInitFeatures ret_var = InitFeatures_clone(arg);
30902 uint64_t ret_ref = 0;
30903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30906 ret_ref = (uint64_t)ret_var.inner;
30907 if (ret_var.is_owned) {
30912 int64_t __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
30913 LDKInitFeatures arg_conv;
30914 arg_conv.inner = (void*)(arg & (~1));
30915 arg_conv.is_owned = false;
30916 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30917 int64_t ret_val = InitFeatures_clone_ptr(&arg_conv);
30921 uint32_t __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint32_t orig) {
30922 LDKInitFeatures orig_conv;
30923 orig_conv.inner = (void*)(orig & (~1));
30924 orig_conv.is_owned = false;
30925 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30926 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
30927 uint64_t ret_ref = 0;
30928 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30929 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30930 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30931 ret_ref = (uint64_t)ret_var.inner;
30932 if (ret_var.is_owned) {
30938 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
30939 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
30940 uint64_t ret_ref = 0;
30941 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30942 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30943 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30944 ret_ref = (uint64_t)ret_var.inner;
30945 if (ret_var.is_owned) {
30950 int64_t __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
30951 LDKNodeFeatures arg_conv;
30952 arg_conv.inner = (void*)(arg & (~1));
30953 arg_conv.is_owned = false;
30954 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30955 int64_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
30959 uint32_t __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint32_t orig) {
30960 LDKNodeFeatures orig_conv;
30961 orig_conv.inner = (void*)(orig & (~1));
30962 orig_conv.is_owned = false;
30963 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30964 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
30965 uint64_t ret_ref = 0;
30966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30969 ret_ref = (uint64_t)ret_var.inner;
30970 if (ret_var.is_owned) {
30976 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
30977 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
30978 uint64_t ret_ref = 0;
30979 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30980 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30981 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30982 ret_ref = (uint64_t)ret_var.inner;
30983 if (ret_var.is_owned) {
30988 int64_t __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
30989 LDKChannelFeatures arg_conv;
30990 arg_conv.inner = (void*)(arg & (~1));
30991 arg_conv.is_owned = false;
30992 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30993 int64_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
30997 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint32_t orig) {
30998 LDKChannelFeatures orig_conv;
30999 orig_conv.inner = (void*)(orig & (~1));
31000 orig_conv.is_owned = false;
31001 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31002 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
31003 uint64_t ret_ref = 0;
31004 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31005 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31007 ret_ref = (uint64_t)ret_var.inner;
31008 if (ret_var.is_owned) {
31014 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
31015 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
31016 uint64_t ret_ref = 0;
31017 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31018 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31020 ret_ref = (uint64_t)ret_var.inner;
31021 if (ret_var.is_owned) {
31026 int64_t __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
31027 LDKInvoiceFeatures arg_conv;
31028 arg_conv.inner = (void*)(arg & (~1));
31029 arg_conv.is_owned = false;
31030 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31031 int64_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
31035 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint32_t orig) {
31036 LDKInvoiceFeatures orig_conv;
31037 orig_conv.inner = (void*)(orig & (~1));
31038 orig_conv.is_owned = false;
31039 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31040 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
31041 uint64_t ret_ref = 0;
31042 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31043 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31045 ret_ref = (uint64_t)ret_var.inner;
31046 if (ret_var.is_owned) {
31052 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
31053 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
31054 uint64_t ret_ref = 0;
31055 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31056 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31058 ret_ref = (uint64_t)ret_var.inner;
31059 if (ret_var.is_owned) {
31064 int64_t __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) {
31065 LDKChannelTypeFeatures arg_conv;
31066 arg_conv.inner = (void*)(arg & (~1));
31067 arg_conv.is_owned = false;
31068 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31069 int64_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv);
31073 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint32_t orig) {
31074 LDKChannelTypeFeatures orig_conv;
31075 orig_conv.inner = (void*)(orig & (~1));
31076 orig_conv.is_owned = false;
31077 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31078 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
31079 uint64_t ret_ref = 0;
31080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31083 ret_ref = (uint64_t)ret_var.inner;
31084 if (ret_var.is_owned) {
31090 void __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint32_t this_obj) {
31091 LDKInitFeatures this_obj_conv;
31092 this_obj_conv.inner = (void*)(this_obj & (~1));
31093 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31095 InitFeatures_free(this_obj_conv);
31098 void __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint32_t this_obj) {
31099 LDKNodeFeatures this_obj_conv;
31100 this_obj_conv.inner = (void*)(this_obj & (~1));
31101 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31103 NodeFeatures_free(this_obj_conv);
31106 void __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint32_t this_obj) {
31107 LDKChannelFeatures this_obj_conv;
31108 this_obj_conv.inner = (void*)(this_obj & (~1));
31109 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31111 ChannelFeatures_free(this_obj_conv);
31114 void __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
31115 LDKInvoiceFeatures this_obj_conv;
31116 this_obj_conv.inner = (void*)(this_obj & (~1));
31117 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31119 InvoiceFeatures_free(this_obj_conv);
31122 void __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) {
31123 LDKChannelTypeFeatures this_obj_conv;
31124 this_obj_conv.inner = (void*)(this_obj & (~1));
31125 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31127 ChannelTypeFeatures_free(this_obj_conv);
31130 uint32_t __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
31131 LDKInitFeatures ret_var = InitFeatures_empty();
31132 uint64_t ret_ref = 0;
31133 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31134 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31136 ret_ref = (uint64_t)ret_var.inner;
31137 if (ret_var.is_owned) {
31143 uint32_t __attribute__((export_name("TS_InitFeatures_known"))) TS_InitFeatures_known() {
31144 LDKInitFeatures ret_var = InitFeatures_known();
31145 uint64_t ret_ref = 0;
31146 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31147 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31148 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31149 ret_ref = (uint64_t)ret_var.inner;
31150 if (ret_var.is_owned) {
31156 jboolean __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
31157 LDKInitFeatures this_arg_conv;
31158 this_arg_conv.inner = (void*)(this_arg & (~1));
31159 this_arg_conv.is_owned = false;
31160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31161 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
31165 uint32_t __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
31166 LDKNodeFeatures ret_var = NodeFeatures_empty();
31167 uint64_t ret_ref = 0;
31168 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31169 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31171 ret_ref = (uint64_t)ret_var.inner;
31172 if (ret_var.is_owned) {
31178 uint32_t __attribute__((export_name("TS_NodeFeatures_known"))) TS_NodeFeatures_known() {
31179 LDKNodeFeatures ret_var = NodeFeatures_known();
31180 uint64_t ret_ref = 0;
31181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31183 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31184 ret_ref = (uint64_t)ret_var.inner;
31185 if (ret_var.is_owned) {
31191 jboolean __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
31192 LDKNodeFeatures this_arg_conv;
31193 this_arg_conv.inner = (void*)(this_arg & (~1));
31194 this_arg_conv.is_owned = false;
31195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31196 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
31200 uint32_t __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
31201 LDKChannelFeatures ret_var = ChannelFeatures_empty();
31202 uint64_t ret_ref = 0;
31203 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31204 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31206 ret_ref = (uint64_t)ret_var.inner;
31207 if (ret_var.is_owned) {
31213 uint32_t __attribute__((export_name("TS_ChannelFeatures_known"))) TS_ChannelFeatures_known() {
31214 LDKChannelFeatures ret_var = ChannelFeatures_known();
31215 uint64_t ret_ref = 0;
31216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31219 ret_ref = (uint64_t)ret_var.inner;
31220 if (ret_var.is_owned) {
31226 jboolean __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
31227 LDKChannelFeatures this_arg_conv;
31228 this_arg_conv.inner = (void*)(this_arg & (~1));
31229 this_arg_conv.is_owned = false;
31230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31231 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
31235 uint32_t __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
31236 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
31237 uint64_t ret_ref = 0;
31238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31241 ret_ref = (uint64_t)ret_var.inner;
31242 if (ret_var.is_owned) {
31248 uint32_t __attribute__((export_name("TS_InvoiceFeatures_known"))) TS_InvoiceFeatures_known() {
31249 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
31250 uint64_t ret_ref = 0;
31251 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31252 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31254 ret_ref = (uint64_t)ret_var.inner;
31255 if (ret_var.is_owned) {
31261 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
31262 LDKInvoiceFeatures this_arg_conv;
31263 this_arg_conv.inner = (void*)(this_arg & (~1));
31264 this_arg_conv.is_owned = false;
31265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31266 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
31270 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
31271 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
31272 uint64_t ret_ref = 0;
31273 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31274 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31275 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31276 ret_ref = (uint64_t)ret_var.inner;
31277 if (ret_var.is_owned) {
31283 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_known"))) TS_ChannelTypeFeatures_known() {
31284 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
31285 uint64_t ret_ref = 0;
31286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31289 ret_ref = (uint64_t)ret_var.inner;
31290 if (ret_var.is_owned) {
31296 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) {
31297 LDKChannelTypeFeatures this_arg_conv;
31298 this_arg_conv.inner = (void*)(this_arg & (~1));
31299 this_arg_conv.is_owned = false;
31300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31301 jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
31305 int8_tArray __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint32_t obj) {
31306 LDKInitFeatures obj_conv;
31307 obj_conv.inner = (void*)(obj & (~1));
31308 obj_conv.is_owned = false;
31309 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31310 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
31311 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31312 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31313 CVec_u8Z_free(ret_var);
31317 uint32_t __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
31318 LDKu8slice ser_ref;
31319 ser_ref.datalen = ser->arr_len;
31320 ser_ref.data = ser->elems;
31321 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
31322 *ret_conv = InitFeatures_read(ser_ref);
31323 return (uint64_t)ret_conv;
31326 int8_tArray __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint32_t obj) {
31327 LDKChannelFeatures obj_conv;
31328 obj_conv.inner = (void*)(obj & (~1));
31329 obj_conv.is_owned = false;
31330 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31331 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
31332 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31333 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31334 CVec_u8Z_free(ret_var);
31338 uint32_t __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
31339 LDKu8slice ser_ref;
31340 ser_ref.datalen = ser->arr_len;
31341 ser_ref.data = ser->elems;
31342 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
31343 *ret_conv = ChannelFeatures_read(ser_ref);
31344 return (uint64_t)ret_conv;
31347 int8_tArray __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint32_t obj) {
31348 LDKNodeFeatures obj_conv;
31349 obj_conv.inner = (void*)(obj & (~1));
31350 obj_conv.is_owned = false;
31351 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31352 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
31353 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31354 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31355 CVec_u8Z_free(ret_var);
31359 uint32_t __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
31360 LDKu8slice ser_ref;
31361 ser_ref.datalen = ser->arr_len;
31362 ser_ref.data = ser->elems;
31363 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
31364 *ret_conv = NodeFeatures_read(ser_ref);
31365 return (uint64_t)ret_conv;
31368 int8_tArray __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint32_t obj) {
31369 LDKInvoiceFeatures obj_conv;
31370 obj_conv.inner = (void*)(obj & (~1));
31371 obj_conv.is_owned = false;
31372 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31373 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
31374 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31375 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31376 CVec_u8Z_free(ret_var);
31380 uint32_t __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
31381 LDKu8slice ser_ref;
31382 ser_ref.datalen = ser->arr_len;
31383 ser_ref.data = ser->elems;
31384 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
31385 *ret_conv = InvoiceFeatures_read(ser_ref);
31386 return (uint64_t)ret_conv;
31389 int8_tArray __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint32_t obj) {
31390 LDKChannelTypeFeatures obj_conv;
31391 obj_conv.inner = (void*)(obj & (~1));
31392 obj_conv.is_owned = false;
31393 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31394 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
31395 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31396 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31397 CVec_u8Z_free(ret_var);
31401 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
31402 LDKu8slice ser_ref;
31403 ser_ref.datalen = ser->arr_len;
31404 ser_ref.data = ser->elems;
31405 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
31406 *ret_conv = ChannelTypeFeatures_read(ser_ref);
31407 return (uint64_t)ret_conv;
31410 void __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint32_t this_obj) {
31411 LDKShutdownScript this_obj_conv;
31412 this_obj_conv.inner = (void*)(this_obj & (~1));
31413 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31415 ShutdownScript_free(this_obj_conv);
31418 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
31419 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
31420 uint64_t ret_ref = 0;
31421 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31422 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31423 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31424 ret_ref = (uint64_t)ret_var.inner;
31425 if (ret_var.is_owned) {
31430 int64_t __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
31431 LDKShutdownScript arg_conv;
31432 arg_conv.inner = (void*)(arg & (~1));
31433 arg_conv.is_owned = false;
31434 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31435 int64_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
31439 uint32_t __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint32_t orig) {
31440 LDKShutdownScript orig_conv;
31441 orig_conv.inner = (void*)(orig & (~1));
31442 orig_conv.is_owned = false;
31443 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31444 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
31445 uint64_t ret_ref = 0;
31446 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31447 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31449 ret_ref = (uint64_t)ret_var.inner;
31450 if (ret_var.is_owned) {
31456 void __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
31457 LDKInvalidShutdownScript this_obj_conv;
31458 this_obj_conv.inner = (void*)(this_obj & (~1));
31459 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31461 InvalidShutdownScript_free(this_obj_conv);
31464 int8_tArray __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
31465 LDKInvalidShutdownScript this_ptr_conv;
31466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31467 this_ptr_conv.is_owned = false;
31468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31469 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
31470 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31471 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31475 void __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
31476 LDKInvalidShutdownScript this_ptr_conv;
31477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31478 this_ptr_conv.is_owned = false;
31479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31480 LDKCVec_u8Z val_ref;
31481 val_ref.datalen = val->arr_len;
31482 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31483 memcpy(val_ref.data, val->elems, val_ref.datalen);
31484 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
31487 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
31488 LDKCVec_u8Z script_arg_ref;
31489 script_arg_ref.datalen = script_arg->arr_len;
31490 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31491 memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen);
31492 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
31493 uint64_t ret_ref = 0;
31494 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31495 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31496 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31497 ret_ref = (uint64_t)ret_var.inner;
31498 if (ret_var.is_owned) {
31504 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
31505 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
31506 uint64_t ret_ref = 0;
31507 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31508 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31510 ret_ref = (uint64_t)ret_var.inner;
31511 if (ret_var.is_owned) {
31516 int64_t __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
31517 LDKInvalidShutdownScript arg_conv;
31518 arg_conv.inner = (void*)(arg & (~1));
31519 arg_conv.is_owned = false;
31520 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31521 int64_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
31525 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
31526 LDKInvalidShutdownScript orig_conv;
31527 orig_conv.inner = (void*)(orig & (~1));
31528 orig_conv.is_owned = false;
31529 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31530 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
31531 uint64_t ret_ref = 0;
31532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31534 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31535 ret_ref = (uint64_t)ret_var.inner;
31536 if (ret_var.is_owned) {
31542 int8_tArray __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint32_t obj) {
31543 LDKShutdownScript obj_conv;
31544 obj_conv.inner = (void*)(obj & (~1));
31545 obj_conv.is_owned = false;
31546 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31547 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
31548 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31549 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31550 CVec_u8Z_free(ret_var);
31554 uint32_t __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
31555 LDKu8slice ser_ref;
31556 ser_ref.datalen = ser->arr_len;
31557 ser_ref.data = ser->elems;
31558 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31559 *ret_conv = ShutdownScript_read(ser_ref);
31560 return (uint64_t)ret_conv;
31563 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
31564 unsigned char pubkey_hash_arr[20];
31565 CHECK(pubkey_hash->arr_len == 20);
31566 memcpy(pubkey_hash_arr, pubkey_hash->elems, 20);
31567 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
31568 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
31569 uint64_t ret_ref = 0;
31570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31573 ret_ref = (uint64_t)ret_var.inner;
31574 if (ret_var.is_owned) {
31580 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
31581 unsigned char script_hash_arr[32];
31582 CHECK(script_hash->arr_len == 32);
31583 memcpy(script_hash_arr, script_hash->elems, 32);
31584 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
31585 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
31586 uint64_t ret_ref = 0;
31587 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31588 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31590 ret_ref = (uint64_t)ret_var.inner;
31591 if (ret_var.is_owned) {
31597 uint32_t __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
31598 LDKu8slice program_ref;
31599 program_ref.datalen = program->arr_len;
31600 program_ref.data = program->elems;
31601 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31602 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
31603 return (uint64_t)ret_conv;
31606 int8_tArray __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
31607 LDKShutdownScript this_arg_conv;
31608 this_arg_conv.inner = (void*)(this_arg & (~1));
31609 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
31610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31611 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
31612 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
31613 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31614 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31615 CVec_u8Z_free(ret_var);
31619 int8_tArray __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
31620 LDKShutdownScript this_arg_conv;
31621 this_arg_conv.inner = (void*)(this_arg & (~1));
31622 this_arg_conv.is_owned = false;
31623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31624 int8_tArray ret_arr = init_int8_tArray(33);
31625 memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
31629 jboolean __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
31630 LDKShutdownScript this_arg_conv;
31631 this_arg_conv.inner = (void*)(this_arg & (~1));
31632 this_arg_conv.is_owned = false;
31633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31634 LDKInitFeatures features_conv;
31635 features_conv.inner = (void*)(features & (~1));
31636 features_conv.is_owned = false;
31637 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
31638 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
31642 void __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
31643 if ((this_ptr & 1) != 0) return;
31644 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31645 CHECK_ACCESS(this_ptr_ptr);
31646 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
31647 FREE((void*)this_ptr);
31648 CustomMessageReader_free(this_ptr_conv);
31651 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
31652 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31653 *ret_ret = Type_clone(arg);
31654 return (uint64_t)ret_ret;
31656 int64_t __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint32_t arg) {
31657 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
31658 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
31659 LDKType* arg_conv = (LDKType*)arg_ptr;
31660 int64_t ret_val = Type_clone_ptr(arg_conv);
31664 uint32_t __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint32_t orig) {
31665 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
31666 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
31667 LDKType* orig_conv = (LDKType*)orig_ptr;
31668 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31669 *ret_ret = Type_clone(orig_conv);
31670 return (uint64_t)ret_ret;
31673 void __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint32_t this_ptr) {
31674 if ((this_ptr & 1) != 0) return;
31675 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31676 CHECK_ACCESS(this_ptr_ptr);
31677 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
31678 FREE((void*)this_ptr);
31679 Type_free(this_ptr_conv);
31682 void __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint32_t this_obj) {
31683 LDKNodeId this_obj_conv;
31684 this_obj_conv.inner = (void*)(this_obj & (~1));
31685 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31687 NodeId_free(this_obj_conv);
31690 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
31691 LDKNodeId ret_var = NodeId_clone(arg);
31692 uint64_t ret_ref = 0;
31693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31696 ret_ref = (uint64_t)ret_var.inner;
31697 if (ret_var.is_owned) {
31702 int64_t __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint32_t arg) {
31703 LDKNodeId arg_conv;
31704 arg_conv.inner = (void*)(arg & (~1));
31705 arg_conv.is_owned = false;
31706 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31707 int64_t ret_val = NodeId_clone_ptr(&arg_conv);
31711 uint32_t __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint32_t orig) {
31712 LDKNodeId orig_conv;
31713 orig_conv.inner = (void*)(orig & (~1));
31714 orig_conv.is_owned = false;
31715 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31716 LDKNodeId ret_var = NodeId_clone(&orig_conv);
31717 uint64_t ret_ref = 0;
31718 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31719 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31720 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31721 ret_ref = (uint64_t)ret_var.inner;
31722 if (ret_var.is_owned) {
31728 uint32_t __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
31729 LDKPublicKey pubkey_ref;
31730 CHECK(pubkey->arr_len == 33);
31731 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
31732 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
31733 uint64_t ret_ref = 0;
31734 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31735 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31736 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31737 ret_ref = (uint64_t)ret_var.inner;
31738 if (ret_var.is_owned) {
31744 int8_tArray __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint32_t this_arg) {
31745 LDKNodeId this_arg_conv;
31746 this_arg_conv.inner = (void*)(this_arg & (~1));
31747 this_arg_conv.is_owned = false;
31748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31749 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
31750 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31751 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31755 int64_t __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint32_t o) {
31757 o_conv.inner = (void*)(o & (~1));
31758 o_conv.is_owned = false;
31759 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31760 int64_t ret_val = NodeId_hash(&o_conv);
31764 int8_tArray __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint32_t obj) {
31765 LDKNodeId obj_conv;
31766 obj_conv.inner = (void*)(obj & (~1));
31767 obj_conv.is_owned = false;
31768 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31769 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
31770 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31771 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31772 CVec_u8Z_free(ret_var);
31776 uint32_t __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
31777 LDKu8slice ser_ref;
31778 ser_ref.datalen = ser->arr_len;
31779 ser_ref.data = ser->elems;
31780 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
31781 *ret_conv = NodeId_read(ser_ref);
31782 return (uint64_t)ret_conv;
31785 void __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint32_t this_obj) {
31786 LDKNetworkGraph this_obj_conv;
31787 this_obj_conv.inner = (void*)(this_obj & (~1));
31788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31790 NetworkGraph_free(this_obj_conv);
31793 static inline uintptr_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
31794 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
31795 uint64_t ret_ref = 0;
31796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31799 ret_ref = (uint64_t)ret_var.inner;
31800 if (ret_var.is_owned) {
31805 int64_t __attribute__((export_name("TS_NetworkGraph_clone_ptr"))) TS_NetworkGraph_clone_ptr(uint32_t arg) {
31806 LDKNetworkGraph arg_conv;
31807 arg_conv.inner = (void*)(arg & (~1));
31808 arg_conv.is_owned = false;
31809 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31810 int64_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
31814 uint32_t __attribute__((export_name("TS_NetworkGraph_clone"))) TS_NetworkGraph_clone(uint32_t orig) {
31815 LDKNetworkGraph orig_conv;
31816 orig_conv.inner = (void*)(orig & (~1));
31817 orig_conv.is_owned = false;
31818 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31819 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
31820 uint64_t ret_ref = 0;
31821 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31822 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31824 ret_ref = (uint64_t)ret_var.inner;
31825 if (ret_var.is_owned) {
31831 void __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
31832 LDKReadOnlyNetworkGraph this_obj_conv;
31833 this_obj_conv.inner = (void*)(this_obj & (~1));
31834 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31836 ReadOnlyNetworkGraph_free(this_obj_conv);
31839 void __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
31840 if ((this_ptr & 1) != 0) return;
31841 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31842 CHECK_ACCESS(this_ptr_ptr);
31843 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
31844 FREE((void*)this_ptr);
31845 NetworkUpdate_free(this_ptr_conv);
31848 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
31849 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31850 *ret_copy = NetworkUpdate_clone(arg);
31851 uint64_t ret_ref = (uint64_t)ret_copy;
31854 int64_t __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
31855 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
31856 int64_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
31860 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint32_t orig) {
31861 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
31862 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31863 *ret_copy = NetworkUpdate_clone(orig_conv);
31864 uint64_t ret_ref = (uint64_t)ret_copy;
31868 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
31869 LDKChannelUpdate msg_conv;
31870 msg_conv.inner = (void*)(msg & (~1));
31871 msg_conv.is_owned = (msg & 1) || (msg == 0);
31872 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31873 msg_conv = ChannelUpdate_clone(&msg_conv);
31874 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31875 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
31876 uint64_t ret_ref = (uint64_t)ret_copy;
31880 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_closed"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
31881 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31882 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
31883 uint64_t ret_ref = (uint64_t)ret_copy;
31887 uint32_t __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
31888 LDKPublicKey node_id_ref;
31889 CHECK(node_id->arr_len == 33);
31890 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
31891 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31892 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
31893 uint64_t ret_ref = (uint64_t)ret_copy;
31897 int8_tArray __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint32_t obj) {
31898 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
31899 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
31900 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31901 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31902 CVec_u8Z_free(ret_var);
31906 uint32_t __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
31907 LDKu8slice ser_ref;
31908 ser_ref.datalen = ser->arr_len;
31909 ser_ref.data = ser->elems;
31910 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
31911 *ret_conv = NetworkUpdate_read(ser_ref);
31912 return (uint64_t)ret_conv;
31915 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_as_EventHandler"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
31916 LDKNetGraphMsgHandler this_arg_conv;
31917 this_arg_conv.inner = (void*)(this_arg & (~1));
31918 this_arg_conv.is_owned = false;
31919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31920 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
31921 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
31922 return (uint64_t)ret_ret;
31925 void __attribute__((export_name("TS_NetGraphMsgHandler_free"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
31926 LDKNetGraphMsgHandler this_obj_conv;
31927 this_obj_conv.inner = (void*)(this_obj & (~1));
31928 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31930 NetGraphMsgHandler_free(this_obj_conv);
31933 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_new"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
31934 LDKNetworkGraph network_graph_conv;
31935 network_graph_conv.inner = (void*)(network_graph & (~1));
31936 network_graph_conv.is_owned = false;
31937 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
31938 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
31939 CHECK_ACCESS(chain_access_ptr);
31940 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
31941 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
31942 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
31943 // Manually implement clone for Java trait instances
31945 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
31946 CHECK_ACCESS(logger_ptr);
31947 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31948 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
31949 uint64_t ret_ref = 0;
31950 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31951 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31952 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31953 ret_ref = (uint64_t)ret_var.inner;
31954 if (ret_var.is_owned) {
31960 void __attribute__((export_name("TS_NetGraphMsgHandler_add_chain_access"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
31961 LDKNetGraphMsgHandler this_arg_conv;
31962 this_arg_conv.inner = (void*)(this_arg & (~1));
31963 this_arg_conv.is_owned = false;
31964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31965 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
31966 CHECK_ACCESS(chain_access_ptr);
31967 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
31968 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
31969 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
31970 // Manually implement clone for Java trait instances
31972 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
31975 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_as_RoutingMessageHandler"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
31976 LDKNetGraphMsgHandler this_arg_conv;
31977 this_arg_conv.inner = (void*)(this_arg & (~1));
31978 this_arg_conv.is_owned = false;
31979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31980 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
31981 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
31982 return (uint64_t)ret_ret;
31985 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_as_MessageSendEventsProvider"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
31986 LDKNetGraphMsgHandler this_arg_conv;
31987 this_arg_conv.inner = (void*)(this_arg & (~1));
31988 this_arg_conv.is_owned = false;
31989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31990 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
31991 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
31992 return (uint64_t)ret_ret;
31995 void __attribute__((export_name("TS_DirectionalChannelInfo_free"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
31996 LDKDirectionalChannelInfo this_obj_conv;
31997 this_obj_conv.inner = (void*)(this_obj & (~1));
31998 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32000 DirectionalChannelInfo_free(this_obj_conv);
32003 int32_t __attribute__((export_name("TS_DirectionalChannelInfo_get_last_update"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
32004 LDKDirectionalChannelInfo this_ptr_conv;
32005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32006 this_ptr_conv.is_owned = false;
32007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32008 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
32012 void __attribute__((export_name("TS_DirectionalChannelInfo_set_last_update"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
32013 LDKDirectionalChannelInfo this_ptr_conv;
32014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32015 this_ptr_conv.is_owned = false;
32016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32017 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
32020 jboolean __attribute__((export_name("TS_DirectionalChannelInfo_get_enabled"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
32021 LDKDirectionalChannelInfo this_ptr_conv;
32022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32023 this_ptr_conv.is_owned = false;
32024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32025 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
32029 void __attribute__((export_name("TS_DirectionalChannelInfo_set_enabled"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
32030 LDKDirectionalChannelInfo this_ptr_conv;
32031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32032 this_ptr_conv.is_owned = false;
32033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32034 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
32037 int16_t __attribute__((export_name("TS_DirectionalChannelInfo_get_cltv_expiry_delta"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
32038 LDKDirectionalChannelInfo this_ptr_conv;
32039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32040 this_ptr_conv.is_owned = false;
32041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32042 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
32046 void __attribute__((export_name("TS_DirectionalChannelInfo_set_cltv_expiry_delta"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
32047 LDKDirectionalChannelInfo this_ptr_conv;
32048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32049 this_ptr_conv.is_owned = false;
32050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32051 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
32054 int64_t __attribute__((export_name("TS_DirectionalChannelInfo_get_htlc_minimum_msat"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
32055 LDKDirectionalChannelInfo this_ptr_conv;
32056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32057 this_ptr_conv.is_owned = false;
32058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32059 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
32063 void __attribute__((export_name("TS_DirectionalChannelInfo_set_htlc_minimum_msat"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
32064 LDKDirectionalChannelInfo this_ptr_conv;
32065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32066 this_ptr_conv.is_owned = false;
32067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32068 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
32071 uint32_t __attribute__((export_name("TS_DirectionalChannelInfo_get_htlc_maximum_msat"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
32072 LDKDirectionalChannelInfo this_ptr_conv;
32073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32074 this_ptr_conv.is_owned = false;
32075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32076 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32077 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
32078 uint64_t ret_ref = (uint64_t)ret_copy;
32082 void __attribute__((export_name("TS_DirectionalChannelInfo_set_htlc_maximum_msat"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
32083 LDKDirectionalChannelInfo this_ptr_conv;
32084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32085 this_ptr_conv.is_owned = false;
32086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32087 void* val_ptr = (void*)(((uint64_t)val) & ~1);
32088 CHECK_ACCESS(val_ptr);
32089 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32090 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
32091 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
32094 uint32_t __attribute__((export_name("TS_DirectionalChannelInfo_get_fees"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
32095 LDKDirectionalChannelInfo this_ptr_conv;
32096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32097 this_ptr_conv.is_owned = false;
32098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32099 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
32100 uint64_t ret_ref = 0;
32101 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32102 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32103 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32104 ret_ref = (uint64_t)ret_var.inner;
32105 if (ret_var.is_owned) {
32111 void __attribute__((export_name("TS_DirectionalChannelInfo_set_fees"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
32112 LDKDirectionalChannelInfo this_ptr_conv;
32113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32114 this_ptr_conv.is_owned = false;
32115 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32116 LDKRoutingFees val_conv;
32117 val_conv.inner = (void*)(val & (~1));
32118 val_conv.is_owned = (val & 1) || (val == 0);
32119 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32120 val_conv = RoutingFees_clone(&val_conv);
32121 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
32124 uint32_t __attribute__((export_name("TS_DirectionalChannelInfo_get_last_update_message"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
32125 LDKDirectionalChannelInfo this_ptr_conv;
32126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32127 this_ptr_conv.is_owned = false;
32128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32129 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
32130 uint64_t ret_ref = 0;
32131 if ((uint64_t)ret_var.inner > 4096) {
32132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32135 ret_ref = (uint64_t)ret_var.inner;
32136 if (ret_var.is_owned) {
32143 void __attribute__((export_name("TS_DirectionalChannelInfo_set_last_update_message"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
32144 LDKDirectionalChannelInfo this_ptr_conv;
32145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32146 this_ptr_conv.is_owned = false;
32147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32148 LDKChannelUpdate val_conv;
32149 val_conv.inner = (void*)(val & (~1));
32150 val_conv.is_owned = (val & 1) || (val == 0);
32151 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32152 val_conv = ChannelUpdate_clone(&val_conv);
32153 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
32156 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) {
32157 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
32158 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
32159 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
32160 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
32161 LDKRoutingFees fees_arg_conv;
32162 fees_arg_conv.inner = (void*)(fees_arg & (~1));
32163 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
32164 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
32165 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
32166 LDKChannelUpdate last_update_message_arg_conv;
32167 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
32168 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
32169 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
32170 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
32171 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);
32172 uint64_t ret_ref = 0;
32173 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32174 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32175 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32176 ret_ref = (uint64_t)ret_var.inner;
32177 if (ret_var.is_owned) {
32183 static inline uintptr_t DirectionalChannelInfo_clone_ptr(LDKDirectionalChannelInfo *NONNULL_PTR arg) {
32184 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(arg);
32185 uint64_t ret_ref = 0;
32186 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32187 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32189 ret_ref = (uint64_t)ret_var.inner;
32190 if (ret_var.is_owned) {
32195 int64_t __attribute__((export_name("TS_DirectionalChannelInfo_clone_ptr"))) TS_DirectionalChannelInfo_clone_ptr(uint32_t arg) {
32196 LDKDirectionalChannelInfo arg_conv;
32197 arg_conv.inner = (void*)(arg & (~1));
32198 arg_conv.is_owned = false;
32199 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32200 int64_t ret_val = DirectionalChannelInfo_clone_ptr(&arg_conv);
32204 uint32_t __attribute__((export_name("TS_DirectionalChannelInfo_clone"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
32205 LDKDirectionalChannelInfo orig_conv;
32206 orig_conv.inner = (void*)(orig & (~1));
32207 orig_conv.is_owned = false;
32208 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32209 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
32210 uint64_t ret_ref = 0;
32211 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32212 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32214 ret_ref = (uint64_t)ret_var.inner;
32215 if (ret_var.is_owned) {
32221 int8_tArray __attribute__((export_name("TS_DirectionalChannelInfo_write"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
32222 LDKDirectionalChannelInfo obj_conv;
32223 obj_conv.inner = (void*)(obj & (~1));
32224 obj_conv.is_owned = false;
32225 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32226 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
32227 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32228 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32229 CVec_u8Z_free(ret_var);
32233 uint32_t __attribute__((export_name("TS_DirectionalChannelInfo_read"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
32234 LDKu8slice ser_ref;
32235 ser_ref.datalen = ser->arr_len;
32236 ser_ref.data = ser->elems;
32237 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
32238 *ret_conv = DirectionalChannelInfo_read(ser_ref);
32239 return (uint64_t)ret_conv;
32242 void __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint32_t this_obj) {
32243 LDKChannelInfo this_obj_conv;
32244 this_obj_conv.inner = (void*)(this_obj & (~1));
32245 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32247 ChannelInfo_free(this_obj_conv);
32250 uint32_t __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
32251 LDKChannelInfo this_ptr_conv;
32252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32253 this_ptr_conv.is_owned = false;
32254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32255 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
32256 uint64_t ret_ref = 0;
32257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32260 ret_ref = (uint64_t)ret_var.inner;
32261 if (ret_var.is_owned) {
32267 void __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
32268 LDKChannelInfo this_ptr_conv;
32269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32270 this_ptr_conv.is_owned = false;
32271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32272 LDKChannelFeatures val_conv;
32273 val_conv.inner = (void*)(val & (~1));
32274 val_conv.is_owned = (val & 1) || (val == 0);
32275 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32276 val_conv = ChannelFeatures_clone(&val_conv);
32277 ChannelInfo_set_features(&this_ptr_conv, val_conv);
32280 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
32281 LDKChannelInfo this_ptr_conv;
32282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32283 this_ptr_conv.is_owned = false;
32284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32285 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
32286 uint64_t ret_ref = 0;
32287 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32288 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32289 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32290 ret_ref = (uint64_t)ret_var.inner;
32291 if (ret_var.is_owned) {
32297 void __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
32298 LDKChannelInfo this_ptr_conv;
32299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32300 this_ptr_conv.is_owned = false;
32301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32302 LDKNodeId val_conv;
32303 val_conv.inner = (void*)(val & (~1));
32304 val_conv.is_owned = (val & 1) || (val == 0);
32305 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32306 val_conv = NodeId_clone(&val_conv);
32307 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
32310 uint32_t __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
32311 LDKChannelInfo this_ptr_conv;
32312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32313 this_ptr_conv.is_owned = false;
32314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32315 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
32316 uint64_t ret_ref = 0;
32317 if ((uint64_t)ret_var.inner > 4096) {
32318 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32319 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32321 ret_ref = (uint64_t)ret_var.inner;
32322 if (ret_var.is_owned) {
32329 void __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
32330 LDKChannelInfo this_ptr_conv;
32331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32332 this_ptr_conv.is_owned = false;
32333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32334 LDKDirectionalChannelInfo val_conv;
32335 val_conv.inner = (void*)(val & (~1));
32336 val_conv.is_owned = (val & 1) || (val == 0);
32337 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32338 val_conv = DirectionalChannelInfo_clone(&val_conv);
32339 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
32342 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
32343 LDKChannelInfo this_ptr_conv;
32344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32345 this_ptr_conv.is_owned = false;
32346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32347 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
32348 uint64_t ret_ref = 0;
32349 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32350 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32352 ret_ref = (uint64_t)ret_var.inner;
32353 if (ret_var.is_owned) {
32359 void __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
32360 LDKChannelInfo this_ptr_conv;
32361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32362 this_ptr_conv.is_owned = false;
32363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32364 LDKNodeId val_conv;
32365 val_conv.inner = (void*)(val & (~1));
32366 val_conv.is_owned = (val & 1) || (val == 0);
32367 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32368 val_conv = NodeId_clone(&val_conv);
32369 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
32372 uint32_t __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
32373 LDKChannelInfo this_ptr_conv;
32374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32375 this_ptr_conv.is_owned = false;
32376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32377 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
32378 uint64_t ret_ref = 0;
32379 if ((uint64_t)ret_var.inner > 4096) {
32380 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32381 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32382 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32383 ret_ref = (uint64_t)ret_var.inner;
32384 if (ret_var.is_owned) {
32391 void __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
32392 LDKChannelInfo this_ptr_conv;
32393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32394 this_ptr_conv.is_owned = false;
32395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32396 LDKDirectionalChannelInfo val_conv;
32397 val_conv.inner = (void*)(val & (~1));
32398 val_conv.is_owned = (val & 1) || (val == 0);
32399 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32400 val_conv = DirectionalChannelInfo_clone(&val_conv);
32401 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
32404 uint32_t __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
32405 LDKChannelInfo this_ptr_conv;
32406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32407 this_ptr_conv.is_owned = false;
32408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32409 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32410 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
32411 uint64_t ret_ref = (uint64_t)ret_copy;
32415 void __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
32416 LDKChannelInfo this_ptr_conv;
32417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32418 this_ptr_conv.is_owned = false;
32419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32420 void* val_ptr = (void*)(((uint64_t)val) & ~1);
32421 CHECK_ACCESS(val_ptr);
32422 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32423 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
32424 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
32427 uint32_t __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
32428 LDKChannelInfo this_ptr_conv;
32429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32430 this_ptr_conv.is_owned = false;
32431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32432 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
32433 uint64_t ret_ref = 0;
32434 if ((uint64_t)ret_var.inner > 4096) {
32435 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32436 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32438 ret_ref = (uint64_t)ret_var.inner;
32439 if (ret_var.is_owned) {
32446 void __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
32447 LDKChannelInfo this_ptr_conv;
32448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32449 this_ptr_conv.is_owned = false;
32450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32451 LDKChannelAnnouncement val_conv;
32452 val_conv.inner = (void*)(val & (~1));
32453 val_conv.is_owned = (val & 1) || (val == 0);
32454 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32455 val_conv = ChannelAnnouncement_clone(&val_conv);
32456 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
32459 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
32460 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
32461 uint64_t ret_ref = 0;
32462 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32463 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32464 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32465 ret_ref = (uint64_t)ret_var.inner;
32466 if (ret_var.is_owned) {
32471 int64_t __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
32472 LDKChannelInfo arg_conv;
32473 arg_conv.inner = (void*)(arg & (~1));
32474 arg_conv.is_owned = false;
32475 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32476 int64_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
32480 uint32_t __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint32_t orig) {
32481 LDKChannelInfo orig_conv;
32482 orig_conv.inner = (void*)(orig & (~1));
32483 orig_conv.is_owned = false;
32484 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32485 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
32486 uint64_t ret_ref = 0;
32487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32490 ret_ref = (uint64_t)ret_var.inner;
32491 if (ret_var.is_owned) {
32497 int8_tArray __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint32_t obj) {
32498 LDKChannelInfo obj_conv;
32499 obj_conv.inner = (void*)(obj & (~1));
32500 obj_conv.is_owned = false;
32501 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32502 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
32503 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32504 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32505 CVec_u8Z_free(ret_var);
32509 uint32_t __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
32510 LDKu8slice ser_ref;
32511 ser_ref.datalen = ser->arr_len;
32512 ser_ref.data = ser->elems;
32513 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
32514 *ret_conv = ChannelInfo_read(ser_ref);
32515 return (uint64_t)ret_conv;
32518 void __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint32_t this_obj) {
32519 LDKRoutingFees this_obj_conv;
32520 this_obj_conv.inner = (void*)(this_obj & (~1));
32521 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32523 RoutingFees_free(this_obj_conv);
32526 int32_t __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
32527 LDKRoutingFees this_ptr_conv;
32528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32529 this_ptr_conv.is_owned = false;
32530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32531 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
32535 void __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
32536 LDKRoutingFees this_ptr_conv;
32537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32538 this_ptr_conv.is_owned = false;
32539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32540 RoutingFees_set_base_msat(&this_ptr_conv, val);
32543 int32_t __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
32544 LDKRoutingFees this_ptr_conv;
32545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32546 this_ptr_conv.is_owned = false;
32547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32548 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
32552 void __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
32553 LDKRoutingFees this_ptr_conv;
32554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32555 this_ptr_conv.is_owned = false;
32556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32557 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
32560 uint32_t __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
32561 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
32562 uint64_t ret_ref = 0;
32563 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32564 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32565 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32566 ret_ref = (uint64_t)ret_var.inner;
32567 if (ret_var.is_owned) {
32573 jboolean __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
32574 LDKRoutingFees a_conv;
32575 a_conv.inner = (void*)(a & (~1));
32576 a_conv.is_owned = false;
32577 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32578 LDKRoutingFees b_conv;
32579 b_conv.inner = (void*)(b & (~1));
32580 b_conv.is_owned = false;
32581 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32582 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
32586 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
32587 LDKRoutingFees ret_var = RoutingFees_clone(arg);
32588 uint64_t ret_ref = 0;
32589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32592 ret_ref = (uint64_t)ret_var.inner;
32593 if (ret_var.is_owned) {
32598 int64_t __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
32599 LDKRoutingFees arg_conv;
32600 arg_conv.inner = (void*)(arg & (~1));
32601 arg_conv.is_owned = false;
32602 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32603 int64_t ret_val = RoutingFees_clone_ptr(&arg_conv);
32607 uint32_t __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint32_t orig) {
32608 LDKRoutingFees orig_conv;
32609 orig_conv.inner = (void*)(orig & (~1));
32610 orig_conv.is_owned = false;
32611 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32612 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
32613 uint64_t ret_ref = 0;
32614 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32615 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32617 ret_ref = (uint64_t)ret_var.inner;
32618 if (ret_var.is_owned) {
32624 int64_t __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint32_t o) {
32625 LDKRoutingFees o_conv;
32626 o_conv.inner = (void*)(o & (~1));
32627 o_conv.is_owned = false;
32628 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32629 int64_t ret_val = RoutingFees_hash(&o_conv);
32633 int8_tArray __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint32_t obj) {
32634 LDKRoutingFees obj_conv;
32635 obj_conv.inner = (void*)(obj & (~1));
32636 obj_conv.is_owned = false;
32637 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32638 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
32639 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32640 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32641 CVec_u8Z_free(ret_var);
32645 uint32_t __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
32646 LDKu8slice ser_ref;
32647 ser_ref.datalen = ser->arr_len;
32648 ser_ref.data = ser->elems;
32649 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
32650 *ret_conv = RoutingFees_read(ser_ref);
32651 return (uint64_t)ret_conv;
32654 void __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
32655 LDKNodeAnnouncementInfo this_obj_conv;
32656 this_obj_conv.inner = (void*)(this_obj & (~1));
32657 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32659 NodeAnnouncementInfo_free(this_obj_conv);
32662 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
32663 LDKNodeAnnouncementInfo this_ptr_conv;
32664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32665 this_ptr_conv.is_owned = false;
32666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32667 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
32668 uint64_t ret_ref = 0;
32669 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32670 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32671 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32672 ret_ref = (uint64_t)ret_var.inner;
32673 if (ret_var.is_owned) {
32679 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
32680 LDKNodeAnnouncementInfo this_ptr_conv;
32681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32682 this_ptr_conv.is_owned = false;
32683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32684 LDKNodeFeatures val_conv;
32685 val_conv.inner = (void*)(val & (~1));
32686 val_conv.is_owned = (val & 1) || (val == 0);
32687 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32688 val_conv = NodeFeatures_clone(&val_conv);
32689 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
32692 int32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
32693 LDKNodeAnnouncementInfo this_ptr_conv;
32694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32695 this_ptr_conv.is_owned = false;
32696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32697 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
32701 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
32702 LDKNodeAnnouncementInfo this_ptr_conv;
32703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32704 this_ptr_conv.is_owned = false;
32705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32706 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
32709 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
32710 LDKNodeAnnouncementInfo this_ptr_conv;
32711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32712 this_ptr_conv.is_owned = false;
32713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32714 int8_tArray ret_arr = init_int8_tArray(3);
32715 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
32719 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
32720 LDKNodeAnnouncementInfo this_ptr_conv;
32721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32722 this_ptr_conv.is_owned = false;
32723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32724 LDKThreeBytes val_ref;
32725 CHECK(val->arr_len == 3);
32726 memcpy(val_ref.data, val->elems, 3);
32727 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
32730 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
32731 LDKNodeAnnouncementInfo this_ptr_conv;
32732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32733 this_ptr_conv.is_owned = false;
32734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32735 int8_tArray ret_arr = init_int8_tArray(32);
32736 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
32740 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
32741 LDKNodeAnnouncementInfo this_ptr_conv;
32742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32743 this_ptr_conv.is_owned = false;
32744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32745 LDKThirtyTwoBytes val_ref;
32746 CHECK(val->arr_len == 32);
32747 memcpy(val_ref.data, val->elems, 32);
32748 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
32751 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
32752 LDKNodeAnnouncementInfo this_ptr_conv;
32753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32754 this_ptr_conv.is_owned = false;
32755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32756 LDKCVec_NetAddressZ val_constr;
32757 val_constr.datalen = val->arr_len;
32758 if (val_constr.datalen > 0)
32759 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32761 val_constr.data = NULL;
32762 uint32_t* val_vals = val->elems;
32763 for (size_t m = 0; m < val_constr.datalen; m++) {
32764 uint32_t val_conv_12 = val_vals[m];
32765 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
32766 CHECK_ACCESS(val_conv_12_ptr);
32767 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
32768 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
32769 val_constr.data[m] = val_conv_12_conv;
32771 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
32774 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
32775 LDKNodeAnnouncementInfo this_ptr_conv;
32776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32777 this_ptr_conv.is_owned = false;
32778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32779 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
32780 uint64_t ret_ref = 0;
32781 if ((uint64_t)ret_var.inner > 4096) {
32782 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32783 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32785 ret_ref = (uint64_t)ret_var.inner;
32786 if (ret_var.is_owned) {
32793 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
32794 LDKNodeAnnouncementInfo this_ptr_conv;
32795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32796 this_ptr_conv.is_owned = false;
32797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32798 LDKNodeAnnouncement val_conv;
32799 val_conv.inner = (void*)(val & (~1));
32800 val_conv.is_owned = (val & 1) || (val == 0);
32801 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32802 val_conv = NodeAnnouncement_clone(&val_conv);
32803 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
32806 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) {
32807 LDKNodeFeatures features_arg_conv;
32808 features_arg_conv.inner = (void*)(features_arg & (~1));
32809 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
32810 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
32811 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
32812 LDKThreeBytes rgb_arg_ref;
32813 CHECK(rgb_arg->arr_len == 3);
32814 memcpy(rgb_arg_ref.data, rgb_arg->elems, 3);
32815 LDKThirtyTwoBytes alias_arg_ref;
32816 CHECK(alias_arg->arr_len == 32);
32817 memcpy(alias_arg_ref.data, alias_arg->elems, 32);
32818 LDKCVec_NetAddressZ addresses_arg_constr;
32819 addresses_arg_constr.datalen = addresses_arg->arr_len;
32820 if (addresses_arg_constr.datalen > 0)
32821 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32823 addresses_arg_constr.data = NULL;
32824 uint32_t* addresses_arg_vals = addresses_arg->elems;
32825 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
32826 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
32827 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
32828 CHECK_ACCESS(addresses_arg_conv_12_ptr);
32829 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
32830 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
32832 LDKNodeAnnouncement announcement_message_arg_conv;
32833 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
32834 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
32835 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
32836 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
32837 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
32838 uint64_t ret_ref = 0;
32839 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32840 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32841 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32842 ret_ref = (uint64_t)ret_var.inner;
32843 if (ret_var.is_owned) {
32849 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
32850 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
32851 uint64_t ret_ref = 0;
32852 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32853 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32854 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32855 ret_ref = (uint64_t)ret_var.inner;
32856 if (ret_var.is_owned) {
32861 int64_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
32862 LDKNodeAnnouncementInfo arg_conv;
32863 arg_conv.inner = (void*)(arg & (~1));
32864 arg_conv.is_owned = false;
32865 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32866 int64_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
32870 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
32871 LDKNodeAnnouncementInfo orig_conv;
32872 orig_conv.inner = (void*)(orig & (~1));
32873 orig_conv.is_owned = false;
32874 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32875 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
32876 uint64_t ret_ref = 0;
32877 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32878 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32880 ret_ref = (uint64_t)ret_var.inner;
32881 if (ret_var.is_owned) {
32887 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
32888 LDKNodeAnnouncementInfo obj_conv;
32889 obj_conv.inner = (void*)(obj & (~1));
32890 obj_conv.is_owned = false;
32891 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32892 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
32893 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32894 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32895 CVec_u8Z_free(ret_var);
32899 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
32900 LDKu8slice ser_ref;
32901 ser_ref.datalen = ser->arr_len;
32902 ser_ref.data = ser->elems;
32903 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
32904 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
32905 return (uint64_t)ret_conv;
32908 void __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint32_t this_obj) {
32909 LDKNodeInfo this_obj_conv;
32910 this_obj_conv.inner = (void*)(this_obj & (~1));
32911 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32913 NodeInfo_free(this_obj_conv);
32916 void __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
32917 LDKNodeInfo this_ptr_conv;
32918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32919 this_ptr_conv.is_owned = false;
32920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32921 LDKCVec_u64Z val_constr;
32922 val_constr.datalen = val->arr_len;
32923 if (val_constr.datalen > 0)
32924 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32926 val_constr.data = NULL;
32927 int64_t* val_vals = val->elems;
32928 for (size_t i = 0; i < val_constr.datalen; i++) {
32929 int64_t val_conv_8 = val_vals[i];
32930 val_constr.data[i] = val_conv_8;
32932 NodeInfo_set_channels(&this_ptr_conv, val_constr);
32935 uint32_t __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
32936 LDKNodeInfo this_ptr_conv;
32937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32938 this_ptr_conv.is_owned = false;
32939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32940 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
32941 uint64_t ret_ref = 0;
32942 if ((uint64_t)ret_var.inner > 4096) {
32943 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32944 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32946 ret_ref = (uint64_t)ret_var.inner;
32947 if (ret_var.is_owned) {
32954 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) {
32955 LDKNodeInfo this_ptr_conv;
32956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32957 this_ptr_conv.is_owned = false;
32958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32959 LDKRoutingFees val_conv;
32960 val_conv.inner = (void*)(val & (~1));
32961 val_conv.is_owned = (val & 1) || (val == 0);
32962 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32963 val_conv = RoutingFees_clone(&val_conv);
32964 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
32967 uint32_t __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
32968 LDKNodeInfo this_ptr_conv;
32969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32970 this_ptr_conv.is_owned = false;
32971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32972 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
32973 uint64_t ret_ref = 0;
32974 if ((uint64_t)ret_var.inner > 4096) {
32975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32978 ret_ref = (uint64_t)ret_var.inner;
32979 if (ret_var.is_owned) {
32986 void __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
32987 LDKNodeInfo this_ptr_conv;
32988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32989 this_ptr_conv.is_owned = false;
32990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32991 LDKNodeAnnouncementInfo val_conv;
32992 val_conv.inner = (void*)(val & (~1));
32993 val_conv.is_owned = (val & 1) || (val == 0);
32994 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32995 val_conv = NodeAnnouncementInfo_clone(&val_conv);
32996 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
32999 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) {
33000 LDKCVec_u64Z channels_arg_constr;
33001 channels_arg_constr.datalen = channels_arg->arr_len;
33002 if (channels_arg_constr.datalen > 0)
33003 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33005 channels_arg_constr.data = NULL;
33006 int64_t* channels_arg_vals = channels_arg->elems;
33007 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
33008 int64_t channels_arg_conv_8 = channels_arg_vals[i];
33009 channels_arg_constr.data[i] = channels_arg_conv_8;
33011 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
33012 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
33013 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
33014 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
33015 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
33016 LDKNodeAnnouncementInfo announcement_info_arg_conv;
33017 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
33018 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
33019 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
33020 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
33021 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
33022 uint64_t ret_ref = 0;
33023 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33024 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33025 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33026 ret_ref = (uint64_t)ret_var.inner;
33027 if (ret_var.is_owned) {
33033 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
33034 LDKNodeInfo ret_var = NodeInfo_clone(arg);
33035 uint64_t ret_ref = 0;
33036 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33037 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33038 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33039 ret_ref = (uint64_t)ret_var.inner;
33040 if (ret_var.is_owned) {
33045 int64_t __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
33046 LDKNodeInfo arg_conv;
33047 arg_conv.inner = (void*)(arg & (~1));
33048 arg_conv.is_owned = false;
33049 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33050 int64_t ret_val = NodeInfo_clone_ptr(&arg_conv);
33054 uint32_t __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint32_t orig) {
33055 LDKNodeInfo orig_conv;
33056 orig_conv.inner = (void*)(orig & (~1));
33057 orig_conv.is_owned = false;
33058 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33059 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
33060 uint64_t ret_ref = 0;
33061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33063 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33064 ret_ref = (uint64_t)ret_var.inner;
33065 if (ret_var.is_owned) {
33071 int8_tArray __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint32_t obj) {
33072 LDKNodeInfo obj_conv;
33073 obj_conv.inner = (void*)(obj & (~1));
33074 obj_conv.is_owned = false;
33075 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33076 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
33077 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33078 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33079 CVec_u8Z_free(ret_var);
33083 uint32_t __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
33084 LDKu8slice ser_ref;
33085 ser_ref.datalen = ser->arr_len;
33086 ser_ref.data = ser->elems;
33087 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
33088 *ret_conv = NodeInfo_read(ser_ref);
33089 return (uint64_t)ret_conv;
33092 int8_tArray __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint32_t obj) {
33093 LDKNetworkGraph obj_conv;
33094 obj_conv.inner = (void*)(obj & (~1));
33095 obj_conv.is_owned = false;
33096 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33097 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
33098 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33099 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33100 CVec_u8Z_free(ret_var);
33104 uint32_t __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser) {
33105 LDKu8slice ser_ref;
33106 ser_ref.datalen = ser->arr_len;
33107 ser_ref.data = ser->elems;
33108 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
33109 *ret_conv = NetworkGraph_read(ser_ref);
33110 return (uint64_t)ret_conv;
33113 uint32_t __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
33114 LDKThirtyTwoBytes genesis_hash_ref;
33115 CHECK(genesis_hash->arr_len == 32);
33116 memcpy(genesis_hash_ref.data, genesis_hash->elems, 32);
33117 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
33118 uint64_t ret_ref = 0;
33119 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33120 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33121 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33122 ret_ref = (uint64_t)ret_var.inner;
33123 if (ret_var.is_owned) {
33129 uint32_t __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
33130 LDKNetworkGraph this_arg_conv;
33131 this_arg_conv.inner = (void*)(this_arg & (~1));
33132 this_arg_conv.is_owned = false;
33133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33134 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
33135 uint64_t ret_ref = 0;
33136 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33137 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33139 ret_ref = (uint64_t)ret_var.inner;
33140 if (ret_var.is_owned) {
33146 uint32_t __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
33147 LDKNetworkGraph this_arg_conv;
33148 this_arg_conv.inner = (void*)(this_arg & (~1));
33149 this_arg_conv.is_owned = false;
33150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33151 LDKNodeAnnouncement msg_conv;
33152 msg_conv.inner = (void*)(msg & (~1));
33153 msg_conv.is_owned = false;
33154 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33155 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33156 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
33157 return (uint64_t)ret_conv;
33160 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) {
33161 LDKNetworkGraph this_arg_conv;
33162 this_arg_conv.inner = (void*)(this_arg & (~1));
33163 this_arg_conv.is_owned = false;
33164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33165 LDKUnsignedNodeAnnouncement msg_conv;
33166 msg_conv.inner = (void*)(msg & (~1));
33167 msg_conv.is_owned = false;
33168 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33169 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33170 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
33171 return (uint64_t)ret_conv;
33174 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) {
33175 LDKNetworkGraph this_arg_conv;
33176 this_arg_conv.inner = (void*)(this_arg & (~1));
33177 this_arg_conv.is_owned = false;
33178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33179 LDKChannelAnnouncement msg_conv;
33180 msg_conv.inner = (void*)(msg & (~1));
33181 msg_conv.is_owned = false;
33182 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33183 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
33184 CHECK_ACCESS(chain_access_ptr);
33185 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
33186 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
33187 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
33188 // Manually implement clone for Java trait instances
33190 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33191 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
33192 return (uint64_t)ret_conv;
33195 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) {
33196 LDKNetworkGraph this_arg_conv;
33197 this_arg_conv.inner = (void*)(this_arg & (~1));
33198 this_arg_conv.is_owned = false;
33199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33200 LDKUnsignedChannelAnnouncement msg_conv;
33201 msg_conv.inner = (void*)(msg & (~1));
33202 msg_conv.is_owned = false;
33203 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33204 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
33205 CHECK_ACCESS(chain_access_ptr);
33206 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
33207 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
33208 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
33209 // Manually implement clone for Java trait instances
33211 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33212 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
33213 return (uint64_t)ret_conv;
33216 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) {
33217 LDKNetworkGraph this_arg_conv;
33218 this_arg_conv.inner = (void*)(this_arg & (~1));
33219 this_arg_conv.is_owned = false;
33220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33221 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
33224 void __attribute__((export_name("TS_NetworkGraph_fail_node"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
33225 LDKNetworkGraph this_arg_conv;
33226 this_arg_conv.inner = (void*)(this_arg & (~1));
33227 this_arg_conv.is_owned = false;
33228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33229 LDKPublicKey _node_id_ref;
33230 CHECK(_node_id->arr_len == 33);
33231 memcpy(_node_id_ref.compressed_form, _node_id->elems, 33);
33232 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
33235 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) {
33236 LDKNetworkGraph this_arg_conv;
33237 this_arg_conv.inner = (void*)(this_arg & (~1));
33238 this_arg_conv.is_owned = false;
33239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33240 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
33243 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
33244 LDKNetworkGraph this_arg_conv;
33245 this_arg_conv.inner = (void*)(this_arg & (~1));
33246 this_arg_conv.is_owned = false;
33247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33248 LDKChannelUpdate msg_conv;
33249 msg_conv.inner = (void*)(msg & (~1));
33250 msg_conv.is_owned = false;
33251 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33252 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33253 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
33254 return (uint64_t)ret_conv;
33257 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
33258 LDKNetworkGraph this_arg_conv;
33259 this_arg_conv.inner = (void*)(this_arg & (~1));
33260 this_arg_conv.is_owned = false;
33261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33262 LDKUnsignedChannelUpdate msg_conv;
33263 msg_conv.inner = (void*)(msg & (~1));
33264 msg_conv.is_owned = false;
33265 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33266 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
33267 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
33268 return (uint64_t)ret_conv;
33271 uint32_t __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
33272 LDKReadOnlyNetworkGraph this_arg_conv;
33273 this_arg_conv.inner = (void*)(this_arg & (~1));
33274 this_arg_conv.is_owned = false;
33275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33276 LDKPublicKey pubkey_ref;
33277 CHECK(pubkey->arr_len == 33);
33278 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
33279 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
33280 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
33281 uint64_t ret_ref = (uint64_t)ret_copy;
33285 void __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint32_t this_obj) {
33286 LDKRouteHop this_obj_conv;
33287 this_obj_conv.inner = (void*)(this_obj & (~1));
33288 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33290 RouteHop_free(this_obj_conv);
33293 int8_tArray __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
33294 LDKRouteHop this_ptr_conv;
33295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33296 this_ptr_conv.is_owned = false;
33297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33298 int8_tArray ret_arr = init_int8_tArray(33);
33299 memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
33303 void __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
33304 LDKRouteHop this_ptr_conv;
33305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33306 this_ptr_conv.is_owned = false;
33307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33308 LDKPublicKey val_ref;
33309 CHECK(val->arr_len == 33);
33310 memcpy(val_ref.compressed_form, val->elems, 33);
33311 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
33314 uint32_t __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
33315 LDKRouteHop this_ptr_conv;
33316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33317 this_ptr_conv.is_owned = false;
33318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33319 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
33320 uint64_t ret_ref = 0;
33321 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33322 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33324 ret_ref = (uint64_t)ret_var.inner;
33325 if (ret_var.is_owned) {
33331 void __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
33332 LDKRouteHop this_ptr_conv;
33333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33334 this_ptr_conv.is_owned = false;
33335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33336 LDKNodeFeatures val_conv;
33337 val_conv.inner = (void*)(val & (~1));
33338 val_conv.is_owned = (val & 1) || (val == 0);
33339 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33340 val_conv = NodeFeatures_clone(&val_conv);
33341 RouteHop_set_node_features(&this_ptr_conv, val_conv);
33344 int64_t __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
33345 LDKRouteHop this_ptr_conv;
33346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33347 this_ptr_conv.is_owned = false;
33348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33349 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
33353 void __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
33354 LDKRouteHop this_ptr_conv;
33355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33356 this_ptr_conv.is_owned = false;
33357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33358 RouteHop_set_short_channel_id(&this_ptr_conv, val);
33361 uint32_t __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
33362 LDKRouteHop this_ptr_conv;
33363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33364 this_ptr_conv.is_owned = false;
33365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33366 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
33367 uint64_t ret_ref = 0;
33368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33371 ret_ref = (uint64_t)ret_var.inner;
33372 if (ret_var.is_owned) {
33378 void __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
33379 LDKRouteHop this_ptr_conv;
33380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33381 this_ptr_conv.is_owned = false;
33382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33383 LDKChannelFeatures val_conv;
33384 val_conv.inner = (void*)(val & (~1));
33385 val_conv.is_owned = (val & 1) || (val == 0);
33386 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33387 val_conv = ChannelFeatures_clone(&val_conv);
33388 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
33391 int64_t __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
33392 LDKRouteHop this_ptr_conv;
33393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33394 this_ptr_conv.is_owned = false;
33395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33396 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
33400 void __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
33401 LDKRouteHop this_ptr_conv;
33402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33403 this_ptr_conv.is_owned = false;
33404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33405 RouteHop_set_fee_msat(&this_ptr_conv, val);
33408 int32_t __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
33409 LDKRouteHop this_ptr_conv;
33410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33411 this_ptr_conv.is_owned = false;
33412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33413 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
33417 void __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
33418 LDKRouteHop this_ptr_conv;
33419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33420 this_ptr_conv.is_owned = false;
33421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33422 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
33425 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) {
33426 LDKPublicKey pubkey_arg_ref;
33427 CHECK(pubkey_arg->arr_len == 33);
33428 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33);
33429 LDKNodeFeatures node_features_arg_conv;
33430 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
33431 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
33432 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
33433 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
33434 LDKChannelFeatures channel_features_arg_conv;
33435 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
33436 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
33437 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
33438 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
33439 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);
33440 uint64_t ret_ref = 0;
33441 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33442 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33444 ret_ref = (uint64_t)ret_var.inner;
33445 if (ret_var.is_owned) {
33451 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
33452 LDKRouteHop ret_var = RouteHop_clone(arg);
33453 uint64_t ret_ref = 0;
33454 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33455 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33456 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33457 ret_ref = (uint64_t)ret_var.inner;
33458 if (ret_var.is_owned) {
33463 int64_t __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint32_t arg) {
33464 LDKRouteHop arg_conv;
33465 arg_conv.inner = (void*)(arg & (~1));
33466 arg_conv.is_owned = false;
33467 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33468 int64_t ret_val = RouteHop_clone_ptr(&arg_conv);
33472 uint32_t __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint32_t orig) {
33473 LDKRouteHop orig_conv;
33474 orig_conv.inner = (void*)(orig & (~1));
33475 orig_conv.is_owned = false;
33476 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33477 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
33478 uint64_t ret_ref = 0;
33479 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33480 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33481 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33482 ret_ref = (uint64_t)ret_var.inner;
33483 if (ret_var.is_owned) {
33489 int64_t __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint32_t o) {
33490 LDKRouteHop o_conv;
33491 o_conv.inner = (void*)(o & (~1));
33492 o_conv.is_owned = false;
33493 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33494 int64_t ret_val = RouteHop_hash(&o_conv);
33498 jboolean __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
33499 LDKRouteHop a_conv;
33500 a_conv.inner = (void*)(a & (~1));
33501 a_conv.is_owned = false;
33502 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33503 LDKRouteHop b_conv;
33504 b_conv.inner = (void*)(b & (~1));
33505 b_conv.is_owned = false;
33506 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33507 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
33511 int8_tArray __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint32_t obj) {
33512 LDKRouteHop obj_conv;
33513 obj_conv.inner = (void*)(obj & (~1));
33514 obj_conv.is_owned = false;
33515 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33516 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
33517 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33518 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33519 CVec_u8Z_free(ret_var);
33523 uint32_t __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
33524 LDKu8slice ser_ref;
33525 ser_ref.datalen = ser->arr_len;
33526 ser_ref.data = ser->elems;
33527 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
33528 *ret_conv = RouteHop_read(ser_ref);
33529 return (uint64_t)ret_conv;
33532 void __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint32_t this_obj) {
33533 LDKRoute this_obj_conv;
33534 this_obj_conv.inner = (void*)(this_obj & (~1));
33535 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33537 Route_free(this_obj_conv);
33540 ptrArray __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint32_t this_ptr) {
33541 LDKRoute this_ptr_conv;
33542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33543 this_ptr_conv.is_owned = false;
33544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33545 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
33546 ptrArray ret_arr = NULL;
33547 ret_arr = init_ptrArray(ret_var.datalen);
33548 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(((uint8_t*)ret_arr) + 4);
33549 for (size_t m = 0; m < ret_var.datalen; m++) {
33550 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
33551 uint32_tArray ret_conv_12_arr = NULL;
33552 ret_conv_12_arr = init_uint32_tArray(ret_conv_12_var.datalen);
33553 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(((uint8_t*)ret_conv_12_arr) + 4);
33554 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
33555 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
33556 uint64_t ret_conv_12_conv_10_ref = 0;
33557 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33558 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33559 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
33560 ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
33561 if (ret_conv_12_conv_10_var.is_owned) {
33562 ret_conv_12_conv_10_ref |= 1;
33564 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
33567 FREE(ret_conv_12_var.data);
33568 ret_arr_ptr[m] = ret_conv_12_arr;
33571 FREE(ret_var.data);
33575 void __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
33576 LDKRoute this_ptr_conv;
33577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33578 this_ptr_conv.is_owned = false;
33579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33580 LDKCVec_CVec_RouteHopZZ val_constr;
33581 val_constr.datalen = val->arr_len;
33582 if (val_constr.datalen > 0)
33583 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33585 val_constr.data = NULL;
33586 uint32_tArray* val_vals = (void*) val->elems;
33587 for (size_t m = 0; m < val_constr.datalen; m++) {
33588 uint32_tArray val_conv_12 = val_vals[m];
33589 LDKCVec_RouteHopZ val_conv_12_constr;
33590 val_conv_12_constr.datalen = val_conv_12->arr_len;
33591 if (val_conv_12_constr.datalen > 0)
33592 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33594 val_conv_12_constr.data = NULL;
33595 uint32_t* val_conv_12_vals = val_conv_12->elems;
33596 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
33597 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
33598 LDKRouteHop val_conv_12_conv_10_conv;
33599 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
33600 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
33601 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
33602 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
33603 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
33605 val_constr.data[m] = val_conv_12_constr;
33607 Route_set_paths(&this_ptr_conv, val_constr);
33610 uint32_t __attribute__((export_name("TS_Route_get_payee"))) TS_Route_get_payee(uint32_t this_ptr) {
33611 LDKRoute this_ptr_conv;
33612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33613 this_ptr_conv.is_owned = false;
33614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33615 LDKPayee ret_var = Route_get_payee(&this_ptr_conv);
33616 uint64_t ret_ref = 0;
33617 if ((uint64_t)ret_var.inner > 4096) {
33618 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33619 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33620 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33621 ret_ref = (uint64_t)ret_var.inner;
33622 if (ret_var.is_owned) {
33629 void __attribute__((export_name("TS_Route_set_payee"))) TS_Route_set_payee(uint32_t this_ptr, uint32_t val) {
33630 LDKRoute this_ptr_conv;
33631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33632 this_ptr_conv.is_owned = false;
33633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33635 val_conv.inner = (void*)(val & (~1));
33636 val_conv.is_owned = (val & 1) || (val == 0);
33637 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33638 val_conv = Payee_clone(&val_conv);
33639 Route_set_payee(&this_ptr_conv, val_conv);
33642 uint32_t __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint32_t payee_arg) {
33643 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
33644 paths_arg_constr.datalen = paths_arg->arr_len;
33645 if (paths_arg_constr.datalen > 0)
33646 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33648 paths_arg_constr.data = NULL;
33649 uint32_tArray* paths_arg_vals = (void*) paths_arg->elems;
33650 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
33651 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
33652 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
33653 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
33654 if (paths_arg_conv_12_constr.datalen > 0)
33655 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33657 paths_arg_conv_12_constr.data = NULL;
33658 uint32_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
33659 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
33660 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
33661 LDKRouteHop paths_arg_conv_12_conv_10_conv;
33662 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
33663 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
33664 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
33665 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
33666 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
33668 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
33670 LDKPayee payee_arg_conv;
33671 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33672 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33673 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33674 payee_arg_conv = Payee_clone(&payee_arg_conv);
33675 LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv);
33676 uint64_t ret_ref = 0;
33677 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33678 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33679 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33680 ret_ref = (uint64_t)ret_var.inner;
33681 if (ret_var.is_owned) {
33687 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
33688 LDKRoute ret_var = Route_clone(arg);
33689 uint64_t ret_ref = 0;
33690 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33691 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33693 ret_ref = (uint64_t)ret_var.inner;
33694 if (ret_var.is_owned) {
33699 int64_t __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint32_t arg) {
33701 arg_conv.inner = (void*)(arg & (~1));
33702 arg_conv.is_owned = false;
33703 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33704 int64_t ret_val = Route_clone_ptr(&arg_conv);
33708 uint32_t __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint32_t orig) {
33709 LDKRoute orig_conv;
33710 orig_conv.inner = (void*)(orig & (~1));
33711 orig_conv.is_owned = false;
33712 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33713 LDKRoute ret_var = Route_clone(&orig_conv);
33714 uint64_t ret_ref = 0;
33715 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33716 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33718 ret_ref = (uint64_t)ret_var.inner;
33719 if (ret_var.is_owned) {
33725 int64_t __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint32_t o) {
33727 o_conv.inner = (void*)(o & (~1));
33728 o_conv.is_owned = false;
33729 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33730 int64_t ret_val = Route_hash(&o_conv);
33734 jboolean __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint32_t a, uint32_t b) {
33736 a_conv.inner = (void*)(a & (~1));
33737 a_conv.is_owned = false;
33738 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33740 b_conv.inner = (void*)(b & (~1));
33741 b_conv.is_owned = false;
33742 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33743 jboolean ret_val = Route_eq(&a_conv, &b_conv);
33747 int64_t __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint32_t this_arg) {
33748 LDKRoute this_arg_conv;
33749 this_arg_conv.inner = (void*)(this_arg & (~1));
33750 this_arg_conv.is_owned = false;
33751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33752 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
33756 int64_t __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint32_t this_arg) {
33757 LDKRoute this_arg_conv;
33758 this_arg_conv.inner = (void*)(this_arg & (~1));
33759 this_arg_conv.is_owned = false;
33760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33761 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
33765 int8_tArray __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint32_t obj) {
33767 obj_conv.inner = (void*)(obj & (~1));
33768 obj_conv.is_owned = false;
33769 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33770 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
33771 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33772 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33773 CVec_u8Z_free(ret_var);
33777 uint32_t __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
33778 LDKu8slice ser_ref;
33779 ser_ref.datalen = ser->arr_len;
33780 ser_ref.data = ser->elems;
33781 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
33782 *ret_conv = Route_read(ser_ref);
33783 return (uint64_t)ret_conv;
33786 void __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint32_t this_obj) {
33787 LDKRouteParameters this_obj_conv;
33788 this_obj_conv.inner = (void*)(this_obj & (~1));
33789 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33791 RouteParameters_free(this_obj_conv);
33794 uint32_t __attribute__((export_name("TS_RouteParameters_get_payee"))) TS_RouteParameters_get_payee(uint32_t this_ptr) {
33795 LDKRouteParameters this_ptr_conv;
33796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33797 this_ptr_conv.is_owned = false;
33798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33799 LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv);
33800 uint64_t ret_ref = 0;
33801 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33802 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33803 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33804 ret_ref = (uint64_t)ret_var.inner;
33805 if (ret_var.is_owned) {
33811 void __attribute__((export_name("TS_RouteParameters_set_payee"))) TS_RouteParameters_set_payee(uint32_t this_ptr, uint32_t val) {
33812 LDKRouteParameters this_ptr_conv;
33813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33814 this_ptr_conv.is_owned = false;
33815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33817 val_conv.inner = (void*)(val & (~1));
33818 val_conv.is_owned = (val & 1) || (val == 0);
33819 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33820 val_conv = Payee_clone(&val_conv);
33821 RouteParameters_set_payee(&this_ptr_conv, val_conv);
33824 int64_t __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
33825 LDKRouteParameters this_ptr_conv;
33826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33827 this_ptr_conv.is_owned = false;
33828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33829 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
33833 void __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
33834 LDKRouteParameters this_ptr_conv;
33835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33836 this_ptr_conv.is_owned = false;
33837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33838 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
33841 int32_t __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
33842 LDKRouteParameters this_ptr_conv;
33843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33844 this_ptr_conv.is_owned = false;
33845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33846 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
33850 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) {
33851 LDKRouteParameters this_ptr_conv;
33852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33853 this_ptr_conv.is_owned = false;
33854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33855 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
33858 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) {
33859 LDKPayee payee_arg_conv;
33860 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33861 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33862 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33863 payee_arg_conv = Payee_clone(&payee_arg_conv);
33864 LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
33865 uint64_t ret_ref = 0;
33866 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33867 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33869 ret_ref = (uint64_t)ret_var.inner;
33870 if (ret_var.is_owned) {
33876 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
33877 LDKRouteParameters ret_var = RouteParameters_clone(arg);
33878 uint64_t ret_ref = 0;
33879 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33880 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33882 ret_ref = (uint64_t)ret_var.inner;
33883 if (ret_var.is_owned) {
33888 int64_t __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
33889 LDKRouteParameters arg_conv;
33890 arg_conv.inner = (void*)(arg & (~1));
33891 arg_conv.is_owned = false;
33892 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33893 int64_t ret_val = RouteParameters_clone_ptr(&arg_conv);
33897 uint32_t __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint32_t orig) {
33898 LDKRouteParameters orig_conv;
33899 orig_conv.inner = (void*)(orig & (~1));
33900 orig_conv.is_owned = false;
33901 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33902 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
33903 uint64_t ret_ref = 0;
33904 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33905 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33906 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33907 ret_ref = (uint64_t)ret_var.inner;
33908 if (ret_var.is_owned) {
33914 int8_tArray __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint32_t obj) {
33915 LDKRouteParameters obj_conv;
33916 obj_conv.inner = (void*)(obj & (~1));
33917 obj_conv.is_owned = false;
33918 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33919 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
33920 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33921 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33922 CVec_u8Z_free(ret_var);
33926 uint32_t __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
33927 LDKu8slice ser_ref;
33928 ser_ref.datalen = ser->arr_len;
33929 ser_ref.data = ser->elems;
33930 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
33931 *ret_conv = RouteParameters_read(ser_ref);
33932 return (uint64_t)ret_conv;
33935 void __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint32_t this_obj) {
33936 LDKPayee this_obj_conv;
33937 this_obj_conv.inner = (void*)(this_obj & (~1));
33938 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33940 Payee_free(this_obj_conv);
33943 int8_tArray __attribute__((export_name("TS_Payee_get_pubkey"))) TS_Payee_get_pubkey(uint32_t this_ptr) {
33944 LDKPayee this_ptr_conv;
33945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33946 this_ptr_conv.is_owned = false;
33947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33948 int8_tArray ret_arr = init_int8_tArray(33);
33949 memcpy(ret_arr->elems, Payee_get_pubkey(&this_ptr_conv).compressed_form, 33);
33953 void __attribute__((export_name("TS_Payee_set_pubkey"))) TS_Payee_set_pubkey(uint32_t this_ptr, int8_tArray val) {
33954 LDKPayee this_ptr_conv;
33955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33956 this_ptr_conv.is_owned = false;
33957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33958 LDKPublicKey val_ref;
33959 CHECK(val->arr_len == 33);
33960 memcpy(val_ref.compressed_form, val->elems, 33);
33961 Payee_set_pubkey(&this_ptr_conv, val_ref);
33964 uint32_t __attribute__((export_name("TS_Payee_get_features"))) TS_Payee_get_features(uint32_t this_ptr) {
33965 LDKPayee this_ptr_conv;
33966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33967 this_ptr_conv.is_owned = false;
33968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33969 LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv);
33970 uint64_t ret_ref = 0;
33971 if ((uint64_t)ret_var.inner > 4096) {
33972 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33973 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33974 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33975 ret_ref = (uint64_t)ret_var.inner;
33976 if (ret_var.is_owned) {
33983 void __attribute__((export_name("TS_Payee_set_features"))) TS_Payee_set_features(uint32_t this_ptr, uint32_t val) {
33984 LDKPayee this_ptr_conv;
33985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33986 this_ptr_conv.is_owned = false;
33987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33988 LDKInvoiceFeatures val_conv;
33989 val_conv.inner = (void*)(val & (~1));
33990 val_conv.is_owned = (val & 1) || (val == 0);
33991 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33992 val_conv = InvoiceFeatures_clone(&val_conv);
33993 Payee_set_features(&this_ptr_conv, val_conv);
33996 uint32_tArray __attribute__((export_name("TS_Payee_get_route_hints"))) TS_Payee_get_route_hints(uint32_t this_ptr) {
33997 LDKPayee this_ptr_conv;
33998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33999 this_ptr_conv.is_owned = false;
34000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34001 LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv);
34002 uint32_tArray ret_arr = NULL;
34003 ret_arr = init_uint32_tArray(ret_var.datalen);
34004 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
34005 for (size_t l = 0; l < ret_var.datalen; l++) {
34006 LDKRouteHint ret_conv_11_var = ret_var.data[l];
34007 uint64_t ret_conv_11_ref = 0;
34008 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34009 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34010 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
34011 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
34012 if (ret_conv_11_var.is_owned) {
34013 ret_conv_11_ref |= 1;
34015 ret_arr_ptr[l] = ret_conv_11_ref;
34018 FREE(ret_var.data);
34022 void __attribute__((export_name("TS_Payee_set_route_hints"))) TS_Payee_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
34023 LDKPayee this_ptr_conv;
34024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34025 this_ptr_conv.is_owned = false;
34026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34027 LDKCVec_RouteHintZ val_constr;
34028 val_constr.datalen = val->arr_len;
34029 if (val_constr.datalen > 0)
34030 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
34032 val_constr.data = NULL;
34033 uint32_t* val_vals = val->elems;
34034 for (size_t l = 0; l < val_constr.datalen; l++) {
34035 uint32_t val_conv_11 = val_vals[l];
34036 LDKRouteHint val_conv_11_conv;
34037 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
34038 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
34039 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
34040 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
34041 val_constr.data[l] = val_conv_11_conv;
34043 Payee_set_route_hints(&this_ptr_conv, val_constr);
34046 uint32_t __attribute__((export_name("TS_Payee_get_expiry_time"))) TS_Payee_get_expiry_time(uint32_t this_ptr) {
34047 LDKPayee this_ptr_conv;
34048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34049 this_ptr_conv.is_owned = false;
34050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34051 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34052 *ret_copy = Payee_get_expiry_time(&this_ptr_conv);
34053 uint64_t ret_ref = (uint64_t)ret_copy;
34057 void __attribute__((export_name("TS_Payee_set_expiry_time"))) TS_Payee_set_expiry_time(uint32_t this_ptr, uint32_t val) {
34058 LDKPayee this_ptr_conv;
34059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34060 this_ptr_conv.is_owned = false;
34061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34062 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34063 CHECK_ACCESS(val_ptr);
34064 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34065 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34066 Payee_set_expiry_time(&this_ptr_conv, val_conv);
34069 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) {
34070 LDKPublicKey pubkey_arg_ref;
34071 CHECK(pubkey_arg->arr_len == 33);
34072 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33);
34073 LDKInvoiceFeatures features_arg_conv;
34074 features_arg_conv.inner = (void*)(features_arg & (~1));
34075 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
34076 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
34077 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
34078 LDKCVec_RouteHintZ route_hints_arg_constr;
34079 route_hints_arg_constr.datalen = route_hints_arg->arr_len;
34080 if (route_hints_arg_constr.datalen > 0)
34081 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
34083 route_hints_arg_constr.data = NULL;
34084 uint32_t* route_hints_arg_vals = route_hints_arg->elems;
34085 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
34086 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
34087 LDKRouteHint route_hints_arg_conv_11_conv;
34088 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
34089 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
34090 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
34091 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
34092 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
34094 void* expiry_time_arg_ptr = (void*)(((uint64_t)expiry_time_arg) & ~1);
34095 CHECK_ACCESS(expiry_time_arg_ptr);
34096 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
34097 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)expiry_time_arg) & ~1));
34098 LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv);
34099 uint64_t ret_ref = 0;
34100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34103 ret_ref = (uint64_t)ret_var.inner;
34104 if (ret_var.is_owned) {
34110 static inline uintptr_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
34111 LDKPayee ret_var = Payee_clone(arg);
34112 uint64_t ret_ref = 0;
34113 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34114 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34116 ret_ref = (uint64_t)ret_var.inner;
34117 if (ret_var.is_owned) {
34122 int64_t __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint32_t arg) {
34124 arg_conv.inner = (void*)(arg & (~1));
34125 arg_conv.is_owned = false;
34126 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34127 int64_t ret_val = Payee_clone_ptr(&arg_conv);
34131 uint32_t __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint32_t orig) {
34132 LDKPayee orig_conv;
34133 orig_conv.inner = (void*)(orig & (~1));
34134 orig_conv.is_owned = false;
34135 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34136 LDKPayee ret_var = Payee_clone(&orig_conv);
34137 uint64_t ret_ref = 0;
34138 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34139 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34141 ret_ref = (uint64_t)ret_var.inner;
34142 if (ret_var.is_owned) {
34148 int64_t __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint32_t o) {
34150 o_conv.inner = (void*)(o & (~1));
34151 o_conv.is_owned = false;
34152 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34153 int64_t ret_val = Payee_hash(&o_conv);
34157 jboolean __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint32_t a, uint32_t b) {
34159 a_conv.inner = (void*)(a & (~1));
34160 a_conv.is_owned = false;
34161 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34163 b_conv.inner = (void*)(b & (~1));
34164 b_conv.is_owned = false;
34165 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34166 jboolean ret_val = Payee_eq(&a_conv, &b_conv);
34170 int8_tArray __attribute__((export_name("TS_Payee_write"))) TS_Payee_write(uint32_t obj) {
34172 obj_conv.inner = (void*)(obj & (~1));
34173 obj_conv.is_owned = false;
34174 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34175 LDKCVec_u8Z ret_var = Payee_write(&obj_conv);
34176 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34177 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34178 CVec_u8Z_free(ret_var);
34182 uint32_t __attribute__((export_name("TS_Payee_read"))) TS_Payee_read(int8_tArray ser) {
34183 LDKu8slice ser_ref;
34184 ser_ref.datalen = ser->arr_len;
34185 ser_ref.data = ser->elems;
34186 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
34187 *ret_conv = Payee_read(ser_ref);
34188 return (uint64_t)ret_conv;
34191 uint32_t __attribute__((export_name("TS_Payee_from_node_id"))) TS_Payee_from_node_id(int8_tArray pubkey) {
34192 LDKPublicKey pubkey_ref;
34193 CHECK(pubkey->arr_len == 33);
34194 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
34195 LDKPayee ret_var = Payee_from_node_id(pubkey_ref);
34196 uint64_t ret_ref = 0;
34197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34200 ret_ref = (uint64_t)ret_var.inner;
34201 if (ret_var.is_owned) {
34207 uint32_t __attribute__((export_name("TS_Payee_for_keysend"))) TS_Payee_for_keysend(int8_tArray pubkey) {
34208 LDKPublicKey pubkey_ref;
34209 CHECK(pubkey->arr_len == 33);
34210 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
34211 LDKPayee ret_var = Payee_for_keysend(pubkey_ref);
34212 uint64_t ret_ref = 0;
34213 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34214 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34215 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34216 ret_ref = (uint64_t)ret_var.inner;
34217 if (ret_var.is_owned) {
34223 void __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint32_t this_obj) {
34224 LDKRouteHint this_obj_conv;
34225 this_obj_conv.inner = (void*)(this_obj & (~1));
34226 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34228 RouteHint_free(this_obj_conv);
34231 uint32_tArray __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint32_t this_ptr) {
34232 LDKRouteHint this_ptr_conv;
34233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34234 this_ptr_conv.is_owned = false;
34235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34236 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
34237 uint32_tArray ret_arr = NULL;
34238 ret_arr = init_uint32_tArray(ret_var.datalen);
34239 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
34240 for (size_t o = 0; o < ret_var.datalen; o++) {
34241 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
34242 uint64_t ret_conv_14_ref = 0;
34243 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34244 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34245 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
34246 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
34247 if (ret_conv_14_var.is_owned) {
34248 ret_conv_14_ref |= 1;
34250 ret_arr_ptr[o] = ret_conv_14_ref;
34253 FREE(ret_var.data);
34257 void __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
34258 LDKRouteHint this_ptr_conv;
34259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34260 this_ptr_conv.is_owned = false;
34261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34262 LDKCVec_RouteHintHopZ val_constr;
34263 val_constr.datalen = val->arr_len;
34264 if (val_constr.datalen > 0)
34265 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
34267 val_constr.data = NULL;
34268 uint32_t* val_vals = val->elems;
34269 for (size_t o = 0; o < val_constr.datalen; o++) {
34270 uint32_t val_conv_14 = val_vals[o];
34271 LDKRouteHintHop val_conv_14_conv;
34272 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
34273 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
34274 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
34275 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
34276 val_constr.data[o] = val_conv_14_conv;
34278 RouteHint_set_a(&this_ptr_conv, val_constr);
34281 uint32_t __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint32_tArray a_arg) {
34282 LDKCVec_RouteHintHopZ a_arg_constr;
34283 a_arg_constr.datalen = a_arg->arr_len;
34284 if (a_arg_constr.datalen > 0)
34285 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
34287 a_arg_constr.data = NULL;
34288 uint32_t* a_arg_vals = a_arg->elems;
34289 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
34290 uint32_t a_arg_conv_14 = a_arg_vals[o];
34291 LDKRouteHintHop a_arg_conv_14_conv;
34292 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
34293 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
34294 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
34295 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
34296 a_arg_constr.data[o] = a_arg_conv_14_conv;
34298 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
34299 uint64_t ret_ref = 0;
34300 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34301 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34302 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34303 ret_ref = (uint64_t)ret_var.inner;
34304 if (ret_var.is_owned) {
34310 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
34311 LDKRouteHint ret_var = RouteHint_clone(arg);
34312 uint64_t ret_ref = 0;
34313 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34314 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34316 ret_ref = (uint64_t)ret_var.inner;
34317 if (ret_var.is_owned) {
34322 int64_t __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint32_t arg) {
34323 LDKRouteHint arg_conv;
34324 arg_conv.inner = (void*)(arg & (~1));
34325 arg_conv.is_owned = false;
34326 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34327 int64_t ret_val = RouteHint_clone_ptr(&arg_conv);
34331 uint32_t __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint32_t orig) {
34332 LDKRouteHint orig_conv;
34333 orig_conv.inner = (void*)(orig & (~1));
34334 orig_conv.is_owned = false;
34335 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34336 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
34337 uint64_t ret_ref = 0;
34338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34340 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34341 ret_ref = (uint64_t)ret_var.inner;
34342 if (ret_var.is_owned) {
34348 int64_t __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint32_t o) {
34349 LDKRouteHint o_conv;
34350 o_conv.inner = (void*)(o & (~1));
34351 o_conv.is_owned = false;
34352 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34353 int64_t ret_val = RouteHint_hash(&o_conv);
34357 jboolean __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
34358 LDKRouteHint a_conv;
34359 a_conv.inner = (void*)(a & (~1));
34360 a_conv.is_owned = false;
34361 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34362 LDKRouteHint b_conv;
34363 b_conv.inner = (void*)(b & (~1));
34364 b_conv.is_owned = false;
34365 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34366 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
34370 int8_tArray __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint32_t obj) {
34371 LDKRouteHint obj_conv;
34372 obj_conv.inner = (void*)(obj & (~1));
34373 obj_conv.is_owned = false;
34374 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34375 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
34376 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34377 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34378 CVec_u8Z_free(ret_var);
34382 uint32_t __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
34383 LDKu8slice ser_ref;
34384 ser_ref.datalen = ser->arr_len;
34385 ser_ref.data = ser->elems;
34386 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
34387 *ret_conv = RouteHint_read(ser_ref);
34388 return (uint64_t)ret_conv;
34391 void __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint32_t this_obj) {
34392 LDKRouteHintHop this_obj_conv;
34393 this_obj_conv.inner = (void*)(this_obj & (~1));
34394 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34396 RouteHintHop_free(this_obj_conv);
34399 int8_tArray __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
34400 LDKRouteHintHop this_ptr_conv;
34401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34402 this_ptr_conv.is_owned = false;
34403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34404 int8_tArray ret_arr = init_int8_tArray(33);
34405 memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
34409 void __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
34410 LDKRouteHintHop this_ptr_conv;
34411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34412 this_ptr_conv.is_owned = false;
34413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34414 LDKPublicKey val_ref;
34415 CHECK(val->arr_len == 33);
34416 memcpy(val_ref.compressed_form, val->elems, 33);
34417 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
34420 int64_t __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
34421 LDKRouteHintHop this_ptr_conv;
34422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34423 this_ptr_conv.is_owned = false;
34424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34425 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
34429 void __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
34430 LDKRouteHintHop this_ptr_conv;
34431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34432 this_ptr_conv.is_owned = false;
34433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34434 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
34437 uint32_t __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
34438 LDKRouteHintHop this_ptr_conv;
34439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34440 this_ptr_conv.is_owned = false;
34441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34442 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
34443 uint64_t ret_ref = 0;
34444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34447 ret_ref = (uint64_t)ret_var.inner;
34448 if (ret_var.is_owned) {
34454 void __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
34455 LDKRouteHintHop this_ptr_conv;
34456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34457 this_ptr_conv.is_owned = false;
34458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34459 LDKRoutingFees val_conv;
34460 val_conv.inner = (void*)(val & (~1));
34461 val_conv.is_owned = (val & 1) || (val == 0);
34462 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34463 val_conv = RoutingFees_clone(&val_conv);
34464 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
34467 int16_t __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
34468 LDKRouteHintHop this_ptr_conv;
34469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34470 this_ptr_conv.is_owned = false;
34471 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34472 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
34476 void __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
34477 LDKRouteHintHop this_ptr_conv;
34478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34479 this_ptr_conv.is_owned = false;
34480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34481 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
34484 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
34485 LDKRouteHintHop this_ptr_conv;
34486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34487 this_ptr_conv.is_owned = false;
34488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34489 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34490 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
34491 uint64_t ret_ref = (uint64_t)ret_copy;
34495 void __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
34496 LDKRouteHintHop this_ptr_conv;
34497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34498 this_ptr_conv.is_owned = false;
34499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34500 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34501 CHECK_ACCESS(val_ptr);
34502 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34503 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34504 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
34507 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
34508 LDKRouteHintHop this_ptr_conv;
34509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34510 this_ptr_conv.is_owned = false;
34511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34512 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34513 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
34514 uint64_t ret_ref = (uint64_t)ret_copy;
34518 void __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
34519 LDKRouteHintHop this_ptr_conv;
34520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34521 this_ptr_conv.is_owned = false;
34522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34523 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34524 CHECK_ACCESS(val_ptr);
34525 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34526 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34527 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
34530 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) {
34531 LDKPublicKey src_node_id_arg_ref;
34532 CHECK(src_node_id_arg->arr_len == 33);
34533 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33);
34534 LDKRoutingFees fees_arg_conv;
34535 fees_arg_conv.inner = (void*)(fees_arg & (~1));
34536 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
34537 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
34538 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
34539 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
34540 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
34541 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
34542 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
34543 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
34544 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
34545 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
34546 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
34547 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);
34548 uint64_t ret_ref = 0;
34549 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34550 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34552 ret_ref = (uint64_t)ret_var.inner;
34553 if (ret_var.is_owned) {
34559 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
34560 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
34561 uint64_t ret_ref = 0;
34562 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34563 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34565 ret_ref = (uint64_t)ret_var.inner;
34566 if (ret_var.is_owned) {
34571 int64_t __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
34572 LDKRouteHintHop arg_conv;
34573 arg_conv.inner = (void*)(arg & (~1));
34574 arg_conv.is_owned = false;
34575 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34576 int64_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
34580 uint32_t __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint32_t orig) {
34581 LDKRouteHintHop orig_conv;
34582 orig_conv.inner = (void*)(orig & (~1));
34583 orig_conv.is_owned = false;
34584 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34585 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
34586 uint64_t ret_ref = 0;
34587 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34588 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34590 ret_ref = (uint64_t)ret_var.inner;
34591 if (ret_var.is_owned) {
34597 int64_t __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint32_t o) {
34598 LDKRouteHintHop o_conv;
34599 o_conv.inner = (void*)(o & (~1));
34600 o_conv.is_owned = false;
34601 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34602 int64_t ret_val = RouteHintHop_hash(&o_conv);
34606 jboolean __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
34607 LDKRouteHintHop a_conv;
34608 a_conv.inner = (void*)(a & (~1));
34609 a_conv.is_owned = false;
34610 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34611 LDKRouteHintHop b_conv;
34612 b_conv.inner = (void*)(b & (~1));
34613 b_conv.is_owned = false;
34614 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34615 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
34619 int8_tArray __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint32_t obj) {
34620 LDKRouteHintHop obj_conv;
34621 obj_conv.inner = (void*)(obj & (~1));
34622 obj_conv.is_owned = false;
34623 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34624 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
34625 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34626 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34627 CVec_u8Z_free(ret_var);
34631 uint32_t __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
34632 LDKu8slice ser_ref;
34633 ser_ref.datalen = ser->arr_len;
34634 ser_ref.data = ser->elems;
34635 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
34636 *ret_conv = RouteHintHop_read(ser_ref);
34637 return (uint64_t)ret_conv;
34640 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) {
34641 LDKPublicKey our_node_pubkey_ref;
34642 CHECK(our_node_pubkey->arr_len == 33);
34643 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33);
34644 LDKRouteParameters params_conv;
34645 params_conv.inner = (void*)(params & (~1));
34646 params_conv.is_owned = false;
34647 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
34648 LDKNetworkGraph network_conv;
34649 network_conv.inner = (void*)(network & (~1));
34650 network_conv.is_owned = false;
34651 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
34652 LDKCVec_ChannelDetailsZ first_hops_constr;
34653 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
34654 if (first_hops != 0) {
34655 first_hops_constr.datalen = first_hops->arr_len;
34656 if (first_hops_constr.datalen > 0)
34657 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34659 first_hops_constr.data = NULL;
34660 uint32_t* first_hops_vals = first_hops->elems;
34661 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
34662 uint32_t first_hops_conv_16 = first_hops_vals[q];
34663 LDKChannelDetails first_hops_conv_16_conv;
34664 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
34665 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
34666 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
34667 first_hops_constr.data[q] = first_hops_conv_16_conv;
34669 first_hops_ptr = &first_hops_constr;
34671 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
34672 CHECK_ACCESS(logger_ptr);
34673 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34674 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
34675 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
34676 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
34677 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
34678 *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
34679 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
34680 return (uint64_t)ret_conv;
34683 void __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint32_t this_ptr) {
34684 if ((this_ptr & 1) != 0) return;
34685 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
34686 CHECK_ACCESS(this_ptr_ptr);
34687 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
34688 FREE((void*)this_ptr);
34689 Score_free(this_ptr_conv);
34692 void __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint32_t this_ptr) {
34693 if ((this_ptr & 1) != 0) return;
34694 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
34695 CHECK_ACCESS(this_ptr_ptr);
34696 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
34697 FREE((void*)this_ptr);
34698 LockableScore_free(this_ptr_conv);
34701 void __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) {
34702 LDKMultiThreadedLockableScore this_obj_conv;
34703 this_obj_conv.inner = (void*)(this_obj & (~1));
34704 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34706 MultiThreadedLockableScore_free(this_obj_conv);
34709 uint32_t __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint32_t score) {
34710 void* score_ptr = (void*)(((uint64_t)score) & ~1);
34711 CHECK_ACCESS(score_ptr);
34712 LDKScore score_conv = *(LDKScore*)(score_ptr);
34713 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
34714 uint64_t ret_ref = 0;
34715 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34716 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34718 ret_ref = (uint64_t)ret_var.inner;
34719 if (ret_var.is_owned) {
34725 void __attribute__((export_name("TS_ScoringParameters_free"))) TS_ScoringParameters_free(uint32_t this_obj) {
34726 LDKScoringParameters this_obj_conv;
34727 this_obj_conv.inner = (void*)(this_obj & (~1));
34728 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34730 ScoringParameters_free(this_obj_conv);
34733 int64_t __attribute__((export_name("TS_ScoringParameters_get_base_penalty_msat"))) TS_ScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
34734 LDKScoringParameters this_ptr_conv;
34735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34736 this_ptr_conv.is_owned = false;
34737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34738 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
34742 void __attribute__((export_name("TS_ScoringParameters_set_base_penalty_msat"))) TS_ScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
34743 LDKScoringParameters this_ptr_conv;
34744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34745 this_ptr_conv.is_owned = false;
34746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34747 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
34750 int64_t __attribute__((export_name("TS_ScoringParameters_get_failure_penalty_msat"))) TS_ScoringParameters_get_failure_penalty_msat(uint32_t this_ptr) {
34751 LDKScoringParameters this_ptr_conv;
34752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34753 this_ptr_conv.is_owned = false;
34754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34755 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
34759 void __attribute__((export_name("TS_ScoringParameters_set_failure_penalty_msat"))) TS_ScoringParameters_set_failure_penalty_msat(uint32_t this_ptr, int64_t val) {
34760 LDKScoringParameters this_ptr_conv;
34761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34762 this_ptr_conv.is_owned = false;
34763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34764 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
34767 int16_t __attribute__((export_name("TS_ScoringParameters_get_overuse_penalty_start_1024th"))) TS_ScoringParameters_get_overuse_penalty_start_1024th(uint32_t this_ptr) {
34768 LDKScoringParameters this_ptr_conv;
34769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34770 this_ptr_conv.is_owned = false;
34771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34772 int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
34776 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) {
34777 LDKScoringParameters this_ptr_conv;
34778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34779 this_ptr_conv.is_owned = false;
34780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34781 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
34784 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) {
34785 LDKScoringParameters this_ptr_conv;
34786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34787 this_ptr_conv.is_owned = false;
34788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34789 int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
34793 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) {
34794 LDKScoringParameters this_ptr_conv;
34795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34796 this_ptr_conv.is_owned = false;
34797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34798 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
34801 int64_t __attribute__((export_name("TS_ScoringParameters_get_failure_penalty_half_life"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) {
34802 LDKScoringParameters this_ptr_conv;
34803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34804 this_ptr_conv.is_owned = false;
34805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34806 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
34810 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) {
34811 LDKScoringParameters this_ptr_conv;
34812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34813 this_ptr_conv.is_owned = false;
34814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34815 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
34818 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) {
34819 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);
34820 uint64_t ret_ref = 0;
34821 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34822 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34824 ret_ref = (uint64_t)ret_var.inner;
34825 if (ret_var.is_owned) {
34831 int8_tArray __attribute__((export_name("TS_ScoringParameters_write"))) TS_ScoringParameters_write(uint32_t obj) {
34832 LDKScoringParameters obj_conv;
34833 obj_conv.inner = (void*)(obj & (~1));
34834 obj_conv.is_owned = false;
34835 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34836 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
34837 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34838 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34839 CVec_u8Z_free(ret_var);
34843 uint32_t __attribute__((export_name("TS_ScoringParameters_read"))) TS_ScoringParameters_read(int8_tArray ser) {
34844 LDKu8slice ser_ref;
34845 ser_ref.datalen = ser->arr_len;
34846 ser_ref.data = ser->elems;
34847 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
34848 *ret_conv = ScoringParameters_read(ser_ref);
34849 return (uint64_t)ret_conv;
34852 uint32_t __attribute__((export_name("TS_ScoringParameters_default"))) TS_ScoringParameters_default() {
34853 LDKScoringParameters ret_var = ScoringParameters_default();
34854 uint64_t ret_ref = 0;
34855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34857 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34858 ret_ref = (uint64_t)ret_var.inner;
34859 if (ret_var.is_owned) {